//从数据库取出数据 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); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //绑定数据 ddlName.DataSource = cm.GetAllCustomers(); ddlName.DataTextField = "cusname"; ddlName.DataValueField = "cusid"; ddlName.DataBind(); //如果传过来的值不为空,则为添加操作 if (Request.QueryString["iaeid"] != null) { IAEManagerTB iam = new IAEManagerTB(); //根据传过来的id号获取信息 iam = ia.GetIAEManagerTBById(Convert.ToInt32(Request.QueryString["iaeid"])); //填充页面信息 ddlName.SelectedValue = iam.CusID.ToString(); txtDate.Text = iam.IAEDate.ToString(); txtIaeName.Text = iam.IAEName.ToString(); txtPrice.Text = iam.Price.ToString(); if (iam.ISsettle == "是") { rdoYes.Checked = true; } else { rdoNo.Checked = true; } txtRemark.Text = iam.Remark.ToString(); } } }
protected void imgbtnSubmit_Click(object sender, ImageClickEventArgs e) { //添加 if (Request.QueryString["iaeid"] == null) { IAEManagerTB iam = new IAEManagerTB(); iam.CusID = Convert.ToInt32(ddlName.SelectedValue); iam.IAEDate = Convert.ToDateTime(txtDate.Text); iam.IAEName = txtIaeName.Text; iam.Price = Convert.ToDouble(txtPrice.Text); iam.Remark = txtRemark.Text; if (rdoYes.Checked == true) { iam.ISsettle = "1"; } else { iam.ISsettle = "0"; } int cnt = ia.InsertInfo(iam); if (cnt > 0) { //添加成功跳转到查询页面 Response.Redirect("~/IAE/SelectIAE.aspx"); } else { lblMessage.Text = "添加失败!"; } } //修改 else { IAEManagerTB iam = new IAEManagerTB(); iam.CusID = Convert.ToInt32(ddlName.SelectedValue); iam.IAEDate = Convert.ToDateTime(txtDate.Text); iam.IAEName = txtIaeName.Text; iam.Price = Convert.ToDouble(txtPrice.Text); iam.Remark = txtRemark.Text; if (rdoYes.Checked == true) { iam.ISsettle = "1"; } else { iam.ISsettle = "0"; } int cnt = ia.UpdateInfo(iam); if (cnt > 0) { //修改成功跳转到查询页面 Response.Redirect("~/IAE/SelectIAE.aspx"); } else { lblMessage.Text = "修改失败!"; } } }
//修改信息 public int UpdateInfo(IAEManagerTB iae) { string strsql = "update IAEManagerTB set iaedate=@IAEDate,iaename=@IAEName,price=@Price,issettle=@ISsettle,remark=@Remark where cusid=@cusid"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@cusid", iae.CusID), new SqlParameter("@IAEDate", iae.IAEDate), new SqlParameter("@IAEName", iae.IAEName), new SqlParameter("@Price", iae.Price), new SqlParameter("@ISsettle", iae.ISsettle), new SqlParameter("@Remark", iae.Remark) }; return(DBHelper.ExecuteCommand(strsql, paras)); }
//添加信息 public int InsertInfo(IAEManagerTB iae) { string strsql = "insert into IAEManagerTB values(@cusid,@IAEDate,@IAEName,@Price,@ISsettle,@Remark)"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@cusid", iae.CusID), new SqlParameter("@IAEDate", iae.IAEDate), new SqlParameter("@IAEName", iae.IAEName), new SqlParameter("@Price", iae.Price), new SqlParameter("@ISsettle", iae.ISsettle), new SqlParameter("@Remark", iae.Remark) }; return(DBHelper.ExecuteCommand(strsql, paras)); }
private static List <IAEManagerTB> GetIAEManagerTBSql(string strsql) { 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.IAEDate = Convert.ToDateTime(row["iaedate"]); ia.IAEName = row["iaename"].ToString(); ia.Price = Convert.ToDouble(row["price"]); ia.Remark = row["remark"].ToString(); list.Add(ia); } return(list); }
protected void imgbtnsel_Click(object sender, ImageClickEventArgs e) { CustomerPianTB cp = new CustomerPianTB(); int cusid = Convert.ToInt32(ddlcus.SelectedValue); DateTime qtime = Convert.ToDateTime(txtstime.Text); DateTime ttime = Convert.ToDateTime(txtttime.Text); try { if (customerpianmanager.GetCustomerPianTBById(cusid, qtime, ttime) != null) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('该用户信息已存在,请确认业务员及时间。')</script>"); return; } } catch (Exception ex) { try { CustomersTB cus = customersmanager.GetCusmoerByid(cusid); string name = cus.CusName; //获取客户名 DisNoteTB dis = disnotemanager.GetDisNoteTBById(cusid, qtime, ttime); double oddmon = dis.Sum; //获取面单费用 string issrt = dis.IsSet; //获取面单费用是否已结算 if (issrt == "是") { cp.Remark = "面单费已结!"; } else { cp.Remark = "面单费未结!"; } CustomerSentTB cs = customersentmanager.GetCustomerSentTBById(cusid, qtime, ttime); double sendmon = cs.Price;//获取发件费 CustomerSendTB cf = customersendmanager.GetCustomerSendTBById(cusid, qtime, ttime); double givemon = cf.EAllPrice;//获取送件费 SentTB st = sentmanager.GetSentTBById(cusid, qtime, ttime); double backmon = st.Price;//获取收到付件返利 AcceptTB at = acceptmanager.GetAcceptTBById(cusid, qtime, ttime); double accmon = at.Price;//获取派收到付件款 IAEManagerTB ia = iaemanagermanager.GetIAEManagerTBById(cusid, qtime, ttime); double othermon = ia.Price; //获取其他费用 double allmon = oddmon + sendmon + backmon - givemon - accmon + othermon; //总计 string ISsettle = "false"; cp.CusID = Convert.ToInt32(cusid); cp.DateMon = ttime; cp.OddMon = oddmon; cp.SendMon = sendmon; cp.GiveMon = givemon; cp.BackMon = backmon; cp.AccMon = accmon; cp.OtherMon = othermon; cp.AllMon = allmon; cp.ISsettle = ISsettle; int cou = customerpianmanager.AddCustomerPianTBInfo(cp); if (cou == 1) { allInfo = customerpianmanager.GetAllCustomerPianTBInfo(cusid); anpInfo.RecordCount = allInfo.Count(); BindData(); anpInfo.CurrentPageIndex = 1; } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('无该用户信息,请确认业务员及时间。')</script>"); return; } } }
//修改信息 public int UpdateInfo(IAEManagerTB iae) { return(iaemanagerservice.UpdateInfo(iae)); }
//添加信息 public int InsertInfo(IAEManagerTB iae) { return(iaemanagerservice.InsertInfo(iae)); }