Exemplo n.º 1
0
 /// <summary>
 /// 添加会员信息
 /// </summary>
 /// <param name="dr"></param>
 private void addMemberinfo(DataRow dr)
 {
     if (dr != null)
     {
         SOSOshop.Model.MemberInfo       mi    = new SOSOshop.Model.MemberInfo();
         SOSOshop.BLL.MemberInfo         mibll = new SOSOshop.BLL.MemberInfo();
         SOSOshop.BLL.MemberPermission   mpbll = new SOSOshop.BLL.MemberPermission();
         SOSOshop.Model.MemberPermission mp    = new SOSOshop.Model.MemberPermission();
         object UID = mibll.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'");
         if (!mibll.Exists((int)UID))
         {
             mi.Address     = dr["地址"].ToString();
             mi.Code        = dr["会员编号"].ToString();
             mi.discount    = 1;
             mi.Member_Type = 1;
             object r = mibll.ExecuteScalar("select ID from DrugsBase_Enterprise where name='" + dr["公司名称"].ToString() + "'");
             mi.ParentId      = (int)r;
             mi.TrueName      = dr["联系人名"].ToString();
             mi.UID           = (int)UID;
             mi.PriceCategory = dr["价格类型"] as string;
             mibll.Add(mi);
             mp.UID = mi.UID;
             mp.IsMoneyAndShipping = true;
             mi.Province           = GetRegionId(dr["省"].ToString());
             mi.City    = GetRegionId(dr["市"].ToString());
             mi.Borough = GetRegionId(dr["区"].ToString());
             mpbll.Add(mp);
         }
         else
         {
             modifyMemberinfo(dr);
         }
     }
 }
