예제 #1
0
 protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
 {
     LoadTheme(themecode, siteid, languagecode, pcode);
     if (CurrentUser.id == 0)
     {
         //未登录
         if (SYS.IsAnonymousUser != "1")
         {
             Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
         }
     }
     if (SYS.IsSupplierCash == "1")
     {
         int sid = Rint_Para("0");
         supplier = B_Lebi_Supplier.GetModel(sid);
     }
     if (supplier == null)
     {
         supplier = new Lebi_Supplier();
     }
     CookieTool.SetCookieString("supplier", supplier.id.ToString(), 60);
     path   = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_Basket", "") + "\"><span>" + Tag("购物车") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_CheckOut", "") + "\"><span>" + Tag("收银台") + "</span></a>";
     basket = new Basket();
     if (basket.Products.Count == 0)
     {
         Response.Redirect(URL("P_Basket", ""));
     }
     if (CurrentUser.id > 0)
     {
         cards      = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and Type_id_CardType=312 and Type_id_CardStatus in (201,203) and Time_End>'" + FormatTime(System.DateTime.Now) + "'", "id asc");//状态为已发放或部分使用
         moneycards = B_Lebi_Card.GetList("User_id=" + CurrentUser.id + " and Type_id_CardType=311 and Type_id_CardStatus in (201,203) and Time_End>'" + FormatTime(System.DateTime.Now) + "'", "id asc");
     }
     ProPerty135 = B_Lebi_ProPerty.GetList("Type_id_ProPertyType=135", "Sort desc");
 }
예제 #2
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);
            }
        }
예제 #3
0
        /// <summary>
        /// 更新商家资金
        /// </summary>
        /// <param name="user"></param>
        public static void UpdateUserMoney(Lebi_Supplier user)
        {
            string  money = B_Lebi_Supplier_Money.GetValue("sum(Money)", "Supplier_id=" + user.id + " and Type_id_MoneyStatus=181");
            decimal Money = 0;

            Decimal.TryParse(money, out Money);
            user.Money = Money;
            B_Lebi_Supplier.Update(user);
        }
예제 #4
0
        /// <summary>
        /// 获得在线付款接口参数MODEL
        /// </summary>
        /// <param name="code"></param>
        /// <param name="order"></param>
        public static Lebi_OnlinePay GetOnlinePay(Lebi_Order order, string code)
        {
            if (order == null)
            {
                return(null);
            }
            string where = "Code='" + code + "'";
            if (string.IsNullOrEmpty(order.KeyCode))
            {
                if (order.IsSupplierCash == 0 && order.Language_id > 0)
                {
                    where += " and ','+Language_ids+',' like '%," + order.Language_id + ",%'";
                }
            }
            Lebi_OnlinePay pay = B_Lebi_OnlinePay.GetModel(where);
            string         log = "";

            if (pay == null)
            {
                pay = B_Lebi_OnlinePay.GetModel("Code='" + code + "'");
            }
            if (pay == null)
            {
                log = "在线支付接口 " + code + " 配置错误";
                Log.Add(log);
            }
            else
            {
                if (order.IsSupplierCash == 1)
                {
                    Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(order.Supplier_id);
                    if (supplier == null)
                    {
                        supplier = new Lebi_Supplier();
                        log      = "在线支付接口 " + code + " 配置错误[供应商ID:" + order.Supplier_id + "]";
                        Log.Add(log);
                        return(pay);
                    }
                    Lebi_OnlinePay supplierpay = B_Lebi_OnlinePay.GetModel("Code='" + code + "' and Supplier_id=" + supplier.id + "");
                    if (supplierpay == null)
                    {
                        log = "在线支付接口 " + code + " 配置错误[供应商:" + supplier.SubName + ",ID:" + order.Supplier_id + "]";
                        Log.Add(log);
                        return(pay);
                    }
                    supplierpay.TypeName      = pay.TypeName;
                    supplierpay.Url           = pay.Url;
                    supplierpay.Code          = pay.Code;
                    supplierpay.Currency_Code = pay.Currency_Code;
                    supplierpay.Currency_id   = pay.Currency_id;
                    supplierpay.Currency_Name = pay.Currency_Name;
                    return(supplierpay);
                }
            }
            return(pay);
        }
예제 #5
0
        /// <summary>
        /// 获取供应商
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Lebi_Supplier GetSupplier(int id)
        {
            Lebi_Supplier user = B_Lebi_Supplier.GetModel("id = " + id);

            if (user == null)
            {
                user = new Lebi_Supplier();
            }
            return(user);
        }
예제 #6
0
        //获取商家信息
        public static Lebi_Supplier GetUser(int id)
        {
            Lebi_Supplier model = B_Lebi_Supplier.GetModel("id = " + id);

            if (model == null)
            {
                model = new Lebi_Supplier();
                return(model);
            }
            return(model);
        }
