コード例 #1
0
ファイル: Index.aspx.cs プロジェクト: JobsLj/PDF.NET
 protected void btnNew_Click(object sender, EventArgs e)
 {
     dbtCID.ReadOnly = false;
     MyWebForm.ClearIBData(this.Controls);
     this.tbCustomerInfo.Visible = true;
     lblMsg.Text = "请输入客户联系信息!(新建客户默认送10个积分)";
 }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            //实例化一个控件数据映射对象
            ControlDataMap cdm = new ControlDataMap();
            //收集数据到实体对象
            CustomerContactInfo info = cdm.CollectDataToObject <CustomerContactInfo>(
                MyWebForm.GetIBControls(this.tbCustomerInfo.Controls)
                );

            //调用业务类,保存数据
            bool result           = false;
            CustomerManageBIZ biz = new CustomerManageBIZ();

            if (dbtCID.ReadOnly)
            {
                //这里规定主键对应的控件是只读状态,表示当前表单是修改状态,否则是新增状态
                result = biz.UpdateContactInfo(info);
            }
            else
            {
                result          = biz.AddContactInfo(info);
                dbtCID.ReadOnly = true;
                txtComeIn.Text  = dbtCID.Text;
            }
            lblMsg.Text = result ? "保存成功!请进入本超市!(也可以继续修改你的个人信息)" : "保存失败";
        }
コード例 #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (dbtSN.Text.Trim() == "")
            {
                lblMsg.Text = "没有条码号,请输入!";
                return;
            }
            //实例化一个控件数据映射对象
            ControlDataMap cdm = new ControlDataMap();
            //收集数据到实体对象
            GoodsBaseInfo info = cdm.CollectDataToObject <GoodsBaseInfo>(
                MyWebForm.GetIBControls(this.tbGoosBaseInfo.Controls)
                );
            //调用业务类,保存数据
            GoodsManageBIZ biz = new GoodsManageBIZ();

            if (biz.SaveGoodsBaseInfo(info))
            {
                lblMsg.Text = "保存成功!";
            }
            else
            {
                lblMsg.Text = "保存失败.";
            }

            bindGrid();
        }
コード例 #4
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblMsg.Text = "Selected id=" + GridView1.SelectedRow.Cells[1].Text;
            string sn = GridView1.SelectedRow.Cells[1].Text;
            //调用业务层方法获取实体
            GoodsManageBIZ biz  = new GoodsManageBIZ();
            GoodsBaseInfo  info = biz.GetGoodsBaseInfo(sn);

            //将实体与页面控件绑定
            WebControlDataMap.FillDataFromEntityClass(info,
                                                      MyWebForm.GetIBControls(this.tbGoosBaseInfo.Controls)
                                                      );
        }
コード例 #5
0
ファイル: Index.aspx.cs プロジェクト: JobsLj/PDF.NET
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblMsg.Text = "Selected id=" + GridView1.SelectedRow.Cells[1].Text;
            string customerId = GridView1.SelectedRow.Cells[1].Text;
            //调用业务层方法获取实体
            CustomerManageBIZ   biz  = new CustomerManageBIZ();
            CustomerContactInfo info = biz.GetCustomerContactInfo(customerId);

            //将实体与页面控件绑定
            WebControlDataMap.FillDataFromEntityClass(info,
                                                      MyWebForm.GetIBControls(this.tbCustomerInfo.Controls)
                                                      );
            //标记当前表单为编辑状态,主键控件不可编辑
            dbtCID.ReadOnly             = true;
            this.tbCustomerInfo.Visible = true;
            lblMsg.Text = "编辑客户联系信息后请保存!";
        }
コード例 #6
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     if (this.dlCHJLH.Text != "")
     {
         GoodsManageBIZ biz  = new GoodsManageBIZ();
         GoodsStock     info = new GoodsStock()
         {
             GoodsID = int.Parse(this.dlCHJLH.Text)
         };
         biz.DeleteGoodsStock(info);
         lblMsg.Text = "删除成功!";
         MyWebForm.ClearIBData(this.Controls);
         //重新绑定数据
         this.ProPageToolBar1.ReBindResultData();
     }
     else
     {
         lblMsg.Text = "请先选择一条记录!";
     }
 }
コード例 #7
0
 protected void btnNew_Click(object sender, EventArgs e)
 {
     MyWebForm.ClearIBData(this.Controls);
 }
コード例 #8
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            this.dlMsg.CssClass = "label label-danger";
            if (this.dtName.Text == "")
            {
                this.dlMsg.Text = "请输入姓名!";
                return;
            }
            if (this.dtPhone.Text == "")
            {
                this.dlMsg.Text = "请输入电话!";
                return;
            }
            if (this.dtPersonID.Text == "")
            {
                this.dlMsg.Text = "请输入身份ID!";
                return;
            }
            else
            {
                //从页面收集数据到实体类
                ContactInfo info = MyWebForm.DataMap.CollectDataToObject <ContactInfo>(
                    MyWebForm.GetIBControls(this.Controls));
                info.AtTime = DateTime.Now;
                //保存数据到数据库
                ClassReunionRepository rep = new ClassReunionRepository();
                //如果查询到名字和身份证号一致的数据,则修改,否则添加数据
                var existsInfo = rep.UserQuery.GetObject(
                    OQL.From(info)
                    .Select()
                    .Where(cmp => cmp.EqualValue(info.Name) & cmp.EqualValue(info.PersonID))
                    .END
                    );

                int    count  = 0;
                string optMsg = "";
                if (existsInfo == null)
                {
                    optMsg = "添加";
                    count  = rep.Add <ContactInfo>(info);
                }
                else
                {
                    optMsg   = "修改";
                    info.CID = existsInfo.CID; //指定ID主键的值,才可以修改
                    count    = rep.Update <ContactInfo>(info);
                }

                if (count > 0)
                {
                    this.dlMsg.CssClass = "label label-info";
                    this.dlMsg.Text     = optMsg + " 成功!";
                    //重新绑定数据
                    BindLIstData();
                }
                else
                {
                    this.dlMsg.CssClass = "label label-danger";
                    this.dlMsg.Text     = optMsg + " 失败![数据库操作异常,详细信息请检查SQL日志]";
                }
            }
        }