Beispiel #1
0
        /// <summary>
        /// 修改会员账号
        /// </summary>
        /// <param name="dr"></param>
        private void modifyMemberAccount(DataRow dr)
        {
            if (dr != null)
            {
                SOSOshop.BLL.MemberAccount   ma  = new SOSOshop.BLL.MemberAccount();
                SOSOshop.Model.MemberAccount mam = new SOSOshop.Model.MemberAccount();
                object UID = ma.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'");

                if (UID != null)
                {
                    int x = 0;
                    if (int.TryParse(UID.ToString(), out x))
                    {
                        mam              = ma.GetModel(x);
                        mam.MobilePhone  = dr["联系手机"].ToString();
                        mam.CompanyClass = dr["客户类型"].ToString();
                        mam.UserId       = dr["会员编号"].ToString();
                        ma.Update(mam);
                    }
                    else
                    {
                        SOSOshop.BLL.Logs.Log.LogAdminAdd("没有该会员信息" + dr["联系手机"].ToString().Trim(), 0, "", 0);
                    }
                }
                else
                {
                    addMemberAccount(dr);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加会员账号
        /// </summary>
        /// <param name="dr"></param>
        private void addMemberAccount(DataRow dr)
        {
            if (dr != null)
            {
                SOSOshop.BLL.MemberAccount   ma  = new SOSOshop.BLL.MemberAccount();
                SOSOshop.Model.MemberAccount mam = new SOSOshop.Model.MemberAccount();

                object UID = ma.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'");
                if (UID == null)
                {
                    mam.MobilePhone  = dr["联系手机"].ToString();
                    mam.CompanyClass = dr["客户类型"].ToString();
                    mam.State        = 1;

                    mam.RegisterDate     = DateTime.Now;
                    mam.PassWord         = ChangeHope.Common.DEncryptHelper.Encrypt("123456", 1);
                    mam.PeriodOfValidity = DateTime.Now.AddYears(3);
                    mam.UserId           = dr["会员编号"].ToString();
                    ma.Add(mam);
                }
                else
                {
                    modifyMemberAccount(dr);
                }
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SOSOshop.Model.MemberAccount a = null;
                int uid = 0; int.TryParse(Request["UID"], out uid);

                if (uid > 0)
                {
                    SOSOshop.BLL.MemberAccount bll   = new SOSOshop.BLL.MemberAccount();
                    SOSOshop.Model.MemberInfo  model = new SOSOshop.BLL.MemberInfo().GetModel(uid);
                    object obj = bll.ExecuteScalar("select top(1) Name from DrugsBase_Enterprise where ID=" + model.ParentId);

                    a = bll.GetModel(uid);
                    hfmobilePhone.Value    = a.MobilePhone;
                    hftrueName.Value       = model.TrueName;
                    hfdefaultIncName.Value = obj != null?obj.ToString() : "未设置";

                    hfmember_Class.Value = "无"; if (model.Member_Class >= 0)
                    {
                        hfmember_Class.Value = Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.Member_Class), model.Member_Class);
                    }

                    #region 实例化省市区联动

                    DataSet dsProvinces = bll.ExecuteDataSet("select isnull((select TOP(1) Name from Region where ID=" + model.Province + "),'') as a,isnull((select TOP(1) Name from Region where ID=" + model.City + "),'') as b,isnull((select TOP(1) Name from Region where ID=" + model.Borough + "),'') as c");

                    if (dsProvinces != null && dsProvinces.Tables.Count > 0 && dsProvinces.Tables[0].Rows.Count > 0)
                    {
                        hfConsigneeProvince.Value = dsProvinces.Tables[0].Rows[0][0].ToString();
                        hfConsigneeCity.Value     = dsProvinces.Tables[0].Rows[0][1].ToString();
                        hfConsigneeBorough.Value  = dsProvinces.Tables[0].Rows[0][2].ToString();
                    }

                    #endregion
                }

                if (a != null)
                {
                    this.hfUID.Value = uid.ToString();
                    //显示列表
                    Search_Click(null, null);
                }
                else
                {
                    Response.Write("<center><br><h3>未知买家!</h3>"); Response.End();
                }
            }
        }
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                // 注册用户
                bool ok  = false;
                int  UID = 0;

                //添加买家账号信息
                SOSOshop.BLL.MemberAccount   aBll = new SOSOshop.BLL.MemberAccount();
                SOSOshop.Model.MemberAccount a    = new SOSOshop.Model.MemberAccount();
                if (string.IsNullOrEmpty(model.Captcha) || !model.Captcha.Equals(Convert.ToString(Session["Captcha"]), StringComparison.CurrentCultureIgnoreCase))
                {
                    ModelState.AddModelError("", "提供的验证码不正确。");
                }
                else
                {
                    if (!string.IsNullOrEmpty(model.UserName) &&
                        !string.IsNullOrEmpty(model.PassWord) &&
                        model.PassWord.Equals(model.ConfirmPassword) &&
                        !string.IsNullOrEmpty(model.LinkMan) &&
                        !string.IsNullOrEmpty(model.Email))
                    {
                        int i = new SOSOshop.BLL.MemberAccount().GetUserIdNameClass(model.UserName);
                        if (i == 2)
                        {
                            a.UserId      = "";
                            a.MobilePhone = model.UserName;
                            a.Email       = model.Email;
                        }
                        //else if (i == 3)
                        //{
                        //    a.UserId = "";
                        //    a.MobilePhone = "";
                        //    a.Email = model.UserName;
                        //}
                        //else
                        //{
                        //    a.UserId = model.UserName;
                        //    a.MobilePhone = "";
                        //    a.Email = model.Email;
                        //}
                        //Response.Write(model.PassWord+" "+i);
                        a.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1);

                        a.Email_QQ         = model.Email.EndsWith("@qq.com") ? model.Email : "";
                        a.Question         = "";
                        a.Answer           = "";
                        a.RegisterDate     = DateTime.Now;
                        a.RegisterIP       = ChangeHope.WebPage.PageRequest.GetIP();
                        a.PeriodOfValidity = a.RegisterDate.AddYears(20);
                        a.State            = 1;
                        a.CompanyClass     = model.CompanyClass;
                        UID = aBll.Add(a);
                    }
                    //添加买家联系信息
                    if (UID > 0)
                    {
                        SOSOshop.BLL.MemberInfo   bBll = new SOSOshop.BLL.MemberInfo();
                        SOSOshop.Model.MemberInfo b    = new SOSOshop.Model.MemberInfo();
                        b.UID          = UID;
                        b.TrueName     = model.LinkMan;
                        b.Member_Class = -1;
                        b.Member_Type  = 0;
                        int area = 0; int.TryParse(Request["province"], out area);
                        b.Province = area;
                        area       = 0; int.TryParse(Request["city"], out area);
                        b.City     = area;
                        area       = 0; int.TryParse(Request["county"], out area);
                        b.Borough  = area;

                        if (model.CompanyClass == "生产企业" || model.CompanyClass == "商业公司" || model.CompanyClass == "民营医院")
                        {
                            b.Member_Class = 0;
                        }
                        else
                        {
                            b.Member_Class = 1;
                        }
                        //通知交易人员
                        //int tId = 0;//交易员ID  取消//改为数据库设置默认值 2014/2/12
                        //string tname = new SOSOshop.BLL.Administrators().GetTraderIdByRegion(b.Province, b.City, b.Borough, out tId, model.CompanyClass);//交易员姓名
                        int    oId   = 0;                                                                                                                        //外销人员(线下推广人员)ID
                        string oName = new SOSOshop.BLL.Administrators().GetOutSellPersonIdByRegion(b.Province, b.City, b.Borough, out oId, model.CompanyClass); //外销人员(线下推广人员)姓名

                        //if (tId != 0)
                        //{
                        //    string jyphone = string.Format(" SELECT zyphone FROM zhiyzl WHERE is_czy='是' and beactive='是' and zhiyname='{0}'", tname);
                        //    SOSOshop.BLL.DbBase db = new SOSOshop.BLL.Db();
                        //    db.ChangeDB("ConnectionStringERP");
                        //    DataTable dt = db.ExecuteTable(jyphone);
                        //    if (dt.Rows.Count > 0)
                        //    {
                        //        string phone = dt.Rows[0][0].ToString().Trim();
                        //        if (!string.IsNullOrEmpty(phone))
                        //        {
                        //            ok = SOSOshop.BLL.Sms.SendAndSaveDataBase(phone, "手机号为" + model.UserName + "的用户,已经在101商城前台进行注册,请尽快联系完成后续注册审核。", "系统", phone);
                        //        }
                        //    }
                        //}
                        //b.Editer = tId;
                        b.OSPId     = oId;
                        b.HandPhone = a.MobilePhone;
                        ok          = bBll.Add(b);
                        //添加权限
                        if (ok)
                        {
                            SOSOshop.BLL.MemberPermission   cBll = new SOSOshop.BLL.MemberPermission();
                            SOSOshop.Model.MemberPermission c    = new SOSOshop.Model.MemberPermission();
                            c.UID = UID;
                            c.IsMoneyAndShipping = true;//款到发货权限
                            ok = cBll.Add(c);
                        }
                        if (!ok)
                        {
                            aBll.Delete(UID);
                        }
                    }
                    if (ok)
                    {
                        //发送注册成功的短信 取消//彭宴负责交易员分配工作,后台操作后发送短信 2014/2/12
                        var    sms   = new SOSOshop.MSG.Sms();
                        object phone = aBll.ExecuteScalar("select OfficePhone from yxs_administrators where adminid=(select Editer from memberaccount a inner join memberinfo b on a.UID=b.UID where a.UID='" + UID + "')");
                        //string SmsMsg = "尊敬的" + model.LinkMan + ",您已完成注册第一步,立即致电您的专属采购顾问" + phone + "开通查看价格权限";
                        string CompanyShortName = ConfigurationManager.AppSettings["CompanyShortName"];
                        string SmsMsg           = string.Format("尊敬的用户,您在{0}医药网注册已成功,您的账户名为", CompanyShortName) + model.UserName + ",请留意保存,祝您采购愉快!";
                        string from             = "系统";
                        string to = model.UserName;
                        ok = SOSOshop.BLL.Sms.SendAndSaveDataBase(model.UserName, SmsMsg, from, to);
                        //写入登陆日志
                        new SOSOshop.BLL.MemberLoginLog().Add(UID, model.UserName, a.PassWord);
                        Session["Captcha"] = null;
                        DateTime expiration = DateTime.Now.AddHours(12);
                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                         model.UserName,
                                                                                         DateTime.Now,
                                                                                         expiration,
                                                                                         false,
                                                                                         UID.ToString(),
                                                                                         FormsAuthentication.FormsCookiePath);
                        string     encTicket = FormsAuthentication.Encrypt(ticket);
                        HttpCookie tk        = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                        Response.Cookies.Add(tk);
                        return(RedirectToAction("RegisterOK"));
                    }
                    else
                    {
                        ModelState.AddModelError("", "注册失败!");
                    }
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return(View(model));
        }