Beispiel #1
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;
            }
        }
Beispiel #2
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\"}");
        }
Beispiel #3
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);
        }
Beispiel #4
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.ToLower().IndexOf("http") > -1 || backurl.ToLower().IndexOf("login.aspx") > -1 || backurl == "")
            {
                backurl = site.AdminPath + "/default.aspx?desk=1";
            }
            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 (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;
                status = Tag("ÐÂ×¢²á");
            }
            else
            {
                if (supplier.Type_id_SupplierStatus == 442)
                {
                    Response.Redirect(site.AdminPath + "/login.aspx");
                }
                status = TypeName(supplier.Type_id_SupplierStatus);
            }
        }
Beispiel #5
0
        //获取商家分组名称
        public static Lebi_Supplier_Group GetGroup(int id)
        {
            Lebi_Supplier_Group model = B_Lebi_Supplier_Group.GetModel(id);

            if (model == null)
            {
                model = new Lebi_Supplier_Group();
                return(model);
            }
            return(model);
        }
Beispiel #6
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\"}");
        }
Beispiel #7
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));
        }
        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 + ",";
        }
        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);
        }
Beispiel #10
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);
        }
Beispiel #11
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 + ""); //未分组
            }
        }
Beispiel #12
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\"}");
        }
Beispiel #13
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\"}");
        }
Beispiel #14
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang"))
            {
                Response.Redirect(WebPath + "/");
                Response.End();
                return;
            }
            PageLoadCheck(); //页面载入检查
            #region 当前用户信息
            int selectsupplierid = RequestTool.RequestInt("selectsupplierid");
            if (selectsupplierid > 0)
            {
                //切换超级账号
                string msg = "";
                EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg);
                CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011");
            }
            if (CurrentSupplierUser == null)
            {
                CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser);
            }

            if (CurrentSupplierUser.id == 0)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id);
            if (CurrentSupplier.Type_id_SupplierStatus != 442)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id);
            if (CurrentSupplierUserGroup == null)
            {
                CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup();
            }
            if (CurrentSupplier != null)
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);

                if (CurrentSupplierGroup == null)
                {
                    CurrentSupplierGroup = new Lebi_Supplier_Group();
                }
            }
            else
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            DateTime LastDate      = CurrentSupplier.Time_This;
            TimeSpan ts            = System.DateTime.Now - LastDate;
            int      NewEventTimes = 0;
            int.TryParse(SYS.NewEventTimes, out NewEventTimes);
            LeftNewEventTimes = Convert.ToInt32(ts.TotalSeconds % (NewEventTimes / 1000));
            LeftNewEventTimes = NewEventTimes - (LeftNewEventTimes * 1000);
            #endregion

            #region 配合前台主题
            string themecode = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("site")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true);
            #endregion

            #region 处理菜单
            MenuType = Shop.Tools.CookieTool.GetCookieString("Menu");
            if (MenuType == "")
            {
                MenuType = "Index";
            }

            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;
                }
            }
            //lebi菜单
            if (!Shop.LebiAPI.Service.Instanse.Check("managelicenese"))
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></span></li></ul>";
                string license = "Copyright 2003-" + DateTime.Now.Year + " <a href=\"http://www.lebi.cn/\" target=\"_blank\" class=\"footcopy\">Lebi.cn</a> , All Rights Reserved. Powered by <a href=\"http://www.lebi.cn/support/license/?url=" + Request.ServerVariables["SERVER_NAME"] + "\" target=\"_blank\" title=\"LebiShop\" class=\"footcopy\">LebiShop</a> V<a href=\"" + site.AdminPath + "/config/version.aspx\">" + SYS.Version + "." + SYS.Version_Son + "</a>";
                try
                {
                    Label LBLicense = (Label)this.Page.FindControl("LBLicense");
                    LBLicense.Text = license;
                }
                catch
                {
                    string strscript = "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\"><script language='javascript'>";
                    strscript += "document.onreadystatechange = loadlicense;";
                    strscript += "function loadlicense(){";
                    strscript += "if(document.readyState == \"complete\"){";
                    strscript += "if ($(\"#lebicopy\")[0] == undefined) {alert('页面布局异常')}";
                    strscript += "$('#lebicopy').html('" + license + "')";
                    strscript += "}}</script>";
                    Response.Write(strscript);
                }
            }
            else
            {
                lbmenu = "<ul class=\"tool\"><li><span><a href=\"" + site.AdminPath + "/?desk=1\">" + Tag("桌面") + "</a></ul>";
            }
            //处理菜单
            desk     = RequestTool.RequestInt("desk", 0);
            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);
                }
            }
            TopMenus = (from m in AllMenus
                        where m.parentid == 0
                        select m).ToList();
            if (desk != 1)
            {
                try
                {
                    var temp = from m in AllMenus
                               where reqPage.Contains(m.URL.ToLower()) && m.parentid > 0 && m.URL != ""
                               select m;
                    //if (temp == null)
                    //    CurrentLeftMenu = new Lebi_Menu();
                    //else
                    //{
                    CurrentLeftMenu = temp.ToList().FirstOrDefault();
                    CurrentTopMenu  = (from m in AllMenus
                                       where m.id == CurrentLeftMenu.parentid
                                       select m).ToList().FirstOrDefault();
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == CurrentTopMenu.parentid
                                      select m).ToList().FirstOrDefault();
                    ////写入cookie
                    NameValueCollection nvs = new NameValueCollection();
                    nvs.Add("top", CurrentTopMenu.id.ToString());
                    nvs.Add("left", CurrentLeftMenu.id.ToString());
                    CookieTool.WriteCookie("sMenu", nvs, 365);
                    //}
                }
                catch (NullReferenceException)
                {
                    var menu = CookieTool.GetCookie("sMenu");
                    int tid  = 0;
                    int lid  = 0;
                    int.TryParse(menu.Get("top"), out tid);
                    int.TryParse(menu.Get("left"), out lid);
                    CurrentTopMenu = (from m in TopMenus
                                      where m.id == tid
                                      select m).ToList().FirstOrDefault();
                    CurrentLeftMenu = (from m in AllMenus
                                       where m.id == lid
                                       select m).ToList().FirstOrDefault();
                }
            }
            else
            {
                //写入cookie
                NameValueCollection nvs = new NameValueCollection();
                nvs.Add("top", "0");
                nvs.Add("left", "0");
                CookieTool.WriteCookie("sMenu", nvs, 365);
            }
            if (CurrentTopMenu == null)
            {
                CurrentTopMenu = new Lebi_Supplier_Menu();
                desk           = 1;
            }
            #endregion
            Suppliers = GetSuppliers();


            base.OnLoad(e);
        }