예제 #7
0
파일: ThemeUrl.cs 프로젝트: zwkjgs/LebiShop
        /// <summary>
        /// 生成域名绑定规则
        /// </summary>
        public static void CreateURLRewrite_shop()
        {
            HtmlEngine    save = new HtmlEngine();
            StringBuilder sb   = new StringBuilder();
            StringBuilder sb1  = new StringBuilder();
            string        str  = HtmlEngine.ReadTxt("httpd.ini");
            string        str1 = HtmlEngine.ReadTxt(".htaccess");

            if (str == "")
            {
                sb.AppendLine("[ISAPI_Rewrite]");
            }
            else
            {
                sb.AppendLine(HtmlEngine.ReadTxt("httpd.ini"));
            }
            if (str1 == "")
            {
                sb1.AppendLine("RewriteEngine On");
                sb1.AppendLine("RewriteCompatibility2 On");
                sb1.AppendLine("RepeatLimit 200");
                sb1.AppendLine("RewriteBase");
            }
            else
            {
                sb1.AppendLine(HtmlEngine.ReadTxt(".htaccess"));
            }
            List <Lebi_Supplier> models = B_Lebi_Supplier.GetList("Domain!=''", "");

            if (models.Count == 0)
            {
                return;
            }
            //RewriteCond %{HTTP_HOST} ^www.shop0769.top$
            //RewriteRule ^(.*)$ http://www.shop0769.com/shop/?id=11
            Lebi_Site site = B_Lebi_Site.GetModel("1=1 order by Sort desc");

            if (site != null)
            {
                foreach (Lebi_Supplier model in models)
                {
                    //sb1.AppendLine(@"RewriteRule //" + model.Domain + "(.*)$ /shop/?id=" + model.id + " [NC,N]");
                    //sb.AppendLine(@"RewriteRule //" + model.Domain + "/(.*) /$1/shop/?id=" + model.id + " [N,I]");

                    sb.AppendLine(@"RewriteCond Host ^" + model.Domain + "$");
                    sb.AppendLine(@"RewriteRule (.*) " + ShopCache.GetBaseConfig().HTTPServer + "://" + site.Domain + "/shop/?id=" + model.id + "$ [N,I]");

                    sb1.AppendLine(@"RewriteCond  %{HTTP_HOST} ^" + model.Domain + "$");
                    sb1.AppendLine(@"RewriteRule ^(.*)$ " + ShopCache.GetBaseConfig().HTTPServer + "://" + site.Domain + "/shop/?id=" + model.id + " [NC,N]");
                }
            }
            save.CreateFile("httpd.ini", sb.ToString(), "ascii");
            save.CreateFile(".htaccess", sb1.ToString(), "ascii");
        }
예제 #8
0
        /// <summary>
        /// 商家下拉框
        /// </summary>
        /// <param name="id"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static string SupplierOption(int id, string lang = "CN")
        {
            StringBuilder        builderTree = new StringBuilder();
            List <Lebi_Supplier> nodes       = B_Lebi_Supplier.GetList("Supplier_Group_id in (select g.id from Lebi_Supplier_Group as g where g.type='supplier')", "");

            foreach (Lebi_Supplier node in nodes)
            {
                //builderTree.Append(string.Format("<option value=\"{0}\" {1}>{2}</option>  \r\n", node.id, node.id == id ? "selected=\"selected\"" : "", Language.Content(node.Name, lang)));
                builderTree.Append(string.Format("<option value=\"{0}\" {1}>{2}</option>  \r\n", node.id, node.id == id ? "selected=\"selected\"" : "", "[" + node.SubName + "]" + node.Company));
            }
            return(builderTree.ToString());
        }
예제 #9
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            LoadTheme(themecode, siteid, languagecode, pcode);
            CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_ShopSearch'");
            keyword     = Rstring_Para("0");

            sort  = Rstring_Para("1");
            where = "Supplier_Group_id in (select w.id from [Lebi_Supplier_Group] as w where w.type='supplier' or w.type='')";
            path  = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("Ê×Ò³") + "\"><span>" + Tag("Ê×Ò³") + "</span></a><em class=\"home\">&raquo;</em><a class=\"text\"><span>" + Tag("µêÆÌËÑË÷") + "</span></a><em>&raquo;</em><a class=\"text\"><span>¡°" + keyword + "¡±</span></a>";

            if (keyword != "")
            {
                string wherekeyword = "";
                if (keyword.IndexOf(" ") > -1)
                {
                    string[] keywordsArr;
                    keywordsArr = keyword.Split(new char[1] {
                        ' '
                    });
                    foreach (string keywords in keywordsArr)
                    {
                        if (keywords != "")
                        {
                            if (wherekeyword == "")
                            {
                                wherekeyword = "(Name like lbsql{'%" + keywords + "%'} or SubName like lbsql{'%" + keywords + "%'})";
                            }
                            else
                            {
                                wherekeyword += " and (Name like lbsql{'%" + keywords + "%'} or SubName like lbsql{'%" + keywords + "%'})";
                            }
                        }
                    }
                }
                else
                {
                    wherekeyword = "(Name like lbsql{'%" + keyword + "%'} or SubName like lbsql{'%" + keyword + "%'})";
                }
                where = wherekeyword;
            }


            //SQLDataAccess.SQLPara sp = new SQLDataAccess.SQLPara(where, "id desc", "*");
            shops       = B_Lebi_Supplier.GetList(where, "id desc", PageSize, pageindex);
            recordCount = B_Lebi_Supplier.Counts(where);
            string url = URL("P_ShopSearch", keyword + "," + sort + ",{0}");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
        }
