public static bool AddDistributors(DistributorsInfo distributors)
 {
     MemberInfo currentMember = MemberProcessor.GetCurrentMember();
     distributors.DistributorGradeId = DistributorGrade.OneDistributor;
     distributors.ParentUserId = new int?(currentMember.UserId);
     distributors.UserId = currentMember.UserId;
     DistributorsInfo currentDistributors = GetCurrentDistributors();
     if (currentDistributors != null)
     {
         if (!string.IsNullOrEmpty(currentDistributors.ReferralPath))
         {
             distributors.ReferralPath = currentDistributors.ReferralPath + "|" + currentDistributors.UserId.ToString();
         }
         else
         {
             distributors.ReferralPath = currentDistributors.UserId.ToString();
         }
         distributors.ParentUserId = new int?(currentDistributors.UserId);
         if (currentDistributors.DistributorGradeId == DistributorGrade.OneDistributor)
         {
             distributors.DistributorGradeId = DistributorGrade.TowDistributor;
         }
         else if (currentDistributors.DistributorGradeId == DistributorGrade.TowDistributor)
         {
             distributors.DistributorGradeId = DistributorGrade.ThreeDistributor;
         }
         else
         {
             distributors.DistributorGradeId = DistributorGrade.ThreeDistributor;
             distributors.ReferralPath = currentDistributors.ReferralPath;
         }
     }
     return new DistributorsDao().CreateDistributor(distributors);
 }
Beispiel #2
0
 public static IList<string> BatchCreateMembers(IList<string> distributornames, int referruserId, string createtype = "1")
 {
     string str = string.Empty;
     string referralPath = string.Empty;
     IList<string> list = new List<string>();
     if (referruserId > 0)
     {
         referralPath = new DistributorsDao().GetDistributorInfo(referruserId).ReferralPath;
         if (string.IsNullOrEmpty(referralPath))
         {
             referralPath = referruserId.ToString();
         }
         else if (referralPath.Contains("|"))
         {
             referralPath = referralPath.Split(new char[] { '|' })[1];
         }
         else
         {
             referralPath = referralPath + "|" + referruserId.ToString();
         }
     }
     foreach (string str3 in distributornames)
     {
         MemberInfo member = new MemberInfo();
         string generateId = Globals.GetGenerateId();
         member.GradeId = new MemberGradeDao().GetDefaultMemberGrade();
         member.UserName = str3;
         member.CreateDate = DateTime.Now;
         member.SessionId = generateId;
         member.SessionEndTime = DateTime.Now.AddYears(10);
         member.Password = HiCryptographer.Md5Encrypt("888888");
         if ((new MemberDao().GetusernameMember(str3) == null) && new MemberDao().CreateMember(member))
         {
             DistributorsInfo distributor = new DistributorsInfo {
                 UserId = new MemberDao().GetusernameMember(str3).UserId,
                 RequestAccount = str3,
                 StoreName = str3,
                 StoreDescription = str3,
                 BackImage = "/Storage/data/DistributorBackgroundPic/default.jpg",
                 Logo = "/Utility/pics/headLogo.jpg"
             };
             str = distributor.UserId.ToString();
             distributor.ReferralPath = referralPath;
             distributor.DistributorGradeId = (referralPath.Split(new char[] { '|' }).Length == 1) ? DistributorGrade.TowDistributor : DistributorGrade.ThreeDistributor;
             distributor.ParentUserId = new int?(Convert.ToInt32((referralPath.Split(new char[] { '|' }).Length == 1) ? referralPath : referralPath.Split(new char[] { '|' })[1].ToString()));
             if (new DistributorsDao().CreateDistributor(distributor) && (createtype == "1"))
             {
                 list.Add(str3);
             }
         }
         else if (createtype == "2")
         {
             list.Add(str3);
         }
     }
     return list;
 }