Beispiel #15
0
        //public static bool CheckPower(string code, string name)
        //{
        //    if (!Power(code, name))
        //    {
        //        NoPower();
        //        return false;
        //    }
        //    return true;
        //}
        //public static void NoPower()
        //{
        //    HttpContext.Current.Response.Write("{\"msg\":\"权限不足\"}");
        //    HttpContext.Current.Response.End();
        //}
        #endregion

        /// <summary>
        /// 供应商账号登录
        /// </summary>
        /// <param name="user"></param>
        /// <param name="type">账号类型</param>
        /// <param name="supplierid"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool Login(Lebi_User user, string type, int supplierid, out string msg, int adminlogin = 0)
        {
            msg = "OK";
            Lebi_Supplier_User supplieruser = null;
            Lebi_Supplier      supplier     = null;

            if (supplierid == 0)
            {
                string supplierid_ = CookieTool.GetCookieString("supplier");
                //int supplierid = 0;
                int.TryParse(supplierid_, out supplierid);
            }
            //string and = "";
            //if (type != "")
            //{
            //    and = " and Supplier_id in (select id from [Lebi_Supplier] where Supplier_Group_id in (select id from [Lebi_Supplier_Group] where type='" + type + "'))";
            //}
            if (supplierid > 0)
            {
                supplier = B_Lebi_Supplier.GetModel(supplierid);
                if (supplier != null)
                {
                    Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(supplier.Supplier_Group_id);
                    if (group.type == type || type == "")
                    {
                        supplieruser = B_Lebi_Supplier_User.GetModel("User_id = " + user.id + " and Supplier_id=" + supplierid + " and Type_id_SupplierUserStatus=9011");
                    }
                }
            }
            if (supplieruser == null)
            {
                List <Lebi_Supplier_User> users = B_Lebi_Supplier_User.GetList("User_id = " + user.id + " and Type_id_SupplierUserStatus=9011", "");
                if (type == "")
                {
                    foreach (Lebi_Supplier_User u in users)
                    {
                        supplier = B_Lebi_Supplier.GetModel(u.Supplier_id);
                        if (supplier != null)
                        {
                            supplieruser = u;
                            break;
                        }
                    }
                    //supplieruser = users.FirstOrDefault();
                    //if (supplieruser == null)
                    //{
                    //    msg = "User_id = " + user.id + " and Type_id_SupplierUserStatus=9011";
                    //    return false;
                    //}
                    //supplier = B_Lebi_Supplier.GetModel(supplieruser.Supplier_id);
                }
                else
                {
                    foreach (Lebi_Supplier_User u in users)
                    {
                        supplier = B_Lebi_Supplier.GetModel(u.Supplier_id);
                        if (supplier == null)
                        {
                            continue;
                        }
                        Lebi_Supplier_Group group = B_Lebi_Supplier_Group.GetModel(supplier.Supplier_Group_id);
                        if (group.type == type)
                        {
                            supplieruser = u;
                            break;
                        }
                    }
                }
            }
            if (supplieruser == null)
            {
                Log.Add("登陆失败", "Login", "", supplier, "账号:" + user.UserName);
                msg = "登陆失败";
                return(false);
            }
            if (supplier == null)
            {
                Log.Add("登陆失败:账号不存在或不可用", "Login", "", supplier, "账号:" + user.UserName);
                msg = "账号不存在或不可用";
                return(false);
            }
            if (supplier.Type_id_SupplierStatus != 442)
            {
                Log.Add("登陆失败:供应商账号不可用", "Login", "", supplier, "账号:" + user.UserName);
                msg = "供应商账号不可用";
                return(false);
            }
            supplier.Time_Last = supplier.Time_This;
            supplier.Time_This = DateTime.Now;
            supplier.Count_Login++;
            supplier.IP_Last = supplier.IP_This;
            supplier.IP_This = RequestTool.GetClientIP();
            Shop.Tools.CookieTool.SetCookieString("supplier", supplier.id.ToString(), 60 * 24);
            B_Lebi_Supplier.Update(supplier);
            if (adminlogin == 0)
            {
                Log.Add("登陆系统", "Login", "", supplier, "账号:" + user.UserName);
            }
            return(true);
        }