예제 #10
0
파일: SMS.cs 프로젝트: zwkjgs/LebiShop
        /// <summary>
        /// 订单留言
        /// </summary>
        /// <param name="user"></param>
        public static void SendSMS_ordercomment(Lebi_User user, Lebi_Comment model)
        {
            BaseConfig conf          = ShopCache.GetBaseConfig();
            int        IsAdminSms    = 0;
            int        IsSupplierSms = 0;

            if (conf.SMS_sendmode.Contains("SMSTPL_Admin_ordercomment"))
            {
                IsAdminSms = 1;
            }
            Lebi_Order order = B_Lebi_Order.GetModel(model.Keyid);

            if (order == null)
            {
                order = new Lebi_Order();
            }
            if (order.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(order.Supplier_id);
                if (supplier.IsSupplierTransport == 0)  //商家发货
                {
                    if (ShopCache.GetBaseConfig_Supplier(order.Supplier_id).SMS_sendmode.Contains("SMSTPL_Admin_ordercomment"))
                    {
                        IsSupplierSms = 1;
                    }
                }
            }
            if (IsAdminSms == 0 && IsSupplierSms == 0)
            {
                return;
            }
            if (user.Language == "")
            {
                user.Language = Language.Languages().FirstOrDefault().Code;
            }
            string Admin_content = Language.Content(conf.SMSTPL_Admin_ordercomment, user.Language);

            Admin_content = ReplaceSMSTag(Admin_content, user, conf);
            Admin_content = Admin_content.Replace("{$Content}", model.Content);
            Admin_content = Admin_content.Replace("{$OrderNO}", order.Code);
            if (IsAdminSms == 1)
            {
                Send(conf.SMS_reciveno, Admin_content);
            }
            if (IsSupplierSms == 1)
            {
                BaseConfig_Supplier config_supplier = ShopCache.GetBaseConfig_Supplier(order.Supplier_id);
                Send(config_supplier.SMS_reciveno, Admin_content);
            }
        }
예제 #11
0
파일: SMS.cs 프로젝트: zwkjgs/LebiShop
        /// <summary>
        /// 商品咨询
        /// </summary>
        /// <param name="user"></param>
        /// <param name="model"></param>
        public static void SendSMS_ask(Lebi_User user, Lebi_Comment model)
        {
            BaseConfig conf          = ShopCache.GetBaseConfig();
            int        IsAdminSms    = 0;
            int        IsSupplierSms = 0;

            if (conf.SMS_sendmode.Contains("SMSTPL_ask"))
            {
                IsAdminSms = 1;
            }
            Lebi_Product product = B_Lebi_Product.GetModel(model.Product_id);

            if (product == null)
            {
                product = new Lebi_Product();
            }
            if (product.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(product.Supplier_id);
                if (supplier.IsSupplierTransport == 0)  //商家发货
                {
                    if (ShopCache.GetBaseConfig_Supplier(product.Supplier_id).SMS_sendmode.Contains("SMSTPL_ask"))
                    {
                        IsSupplierSms = 1;
                    }
                }
            }
            if (IsAdminSms == 0 && IsSupplierSms == 0)
            {
                return;
            }
            if (user.Language == "")
            {
                user.Language = Language.Languages().FirstOrDefault().Code;
            }
            string list          = "" + Language.Tag("商品名称", user.Language) + ":" + Language.Content(product.Name, user.Language) + ";" + Language.Tag("内容", user.Language) + ":" + model.Content + ";";
            string Admin_content = Language.Content(conf.SMSTPL_Admin_ask, user.Language);

            Admin_content = ReplaceSMSTag(Admin_content, user, conf);
            Admin_content = Admin_content.Replace("{$Content}", list);
            if (IsAdminSms == 1)
            {
                Send(conf.SMS_reciveno, Admin_content);
            }
            if (IsSupplierSms == 1)
            {
                BaseConfig_Supplier config_supplier = ShopCache.GetBaseConfig_Supplier(product.Supplier_id);
                Send(config_supplier.SMS_reciveno, Admin_content);
            }
        }