Beispiel #3
0
 protected override void AttachChildControls()
 {
     this.rptProducts = (VshopTemplatedRepeater) this.FindControl("rptProducts");
     this.img = (HtmlImage) this.FindControl("imgDefaultBg");
     this.pager = (Pager) this.FindControl("pager");
     this.litstorename = (Literal) this.FindControl("litstorename");
     this.litdescription = (Literal) this.FindControl("litdescription");
     this.imgback = (HiImage) this.FindControl("imgback");
     this.imglogo = (HiImage) this.FindControl("imglogo");
     this.Page.Session["stylestatus"] = "3";
     SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
     PageTitle.AddSiteNameTitle(masterSettings.SiteName);
     this.litstorename.Text = masterSettings.SiteName;
     this.litdescription.Text = masterSettings.ShopIntroduction;
     if (base.referralId <= 0)
     {
         HttpCookie cookie = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
         if (!((cookie == null) || string.IsNullOrEmpty(cookie.Value)))
         {
             base.referralId = int.Parse(cookie.Value);
         }
     }
     DistributorsInfo userIdDistributors = new DistributorsInfo();
     userIdDistributors = DistributorsBrower.GetUserIdDistributors(base.referralId);
     if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
     {
         PageTitle.AddSiteNameTitle(userIdDistributors.StoreName);
         this.litdescription.Text = userIdDistributors.StoreDescription;
         this.litstorename.Text = userIdDistributors.StoreName;
         if (userIdDistributors.Logo != "")
         {
             this.imglogo.ImageUrl = userIdDistributors.Logo;
         }
         this.imgback.ImageUrl = userIdDistributors.BackImage;
     }
     if (this.rptProducts != null)
     {
         ProductQuery query = new ProductQuery {
             PageSize = this.pager.PageSize,
             PageIndex = this.pager.PageIndex
         };
         DbQueryResult homeProduct = ProductBrowser.GetHomeProduct(MemberProcessor.GetCurrentMember(), query);
         this.rptProducts.DataSource = homeProduct.Data;
         this.rptProducts.DataBind();
         this.pager.TotalRecords = homeProduct.TotalRecords;
         if (this.pager.TotalRecords <= this.pager.PageSize)
         {
             this.pager.Visible = false;
         }
     }
     if (this.img != null)
     {
         this.img.Src = new VTemplateHelper().GetDefaultBg();
     }
 }
Beispiel #4
0
 public void AddDistributor(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     StringBuilder sb = new StringBuilder();
     if (this.CheckRequestDistributors(context, sb))
     {
         DistributorsInfo distributors = new DistributorsInfo {
             RequestAccount = context.Request["acctount"].Trim(),
             StoreName = context.Request["stroename"].Trim(),
             StoreDescription = context.Request["descriptions"].Trim(),
             BackImage = context.Request["backimg"].Trim()
         };
         HttpPostedFile file = context.Request.Files["logo"];
         distributors.Logo = "";
         if ((file != null) && !string.IsNullOrEmpty(file.FileName))
         {
             distributors.Logo = this.UploadFileImages(context, file);
         }
         if (DistributorsBrower.AddDistributors(distributors))
         {
             if (HttpContext.Current.Request.Cookies["Vshop-Member"] != null)
             {
                 string name = "Vshop-ReferralId";
                 HttpContext.Current.Response.Cookies[name].Expires = DateTime.Now.AddDays(-1.0);
                 HttpCookie cookie = new HttpCookie(name) {
                     Value = Globals.GetCurrentMemberUserId().ToString(),
                     Expires = DateTime.Now.AddYears(10)
                 };
                 HttpContext.Current.Response.Cookies.Add(cookie);
             }
             context.Response.Write("OK");
             context.Response.End();
         }
         else
         {
             context.Response.Write("添加失败");
             context.Response.End();
         }
     }
     else
     {
         context.Response.Write(sb.ToString() ?? "");
         context.Response.End();
     }
 }
