Exemple #1
0
 public static decimal GetDiscount(int uid)
 {
     if (uid > 0)
     {
         DbBase  db       = new DbBase();
         decimal discount = 0;
         object  obj      = db.ExecuteScalar("select discount from memberinfo where uid=" + uid);
         if (obj != null)
         {
             discount = (decimal)obj;
         }
         return(discount);
     }
     return(1.0M);
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SOSOshop.BLL.PromptInfo.Popedom("008009004", "对不起,您没有权限进行编辑");
            SOSOshop.BLL.MemberInfo bll = new SOSOshop.BLL.MemberInfo();
            int  uid  = ChangeHope.WebPage.PageRequest.GetQueryInt("uid");
            bool edit = (uid > 0);

            //try
            //{
            //if (ChangeHope.WebPage.PageRequest.GetFormString("ParentId").Replace("0,", "").Trim(',') == "")
            //{
            //    this.ltlMsg.Text = "保存失败" + "\r\n上级单位不能为空!";
            //    this.pnlMsg.Visible = true;
            //    this.pnlMsg.CssClass = "actionErr";
            //    return;
            //}
            if (this.txtTrueName.Text.Trim() == "")
            {
                this.ltlMsg.Text     = "保存失败" + "\r\n联系人不能为空!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            if (this.txtMobilePhone.Text.Trim() == "")
            {
                this.ltlMsg.Text     = "保存失败" + "\r\n手机号不能为空!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            else if (!Regex.IsMatch(this.txtMobilePhone.Text.Trim(), @"^[0-9\-/ ]+$", RegexOptions.IgnoreCase))
            {
                this.ltlMsg.Text     = "保存失败" + "\r\n手机号填写错误!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            else if ((!edit && bll.ExecuteScalar("select 1 from memberaccount where MobilePhone like '" + this.txtMobilePhone.Text.Trim() + "%'") != null) ||
                     (edit && bll.ExecuteScalar("select 1 from memberaccount where MobilePhone like '" + this.txtMobilePhone.Text.Trim() + "%' and UID!=" + uid) != null))
            {
                this.ltlMsg.Text     = "保存失败" + "\r\n手机号填写错误!此手机号已经在使用,请检查后再填写正确!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            if (this.txtEmail.Text.Trim() != string.Empty)
            {
                if (!Regex.IsMatch(this.txtEmail.Text.Trim(), @"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", RegexOptions.IgnoreCase))
                {
                    this.ltlMsg.Text     = "保存失败" + "\r\n邮箱填写错误!";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                else if (bll.ExecuteScalar("select 1 from memberaccount where Email = '" + this.txtEmail.Text.Trim() + "' and UID!=" + uid) != null)
                {
                    this.ltlMsg.Text     = "保存失败" + "\r\n邮箱填写错误!此邮箱已经在使用,请检查后再填写正确!";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            if (this.txtEmail_QQ.Text.Trim() != string.Empty)
            {
                if (!Regex.IsMatch(this.txtEmail_QQ.Text.Trim(), @"^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$", RegexOptions.IgnoreCase))
                {
                    this.ltlMsg.Text     = "保存失败" + "\r\n邮箱填写错误!";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                else if (bll.ExecuteScalar("select 1 from memberaccount where Email_QQ = '" + this.txtEmail_QQ.Text.Trim() + "' and UID!=" + uid) != null)
                {
                    this.ltlMsg.Text     = "保存失败" + "\r\n邮箱填写错误!此邮箱已经在使用,请检查后再填写正确!";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
            }
            //if (ddl_Editer.SelectedValue == "0" || ddl_Editer.SelectedValue == "")
            //{
            //    this.ltlMsg.Text = "保存失败" + "\r\n请选择交易人员后再保存!";
            //    this.pnlMsg.Visible = true;
            //    this.pnlMsg.CssClass = "actionErr";
            //    return;
            //}
            //if (CRM_InterunitStyle_ID.Value == "0" || CRM_InterunitStyle_ID.Value == "")
            //{
            //    this.ltlMsg.Text = "保存失败" + "\r\n请选择CRM客户分类后再保存!";
            //    this.pnlMsg.Visible = true;
            //    this.pnlMsg.CssClass = "actionErr";
            //    return;
            //}

            string Province = ChangeHope.WebPage.PageRequest.GetFormString("province");
            string City     = ChangeHope.WebPage.PageRequest.GetFormString("city");
            string Borough  = ChangeHope.WebPage.PageRequest.GetFormString("county");

            if (Province == null || Province.Trim() == string.Empty || !Regex.IsMatch(Province, @"^[0-9]{1,4}$", RegexOptions.IgnoreCase) ||
                City == null || City.Trim() == string.Empty || !Regex.IsMatch(City, @"^[0-9]{1,4}$", RegexOptions.IgnoreCase))
            {
                this.ltlMsg.Text     = "保存失败" + "\r\n没有选择省份城市!请检查!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
            if (edit)
            {
                if (!UpdateAccount())
                {
                    return;
                }
                UpdateInfo();
                if (DropDownList2.SelectedValue == "0")
                {
                    MemberIntegral     bllmi = new MemberIntegral();
                    MemberIntegralLock ml    = new MemberIntegralLock();
                    if (ml.isAllow(uid, MemberIntegralTemplateEnum.建档通过))
                    {
                        //注册送积分(建档成功才开始送会员积分)
                        bllmi.AddIntegral(uid, 0, SOSOshop.BLL.Integral.MemberIntegralTemplateEnum.会员注册, "");
                        bllmi.AddIntegral(uid, 0, MemberIntegralTemplateEnum.建档通过, "");
                    }
                }
                #region 后台用户操作日志记录
                SOSOshop.Model.AdminInfo adminInfo = SOSOshop.BLL.AdministrorManager.Get();
                SOSOshop.BLL.Logs.Log.LogAdminAdd("修改买家信息", (adminInfo == null ? 0 : adminInfo.AdminId), (adminInfo == null ? "" : adminInfo.AdminName), 1);
                #endregion
                #region 清除缓存
                SOSOshop.BLL.DbBase db1 = new SOSOshop.BLL.DbBase(); db1.ClearCache();
                #endregion
            }
            else
            {
                AddAccount();
                #region 后台用户操作日志记录
                SOSOshop.Model.AdminInfo adminInfo = SOSOshop.BLL.AdministrorManager.Get();
                SOSOshop.BLL.Logs.Log.LogAdminAdd("添加买家信息", (adminInfo == null ? 0 : adminInfo.AdminId), (adminInfo == null ? "" : adminInfo.AdminName), 1);
                #endregion
            }
            //}
            //catch (Exception ex)
            //{

            //    this.ltlMsg.Text = (edit ? "编辑" : "添加") + "买家资料失败" + "\r\n" + ex.Message;
            //    this.pnlMsg.Visible = true;
            //    this.pnlMsg.CssClass = "actionErr";
            //}
        }