예제 #12
0
 protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
 {
     if (CurrentUser.id == 0)
     {
         Response.Redirect(URL("P_Login", "" + HttpUtility.UrlEncode(RequestTool.GetRequestUrlNonDomain()) + "," + GetUrlToken(RequestTool.GetRequestUrlNonDomain()) + ""));
     }
     LoadTheme(themecode, siteid, languagecode, pcode);
     if (SYS.IsClosetuihuo == "1")
     {
         PageError();
     }
     CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_UserReturnApply'");
     path        = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_UserCenter", "") + "\"><span>" + Tag("会员中心") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_UserReturn", "" + id + "") + "\"><span>" + Tag("退货订单") + "</span></a><em>&raquo;</em><a href=\"" + URL("P_UserReturnApply", "") + "\"><span>" + Tag("退货申请") + "</span></a>";
     CurrentPage = B_Lebi_Theme_Page.GetModel("Code='P_UserReturnApply'");
     id          = Rint_Para("0");
     order       = B_Lebi_Order.GetModel("User_id = " + CurrentUser.id + " and id = " + id + "");
     if (order == null)
     {
         PageError();
     }
     if (order.User_id != CurrentUser.id)
     {
         PageError();
     }
     where          = "Order_id=" + order.id + "";
     order_products = B_Lebi_Order_Product.GetList(where, "id desc");
     if (order.Supplier_id > 0)
     {
         Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(order.Supplier_id);
         if (supplier != null)
         {
             shouhuoren     = supplier.RealName;
             shouhuodizhi   = supplier.Address;
             shouhuodianhua = supplier.Phone;
             shouhuoyoubian = supplier.Postalcode;
         }
     }
     else
     {
         Lebi_Express_Shipper shipper = B_Lebi_Express_Shipper.GetList("", "Sort desc", 1, 1).FirstOrDefault();
         if (shipper != null)
         {
             shouhuoren     = shipper.UserName;
             shouhuodizhi   = shipper.Address;
             shouhuodianhua = shipper.Tel;
             shouhuoyoubian = shipper.ZipCode;
         }
     }
 }
예제 #13
0
        /// <summary>
        ///  商家选择
        /// </summary>
        /// <param name="InputName"></param>
        /// <param name="ids"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static string SupplierCheckbox(string InputName, string ids, string lang = "CN")
        {
            List <Lebi_Supplier> models = B_Lebi_Supplier.GetList("Type_id_SupplierStatus = 442", "");
            string str = "";

            foreach (Lebi_Supplier model in models)
            {
                string sel = "";
                if (("," + ids + ",").IndexOf("," + model.id + ",") > -1)
                {
                    sel = "checked";
                }
                str += "<input type=\"checkbox\" name=\"" + InputName + "\" id=\"" + InputName + "" + model.id + "\" shop=\"true\" value=\"" + model.id + "\" " + sel + "><label for=\"" + InputName + "" + model.id + "\">" + Shop.Bussiness.Language.Content(model.Name, lang) + "&nbsp;</label>";
            }
            return(str);
        }
예제 #14
0
        /// <summary>
        /// 添加佣金记录
        /// </summary>
        /// <param name="money"></param>
        /// <param name="user"></param>
        /// <param name="order"></param>
        /// <param name="type"></param>
        /// <param name="status"></param>
        /// <param name="areaid"></param>
        /// <param name="productid"></param>
        /// <param name="productparentid"></param>
        private void AddMoney(decimal money, Lebi_User user, int type, int areaid, int productid, int productparentid, string productnumber = "")
        {
            if (money == 0)
            {
                SystemLog.Add("金额:" + money + ",会员:" + user.id + ",订单:" + Order.Code + "");
                return;
            }
            int IsSpread = 1;

            if (Order.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(Order.Supplier_id);
                if (supplier != null)
                {
                    IsSpread = supplier.IsSpread;
                }
            }
            if (IsSpread == 1) //判断是否开启推广佣金 by lebi.kingdge 2015-04-10
            {
                Lebi_Agent_Money model = new Lebi_Agent_Money();
                model.Area_id = areaid;
                model.Money   = money;
                model.Type_id_AgentMoneyType = type;
                if (Order.Type_id_OrderType == 212)//退货单
                {
                    model.Money = 0 - money;
                }
                model.Order_Code               = Order.Code;
                model.Order_id                 = Order.id;
                model.Product_id               = productid;
                model.Product_id_parent        = productparentid;
                model.Type_id_AgentMoneyStatus = 381;
                model.Product_Number           = productnumber;
                model.User_id       = user.id;
                model.User_UserName = user.UserName;
                model.Supplier_id   = Order.Supplier_id;
                model.DT_id         = user.DT_id;
                B_Lebi_Agent_Money.Add(model);
                UpdateUserMoney(user, model);
            }
        }
