protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            model = B_Lebi_Supplier_User.GetModel(id);
            if (model == null)
            {
                if (!Power("supplier_user_add", "添加用户"))
                {
                    AjaxNoPower();
                }
                model = new Lebi_Supplier_User();
            }
            else
            {
                if (!Power("supplier_user_edit", "编辑用户"))
                {
                    AjaxNoPower();
                }
            }
            user = B_Lebi_User.GetModel(model.User_id);
            if (user == null)
            {
                user = new Lebi_User();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 编辑用户
        /// 20141124 未考虑用户同意(拒绝)的功能
        /// </summary>
        public void User_Edit()
        {
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_User model = B_Lebi_Supplier_User.GetModel("Supplier_id=" + CurrentSupplier.id + " and id =" + id);

            if (model == null)
            {
                if (!Power("supplier_user_add", "添加用户"))
                {
                    AjaxNoPower();
                    return;
                }
                model = new Lebi_Supplier_User();
            }
            else
            {
                if (!Power("supplier_user_edit", "编辑用户"))
                {
                    AjaxNoPower();
                    return;
                }
            }
            string UserName = RequestTool.RequestSafeString("UserName");

            B_Lebi_Supplier_User.SafeBindForm(model);
            if (model.id == 0)
            {
                Lebi_User user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("用户不存在") + "\"}");
                    return;
                }
                int count = B_Lebi_Supplier_User.Counts("User_id=" + user.id + " and Supplier_id=" + CurrentSupplier.id + "");
                if (count > 0)
                {
                    Response.Write("{\"msg\":\"" + Tag("不能重复添加") + "\"}");
                    return;
                }
                model.User_id     = user.id;
                model.Supplier_id = CurrentSupplier.id;
                B_Lebi_Supplier_User.Add(model);
                model.id = B_Lebi_Supplier_User.GetMaxId();
                Log.Add("添加用户", "Supplier_User", model.id.ToString(), CurrentSupplier, "用户:" + CurrentUser.UserName);
            }
            else
            {
                if (model.User_id == CurrentSupplier.User_id)
                {
                    model.Type_id_SupplierUserStatus = 9011;//不能锁定所有者
                }
                B_Lebi_Supplier_User.Update(model);
                Log.Add("编辑用户", "Supplier_User", model.id.ToString(), CurrentSupplier, "用户:" + CurrentUser.UserName);
            }
            Response.Write("{\"msg\":\"OK\",\"id\":\"" + model.id + "\"}");
        }
Esempio n. 3
0
        /// <summary>
        /// 编辑商家
        /// </summary>
        public void User_Edit()
        {
            if (!EX_Admin.Power("supplier_user_edit", "编辑商家"))
            {
                AjaxNoPower();
                return;
            }
            int       id                  = RequestTool.RequestInt("id", 0);
            string    UserName            = RequestTool.RequestString("UserName");
            int       Level_id            = RequestTool.RequestInt("Level_id", 0);
            int       IsCash              = RequestTool.RequestInt("IsCash", 0);
            int       IsSupplierTransport = RequestTool.RequestInt("IsSupplierTransport", 0);
            Lebi_User user                = new Lebi_User();

            if (UserName != "")
            {
                user = B_Lebi_User.GetModel("UserName=lbsql{'" + UserName + "'}");
                if (user == null)
                {
                    Response.Write("{\"msg\":\"帐号不存在\"}");
                    return;
                }
                string where = "User_id='" + user.id + "'";
                if (id > 0)
                {
                    where += " and id!=" + id + "";
                }
                int count = B_Lebi_Supplier.Counts(where);
                if (count > 0)
                {
                    Response.Write("{\"msg\":\"此帐号已注册\"}");
                    return;
                }
            }
            if (IsCash == 1 && IsSupplierTransport == 0)
            {
                Response.Write("{\"msg\":\"独立收款的商家必须独立发货\"}");
                return;
            }
            Lebi_Supplier model = B_Lebi_Supplier.GetModel(id);

            //model.IsCash = 0;
            //model.IsSupplierTransport = 0;
            if (model == null)
            {
                model = new Lebi_Supplier();
            }
            B_Lebi_Supplier.SafeBindForm(model);
            model.Name              = Language.RequestString("Name");
            model.Description       = Language.RequestString("Description");
            model.ClassName         = Language.RequestString("ClassName");
            model.SEO_Title         = Language.RequestString("SEO_Title");
            model.SEO_Keywords      = Language.RequestString("SEO_Keywords");
            model.SEO_Description   = Language.RequestString("SEO_Description");
            model.Supplier_Group_id = Level_id;
            if (model.id == 0)
            {
                Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(Level_id);
                if (group != null)
                {
                    model.Supplier_Group_id = group.id;
                    model.Money_Service     = group.ServicePrice;
                    model.Money_Margin      = group.MarginPrice;
                    model.BillingDays       = group.BillingDays;
                }
                model.User_id  = user.id;
                model.UserName = user.UserName;
                B_Lebi_Supplier.Add(model);
                model.id = B_Lebi_Supplier.GetMaxId();
            }
            else
            {
                if (IsSupplierTransport != model.IsSupplierTransport)
                {
                    string sql = "update [Lebi_Order_Product] set IsSupplierTransport=" + model.IsSupplierTransport + " where Supplier_id=" + id + "";
                    Common.ExecuteSql(sql);
                    string sql2 = "update [Lebi_Product] set IsSupplierTransport=" + model.IsSupplierTransport + " where Supplier_id=" + id + "";
                    Common.ExecuteSql(sql2);
                }
                user = B_Lebi_User.GetModel(model.User_id);
                B_Lebi_Supplier.Update(model);
            }
            if (model.Type_id_SupplierStatus == 442)
            {
                try
                {
                    Lebi_Supplier_User suser = B_Lebi_Supplier_User.GetModel("User_id=" + model.User_id + " and Supplier_id=" + model.id + "");
                    if (suser == null)
                    {
                        suser            = new Lebi_Supplier_User();
                        suser.RemarkName = user.RealName;
                        if (suser.RemarkName == "")
                        {
                            suser.RemarkName = user.UserName;
                        }
                        suser.Supplier_id = model.id;
                        suser.User_id     = model.User_id;
                        suser.Type_id_SupplierUserStatus = 9011;
                        B_Lebi_Supplier_User.Add(suser);
                    }
                    else
                    {
                        suser.Supplier_id = model.id;
                        suser.User_id     = model.User_id;
                        suser.Type_id_SupplierUserStatus = 9011;
                        B_Lebi_Supplier_User.Update(suser);
                    }
                }
                catch
                { }
            }
            if (model.Domain != "")
            {
                ThemeUrl.CreateURLRewrite_shop();
            }
            if (model.Type_id_SupplierStatus == 444) //如果状态冻结 商品全部冻结 by lebi.kingdge 2015-02-09
            {
                string sql = "update [Lebi_Product] set Type_id_ProductStatus=103 where Supplier_id=" + id + "";
                Common.ExecuteSql(sql);
            }
            Log.Add("编辑商家信息", "Supplier_User", id.ToString(), CurrentAdmin, model.UserName);
            string result = "{\"msg\":\"OK\", \"id\":\"" + model.id + "\"}";

            Response.Write(result);
        }