Beispiel #5
0
 public bool CreateDistributor(DistributorsInfo distributor)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO aspnet_Distributors(UserId,StoreName,Logo,BackImage,RequestAccount,GradeId,ReferralUserId,ReferralPath, ReferralOrders,ReferralBlance, ReferralRequestBalance,ReferralStatus,StoreDescription) VALUES(@UserId,@StoreName,@Logo,@BackImage,@RequestAccount,@GradeId,@ReferralUserId,@ReferralPath,@ReferralOrders,@ReferralBlance, @ReferralRequestBalance, @ReferralStatus,@StoreDescription)");
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, distributor.UserId);
     this.database.AddInParameter(sqlStringCommand, "StoreName", DbType.String, distributor.StoreName);
     this.database.AddInParameter(sqlStringCommand, "Logo", DbType.String, distributor.Logo);
     this.database.AddInParameter(sqlStringCommand, "BackImage", DbType.String, distributor.BackImage);
     this.database.AddInParameter(sqlStringCommand, "RequestAccount", DbType.String, distributor.RequestAccount);
     this.database.AddInParameter(sqlStringCommand, "GradeId", DbType.Int64, (int) distributor.DistributorGradeId);
     this.database.AddInParameter(sqlStringCommand, "ReferralUserId", DbType.Int64, distributor.ParentUserId.Value);
     this.database.AddInParameter(sqlStringCommand, "ReferralPath", DbType.String, distributor.ReferralPath);
     this.database.AddInParameter(sqlStringCommand, "ReferralOrders", DbType.Int64, distributor.ReferralOrders);
     this.database.AddInParameter(sqlStringCommand, "ReferralBlance", DbType.Decimal, distributor.ReferralBlance);
     this.database.AddInParameter(sqlStringCommand, "ReferralRequestBalance", DbType.Decimal, distributor.ReferralRequestBalance);
     this.database.AddInParameter(sqlStringCommand, "ReferralStatus", DbType.Int64, distributor.ReferralStatus);
     this.database.AddInParameter(sqlStringCommand, "StoreDescription", DbType.String, distributor.StoreDescription);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }
Beispiel #6
0
 private void FinishOrder(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     OrderInfo orderInfo = ShoppingProcessor.GetOrderInfo(Convert.ToString(context.Request["orderId"]));
     if ((orderInfo != null) && MemberProcessor.ConfirmOrderFinish(orderInfo))
     {
         DistributorsBrower.UpdateCalculationCommission(orderInfo);
         SiteSettings masterSettings = SettingsManager.GetMasterSettings(false);
         MemberProcessor.RemoveUserCache(orderInfo.UserId);
         MemberInfo currentMember = MemberProcessor.GetCurrentMember();
         DistributorsInfo userIdDistributors = new DistributorsInfo();
         userIdDistributors = DistributorsBrower.GetUserIdDistributors(orderInfo.UserId);
         int num = 0;
         if ((masterSettings.IsRequestDistributor && ((userIdDistributors == null) || (userIdDistributors.UserId == 0))) && (!string.IsNullOrEmpty(masterSettings.FinishedOrderMoney.ToString()) && (currentMember.Expenditure >= masterSettings.FinishedOrderMoney)))
         {
             num = 1;
         }
         context.Response.Write("{\"success\":true,\"isapply\":" + num + "}");
     }
     else
     {
         context.Response.Write("{\"success\":false, \"msg\":\"订单当前状态不允许完成\"}");
     }
 }
