📄 order.cs
字号:
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;
//String sqldb = ConfigurationSettings.AppSettings["ConnString"];
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();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -