示例#1
0
        /// <summary>
        /// 删除会员分组
        /// </summary>
        public void Group_Del()
        {
            string id = RequestTool.RequestString("id");

            if (!EX_Admin.Power("supplier_group_del", "删除商家分组"))
            {
                AjaxNoPower();
                return;
            }
            if (id != "")
            {
                List <Lebi_Supplier_Group> models = B_Lebi_Supplier_Group.GetList("id in (lbsql{" + id + "})", "");
                foreach (Lebi_Supplier_Group model in models)
                {
                    int Level_id = 1;
                    Lebi_Supplier_Group tmodel = B_Lebi_Supplier_Group.GetModel("Grade>" + model.Grade + " order by Grade asc");
                    if (tmodel == null)
                    {
                        Level_id = 1;
                    }
                    else
                    {
                        Level_id = tmodel.id;
                    }
                    Common.ExecuteSql("Update Lebi_Supplier set Supplier_Group_id = " + Level_id + " where Supplier_Group_id = " + model.id + "");
                    //}->
                    B_Lebi_Supplier_Group.Delete(model.id);
                }
                Log.Add("删除商家分组", "Supplier_Group", id.ToString(), CurrentAdmin, id.ToString());
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
示例#2
0
        /// <summary>
        /// 供应商皮肤下拉框选项
        /// </summary>
        public void GetSupplierSkinOptions()
        {
            int    gid = RequestTool.RequestInt("groupid");
            int    id  = RequestTool.RequestInt("id");
            string str = "<option value=\"0\">┌ " + Tag("默认皮肤") + "</option>";
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(gid);

            if (group != null)
            {
                if (group.Supplier_Skin_ids != "")
                {
                    string sel = "";
                    List <Lebi_Supplier_Skin> models = B_Lebi_Supplier_Skin.GetList("id in (" + group.Supplier_Skin_ids + ")", "");
                    foreach (Lebi_Supplier_Skin model in models)
                    {
                        sel = "";
                        if (id == model.id)
                        {
                            sel = "selected";
                        }
                        str += "<option value=\"" + model.id + "\" " + sel + ">" + model.Name + "</option>";
                    }
                }
            }
            Response.Write(str);
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int id = RequestTool.RequestInt("id", 0);

            if (id == 0)
            {
                if (!EX_Admin.Power("supplier_group_edit", "添加商家分组"))
                {
                    WindowNoPower();
                }
            }
            else
            {
                if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
                {
                    WindowNoPower();
                }
            }
            string type = RequestTool.RequestString("type");

            if (type == "")
            {
                type = "supplier";
            }
            model = B_Lebi_Supplier_Group.GetModel(id);
            if (model == null)
            {
                model      = new Lebi_Supplier_Group();
                model.type = type;
            }
        }
示例#4
0
        public List <Lebi_Supplier_Menu> Supplier_GetMenus(int pid)
        {
            string menu_ids = "";

            if (CurrentSupplierUserGroup != null && CurrentSupplierUser.User_id != CurrentSupplier.User_id)
            {
                menu_ids = CurrentSupplierUserGroup.Menu_ids;
            }
            else
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);
                if (CurrentSupplierGroup != null)
                {
                    menu_ids = CurrentSupplierGroup.Menu_ids;
                }
            }
            AllMenus = new List <Lebi_Supplier_Menu>();
            List <Lebi_Supplier_Menu> All = B_Lebi_Supplier_Menu.GetList("Isshow=1", "Sort desc");
            string currentgroupmenu       = "," + menu_ids + ",";

            foreach (Lebi_Supplier_Menu m in All)
            {
                if (currentgroupmenu.Contains("," + m.id + ","))
                {
                    AllMenus.Add(m);
                }
            }
            List <Lebi_Supplier_Menu> menus = (from m in AllMenus
                                               where m.parentid == pid
                                               select m).ToList();

            return(menus);
        }
示例#5
0
        /// <summary>
        /// 编辑权限-编辑过滤页面
        /// </summary>
        public void url_Edit()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            int    id  = RequestTool.RequestInt("id", 0);
            int    gid = RequestTool.RequestInt("gid", 0);
            string url = RequestTool.RequestString("Url");
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(gid);

            if (url == "")
            {
                Response.Write("{\"msg\":\"" + Tag("地址不能为空") + "\"}");
                return;
            }
            if (group == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            Lebi_Supplier_Power p = B_Lebi_Supplier_Power.GetModel(id);

            if (p == null)
            {
                p = B_Lebi_Supplier_Power.GetList("Admin_Group_id=" + group.id + " and Url=lbsql{'" + url + "'}", "").FirstOrDefault();
                if (p != null)
                {
                    Response.Write("{\"msg\":\"" + Tag("地址已经存在") + "\"}");
                    return;
                }
                p = new Lebi_Supplier_Power();
                p.Supplier_Group_id = group.id;
                p.Url = url;
                B_Lebi_Supplier_Power.Add(p);
                string action      = Tag("添加过滤页面");
                string description = url;
                Log.Add(action, "Supplier_Group", p.id.ToString(), CurrentAdmin, description);
            }
            else
            {
                p.Url = url;
                B_Lebi_Supplier_Power.Update(p);
                string action      = Tag("编辑过滤页面");
                string description = url;
                Log.Add(action, "Supplier_Group", p.id.ToString(), CurrentAdmin, description);
            }

            Response.Write("{\"msg\":\"OK\"}");
        }
示例#6
0
        /// <summary>
        /// 返回供应商分组名称
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GroupName(int id)
        {
            if (type == "")
            {
                type = "supplier";
            }
            List <Lebi_Supplier_Group> levels = B_Lebi_Supplier_Group.GetList("type=lbsql{'" + type + "'}", "Grade asc");
            Lebi_Supplier_Group        group  = B_Lebi_Supplier_Group.GetModel(id);

            if (group == null)
            {
                return("");
            }
            return(Lang(group.Name));
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            models = GetMenu(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_Group.GetModel(id);
            if (group == null)
            {
                PageError();
            }
            ids = "," + group.Menu_ids_index + ",";
        }
示例#8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageNoPower();
            }
            int id  = RequestTool.RequestInt("id", 0);
            int gid = RequestTool.RequestInt("gid", 0);

            model = B_Lebi_Supplier_Power.GetModel(id);
            if (model == null)
            {
                model = new Lebi_Supplier_Power();
            }
            else
            {
                gid = model.Supplier_Group_id;
            }
            group = B_Lebi_Supplier_Group.GetModel(gid);
        }
示例#9
0
        /// <summary>
        /// 编辑等级分组
        /// </summary>
        public void Group_Edit()
        {
            int id = RequestTool.RequestInt("id", 0);
            Lebi_Supplier_Group model = B_Lebi_Supplier_Group.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Supplier_Group();
            }
            B_Lebi_Supplier_Group.BindForm(model);
            model.Supplier_Skin_ids = RequestTool.RequestString("Supplier_Skin_ids");
            model.Verified_ids      = RequestTool.RequestString("Verified_ids");
            model.Name = Language.RequestString("Name");
            if (model.id == 0)
            {
                if (!EX_Admin.Power("supplier_group_add", "添加商家分组"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Supplier_Group.Add(model);
                id = B_Lebi_Supplier_Group.GetMaxId();
                Log.Add("添加商家分组", "Supplier_Group", id.ToString(), CurrentAdmin, Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN"));
            }
            else
            {
                if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
                {
                    AjaxNoPower();
                    return;
                }
                B_Lebi_Supplier_Group.Update(model);
                Log.Add("编辑商家分组", "Supplier_Group", id.ToString(), CurrentAdmin, Shop.Bussiness.Language.Content(Language.RequestString("Name"), "CN"));
            }
            string result = "{\"msg\":\"OK\", \"id\":\"" + id + "\"}";

            Response.Write(result);
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                PageReturnMsg = PageNoPowerMsg();
            }

            models = GetLimit(0);
            int id = RequestTool.RequestInt("id", 0);

            group = B_Lebi_Supplier_Group.GetModel(id);
            if (group == null)
            {
                PageError();
            }
            ps            = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url=''", "");
            purls         = B_Lebi_Supplier_Power.GetList("Supplier_Group_id=" + group.id + " and Url!=''", "");
            defaultparent = B_Lebi_Supplier_Limit.GetModel("Code='default'");
            if (defaultparent != null)
            {
                count = B_Lebi_Supplier_Limit.Counts("parentid = " + defaultparent.id + ""); //未分组
            }
        }
示例#11
0
        /// <summary>
        /// 编辑桌面菜单
        /// </summary>
        public void SaveIndexMenu()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            string ids = RequestTool.RequestString("id");
            int    gid = RequestTool.RequestInt("gid", 0);
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(gid);

            if (group == null)
            {
                Response.Write("{\"msg" + Tag("参数错误") + "\"}");
                return;
            }
            group.Menu_ids_index = ids;
            B_Lebi_Supplier_Group.Update(group);
            string action      = Tag("编辑桌面菜单");
            string description = Shop.Bussiness.Language.Content(group.Name, "CN");

            Log.Add(action, "Supplier_Group", gid.ToString(), CurrentAdmin, description);
            Response.Write("{\"msg\":\"OK\"}");
        }
示例#12
0
        /// <summary>
        /// 保存权限
        /// </summary>
        public void SavePower()
        {
            if (!EX_Admin.Power("supplier_group_edit", "编辑商家分组"))
            {
                AjaxNoPower();
                return;
            }
            string ids = RequestTool.RequestString("id");
            int    gid = RequestTool.RequestInt("gid", 0);
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(gid);

            if (group == null)
            {
                Response.Write("{\"msg" + Tag("参数错误") + "\"}");
                return;
            }
            B_Lebi_Supplier_Power.Delete("Supplier_Group_id=" + group.id + "");
            List <Lebi_Supplier_Limit> models = B_Lebi_Supplier_Limit.GetList("id in (lbsql{" + ids + "})", "");

            if (models != null)
            {
                Lebi_Supplier_Power p = new Lebi_Supplier_Power();
                foreach (Lebi_Supplier_Limit model in models)
                {
                    p.Supplier_Group_id   = group.id;
                    p.Supplier_Limit_Code = model.Code;
                    p.Supplier_Limit_id   = model.id;
                    B_Lebi_Supplier_Power.Add(p);
                }
            }
            string action      = Tag("编辑权限");
            string description = Shop.Bussiness.Language.Content(group.Name, "CN");

            Log.Add(action, "Supplier_Group", gid.ToString(), CurrentAdmin, description);
            Response.Write("{\"msg\":\"OK\"}");
        }
示例#13
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            site    = new Site_Supplier();
            backurl = RequestTool.RequestString("url").Replace("<", "").Replace(">", "");
            if (backurl == "")
            {
                backurl = site.AdminPath + "/login.aspx";
            }
            if (CurrentUser.id == 0)
            {
                Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
            }
            path      = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("Ê×Ò³") + "\"><span>" + Tag("Ê×Ò³") + "</span></a><em class=\"home\">&raquo;</em><a>" + Tag("É̼Ò×¢²á") + "</a>";
            verifieds = B_Lebi_Supplier_Verified.GetList("", "Sort desc");
            logintype = RequestTool.RequestString("logintype", "");

            List <Lebi_Supplier> suppliers = B_Lebi_Supplier.GetList("User_id=" + CurrentUser.id + "", "id desc");

            if (suppliers.Count == 0)
            {
                supplier = new Lebi_Supplier();
                supplier.Type_id_SupplierStatus = 441;
            }
            if (logintype == "" && suppliers.Count > 0)
            {
                supplier = suppliers.FirstOrDefault();
                Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(supplier.Supplier_Group_id);
                logintype = group.type;
            }
            else
            {
                foreach (Lebi_Supplier sup in suppliers)
                {
                    Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(sup.Supplier_Group_id);
                    if (logintype == group.type)
                    {
                        supplier = sup;
                    }
                }
            }
            logintype = logintype == "" ? "supplier" : logintype;
            if (supplier == null)
            {
                supplier                        = new Lebi_Supplier();
                supplier.Address                = CurrentUser.Address;
                supplier.Area_id                = CurrentUser.Area_id;
                supplier.Fax                    = CurrentUser.Fax;
                supplier.Email                  = CurrentUser.Email;
                supplier.MobilePhone            = CurrentUser.MobilePhone;
                supplier.Msn                    = CurrentUser.Msn;
                supplier.Phone                  = CurrentUser.Phone;
                supplier.Postalcode             = CurrentUser.Postalcode;
                supplier.QQ                     = CurrentUser.QQ;
                supplier.RealName               = CurrentUser.RealName;
                supplier.UserName               = CurrentUser.UserName;
                supplier.User_id                = CurrentUser.id;
                supplier.Type_id_SupplierStatus = 441;
                status = Tag("ÐÂ×¢²á");
            }
            else
            {
                if (supplier.Type_id_SupplierStatus == 442)
                {
                    Response.Redirect(site.AdminPath + "/login.aspx");
                }
                status = TypeName(supplier.Type_id_SupplierStatus);
            }
        }
