📄 selloperate.cs
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using DaFanRongMIS.Model.Login;
namespace DaFanRongMIS.Model.Sell
{
class SellOperate
{
#region 销售操作(主从表)
public string Operater(SellMainEntity SellMain,DataTable Datatable)
{
SellMainDAO SMD = new SellMainDAOImpl();
SellMainEntity SME = new SellMainEntity();
SellDetailDAO SDD = new SellDetailDAOImpl();
SellDetailEntity SDE = new SellDetailEntity();
SqlCommand cmd = new SqlCommand();
SqlTransaction tran = null;
//tran=cmd.Connection.BeginTransaction("Transaction Of SellProduct");
//cmd.Transaction = tran;
try
{
SMD.AddSellMain(SellMain);
DataTable dt = Datatable;
for (int i=0; i < dt.Rows.Count; i++)
{
SDE.MainID = dt.Rows[i][0].ToString();
SDE.ProductID = dt.Rows[i][2].ToString();
SDE.SoldCount =Convert.ToDecimal( dt.Rows[i]["3"].ToString());
SDD.AddSellDetail(SDE);
}
//tran.Commit();
}
catch (Exception ee)
{
//tran.Rollback();
}
return "OK";
}
#endregion
#region 查找店号,店名,操作员
public DataTable Sel_ShellByShopID(string UserName, string Pwd, string status)
{
SqlDataAdapter da = new SqlDataAdapter();
DataSet ds = new DataSet();
DataTable dt = new DataTable();
SqlCommand cmdSelect = new SqlCommand();
cmdSelect.CommandType = CommandType.StoredProcedure;
cmdSelect.CommandText = "Proc_Sel_Shell";
cmdSelect.Connection = Common.ConnectionDataBase.getConOpen();
string str = "";
//参数赋值
SqlParameter StatusSelect = new SqlParameter("@Status", SqlDbType.VarChar, 10);
StatusSelect.Value = status;
cmdSelect.Parameters.Add(StatusSelect);
SqlParameter UserIDSelect = new SqlParameter("@UserID", SqlDbType.VarChar, 20);
UserIDSelect.Value = UserName;
cmdSelect.Parameters.Add(UserIDSelect);
SqlParameter PasswordSelect = new SqlParameter("@Password", SqlDbType.VarChar, 30);
PasswordSelect.Value = Pwd;
cmdSelect.Parameters.Add(PasswordSelect);
//结束参数赋值
da.SelectCommand = cmdSelect;
da.Fill(ds);
dt = ds.Tables[0];
return dt;
}
#endregion
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -