Order.cs
资源名称:yjal.rar [点击查看]
上传用户:shjujing
上传日期:2022-07-28
资源大小:11244k
文件大小:5k
源码类别:
Email客户端
开发平台:
Visual C++
- using System;
- using System.Data;
- using System.Configuration;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Data.SqlClient;
- /// <summary>
- /// Order 的摘要说明
- /// </summary>
- public class Order
- {
- SqlConnection myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["CartConnectionString"].ConnectionString);
- public Order()
- {
- //
- // TODO: 在此处添加构造函数逻辑
- //
- }
- public String getNoTodayOrder()
- {
- String selectinfo = "Select count(*) from OrderUser where datepart(year,Odata)=datepart(year,getDate()) and datepart(month,Odata)=datepart(month,getdate()) and datepart(day,Odata)=datepart(day,getdate()) and OState=1";
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- String count = "";
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0).ToString();
- }
- myConnection.Close();
- return count;
- }
- public String getNoHistorTodayOrder()
- {
- String selectinfo = "Select count(*) from OrderUser where OState=1";
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- String count = "";
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0).ToString();
- }
- myConnection.Close();
- return count;
- }
- public String getSendTodayOrder()
- {
- String selectinfo = "Select count(*) from OrderUser where datepart(year,Odata)=datepart(year,getDate()) and datepart(month,Odata)=datepart(month,getdate()) and datepart(day,Odata)=datepart(day,getdate()) and OState=2";
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- String count = "";
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0).ToString();
- }
- myConnection.Close();
- return count;
- }
- public String getSendHistorTodayOrder()
- {
- String selectinfo = "Select count(*) from OrderUser where OState=2";
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- String count = "";
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0).ToString();
- }
- myConnection.Close();
- return count;
- }
- public String getHistorOrder()
- {
- String selectinfo = "Select count(*) from OrderUser where OState=3";
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- String count = "";
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0).ToString();
- }
- myConnection.Close();
- return count;
- }
- public Int32 getOState(Int32 oid)
- {
- String selectinfo = "Select OState from OrderUser where Oid=" + oid;
- SqlCommand comm = new SqlCommand(selectinfo, myConnection);
- myConnection.Open();
- Int32 count = 0;
- SqlDataReader dd = comm.ExecuteReader();
- if (dd.Read())
- {
- count = dd.GetInt32(0);
- }
- myConnection.Close();
- return count;
- }
- public Boolean updateNoSend(Int32 O_id, Int32 O_state)
- {
- Boolean isvalidat = false;
- SqlCommand myconmand = new SqlCommand();
- myconmand.Connection = myConnection;
- try
- {
- myconmand.Connection.Open();
- myconmand.CommandText = "Proc_UpdateOrderUser";
- myconmand.CommandType = CommandType.StoredProcedure;
- SqlParameter Name = new SqlParameter("@OID", SqlDbType.Int, 4);
- Name.Value = O_id;
- myconmand.Parameters.Add(Name);
- SqlParameter pass = new SqlParameter("@OState", SqlDbType.Int, 4);
- pass.Value = O_state;
- myconmand.Parameters.Add(pass);
- SqlParameter type = new SqlParameter("@type", SqlDbType.Int);
- type.Direction = ParameterDirection.Output;
- myconmand.Parameters.Add(type);
- myconmand.ExecuteNonQuery();
- if ((int)type.Value == 1)
- {
- isvalidat = true;
- }
- return isvalidat;
- }
- catch (SqlException er)
- {
- throw (er);
- }
- finally
- {
- myconmand.Connection.Close();
- }
- }
- }