//私有方法 private List <CustomerSendTB> GetInfoBysql(string strsql) { DataTable ds = DBHelper.GetTable(strsql); List <CustomerSendTB> AllCS = new List <CustomerSendTB>(); foreach (DataRow r in ds.Rows) { CustomerSendTB CS = new CustomerSendTB(); CS.CEid = Convert.ToInt32(r["CEid"]); CS.CusID = r["CusID"].ToString(); CS.ECount = Convert.ToInt32(r["ECount"]); object iss = r["Issettle"]; int cnt = Convert.ToInt32(iss); string ise = ""; if (cnt == 1) { ise = "是"; } if (cnt == 0) { ise = "否"; } CS.Issettle = ise; CS.EAllPrice = Convert.ToDouble(r["EAllPrice"]); CS.EDate = Convert.ToDateTime(r["Edate"]); CS.Remark = r["Remark"].ToString(); CustomersService cust = new CustomersService(); CS.Ccustomer = cust.GetCusmoerByid(Convert.ToInt32(r["CusID"].ToString())); AllCS.Add(CS); } return(AllCS); }
//遍历数组,拿出数据 private static List <SentTB> GetSentTBBySql(string strsql) { CustomersService cs = new CustomersService(); CarrieCompanyService ccs = new CarrieCompanyService(); List <SentTB> list = new List <SentTB>(); DataTable table = DBHelper.GetTable(strsql); foreach (DataRow row in table.Rows) { SentTB st = new SentTB(); st.Sid = Convert.ToInt32(row["sid"]); st.CusID = Convert.ToInt32(row["cusid"]); st.Cid = Convert.ToInt32(row["cid"]); st.CSid = Convert.ToInt64(row["csid"]); st.Kilo = Convert.ToDouble(row["kilo"]); st.Price = Convert.ToDouble(row["price"]); st.BeginDate = Convert.ToDateTime(row["begindate"]); st.Remark = row["remark"].ToString(); st.cust = cs.GetCusmoerByid(Convert.ToInt32(row["cusid"])); st.company = ccs.GetCompanyByid(Convert.ToInt32(row["cid"])); list.Add(st); } return(list); }
//从数据库取出数据 private static List <IAEManagerTB> GetIAEManagerTBBySql(string strsql) { CustomersService cs = new CustomersService(); List <IAEManagerTB> list = new List <IAEManagerTB>(); DataTable table = DBHelper.GetTable(strsql); foreach (DataRow row in table.Rows) { IAEManagerTB ia = new IAEManagerTB(); ia.IAEid = Convert.ToInt32(row["iaeid"]); ia.CusID = Convert.ToInt32(row["cusid"]); ia.customer = cs.GetCusmoerByid(Convert.ToInt32(row["cusid"])); ia.IAEDate = Convert.ToDateTime(row["iaedate"]); ia.IAEName = row["iaename"].ToString(); ia.Price = Convert.ToDouble(row["price"]); ia.ISsettle = row["issettle"].ToString(); if (ia.ISsettle == "True") { ia.ISsettle = "是"; } else { ia.ISsettle = "否"; } ia.Remark = row["remark"].ToString(); list.Add(ia); } return(list); }
//根据SQL语句查找所有信息 public static List <CustomerPianTB> GetAllCustomerPianTBBySql(string strsql) { List <CustomerPianTB> allinfo = new List <CustomerPianTB>(); DataTable dt = DBHelper.GetTable(strsql); foreach (DataRow row in dt.Rows) { CustomersService cus = new CustomersService(); CustomerPianTB t = new CustomerPianTB(); t.CPid = Convert.ToInt32(row["cpid"]); t.CusID = Convert.ToInt32(row["cusid"]); t.DateMon = Convert.ToDateTime(row["datemon"]); t.OddMon = Convert.ToDouble(row["oddmon"]); t.SendMon = Convert.ToDouble(row["sendmon"]); t.GiveMon = Convert.ToDouble(row["givemon"]); t.BackMon = Convert.ToDouble(row["backmon"]); t.AccMon = Convert.ToDouble(row["accmon"]); t.OtherMon = Convert.ToDouble(row["othermon"]); t.AllMon = Convert.ToDouble(row["allmon"]); t.ISsettle = row["issettle"].ToString(); if (t.ISsettle == "True") { t.ISsettle = "已付"; } else { t.ISsettle = "未付"; } t.Remark = row["remark"].ToString(); t.customer = cus.GetCusmoerByid(Convert.ToInt32(row["cusid"])); allinfo.Add(t); } return(allinfo); }
public List <DelGoodMon> GetInfoBysql(string strsql) { DataTable ds = DBHelper.GetTable(strsql); List <DelGoodMon> allDelGoods = new List <DelGoodMon>(); foreach (DataRow r in ds.Rows) { DelGoodMon Del = new DelGoodMon(); Del.DelID = Convert.ToInt32(r["DelID"]); CustomersService CS = new CustomersService(); Del.customer = CS.GetCusmoerByid(Convert.ToInt32(r["CusID"])); Del.DelUnitPrice = Convert.ToDouble(r["DelUnitPrice"]); Del.Remark = r["Remark"].ToString(); allDelGoods.Add(Del); } return(allDelGoods); }
//根据sql语句得到信息 public static List <CustomerSentTB> GetAllBySql(string strsql) { CustomersService cst = new CustomersService(); CarrieCompanyService ccs = new CarrieCompanyService(); List <CustomerSentTB> all = new List <CustomerSentTB>(); DataTable ds = DBHelper.GetTable(strsql); foreach (DataRow row in ds.Rows) { CustomerSentTB cs = new CustomerSentTB(); cs.CSid = Convert.ToInt32(row["csid"]); cs.Rid = (long)row["rid"]; //cs.cusid = Convert.ToInt32(row["cusid"]); cs.cusid = row["cusid"] != DBNull.Value ? Convert.ToInt32(row["cusid"]) : 0; //cs.Cid = Convert.ToInt32(row["cid"]); cs.Cid = row["cid"] != DBNull.Value ? Convert.ToInt32(row["cid"]) : 0; if (cs.cusid != 0) { cs.customer = cst.GetCusmoerByid(Convert.ToInt32(row["cusid"])); cs.carriecompany = ccs.GetCompanyByid(Convert.ToInt32(row["cid"])); } cs.Destination = row["destination"].ToString(); cs.Kilo = Convert.ToDouble(row["kilo"]); cs.Price = Convert.ToDouble(row["price"]); cs.Resdate = Convert.ToDateTime(row["resdate"]); cs.IsSet = (row["isset"].ToString()); if (cs.IsSet == "true") { cs.IsSet = "是"; } else { cs.IsSet = "否"; } cs.Remark = row["remark"].ToString(); all.Add(cs); } return(all); }
//根据客户ID得到客户姓名 public DelGoodMon GetAllDelGoodsInfoByID(int DelID) { string strsql = "select * from DelGoodsMonTB where DelID=" + @DelID; DelGoodMon Del = new DelGoodMon(); try { DataTable dt = DBHelper.GetTable(strsql, new SqlParameter("@DelID", DelID)); foreach (DataRow row in dt.Rows) { Del.CusID = row["CusID"].ToString(); Del.DelID = Convert.ToInt32(row["DelID"]); CustomersService CS = new CustomersService(); Del.customer = CS.GetCusmoerByid(Convert.ToInt32(Del.CusID)); Del.DelUnitPrice = Convert.ToDouble(row["DelUnitPrice"]); Del.Remark = row["Remark"].ToString(); } return(Del); } catch (Exception e) { throw e; } }
//白少杰 01-11 //根据CEid查询所有 public CustomerSendTB SelectCustomerSendByCEid(int CEid) { string str = "Select * from CustomerSendTB where CEid=@CEid"; DataTable dt = DBHelper.GetTable(str, new SqlParameter("@CEid", CEid)); List <CustomerSendTB> AllCS = new List <CustomerSendTB>(); foreach (DataRow r in dt.Rows) { CustomerSendTB CS = new CustomerSendTB(); CS.CEid = Convert.ToInt32(r["CEid"]); CS.CusID = r["CusID"].ToString(); CS.ECount = Convert.ToInt32(r["ECount"]); object iss = r["Issettle"]; int cnt = Convert.ToInt32(iss); string ise = ""; if (cnt == 1) { ise = "是"; } if (cnt == 0) { ise = "否"; } CS.Issettle = ise; CS.EAllPrice = Convert.ToDouble(r["EAllPrice"]); CS.EDate = Convert.ToDateTime(r["Edate"]); CS.Remark = r["Remark"].ToString(); CustomersService cust = new CustomersService(); CS.Ccustomer = cust.GetCusmoerByid(Convert.ToInt32(r["CusID"].ToString())); AllCS.Add(CS); } return(AllCS[0]); }
//根据sql语句查询 private static List <CustomerPriceTB> GetCustomersBySql(string strsql) { CustomersService cs = new CustomersService(); CarrieCompanyService ccs = new CarrieCompanyService(); List <CustomerPriceTB> list = new List <CustomerPriceTB>(); DataTable table = DBHelper.GetTable(strsql); foreach (DataRow row in table.Rows) { CustomerPriceTB cp = new CustomerPriceTB(); cp.Cpid = Convert.ToInt32(row["cpid"]); cp.carriecomapny = ccs.GetCompanyByid(Convert.ToInt32(row["cid"])); cp.customer = cs.GetCusmoerByid(Convert.ToInt32(row["cusid"])); cp.CusID = Convert.ToInt32(row["cusid"]); cp.Cid = Convert.ToInt32(row["cid"]); cp.CpName = row["cpname"].ToString(); cp.PNo = row["pno"].ToString(); cp.Remark = row["remark"].ToString(); list.Add(cp); } return(list); }