示例#14
0
        /// <summary>
        /// 余额购买其他内容
        /// </summary>
        public void BuyOther()
        {
            int     keyid     = RequestTool.RequestInt("keyid");
            string  tablename = RequestTool.RequestSafeString("tablename");
            decimal postmoney = RequestTool.RequestDecimal("money");
            string  paypwd    = RequestTool.RequestSafeString("paypwd");
            decimal money     = 0;

            if (EX_User.MD5(paypwd) != CurrentUser.Pay_Password)
            {
                Response.Write("{\"msg\":\"" + Tag("支付密码错误") + "\"}");
                return;
            }
            if (tablename == "Agent_Product_Level")
            {
                Lebi_Agent_Product_Level lev = B_Lebi_Agent_Product_Level.GetModel(keyid);
                if (lev == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                Lebi_Agent_Product_User user = B_Lebi_Agent_Product_User.GetModel("User_id=" + CurrentUser.id + "");
                if (user == null)
                {
                    //新购买的情况
                    money = lev.Price;
                    if (money > CurrentUser.Money)
                    {
                        Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                        return;
                    }
                    user = new Lebi_Agent_Product_User();
                    user.Agent_Product_Level_id = lev.id;
                    user.Commission             = lev.Commission;
                    user.Count_Product          = lev.Count_Product;
                    user.Count_product_change   = lev.Count_product_change;
                    user.User_id       = CurrentUser.id;
                    user.User_UserName = CurrentUser.UserName;
                    user.Time_end      = System.DateTime.Now.AddYears(lev.Years);
                    B_Lebi_Agent_Product_User.Add(user);
                }
                else
                {
                    if (user.Agent_Product_Level_id == lev.id)
                    {
                        //续费的情况
                        money = lev.Price;
                        if (money > CurrentUser.Money)
                        {
                            Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                            return;
                        }
                        user.Time_end = user.Time_end.AddYears(lev.Years);
                        B_Lebi_Agent_Product_User.Update(user);
                        //更新代理商品的过期时间
                    }
                    else
                    {
                        //升级的情况

                        Lebi_Agent_Product_Level userlev = B_Lebi_Agent_Product_Level.GetModel(user.Agent_Product_Level_id);
                        if (userlev.Sort > lev.Sort)
                        {
                            Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                            return;
                        }
                        money = lev.Price - userlev.Price;
                        if (money < 0)
                        {
                            Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                            return;
                        }
                        if (money > CurrentUser.Money)
                        {
                            Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                            return;
                        }
                        user.Agent_Product_Level_id = lev.id;
                        user.Commission             = lev.Commission;
                        user.Count_Product          = lev.Count_Product;
                        user.Count_product_change   = lev.Count_product_change;
                        B_Lebi_Agent_Product_User.Update(user);
                    }
                }
                EX_User.GiveUserCard(CurrentUser, lev.CardOrder_id);//赠送代金券
                Money.AddMoney(CurrentUser, 0 - money, 196, null, "", "");
            }
            else if (tablename == "Agent_Area")
            {
                Lebi_Agent_Area area = B_Lebi_Agent_Area.GetModel(keyid);
                if (area == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                if (area.User_id > 0 && area.User_id != CurrentUser.id)
                {
                    Response.Write("{\"msg\":\"" + Tag("不能代理此区域") + "\"}");
                    return;
                }
                money = area.Price;
                if (money > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
                if (area.User_id == 0)
                {
                    //新购买的情况
                    area.User_id       = CurrentUser.id;
                    area.User_UserName = CurrentUser.UserName;
                    area.Time_end      = System.DateTime.Now.AddYears(1);
                    area.IsFailure     = 0;
                    B_Lebi_Agent_Area.Update(area);
                }
                else
                {
                    //续费的情况
                    area.Time_end  = area.Time_end.AddYears(1);
                    area.IsFailure = 0;
                    B_Lebi_Agent_Area.Update(area);
                }
                EX_User.GiveUserCard(CurrentUser, area.CardOrder_id);//赠送代金券
                Money.AddMoney(CurrentUser, 0 - money, 196, null, "", "");
            }
            else if (tablename == "suppliermargin")//供应商保证金
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id);
                if (supplier == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                //新购买的情况
                money = supplier.Money_Margin - supplier.Money_Margin_pay;
                if (money > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
                supplier.Money_Margin_pay += money;
                B_Lebi_Supplier.Update(supplier);
                Money.AddMoney(CurrentUser, 0 - money, 197, null, "", "");
            }
            else if (tablename == "suppliermargin")//供应商保证金
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id);
                if (supplier == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                money = supplier.Money_Margin - supplier.Money_Margin_pay;
                if (money > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
                supplier.Money_Margin_pay += money;
                B_Lebi_Supplier.Update(supplier);
                Money.AddMoney(CurrentUser, 0 - money, 197, null, "", "");
            }
            else if (tablename == "supplierservice")//供应商服务费
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id);
                if (supplier == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel("id=" + supplier.Supplier_Group_id);
                if (group == null)
                {
                    Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                    return;
                }
                money = supplier.Money_Service;
                if (money > CurrentUser.Money)
                {
                    Response.Write("{\"msg\":\"" + Tag("余额不足") + "\"}");
                    return;
                }
                supplier.Time_End = supplier.Time_End.AddDays(group.ServiceDays);
                B_Lebi_Supplier.Update(supplier);
                Money.AddMoney(CurrentUser, 0 - money, 198, null, "", "");
            }
            Response.Write("{\"msg\":\"OK\"}");
        }
示例#15
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);
        }