Beispiel #7
0
 public void UserLogin(HttpContext context)
 {
     context.Response.ContentType = "application/json";
     MemberInfo usernameMember = new MemberInfo();
     string username = context.Request["userName"];
     string sourceData = context.Request["password"];
     usernameMember = MemberProcessor.GetusernameMember(username);
     StringBuilder builder = new StringBuilder();
     builder.Append("{");
     if (usernameMember == null)
     {
         builder.Append("\"Status\":\"-1\"");
         builder.Append("}");
         context.Response.Write(builder.ToString());
     }
     else
     {
         if (usernameMember.Password == HiCryptographer.Md5Encrypt(sourceData))
         {
             DistributorsInfo userIdDistributors = new DistributorsInfo();
             userIdDistributors = DistributorsBrower.GetUserIdDistributors(usernameMember.UserId);
             if ((userIdDistributors != null) && (userIdDistributors.UserId > 0))
             {
                 HttpContext.Current.Response.Cookies["Vshop-ReferralId"].Expires = DateTime.Now.AddDays(-1.0);
                 HttpCookie cookie = new HttpCookie("Vshop-ReferralId") {
                     Value = Globals.UrlEncode(userIdDistributors.UserId.ToString()),
                     Expires = DateTime.Now.AddYears(1)
                 };
                 HttpContext.Current.Response.Cookies.Add(cookie);
             }
             if (HttpContext.Current.Request.Cookies["Vshop-Member"] != null)
             {
                 HttpContext.Current.Response.Cookies["Vshop-Member"].Expires = DateTime.Now.AddDays(-1.0);
                 HttpCookie cookie3 = new HttpCookie("Vshop-Member") {
                     Value = usernameMember.UserId.ToString(),
                     Expires = DateTime.Now.AddYears(10)
                 };
                 HttpContext.Current.Response.Cookies.Add(cookie3);
             }
             else
             {
                 HttpCookie cookie4 = new HttpCookie("Vshop-Member") {
                     Value = Globals.UrlEncode(usernameMember.UserId.ToString()),
                     Expires = DateTime.Now.AddYears(1)
                 };
                 HttpContext.Current.Response.Cookies.Add(cookie4);
             }
             context.Session["userid"] = usernameMember.UserId.ToString();
             builder.Append("\"Status\":\"OK\"");
         }
         else
         {
             builder.Append("\"Status\":\"-2\"");
         }
         builder.Append("}");
         context.Response.Write(builder.ToString());
     }
 }
Beispiel #8
0
 public static DistributorsInfo PopulateDistributorInfo(IDataReader reader)
 {
     if (null == reader)
     {
         return null;
     }
     DistributorsInfo info = new DistributorsInfo {
         UserId = (int) reader["UserId"],
         StoreName = (string) reader["StoreName"]
     };
     if (reader["RequestAccount"] != DBNull.Value)
     {
         info.RequestAccount = (string) reader["RequestAccount"];
     }
     if (reader["Logo"] != DBNull.Value)
     {
         info.Logo = (string) reader["Logo"];
     }
     info.BackImage = (string) reader["BackImage"];
     if (reader["AccountTime"] != DBNull.Value)
     {
         info.AccountTime = new DateTime?((DateTime) reader["AccountTime"]);
     }
     if (reader["GradeId"] != DBNull.Value)
     {
         info.DistributorGradeId = (DistributorGrade) Enum.Parse(typeof(DistributorGrade), reader["GradeId"].ToString(), true);
     }
     info.OrdersTotal = (decimal) reader["OrdersTotal"];
     if (reader["ReferralPath"] != DBNull.Value)
     {
         info.ReferralPath = (string) reader["ReferralPath"];
     }
     info.ReferralUserId = (int) reader["ReferralUserId"];
     info.ReferralOrders = (int) reader["ReferralOrders"];
     info.ReferralBlance = (decimal) reader["ReferralBlance"];
     info.ReferralRequestBalance = (decimal) reader["ReferralRequestBalance"];
     info.CreateTime = (DateTime) reader["CreateTime"];
     info.ReferralStatus = (int) reader["ReferralStatus"];
     if (reader["StoreDescription"] != DBNull.Value)
     {
         info.StoreDescription = (string) reader["StoreDescription"];
     }
     return info;
 }
 public static bool UpdateDistributor(DistributorsInfo query)
 {
     return new DistributorsDao().UpdateDistributor(query);
 }