Exemplo n.º 2
0
        //获取用户的权限体系
        public SOSOshop.Model.MemberPermission GetUserRight()
        {
            int uid = GetUserId();

            SOSOshop.Model.MemberPermission d_User = new SOSOshop.Model.MemberPermission();

            if (uid != 0)
            {
                SOSOshop.BLL.MemberPermission f_User = new SOSOshop.BLL.MemberPermission();
                d_User = f_User.GetModel(uid);
            }

            return(d_User);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 取得会员权限
 /// </summary>
 /// <returns></returns>
 public static SOSOshop.Model.MemberPermission GetMemberpermission(out int Member_Class)
 {
     //客户类别(0.批发客户,1.OTC拆零客户, -1未知【刚注册的】)
     Member_Class = -1;
     if (System.Web.HttpContext.Current.Request.IsAuthenticated)
     {
         int userid = Public.GetUserId();
         SOSOshop.BLL.MemberPermission   bll   = new SOSOshop.BLL.MemberPermission();
         SOSOshop.Model.MemberPermission model = new SOSOshop.Model.MemberPermission();
         Member_Class = GetMember_Class();
         return(bll.GetModel(userid));
     }
     return(null);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 修改会员信息
 /// </summary>
 /// <param name="dr"></param>
 private void modifyMemberinfo(DataRow dr)
 {
     if (dr != null)
     {
         SOSOshop.Model.MemberInfo       mi    = new SOSOshop.Model.MemberInfo();
         SOSOshop.BLL.MemberInfo         mibll = new SOSOshop.BLL.MemberInfo();
         SOSOshop.BLL.MemberPermission   mpbll = new SOSOshop.BLL.MemberPermission();
         SOSOshop.Model.MemberPermission mp    = new SOSOshop.Model.MemberPermission();
         object UID = mibll.ExecuteScalar("select UID from MemberAccount where MobilePhone='" + dr["联系手机"].ToString() + "'");
         int    x   = 0;
         if (int.TryParse(UID.ToString(), out x))
         {
             if (mibll.Exists(x))
             {
                 mi         = mibll.GetModel(x);
                 mi.Address = dr["地址"].ToString();
                 mi.Code    = dr["会员编号"].ToString();
                 object r = mibll.ExecuteScalar("select ID from DrugsBase_Enterprise where name='" + dr["公司名称"].ToString().Trim() + "'");
                 mi.ParentId      = (int)r;
                 mi.TrueName      = dr["联系人名"].ToString();
                 mi.PriceCategory = dr["价格类型"] as string;
                 mi.UID           = x;
                 mi.Province      = GetRegionId(dr["省"].ToString());
                 mi.City          = GetRegionId(dr["市"].ToString());
                 mi.Borough       = GetRegionId(dr["区"].ToString());
                 mibll.Update(mi);
                 SOSOshop.BLL.Logs.Log.LogAdminAdd("修改" + dr["联系手机"].ToString().Trim(), 0, UID.ToString(), 1);
             }
         }
         else
         {
             //SOSOshop.BLL.Logs.Log.LogAdminAdd("添加" + dr["联系手机"].ToString().Trim(), 0, rii.ToString(), 1);
             addMemberinfo(dr);
         }
     }
 }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SOSOshop.BLL.PromptInfo.Popedom("008009014", "对不起,您没有权限进行查看");
                int uid = 0; int.TryParse(Request["UID"], out uid);
                SOSOshop.Model.MemberAccount    a = null;
                SOSOshop.Model.MemberInfo       b = null;
                SOSOshop.Model.MemberPermission c = null;
                if (uid > 0)
                {
                    //查询数据
                    a = new SOSOshop.BLL.MemberAccount().GetModel(uid);
                    if (a != null)
                    {
                        b = new SOSOshop.BLL.MemberInfo().GetModel(uid);
                    }
                    if (a != null)
                    {
                        c = new SOSOshop.BLL.MemberPermission().GetModelWithNoCache(uid);
                    }
                }
                if (a != null && b != null && c != null)
                {
                    //买家ID
                    this.hfUID.Value = uid.ToString();
                    //买家单位
                    this.ltlMemberinfo.Text = string.Format("<b>{0}</b> &nbsp;&nbsp;<b>{1}</b> &nbsp; <span>(类别:{2} &nbsp; {3})</span>",
                                                            new SOSOshop.BLL.DbBase().ExecuteScalar("select Name from DrugsBase_Enterprise where ID=" + b.ParentId),
                                                            b.TrueName,
                                                            a.UserType >= 0 ? Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.UserType), a.UserType) : "",
                                                            b.Member_Class >= 0 ? Enum.GetName(typeof(SOSOshop.Model.MemberKeyValue.Member_Class), b.Member_Class) : "");

                    //权限列表
                    this.cb_IsCOD.SelectedValue               = c.IsCOD ? "1" : "0";
                    this.cb_IsLookPrice_01.SelectedValue      = c.IsLookPrice_01 ? "1" : "0";
                    this.cb_IsLookPrice_02.SelectedValue      = c.IsLookPrice_02 ? "1" : "0";
                    this.cb_IsLookProduct_01.SelectedValue    = c.IsLookProduct_01 ? "1" : "0";
                    this.cb_IsLookProduct_02.SelectedValue    = c.IsLookProduct_02 ? "1" : "0";
                    this.cb_IsLookStock.SelectedValue         = c.IsLookStock ? "1" : "0";
                    this.cb_IsMoneyAndShipping.SelectedValue  = c.IsMoneyAndShipping ? "1" : "0";
                    this.cb_IsPeriodicalSettle.SelectedValue  = c.IsPeriodicalSettle ? "1" : "0";
                    this.cb_IsTrade.SelectedValue             = c.IsTrade ? "1" : "0";
                    this.cb_IsPriorDistribution.SelectedValue = c.IsPriorDistribution ? "1" : "0";
                    this.cb_IsShippingFor48h.SelectedValue    = c.IsShippingFor48h ? "1" : "0";
                    this.cb_IsSpecialTrade.SelectedValue      = c.IsSpecialTrade ? "1" : "0";

                    //授权
                    bool isCheckUp = SOSOshop.BLL.PowerPass.isPass("008009014");
                    this.cb_IsCOD.Enabled               = isCheckUp;
                    this.cb_IsLookPrice_01.Enabled      = isCheckUp;
                    this.cb_IsLookPrice_02.Enabled      = isCheckUp;
                    this.cb_IsLookProduct_01.Enabled    = isCheckUp;
                    this.cb_IsLookProduct_02.Enabled    = isCheckUp;
                    this.cb_IsLookStock.Enabled         = isCheckUp;
                    this.cb_IsMoneyAndShipping.Enabled  = isCheckUp;
                    this.cb_IsPeriodicalSettle.Enabled  = isCheckUp;
                    this.cb_IsTrade.Enabled             = isCheckUp;
                    this.cb_IsPriorDistribution.Enabled = isCheckUp;
                    this.cb_IsShippingFor48h.Enabled    = isCheckUp;
                    this.cb_IsSpecialTrade.Enabled      = isCheckUp;
                    //建档通过
                    bool bBuyFilingStatus = 1 == _101shop.admin.v3.member.BuyerLib.GetGSP(uid);
                    this.cb_IsSpecialTrade.Enabled = !bBuyFilingStatus && a.State == 0;//已审核的未建档的才能开通快捷交易的权限

                    //权限【拥有快捷开通交易的权限】, 第一次建档状态.通过 > 允许已经建档通过的会员的定单可以执行流程
                    int UID_BuyFilingStatus = (bBuyFilingStatus ? 1 : 0);
                    //var lbll = new SOSOshop.BLL.Logs.Log("LogService");
                    string oks = "买家" + b.Code + "的建档已经通过";
                    if (UID_BuyFilingStatus > 0 && c.IsSpecialTrade && !b.Code.StartsWith("del", StringComparison.CurrentCultureIgnoreCase))
                    {
                        SOSOshop.BLL.Order.Orders obll = new SOSOshop.BLL.Order.Orders();
                        obll.LetOrders2(b.Code, "一级单位");
                        //SOSOshop.BLL.Logs.Log.LogServiceAdd(oks, uid, b.TrueName, "往来单位消息处理1", "同步商城买家" + b.Code + "成功!", 0);
                    }
                    if (b.Member_Class != 0)
                    {
                        cb_IsPriorDistribution.Enabled       = false;
                        c.IsPriorDistribution                = false;
                        cb_IsPriorDistribution.SelectedValue = "0";
                    }
                }
                else
                {
                    Response.Write("<center><br><h3>未知买家!</h3>"); Response.End();
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 添加账户
        /// </summary>
        /// <returns></returns>
        private void AddAccount()
        {
            enabledErpAction = true;
            SOSOshop.BLL.MemberAccount   accountBll = new SOSOshop.BLL.MemberAccount();
            SOSOshop.Model.MemberAccount model      = new SOSOshop.Model.MemberAccount();
            model.UserId = this.txtUserId.Text;
            string password = model.PassWord;
            string resetPwd = "123456";

            model.PassWord = "";
            if (this.cb_resetPwd.Visible && this.cb_resetPwd.Checked)
            {
                model.PassWord = password = resetPwd;
                model.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1);
            }
            else if (this.txtPassword.Text.Trim() != "")
            {
                model.PassWord = password = this.txtPassword.Text.Trim();
                model.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1);
            }
            if (model.PassWord == "")
            {
                model.PassWord = password = resetPwd;
                model.PassWord = ChangeHope.Common.DEncryptHelper.Encrypt(model.PassWord, 1);
            }
            if (Request.Form["rgPeriodOfValidity"] == "1")
            {
                model.PeriodOfValidity = DateTime.Now.AddYears(100);
            }
            else
            {
                model.PeriodOfValidity = DateTime.Parse(txtPeriodOfValidity.Text);
            }

            model.RegisterDate = DateTime.Now;
            model.RegisterIP   = ChangeHope.WebPage.PageRequest.GetIP();
            model.MobilePhone  = this.txtMobilePhone.Text.Trim();
            model.Email        = this.txtEmail.Text.Trim().ToString();
            model.Email_QQ     = this.txtEmail_QQ.Text.Trim().ToString();
            model.Question     = "";
            model.Answer       = "";
            string type = this.radType.SelectedValue;

            if (type == "1")
            {
                if (model.Question == null || model.Question.Trim() == "")
                {
                    string Question = this.ddlQuestion.Value;
                    string Answer   = this.txtAnswer.Text.Trim().ToString();
                    if (Question == "")
                    {
                        this.ltlMsg.Text     = "操作失败:找回密码问题选择错误,请选择一个问题!";
                        this.pnlMsg.Visible  = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                    if (Answer == "")
                    {
                        this.ltlMsg.Text     = "操作失败:找回密码答案填写错误,不能为空!";
                        this.pnlMsg.Visible  = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                    model.Question       = Question;
                    model.Answer         = Answer;
                    this.palOld.CssClass = "msgNormal";
                }
                else
                {
                    string oldQuestion = this.ddlQuestion.Value;
                    string oldAnswer   = this.txtOldAnswer.Text.Trim().ToString();
                    string newAnswer   = this.txtNewAnswer.Text.Trim().ToString();
                    if (oldQuestion == "" || oldQuestion != model.Question)
                    {
                        this.ltlMsg.Text     = "操作失败:原找回密码问题选择错误!";
                        this.pnlMsg.Visible  = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                    if (oldAnswer == "" || oldAnswer != model.Answer)
                    {
                        this.ltlMsg.Text     = "操作失败:原找回密码答案填写错误!";
                        this.pnlMsg.Visible  = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                    if (newAnswer == "")
                    {
                        this.ltlMsg.Text     = "操作失败:新找回密码答案不能为空!";
                        this.pnlMsg.Visible  = true;
                        this.pnlMsg.CssClass = "actionErr";
                        return;
                    }
                    model.Answer         = newAnswer;
                    this.palOld.CssClass = "msgNormal";
                }
            }
            model.State = int.Parse(DropDownList2.SelectedValue);//默认 通过审核 注意和冻结 2 不一样;冻结不能登陆。
            int uid = accountBll.Add(model);

            model.UID = uid;
            if (uid > 0)
            {
                #region 添加积分记录(取消此功能)
                //YXShop.Model.Member.Integral modelInte = new YXShop.Model.Member.Integral();
                //YXShop.BLL.Member.Integral bllInte = new YXShop.BLL.Member.Integral();
                //modelInte.Userid = GetIdByUserId(model.UserId);
                //modelInte.IntegralClass = 3;
                //modelInte.Origin = "注册赠送";
                //modelInte.IntegralNum = model.Points;
                //modelInte.GainDate = DateTime.Now;
                //modelInte.NoteDate = DateTime.Now;
                //modelInte.NoteName = "系统自动记录";
                //modelInte.Remark = "注册买家时赠送的积分";
                //modelInte.IntegralStatus = 0;
                //try
                //{
                //    bllInte.Add(modelInte);
                //}
                //catch
                //{
                //    this.ltlMsg.Text = "添加买家资料失败!";
                //    this.pnlMsg.Visible = true;
                //    this.pnlMsg.CssClass = "actionErr";
                //    return;
                //}
                #endregion

                #region 添加点卷记录(取消此功能)
                //YXShop.Model.Member.UserInfoNote modelNote = new YXShop.Model.Member.UserInfoNote();
                //YXShop.BLL.Member.UserInfoNote bllNote = new YXShop.BLL.Member.UserInfoNote();
                //modelNote.UserID = GetIdByUserId(model.UserId);
                //modelNote.TicketCount = 0;
                //modelNote.Causation = "注册赠送的点卷";
                //modelNote.BosomNote = "注册赠送的点卷";
                //modelNote.NoteDate = DateTime.Parse(DateTime.Now.ToShortDateString());
                //modelNote.NoteName = "系统自动记录";
                //modelNote.NoteType = 0;
                //modelNote.BuckleOrAdd = 0;
                //modelNote.Username = model.UserId;
                //try
                //{
                //    bllNote.Add(modelNote);
                //}
                //catch
                //{
                //    this.ltlMsg.Text = "添加买家资料失败!";
                //    this.pnlMsg.Visible = true;
                //    this.pnlMsg.CssClass = "actionErr";
                //    return;
                //}
                #endregion

                #region 添加附属信息
                SOSOshop.BLL.MemberInfo   bllInfo   = new SOSOshop.BLL.MemberInfo();
                SOSOshop.Model.MemberInfo modelInfo = new SOSOshop.Model.MemberInfo();
                modelInfo.UID         = uid;
                modelInfo.Member_Type = 1;
                modelInfo.TrueName    = txtTrueName.Text.Trim();
                modelInfo.Photo       = "";//txtPhoto.Text;
                int area = 0; int.TryParse(Request["province"], out area);
                modelInfo.Province = area;
                area                    = 0; int.TryParse(Request["city"], out area);
                modelInfo.City          = area;
                area                    = 0; int.TryParse(Request["county"], out area);
                modelInfo.Borough       = area;
                modelInfo.Address       = txtAddress.Text;
                modelInfo.OfficePhone   = txtOfficePhone.Text;
                modelInfo.HomePhone     = ""; // txtHomePhone.Text;
                modelInfo.Fax           = txtFax.Text;
                modelInfo.PersonWebSite = ""; // txtPersonWebSite.Text;
                modelInfo.QQ            = ""; // txtQQ.Text;
                modelInfo.PriceCategory = DropDownList3.SelectedValue;
                modelInfo.ParentId      = 0;
                modelInfo.Parents       = "";

                bool ok = bllInfo.Add(modelInfo, enabledErpAction && int.Parse(DropDownList2.SelectedValue) == 0 /* && modelInfo.ParentId > 0*/);
                //添加权限
                if (ok)
                {
                    SOSOshop.BLL.MemberPermission   cBll = new SOSOshop.BLL.MemberPermission();
                    SOSOshop.Model.MemberPermission c    = new SOSOshop.Model.MemberPermission();
                    c.UID = uid;
                    c.IsMoneyAndShipping = true;//款到发货权限
                    //if (int.Parse(DropDownList2.SelectedValue) == 0 && modelInfo.ParentId > 0 && 1 == BuyerLib.GetGSP(modelInfo.ParentId))
                    //{
                    //    modelInfo = bllInfo.GetModel(modelInfo.UID);
                    //    int Member_Class = modelInfo.Member_Class;
                    //    //SOSOshop.BLL.Service.MemberInfo.GetErp_KeHuLB(modelInfo.Code, ref Member_Class, ref Crm_Class);
                    //    if (Member_Class == 0)
                    //    {
                    //        c.IsTrade = true;
                    //        c.IsLookPrice_01 = true;
                    //        c.IsLookProduct_01 = true;
                    //        c.IsLookPrice_02 = false;
                    //        c.IsLookProduct_02 = false;
                    //    }
                    //    else if (Member_Class == 1)
                    //    {
                    //        c.IsTrade = true;
                    //        c.IsLookPrice_01 = false;
                    //        c.IsLookProduct_01 = false;
                    //        c.IsLookPrice_02 = true;
                    //        c.IsLookProduct_02 = true;
                    //    }
                    //}
                    ok = cBll.Add(c);
                }
                //已经通过审核,同步CRM,ERP
                if (ok && int.Parse(DropDownList2.SelectedValue) == 0 && modelInfo.ParentId > 0)
                {
                    //同步CRM
                    CrmActionHandle(modelInfo);
                }
                if (ok)
                {
                    this.ltlMsg.Text     = "保存成功·<script>if(confirm('添加成功!继续添加请点击确定。')){location.href='Buyer_edit.aspx?act=new';}else{location.href='BuyerLib.aspx';}</script>";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionOk";
                }
                else
                {
                    this.ltlMsg.Text     = "添加买家资料失败!";
                    this.pnlMsg.Visible  = true;
                    this.pnlMsg.CssClass = "actionErr";
                    return;
                }
                #endregion

                //发送短信通知已经通过审核
                if (model.State == 0)
                {
                    if (CheckBox1.ToolTip != "0" && CheckBox1.Checked)
                    {
                        string msg = "恭喜你已经通过管理员审核,请凭手机号登录,登录密码为" + password + "。";
                        SOSOshop.BLL.Sms.SendAndSaveDataBase(txtMobilePhone.Text.Trim(), msg, "系统", txtMobilePhone.Text.Trim());
                    }
                }
            }
            else
            {
                this.ltlMsg.Text     = "添加买家资料失败!";
                this.pnlMsg.Visible  = true;
                this.pnlMsg.CssClass = "actionErr";
                return;
            }
        }