示例#16
0
        /// <summary>
        /// 用户这注册
        /// </summary>
        public void User_Reg()
        {
            string verifycode = RequestTool.RequestString("verifycode");
            string code       = CurrentCheckCode;
            string UserName   = RequestTool.RequestSafeString("UserName");

            //检查用户名存在
            if (CurrentUser.id == 0 || CurrentUser.IsAnonymous == 1)
            {
                Response.Write("{\"msg\":\"" + Tag("请登录") + "\"}");
                return;
            }
            if (SYS.Verifycode_SupplierRegister == "1")
            {
                if (code != verifycode)
                {
                    Response.Write("{\"msg\":\"" + Tag("验证码错误") + "\"}");
                    return;
                }
            }
            //检查用户名存在
            int count = B_Lebi_Supplier.Counts("UserName !='' and UserName=lbsql{'" + CurrentUser.UserName + "'}");

            if (count > 0)
            {
                Response.Write("{\"msg\":\"" + Tag("商家已注册") + "\"}");
                return;
            }
            Lebi_Supplier model = B_Lebi_Supplier.GetModel("User_id=" + CurrentUser.id + "");

            if (model == null)
            {
                model = new Lebi_Supplier();
            }
            Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(RequestTool.RequestInt("Supplier_Group_id"));

            if (group == null)
            {
                Response.Write("{\"msg\":\"" + Tag("参数错误") + "\"}");
                return;
            }
            B_Lebi_Supplier.SafeBindForm(model);
            model.User_id                = CurrentUser.id;
            model.UserName               = CurrentUser.UserName;
            model.Email                  = RequestTool.RequestSafeString("Email");
            model.RealName               = RequestTool.RequestSafeString("RealName");
            model.Company                = RequestTool.RequestSafeString("Company");
            model.Name                   = RequestTool.RequestSafeString("Name");
            model.Name                   = "[{\"L\":\"" + Language.DefaultLanguage().Code + "\",\"C\":\"" + model.Name + "\"}]";
            model.SubName                = RequestTool.RequestSafeString("SubName");
            model.MobilePhone            = RequestTool.RequestSafeString("MobilePhone");
            model.Phone                  = RequestTool.RequestSafeString("Phone");
            model.QQ                     = RequestTool.RequestSafeString("QQ");
            model.Language               = CurrentLanguage.Code;
            model.Time_Reg               = DateTime.Now;
            model.Time_This              = DateTime.Now;
            model.Time_Last              = DateTime.Now;
            model.Count_Login            = 1;
            model.IP_This                = RequestTool.GetClientIP();
            model.IP_Last                = RequestTool.GetClientIP();
            model.Type_id_SupplierStatus = 441;
            model.BillingDays            = group.BillingDays;
            model.Money_Service          = group.ServicePrice;
            model.Money_Margin           = group.MarginPrice;
            model.Time_Begin             = DateTime.Now;
            model.Time_End               = DateTime.Now.AddDays(group.ServiceDays);
            if (model.id == 0)
            {
                B_Lebi_Supplier.Add(model);
                model.id = B_Lebi_Supplier.GetMaxId();
            }
            else
            {
                B_Lebi_Supplier.Update(model);
            }
            if (group.Verified_ids != "")
            {
                List <Lebi_Supplier_Verified> models = B_Lebi_Supplier_Verified.GetList("id in (" + group.Verified_ids + ")", "Sort desc");
                foreach (Lebi_Supplier_Verified m in models)
                {
                    string where = "Verified_id = " + m.id + " and Supplier_id = " + model.id + "";
                    Lebi_Supplier_Verified_Log log = B_Lebi_Supplier_Verified_Log.GetModel(where);
                    if (log == null)
                    {
                        log = new Lebi_Supplier_Verified_Log();
                    }
                    //log = B_Lebi_Supplier_Verified_Log.SafeBindForm(log);
                    log.ImageUrl = RequestTool.RequestSafeString("Image" + m.id);
                    log.Type_id_SupplierVerifiedStatus = 9020;
                    log.Time_Add    = DateTime.Now;
                    log.Verified_id = m.id;
                    log.Supplier_id = model.id;
                    if (log.id == 0)
                    {
                        B_Lebi_Supplier_Verified_Log.Add(log);
                    }
                    else
                    {
                        B_Lebi_Supplier_Verified_Log.Update(log);
                    }
                }
            }
            EX_Supplier.SupplierRegister(model);//触发事件
            Response.Write("{\"msg\":\"OK\"}");
        }