예제 #1
0
        /// <summary>
        /// 提交
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnOK_Click(object sender, EventArgs e)
        {
            bool isEdit = false;

            if (int.TryParse(Request.Params["id"], out id))
            {
                model  = bll.GetModel(id);
                isEdit = true;
            }
            else
            {
                model.NumId   = bll.SetNumID();
                model.AddTime = DateTime.Now;
            }

            model.Addressinfo = txtAddress.Text;
            model.CompanyName = txtCompanyName.Text;
            model.Email       = txtEmail.Text;
            model.Explain     = txtExplain.Text;
            model.NameInfo    = txtNameInfo.Text;
            model.Phone       = txtPhone.Text;
            model.QQNum       = txtQQ.Text;
            model.ParentId    = int.Parse(ddlParentID.SelectedValue);
            model.StateInfo   = ckState.Checked ? 1 : 0;
            model.Tel         = "";

            model.WeChat   = txtWechat.Text;
            model.SourceId = 10013;
            if (isEdit)
            {
                if (bll.Update(model))
                {
                    JsMessage("客户信息修改成功", 2000, "true", "index.aspx" + Request.Url.Query);
                }
                else
                {
                    JsMessage("客户信息修改失败,请稍候重试", 2000, "false");
                }
            }
            else
            {
                if (bll.Add(model) > 0)
                {
                    JsMessage("客户信息录入成功", 2000, "true", "index.aspx");
                }
                else
                {
                    JsMessage("客户信息录入失败,请稍候重试", 2000, "false");
                }
            }
        }