public void BindData() { #region //if (!Context.User.Identity.IsAuthenticated) //{ // return; //} //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); //if (user.HasPermissionID(PermId_Modify)) //{ // gridView.Columns[6].Visible = true; //} //if (user.HasPermissionID(PermId_Delete)) //{ // gridView.Columns[7].Visible = true; //} #endregion //DataSet ds = new DataSet(); StringBuilder strWhere = new StringBuilder(); if (txtKeyword.Text.Trim() != "") { #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 strWhere.AppendFormat("csd5=5 and cname like '%{0}%' or ccode like '%{0}%' or cphone like '%{0}%' ", txtKeyword.Text.Trim()); } else { strWhere.AppendFormat("csd5=5"); } var ds = bll.GetModelList(strWhere.ToString()); gridView.DataSource = ds; gridView.DataBind(); }
protected void btnSearchConsumer_Click(object sender, EventArgs e) { Jium.BLL.consumer bll = new Jium.BLL.consumer(); StringBuilder strWhere = new StringBuilder(); if (txtCphone.Text.Trim() != "") { #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 strWhere.AppendFormat("cphone = '{0}'", txtCphone.Text.Trim()); } else { /// new user? return; } strWhere.Append(" and csd5=5 order by clevel desc"); var consumers = bll.GetModelList(strWhere.ToString()); if (consumers.Count == 0) { Maticsoft.Common.MessageBox.Show(this, "账户信息不存在,请重新输入"); return; } txtCcode.Text = consumers[0].ccode; txtCname.Text = consumers[0].cname; txtSumMoney.Text = consumers[0].csum.ToString(); LinkButtonBuyHistory.PostBackUrl = string.Format("~/piorecord/list.aspx?id={0}", consumers[0].ccode); LinkButtonBuyHistory.Enabled = true; LinkButtonServiceHistory.PostBackUrl = string.Format("~/consumerservice/list.aspx?id={0}", consumers[0].ccode); LinkButtonServiceHistory.Enabled = true; }
protected void btnSearchConsumer_Click(object sender, EventArgs e) { Jium.BLL.consumer bll = new Jium.BLL.consumer(); StringBuilder strWhere = new StringBuilder(); if (txtCphone.Text.Trim() != "") { #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称 strWhere.AppendFormat("cphone = '{0}'", txtCphone.Text.Trim()); } else { /// new user? return; } var consumers = bll.GetModelList(strWhere.ToString()); if (consumers.Count != 1) { return; } txtCcode.Text = consumers[0].ccode; txtCname.Text = consumers[0].cname; }
protected void btnConfirmSale_Click(object sender, EventArgs e) { try { //#warning 代码生成警告:请检查确认真实主键的名称和类型是否正确 string orderid = DateTime.Now.ToString("yyyyMMddHHmmss"); var lstModel = new List <Jium.Model.piorecord>(); for (int i = 0; i < gridViewBuy.Rows.Count; i++) { var model = new Jium.Model.piorecord(); model.pcode = gridViewBuy.Rows[i].Cells[0].Text; model.pios3 = gridViewBuy.Rows[i].Cells[1].Text; model.psaleprice = decimal.Parse(gridViewBuy.Rows[i].Cells[3].Text); model.pcnt = int.Parse(gridViewBuy.Rows[i].Cells[5].Text); model.pzekou = decimal.Parse(gridViewBuy.Rows[i].Cells[6].Text); model.psalerid = 0; model.ptype = (int)PRODUCT_IO_TYPE.SALE;; model.ptime = orderid; model.pguestid = int.Parse(txtCcode.Text); var txtNum = gridViewBuy.Rows[i].Cells[4].Text.Trim(); model.piod1 = string.IsNullOrWhiteSpace(txtNum.Replace(" ", "")) ? 0 : int.Parse(gridViewBuy.Rows[i].Cells[4].Text); //服务 model.pios4 = gridViewBuy.Rows[i].Cells[2].Text.Replace(" ", ""); //单位 model.piod5 = 5; //model.pios5 = cells[i, 0].StringValue.Trim();//系列 model.pios1 = "销售"; lstModel.Add(model); } ERR_CODE iRes = ERR_CODE.SUCCESS; ///事务回滚机制??? var bllCustomeService = new Jium.BLL.consumerservice(); foreach (var model in lstModel) { if (!Ctrl.piorecord.AddPiorecord(model)) { iRes = ERR_CODE.FAIL; break; } if (model.piod1 > 0)//add service for guset { var consumerservice = new Jium.Model.consumerservice(); consumerservice.ccode = model.pguestid.ToString(); consumerservice.csnum = model.piod1 ?? 0; consumerservice.cstype = model.pios3; consumerservice.csleft = model.piod1 ?? 0; consumerservice.csiostatus = 0; consumerservice.cstime0 = orderid; consumerservice.csd5 = "5"; bllCustomeService.Add(consumerservice); } } //update guest info var consumerBll = new Jium.BLL.consumer(); var lstConsumer = consumerBll.GetModelList(string.Format("ccode='{0}' and csd5=5", txtCcode.Text.Trim())); if (lstConsumer.Count == 0) { ///error ///return; } lstConsumer[0].css1 = orderid; lstConsumer[0].csum += decimal.Parse(txtSumReal.Text); lstConsumer[0].clevel = Jium.BLL.consumer.getLevelByConsume(lstConsumer[0].csum).ToString();//get from csum consumerBll.Update(lstConsumer[0]); Maticsoft.Common.MessageBox.ShowAndRedirects(this, "操作完成!", "/default.aspx"); } catch (Exception ex) { Maticsoft.Common.MessageBox.Show(this, "系统错误:" + ex.Message); return; } }