Beispiel #10
0
        public int rangeId = 1;//范围id 1:pc端,0:微信端,


        protected override void AttachChildControls()
        {
            int.TryParse(this.Page.Request.QueryString["categoryId"], out this.categoryId);
            this.keyWord            = this.Page.Request.QueryString["keyWord"];
            this.imglogo            = (HiImage)this.FindControl("imglogo");
            this.litTitle           = (Literal)this.FindControl("litTitle");
            this.litDes             = (Literal)this.FindControl("litDes");
            this.litMemberGradeInfo = (Literal)this.FindControl("litMemberGradeInfo");
            this.imgUrl             = (HiImage)this.FindControl("imgUrl");
            this.litContent         = (Literal)this.FindControl("litContent");
            this.rptProducts        = (VshopTemplatedRepeater)this.FindControl("rptProducts");
            this.rptCategories      = (VshopTemplatedRepeater)this.FindControl("rptCategories");
            this.litCategoryId      = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("litCategoryId");
            this.litCategoryId.SetWhenIsNotNull(this.categoryId.ToString());
            this.Page.Session["stylestatus"] = "4";

            this.storeId = !string.IsNullOrEmpty(this.Page.Request.QueryString["storeid"]) ? int.Parse(this.Page.Request.QueryString["storeid"]) : 0;

            MemberInfo currentMember = MemberProcessor.GetCurrentMember();

            if (currentMember == null)
            {
                this.Page.Response.Redirect("UserLogin.aspx");
            }
            HttpCookie cookie         = HttpContext.Current.Request.Cookies["Vshop-ReferralId"];
            int        ReferralUserId = 0;

            if ((cookie != null) && !string.IsNullOrEmpty(cookie.Value))
            {
                ReferralUserId = Convert.ToInt32(cookie.Value);
            }

            Hidistro.Entities.Members.DistributorsInfo userIdDistributors = DistributorsBrower.GetUserIdDistributors(ReferralUserId);
            Hidistro.Core.Entities.SiteSettings        masterSettings     = Hidistro.Core.SettingsManager.GetMasterSettings(false);
            //店铺logo
            if (userIdDistributors != null && !string.IsNullOrEmpty(userIdDistributors.Logo))
            {
                this.imglogo.ImageUrl = userIdDistributors.Logo;
            }
            else
            {
                if (!string.IsNullOrEmpty(masterSettings.DistributorLogoPic))
                {
                    this.imglogo.ImageUrl = masterSettings.DistributorLogoPic.Split(new char[] { '|' })[0];
                }
            }
            //店铺名和店铺描述
            if (ReferralUserId == 0)//如果没有上级店铺
            {
                this.litTitle.Text = masterSettings.SiteName;
                this.litDes.Text   = masterSettings.ShopIntroduction;
            }
            else
            {
                this.litTitle.Text = userIdDistributors.StoreName;
                this.litDes.Text   = userIdDistributors.StoreDescription;
            }

            //会员等级优惠信息
            if (this.litMemberGradeInfo != null)
            {
                MemberGradeInfo gradeInfo = MemberHelper.GetMemberGrade(currentMember.GradeId);//会员等级信息
                string          gradeName = gradeInfo.Name;
                string          currentMemberGradeName = (currentMember == null) ? "" :
                                                         string.Format("<span style='font-size:12px; background:#F90; color:#FFF; border-radius:3px; padding:3px 5px; margin-right:5px;'>{0}</span>"
                                                                       , gradeName);
                if (gradeInfo.Discount < 100)
                {
                    litMemberGradeInfo.Text = string.Format("{0}以下商品已获得{1}%折扣!", currentMemberGradeName, 100 - gradeInfo.Discount);
                }
                else
                {
                    litMemberGradeInfo.Text = string.Format("{0}以下商品均无打折", currentMemberGradeName, 100 - gradeInfo.Discount);;
                }
            }
            switch (Hidistro.Core.SettingsManager.GetMasterSettings(true).VTheme.ToLower())
            {
            case "common":
            case "hotel":
                Hidistro.Core.HiCache.Remove("DataCache-CategoriesRange");    //清除分类缓存
                //获取手机端所有商品的分类
                DataTable dt = CategoryBrowser.GetCategoriesByRange(rangeId); //CategoryBrowser.GetCategoriesRange(ProductInfo.ProductRanage.NormalSelect);

                int       total = 0;
                DataTable dt2   = new DataTable();
                if (categoryId == 0)
                {
                    if (dt.Rows.Count > 0)
                    {
                        //获取手机端商品的第一个分类id
                        int FirstCategoryID = Convert.ToInt32(dt.Rows[0]["categoryId"]);
                        this.litCategoryId.SetWhenIsNotNull(FirstCategoryID.ToString());

                        dt2 = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, FirstCategoryID, this.keyWord, 1, 20, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                    }
                }
                else
                {
                    dt2 = ProductBrowser.GetProducts(MemberProcessor.GetCurrentMember(), null, 0, categoryId, this.keyWord, 1, 20, out total, "ShowSaleCounts", "desc", "", rangeId, storeId);
                }
                //根据商品id判断是否包含其余规格,如果有,则新增一个字段存入规格号
                dt2.Columns.Add("skuCounts");
                dt2.Columns.Add("Quantity");
                List <Hidistro.Entities.Sales.ShoppingCartInfo> cart = ShoppingCartProcessor.GetShoppingCartList();   //获取购物车信息
                foreach (DataRow row in dt2.Rows)
                {
                    DataTable skus = ProductBrowser.GetSkus(Convert.ToInt32(row["ProductId"]));
                    row["skuCounts"] = skus.Rows.Count;
                    row["Quantity"]  = 0;
                    //根据商品id获取购物车中已存在的数量,防止页面刷新后选中的数量遗失
                    foreach (Hidistro.Entities.Sales.ShoppingCartInfo info in cart)
                    {
                        foreach (Hidistro.Entities.Sales.ShoppingCartItemInfo itemInfo in info.LineItems)
                        {
                            if (Convert.ToInt32(row["ProductId"]) == itemInfo.ProductId)
                            {
                                row["Quantity"] = itemInfo.Quantity;
                            }
                        }
                    }
                }
                this.rptCategories.DataSource = dt;
                this.rptCategories.DataBind();

                this.rptProducts.DataSource = dt2;
                this.rptProducts.DataBind();
                break;

            default:
                this.rptCategories.ItemDataBound += new RepeaterItemEventHandler(this.rptCategories_ItemDataBound);
                if (this.Page.Request.QueryString["TypeId"] != null)
                {
                    this.rptCategories.DataSource = CategoryBrowser.GetCategoriesByPruductType(100, Convert.ToInt32(this.Page.Request.QueryString["TypeId"]));
                    this.rptCategories.DataBind();
                }
                else
                {
                    IList <CategoryInfo> maxSubCategories = CategoryBrowser.GetMaxSubCategoriesRange(this.categoryId, 0x3e8, DistributorsBrower.GetCurrStoreProductRange());
                    this.rptCategories.DataSource = maxSubCategories;
                    this.rptCategories.DataBind();
                }
                PageTitle.AddSiteNameTitle("移动点餐");
                break;
            }
        }