Beispiel #16
0
 /// <summary>
 /// 安全方式绑定表单数据
 /// </summary>
 public static Lebi_Supplier_Group SafeBindForm(Lebi_Supplier_Group model)
 {
     return(D_Lebi_Supplier_Group.Instance.SafeBindForm(model));
 }
Beispiel #17
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static int Add(Lebi_Supplier_Group model)
 {
     return(D_Lebi_Supplier_Group.Instance.Add(model));
 }
Beispiel #18
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\"}");
        }
Beispiel #19
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static void Update(Lebi_Supplier_Group model)
 {
     D_Lebi_Supplier_Group.Instance.Update(model);
 }
Beispiel #20
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\"}");
        }
Beispiel #21
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);
        }
Beispiel #22
0
        protected override void OnLoad(EventArgs e)
        {
            if (!Shop.LebiAPI.Service.Instanse.Check("plugin_gongyingshang"))
            {
                Response.Write("");
                Response.End();
                return;
            }
            PageLoadCheck(); //页面载入检查

            #region 当前用户信息
            int selectsupplierid = RequestTool.RequestInt("selectsupplierid");
            if (selectsupplierid > 0)
            {
                //切换超级账号
                string msg = "";
                EX_Supplier.Login(CurrentUser, "", selectsupplierid, out msg);
                CurrentSupplierUser = B_Lebi_Supplier_User.GetModel("User_id = " + CurrentUser.id + " and Supplier_id=" + selectsupplierid + " and Type_id_SupplierUserStatus=9011");
            }
            if (CurrentSupplierUser == null)
            {
                CurrentSupplierUser = EX_Supplier.CurrentSupplierUser(CurrentUser);
            }

            if (CurrentSupplierUser.id == 0)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }


            CurrentSupplier = B_Lebi_Supplier.GetModel(CurrentSupplierUser.Supplier_id);
            if (CurrentSupplier.Type_id_SupplierStatus != 442)
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            CurrentSupplierUserGroup = B_Lebi_Supplier_UserGroup.GetModel(CurrentSupplierUser.Supplier_UserGroup_id);
            if (CurrentSupplierUserGroup == null)
            {
                CurrentSupplierUserGroup = new Lebi_Supplier_UserGroup();
            }
            if (CurrentSupplier != null)
            {
                CurrentSupplierGroup = B_Lebi_Supplier_Group.GetModel(CurrentSupplier.Supplier_Group_id);

                if (CurrentSupplierGroup == null)
                {
                    CurrentSupplierGroup = new Lebi_Supplier_Group();
                }
            }
            else
            {
                Response.Redirect(Shop.Bussiness.Site.Instance.SupplierPath + "/Login.aspx");
                return;
            }
            #endregion

            #region 配合前台主题
            string themecode = "";
            int    siteid    = 0;
            var    nv        = CookieTool.GetCookie("ThemeStatus");
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                themecode = nv.Get("theme");
            }
            if (!string.IsNullOrEmpty(nv.Get("theme")))
            {
                int.TryParse(nv.Get("site"), out siteid);
            }
            if (siteid == 0)
            {
                siteid = ShopCache.GetMainSite().id;
            }
            LoadTheme(themecode, siteid, CurrentLanguage.Code, "", true);
            #endregion

            Suppliers = GetSuppliers();
            base.OnLoad(e);
        }