예제 #15
0
        /// <summary>
        ///  商家选择
        /// </summary>
        /// <param name="InputName"></param>
        /// <param name="ids"></param>
        /// <param name="lang"></param>
        /// <returns></returns>
        public static string SupplierCheckbox(string InputName, string ids, string lang = "CN")
        {
            List <Lebi_Supplier> models = B_Lebi_Supplier.GetList("Type_id_SupplierStatus = 442", "");
            string str = "";

            foreach (Lebi_Supplier model in models)
            {
                string sel = "";
                if (("," + ids + ",").IndexOf("," + model.id + ",") > -1)
                {
                    sel = "checked";
                }
                if (!string.IsNullOrEmpty(RequestTool.GetConfigKey("SystemAdmin").Trim()))
                {
                    str += "<label class=\"custom-control custom-checkbox m-r-20\"><input type=\"checkbox\" id=\"" + InputName + "" + model.id + "\" name=\"" + InputName + "\" value=\"" + model.id + "\" class=\"custom-control-input\" shop=\"true\" " + sel + "><span class=\"custom-control-label\">" + Shop.Bussiness.Language.Content(model.Name, lang) + "</span></label>";
                }
                else
                {
                    str += "<label><input type=\"checkbox\" name=\"" + InputName + "\" id=\"" + InputName + "" + model.id + "\" shop=\"true\" value=\"" + model.id + "\" " + sel + ">" + Shop.Bussiness.Language.Content(model.Name, lang) + "&nbsp;</label>";
                }
            }
            return(str);
        }
예제 #16
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);
        }
예제 #17
0
        /// <summary>
        /// 推广佣金
        /// </summary>
        private void AgentMoney()
        {
            //SystemLog.Add("计算佣金orderid" + Order.id + "userid" + OrderUser.User_id_parent);
            SystemLog.Add("推广佣金-开始");
            if (OrderUser.User_id_parent == 0)
            {
                return;
            }
            //string Money_Product_Profit_ = Common.GetValue("select sum((Price - Price_Cost)*(Count-Count_Return)) from Lebi_Order_Product where Order_id = " + Order.id + "");
            string  Money_Product_Profit_ = Common.GetValue("select sum((Price - Price_Cost)*Count) from Lebi_Order_Product where Order_id = " + Order.id + "");
            decimal Money_Product_Profit  = 0;

            decimal.TryParse(Money_Product_Profit_, out Money_Product_Profit);
            if (Order.Type_id_OrderType == 212)
            {
                Money_Product_Profit = 0 - Money_Product_Profit;//zhangshijia  退货时产生负数佣金
            }
            //处理一级代理
            Lebi_User user1 = B_Lebi_User.GetModel(OrderUser.User_id_parent);

            if (user1 == null)
            {
                return;
            }
            decimal       yongjin1        = 0; //1级佣金比例
            decimal       yongjin2        = 0; //2级佣金比例
            decimal       yongjin3        = 0; //3级佣金比例
            Lebi_DT_Agent dt_agent        = B_Lebi_DT_Agent.GetModel(0);
            Lebi_User     DT_User         = new Lebi_User();
            Lebi_DT       dt              = new Lebi_DT();
            int           CommissionLevel = 3;

            if (Order.Supplier_id > 0)
            {
                Lebi_Supplier supplier = B_Lebi_Supplier.GetModel(Order.Supplier_id);
                if (supplier.IsSpread == 0)  //商家未开启
                {
                    SystemLog.Add("推广佣金-商家未开启");
                    return;
                }
            }
            if (Order.DT_id > 0)
            {
                Money_Product_Profit = Order.DT_Money;  //如果是分销商,利润为分销商佣金
                dt_agent             = B_Lebi_DT_Agent.GetModel("DT_id=" + Order.DT_id + "");
                dt = B_Lebi_DT.GetModel(Order.DT_id);
                if (dt != null)
                {
                    CommissionLevel = dt.CommissionLevel;
                }
                DT_User = B_Lebi_User.GetModel(dt.User_id);
                if (dt_agent.IsUsedAgent == 0)  //分销商未开启
                {
                    SystemLog.Add("推广佣金-分销商未开启");
                    return;
                }
                //  Money_Product_Profit = Order.DT_Money; ///zhangshijia注释,未找到DT_Money来源
                //List<Lebi_Order_Product> order_pro = B_Lebi_Order_Product.GetModel(" Order_id = " + Order.id + "");
                //foreach (Lebi_Order_Product op in order_pro)
                //{

                //}
            }
            yongjin1 = GetAngentCommission1(dt_agent, user1);
            decimal money = Money_Product_Profit * yongjin1 / 100;

            if (Order.DT_id > 0)
            {
                if (DT_User.Money < money)
                {
                    SystemLog.Add("推广佣金-分销商[" + DT_User.NickName + "-" + DT_User.id + "]金额不足,一级佣金生成失败");
                    return;
                }
            }
            AddMoney(money, user1, 391, 0, 0, 0);
            //SystemLog.Add("计算佣金" + user1.UserName + money.ToString());
            if (Order.DT_id > 0)
            {
                AddMoney(0 - money, DT_User, 391, 0, 0, 0);
            }
            //处理2级代理
            Lebi_User user2 = B_Lebi_User.GetModel(user1.User_id_parent);

            if (user2 == null)
            {
                user2 = new Lebi_User();
            }
            else
            {
                if (CommissionLevel >= 2)
                {
                    yongjin2 = GetAngentCommission2(dt_agent, user2);
                    money    = Money_Product_Profit * yongjin2 / 100;
                    if (Order.DT_id > 0)
                    {
                        if (DT_User.Money < money)
                        {
                            SystemLog.Add("推广佣金-分销商金额不足,二级佣金生成失败");
                            return;
                        }
                    }
                    AddMoney(money, user2, 391, 0, 0, 0);
                    if (Order.DT_id > 0)
                    {
                        AddMoney(0 - money, DT_User, 391, 0, 0, 0);
                    }
                }
            }
            //处理3级代理
            if (CommissionLevel == 2)
            {
                return;
            }
            Lebi_User user3 = B_Lebi_User.GetModel(user2.User_id_parent);

            if (user3 != null)
            {
                yongjin3 = GetAngentCommission3(dt_agent, user3);
                money    = Money_Product_Profit * yongjin3 / 100;
                if (Order.DT_id > 0)
                {
                    if (DT_User.Money < money)
                    {
                        SystemLog.Add("推广佣金-分销商金额不足,三级佣金生成失败");
                        return;
                    }
                }
                AddMoney(money, user3, 391, 0, 0, 0);
                if (Order.DT_id > 0)
                {
                    AddMoney(0 - money, DT_User, 391, 0, 0, 0);
                }
            }
            ////处理条件佣金,佣金历史达到X时,可获得下线,下下线Y%的佣金
            //decimal Angent_Commission_require = 0;
            //decimal.TryParse(bc.Angent_Commission_require, out Angent_Commission_require);
            //decimal yongjin3 = 0;//条件佣金比例
            //decimal.TryParse(bc.Angent_Commission, out yongjin3);
            //money = Money_Product_Profit * yongjin3 / 100;
            //if (user1.AgentMoney_history > Angent_Commission_require)
            //    AddMoney(money, user1, 395, 0, 0, 0);
            //if (user2.AgentMoney_history > Angent_Commission_require)
            //    AddMoney(money, user2, 395, 0, 0, 0);
        }