Beispiel #11
0
 public bool UpdateDistributor(DistributorsInfo distributor)
 {
     DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE aspnet_Distributors SET StoreName=@StoreName,Logo=@Logo,BackImage=@BackImage,ReferralOrders=@ReferralOrders,ReferralBlance=@ReferralBlance, ReferralRequestBalance=@ReferralRequestBalance,StoreDescription=@StoreDescription,ReferralStatus=@ReferralStatus WHERE UserId=@UserId");
     this.database.AddInParameter(sqlStringCommand, "UserId", DbType.Int32, distributor.UserId);
     this.database.AddInParameter(sqlStringCommand, "StoreName", DbType.String, distributor.StoreName);
     this.database.AddInParameter(sqlStringCommand, "Logo", DbType.String, distributor.Logo);
     this.database.AddInParameter(sqlStringCommand, "BackImage", DbType.String, distributor.BackImage);
     this.database.AddInParameter(sqlStringCommand, "ReferralOrders", DbType.Int64, distributor.ReferralOrders);
     this.database.AddInParameter(sqlStringCommand, "ReferralStatus", DbType.Int64, distributor.ReferralStatus);
     this.database.AddInParameter(sqlStringCommand, "ReferralBlance", DbType.Decimal, distributor.ReferralBlance);
     this.database.AddInParameter(sqlStringCommand, "ReferralRequestBalance", DbType.Decimal, distributor.ReferralRequestBalance);
     this.database.AddInParameter(sqlStringCommand, "StoreDescription", DbType.String, distributor.StoreDescription);
     return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
 }