예제 #18
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);
        }
예제 #19
0
        public decimal Money_Tax              = 0;        //税金
        /// <summary>
        /// sid=0,取得全部供应商的商品
        /// </summary>
        /// <param name="type"></param>
        public Basket(int sid)
        {
            Products = Basket.UserProduct(CurrentUser, 142);

            PromotionTypes = new List <Lebi_Promotion_Type>();
            FreeProducts   = new List <Lebi_User_Product>();
            Shops          = new List <BasketShop>();
            List <BasketShop> tempShops   = new List <BasketShop>();
            List <string>     brandstring = new List <string>();

            foreach (Lebi_User_Product pro in Products)
            {
                try
                {
                    Lebi_Product product = B_Lebi_Product.GetModel(pro.Product_id);
                    if (product == null)
                    {
                        continue;
                    }
                    bool ishavebrand = false;
                    for (int i = 0; i < brandstring.Count(); i++)
                    {
                        if (brandstring[i].Contains(product.Brand_id.ToString() + ":"))
                        {
                            brandstring[i] += "," + pro.Product_id;
                            ishavebrand     = true;
                            break;
                        }
                    }
                    if (!ishavebrand)
                    {
                        brandstring.Add(product.Brand_id.ToString() + ":" + pro.Product_id);
                    }
                    if (product.Type_id_ProductType == 324)        //预定商品
                    {
                        pro.Product_Price = product.Price_reserve; //预定金额
                    }
                    else
                    {
                        pro.Product_Price = EX_Product.ProductPrice(product, CurrentUserLevel, CurrentUser, pro.count);//单价
                    }
                    //<-{计算品牌不含税商品总额  by lebi.kingdge 2015-08-22
                    Lebi_Brand brand = B_Lebi_Brand.GetModel(product.Brand_id);
                    if (brand != null)
                    {
                        if (brand.IsVAT == 0)
                        {
                            Money_Product_NOVAT += pro.Product_Price * pro.count;
                        }
                    }
                    //}->
                    Lebi_Supplier shop = B_Lebi_Supplier.GetModel(product.Supplier_id);
                    if (shop == null)
                    {
                        product.Supplier_id = 0;    //容错,商品供应商删除时,商城发货
                        shop = new Lebi_Supplier(); //自营商品
                    }
                    else
                    {
                        if (shop.IsSupplierTransport == 0)//商城代发货的情况
                        {
                            product.Supplier_id = 0;
                            shop = new Lebi_Supplier();//自营商品
                        }
                    }

                    BasketShop bshop = (from m in tempShops
                                        where m.Shop.id == product.Supplier_id
                                        select m).ToList().FirstOrDefault();
                    if (bshop == null)
                    {
                        if (product.Supplier_id == 0)
                        {
                            //shop = new Lebi_Supplier();//自营商品
                            bshop          = new BasketShop();
                            bshop.Shop     = shop;
                            bshop.Products = new List <Lebi_User_Product>();
                            tempShops.Add(bshop);
                        }
                        else
                        {
                            bshop          = new BasketShop();
                            bshop.Shop     = shop;
                            bshop.Products = new List <Lebi_User_Product>();
                            tempShops.Add(bshop);
                        }
                    }
                    (from m in tempShops
                     where m.Shop.id == product.Supplier_id
                     select m).ToList().FirstOrDefault().Products.Add(pro);
                }
                catch (System.NullReferenceException)
                {
                }
            }
            tempShops = tempShops.OrderBy(a => a.Shop.id).ToList();
            if (SYS.IsSupplierCash == "1")
            {
                if (sid == 0)
                {
                    sid = RequestTool.RequestInt("sid");
                }
                if (sid == 0)
                {
                    string tempid = CookieTool.GetCookieString("supplier");
                    int.TryParse(tempid, out sid);
                }
                cashsupplierid = sid;
                bool flag = false;
                foreach (BasketShop shop in tempShops)
                {
                    if (shop.Shop.IsCash == 1)
                    {
                        IsMutiCash = true;
                    }
                    if (shop.Shop.id == cashsupplierid)
                    {
                        flag = true;
                    }
                }
                if (!flag)
                {
                    try
                    {
                        cashsupplierid = tempShops.FirstOrDefault().Shop.id;
                    }
                    catch
                    {
                        cashsupplierid = 0;
                    }
                }

                if (sid > 0)
                {
                    //只保留当前结算供应商的数据
                    List <int> ids = new List <int>();
                    for (int i = 0; i < tempShops.Count; i++)
                    {
                        if (tempShops[i].Shop.id == cashsupplierid)
                        {
                            Shops.Add(tempShops[i]);
                        }
                    }
                }
                else
                {
                    Shops = tempShops;
                }
            }
            else
            {
                Shops = tempShops;
            }
            Products = new List <Lebi_User_Product>();
            for (int i = 0; i < Shops.Count; i++)
            {
                Shops[i]             = SetMoneyAndPoint(CurrentUser, CurrentUserLevel, Shops[i]);
                Weight              += Shops[i].Weight;
                Volume              += Shops[i].Volume;
                Money_Product       += Shops[i].Money_Product;
                Money_Product_begin += Shops[i].Money_Product_begin;
                Money_Property      += Shops[i].Money_Property;
                Money_Cut           += Shops[i].Money_Cut;
                Money_Give          += Shops[i].Money_Give;
                Money_Market        += Shops[i].Money_Market;
                Count         += Shops[i].Count;
                Point         += Shops[i].Point;
                Point_Buy     += Shops[i].Point_Buy;
                Point_Product += Shops[i].Point_Product;
                Point_Free    += Shops[i].Point_Free;
                FreeProducts.AddRange(Shops[i].FreeProducts);
                PromotionTypes.AddRange(Shops[i].PromotionTypes);
                Products.AddRange(Shops[i].Products);
            }
            //<-{退税计算  by lebi.kingdge 2015-08-22
            decimal Refund_MinMoney = 0;
            decimal Refund_VAT      = 0;

            decimal.TryParse(SYS.Refund_MinMoney, out Refund_MinMoney);
            decimal.TryParse(SYS.Refund_VAT, out Refund_VAT);
            if (Refund_MinMoney > 0)
            {
                if ((Money_Product - Money_Product_NOVAT) > Refund_MinMoney)
                {
                    Money_Refund_VAT = (Money_Product - Money_Product_NOVAT) * Refund_VAT / 100;
                    Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, Money_Refund_VAT, Money_Product - Money_Product_NOVAT);
                    Money_Refund     = Money_Refund_VAT - Money_Refund_Fee;
                }
                else
                {
                    Money_Refund     = 0;
                    Money_Refund_VAT = 0;
                    Money_Refund_Fee = 0;
                }
                //循环品牌计算各品牌退税
                if (Refund_VAT > 0)
                {
                    foreach (string bran in brandstring)
                    {
                        string[]   arr   = bran.Split(':');
                        Lebi_Brand brand = B_Lebi_Brand.GetModel("id=" + arr[0] + " and IsVAT = 1");
                        if (brand != null)
                        {
                            decimal Brand_Money_Product            = 0;
                            decimal OtherSite_Money_Refund_VAT     = 0;
                            decimal OtherSite_Money_Refund_Fee     = 0;
                            List <Lebi_User_Product> user_products = (from m in Products where ("," + arr[1] + ",").Contains("," + m.Product_id + ",") select m).ToList();
                            foreach (Lebi_User_Product user_product in user_products)
                            {
                                Brand_Money_Product += user_product.Product_Price * user_product.count;
                            }
                            if (Brand_Money_Product >= Refund_MinMoney)
                            {
                                OtherSite_Money_Refund_VAT = Brand_Money_Product * Refund_VAT / 100;
                                OtherSite_Money_Refund_Fee = Refund_Fee(SYS.Refund_StepR, OtherSite_Money_Refund_VAT, Brand_Money_Product);
                                OtherSite_Money_Refund    += OtherSite_Money_Refund_VAT - OtherSite_Money_Refund_Fee;
                            }
                        }
                    }
                }
            }
            //}->
            //<-{税金计算  by lebi.kingdge 2017-02-17
            decimal TaxRate = 0;

            decimal.TryParse(SYS.TaxRate, out TaxRate);
            if (TaxRate > 0)
            {
                Money_Tax = Money_Product * TaxRate / 100;
            }
            //}->
        }
예제 #20
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);
        }
예제 #21
0
        protected override void LoadPage(string themecode, int siteid, string languagecode, string pcode)
        {
            pcode = "P_ShopProducts";
            LoadTheme(themecode, siteid, languagecode, pcode);
            id        = Rint_Para("0");    //商家ID
            cid       = Rint_Para("1");    //商品分类
            list      = Rstring_Para("2"); //列表或网格
            sort      = Rstring_Para("3"); //排序
            key       = Rstring_Para("5"); //关键词
            pageindex = RequestTool.RequestInt("page", 1);
            parentcid = 0;
            supplier  = B_Lebi_Supplier.GetModel("id = " + id);
            if (supplier == null)
            {
                Response.Redirect(URL("P_404", ""));
                Response.End();
            }
            int Supplier_id = supplier.User_id;

            if (cid != 0)
            {
                producttype = B_Lebi_Supplier_ProductType.GetModel(cid);
                if (producttype.parentid > 0)
                {
                    parentcid = producttype.parentid;
                }
                else
                {
                    parentcid = cid;
                }
            }
            path = "<a href=\"" + URL("P_Index", "") + "\" class=\"home\" title=\"" + Tag("首页") + "\"><span>" + Tag("首页") + "</span></a><em class=\"home\">&raquo;</em><a href=\"" + URL("P_ShopIndex", id) + "\"><span>" + Lang(supplier.Name) + "</span></a>";
            if (key != "")
            {
                path += " > " + key;
            }

            where = "Type_id_ProductStatus = 101 and Product_id=0 and Supplier_id = " + id + "";
            if (cid > 0)
            {
                if (DataBase.DBType == "sqlserver")
                {
                    where += " and Charindex('," + cid + ",',','+Supplier_ProductType_ids+',')>0";
                }
                if (DataBase.DBType == "access")
                {
                    where += " and Instr(','+Supplier_ProductType_ids+',','," + cid + ",')>0";
                }
            }
            if (key != "")
            {
                where += " and Name like '%" + key + "%'";
            }
            if (sort == "")
            {
                sort = "1";
            }
            if (sort == "1")
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            else if (sort == "1a")
            {
                order = " Count_Sales_Show asc"; ordertmp = "";
            }
            else if (sort == "2")
            {
                order = " Price desc"; ordertmp = "a";
            }
            else if (sort == "2a")
            {
                order = " Price asc"; ordertmp = "";
            }
            else if (sort == "3")
            {
                order = " Count_Comment desc"; ordertmp = "a";
            }
            else if (sort == "3a")
            {
                order = " Count_Comment asc"; ordertmp = "";
            }
            else if (sort == "4")
            {
                order = " Time_Add desc"; ordertmp = "a";
            }
            else if (sort == "4a")
            {
                order = " Time_Add asc"; ordertmp = "";
            }
            else if (sort == "5")
            {
                order = " Count_Views_Show desc"; ordertmp = "a";
            }
            else if (sort == "5a")
            {
                order = " Count_Views_Show asc"; ordertmp = "";
            }
            else
            {
                order = " Count_Sales_Show desc"; ordertmp = "a";
            }
            products    = B_Lebi_Product.GetList(where, order, PageSize, pageindex);
            recordCount = B_Lebi_Product.Counts(where);
            //id={0}&pid={1}&cid={2}&list={3}&sort={4}&tid={5}&page={6}
            string url = URL("P_ShopProducts", id + "," + cid + "," + list + "," + sort + ",{0}," + key + "");

            HeadPage = Shop.Bussiness.Pager.GetPaginationStringForWebSimple(url, pageindex, PageSize, recordCount, CurrentLanguage);
            FootPage = Shop.Bussiness.Pager.GetPaginationStringForWeb(url, pageindex, PageSize, recordCount, CurrentLanguage);
            string supplierservicepannelcon = supplier.ServicePanel;

            supplierservicepannel = B_ServicePanel.GetModel(supplierservicepannelcon);

            headcontent = supplier.head;
            longbar     = supplier.longbar;
            shortbar    = supplier.shortbar;
        }
예제 #22
0
        /// <summary>
        /// 返回分组下会员数量
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int UserCount(int id)
        {
            int sum = B_Lebi_Supplier.Counts("Supplier_Group_id in (select g.id from Lebi_Supplier_Group as g where g.type='supplier' and g.id = " + id + ")");

            return(Convert.ToInt32(sum));
        }
예제 #23
0
        /// <summary>
        /// 返回当前账号的可管理超级用户
        /// </summary>
        /// <returns></returns>
        public List <Lebi_Supplier> GetSuppliers()
        {
            List <Lebi_Supplier> models = B_Lebi_Supplier.GetList("id in (select Supplier_id from [Lebi_Supplier_User] where User_id=" + CurrentSupplierUser.User_id + " and Type_id_SupplierUserStatus=9011) and id!=" + CurrentSupplier.id + "", "");

            return(models);
        }