protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { base.CheckAdminPower("StatisticsSale", PowerCheckType.Single); foreach (ProductClassInfo info in ProductClassBLL.ReadProductClassNamedList()) { this.ClassID.Items.Add(new ListItem(info.ClassName, "|" + info.ID + "|")); } this.ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty)); this.BrandID.DataSource = ProductBrandBLL.ReadProductBrandCacheList(); this.BrandID.DataTextField = "Name"; this.BrandID.DataValueField = "ID"; this.BrandID.DataBind(); this.BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty)); this.ClassID.Text = RequestHelper.GetQueryString <string>("ClassID"); this.BrandID.Text = RequestHelper.GetQueryString <string>("BrandID"); this.Name.Text = RequestHelper.GetQueryString <string>("Name"); this.StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate"); this.EndAddDate.Text = RequestHelper.GetQueryString <string>("EndAddDate"); this.UserName.Text = RequestHelper.GetQueryString <string>("UserName"); this.OrderNumber.Text = RequestHelper.GetQueryString <string>("OrderNumber"); ProductSearchInfo productSearch = new ProductSearchInfo(); OrderSearchInfo orderSearch = new OrderSearchInfo(); productSearch.IsSale = 1; productSearch.Name = RequestHelper.GetQueryString <string>("Name"); productSearch.ClassID = RequestHelper.GetQueryString <string>("ClassID"); productSearch.InBrandID = RequestHelper.GetQueryString <string>("BrandID"); productSearch.InProductID = RequestHelper.GetQueryString <string>("ProductID"); orderSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate"); orderSearch.EndAddDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate")); orderSearch.UserName = RequestHelper.GetQueryString <string>("UserName"); orderSearch.OrderNumber = RequestHelper.GetQueryString <string>("OrderNumber"); base.BindControl(OrderDetailBLL.StatisticsSaleDetail(base.CurrentPage, base.PageSize, orderSearch, productSearch, ref this.Count), this.RecordList, this.MyPager); } }
private void LoadProducts() { ProductSearchInfo searchInfo = new ProductSearchInfo(); searchInfo.IsNew = (int)BoolType.True; searchInfo.ProductOrderType = "AddDate"; searchInfo.OrderType = OrderType.Desc; int currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 20; int count = 0; productList = ProductBLL.SearchList(currentPage, pageSize, searchInfo, ref count); string json = Newtonsoft.Json.JsonConvert.SerializeObject(from item in productList select new { id = item.Id, name = StringHelper.Substring(item.Name, 5), photo = item.Photo.Replace("Original", "150-150") }); ResponseHelper.Write(json); ResponseHelper.End(); }
public DataTable StatisticsSaleDetail(int currentPage, int pageSize, OrderSearchInfo orderSearch, ProductSearchInfo productSearch, ref int count) { ShopMssqlPagerClass class2 = new ShopMssqlPagerClass(); class2.TableName = ShopMssqlHelper.TablePrefix + "View_SaleDetail"; class2.Fields = "[Name],[ClassID],[BrandID],[BuyCount],[Money],[OrderNumber],[AddDate],[UserName]"; class2.CurrentPage = currentPage; class2.PageSize = pageSize; class2.OrderField = "[AddDate],[ID]"; class2.OrderType = OrderType.Desc; this.PrepareCondition(class2.MssqlCondition, orderSearch, productSearch); class2.Count = count; count = class2.Count; return(class2.ExecuteDataTable()); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int themeActivityId = RequestHelper.GetQueryString <int>("id"); if (themeActivityId != int.MinValue) { CheckAdminPower("ReadThemeActivity", PowerCheckType.Single); strThemeActivityId = themeActivityId.ToString(); ThemeActivityInfo themeActivity = ThemeActivityBLL.Read(themeActivityId); Name.Text = themeActivity.Name; Photo.Text = themeActivity.Photo; Description.Text = themeActivity.Description; Css.Text = themeActivity.Css; CssMobile.Text = themeActivity.CssMobile; if (themeActivity.ProductGroup != string.Empty) { string idList = string.Empty; int count = themeActivity.ProductGroup.Split('#').Length; photoArray = new string[count]; linkArray = new string[count]; photoMobileArray = new string[count]; linkMobileArray = new string[count]; idArray = new string[count]; for (int i = 0; i < count; i++) { string[] productGroupArray = themeActivity.ProductGroup.Split('#')[i].Split('|'); photoArray[i] = productGroupArray[0]; linkArray[i] = productGroupArray[1]; photoMobileArray[i] = productGroupArray[2]; linkMobileArray[i] = productGroupArray[3]; idArray[i] = productGroupArray[4]; if (productGroupArray[4] != string.Empty) { idList += productGroupArray[4] + ","; } } if (idList != string.Empty) { idList = idList.Substring(0, idList.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = idList; productList = ProductBLL.SearchList(1, idList.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Length, productSearch, ref count); } string[] themeStyleArr = themeActivity.Style.Split('|'); TopImage.Text = themeStyleArr[0]; BackgroundImage.Text = themeStyleArr[1]; BottomImage.Text = themeStyleArr[2]; ProductColor.Text = themeStyleArr[3]; ProductColor.Attributes.Add("style", "color:" + themeStyleArr[3] + ";"); ProductSize.Text = themeStyleArr[4]; PriceColor.Text = themeStyleArr[5]; PriceColor.Attributes.Add("style", "color:" + themeStyleArr[5] + ";"); PriceSize.Text = themeStyleArr[6]; OtherColor.Text = themeStyleArr[7]; OtherColor.Attributes.Add("style", "color:" + themeStyleArr[7] + ";"); OtherSize.Text = themeStyleArr[8]; TopImageMobile.Text = themeStyleArr[9]; BackgroundImageMobile.Text = themeStyleArr[10]; BottomImageMobile.Text = themeStyleArr[11]; } } }
protected override void PageLoad() { if (!StringHelper.CompareSingleString(base.ParentCompanyID, "667") && base.UserID > 0) { Response.Redirect("/Bussiness.aspx");//User/CourseCenter.aspx } base.PageLoad(); //ArticleSearchInfo article = new ArticleSearchInfo(); //article.ClassID = "|" + 1.ToString() + "|"; int count = -2147483648; //this.newsList = ArticleBLL.SearchArticleList(1, 7, article, ref count); ProductSearchInfo product = new ProductSearchInfo(); product.IsNew = 1; //product.IsTop = 1; product.IsSale = 1; count = -2147483648; this.newProductList = ProductBLL.SearchProductList(1, 15, product, ref count); //product.IsTop = 1; //product.IsSale = 1; //product.MarketPrice = 0; //count = -2147483648; //this.freeProductList = ProductBLL.SearchProductList(1, 6, product, ref count); //product = new ProductSearchInfo(); //product.IsHot = 1; //product.IsTop = 1; //product.IsSale = 1; //count = -2147483648; //this.hotProductList = ProductBLL.SearchProductList(1, 10, product, ref count); //product = new ProductSearchInfo(); //product.IsSpecial = 1; //product.IsTop = 1; //product.IsSale = 1; //count = -2147483648; //this.specialProductList = ProductBLL.SearchProductList(product); //ProductBLL.SearchProductList(1, 10, product, ref count); //List<ProductInfo> list = new List<ProductInfo>(); //list.AddRange(this.newProductList); //list.AddRange(this.hotProductList); //list.AddRange(this.specialProductList); //string strProductID = string.Empty; //foreach (ProductInfo info3 in list) //{ // if (strProductID == string.Empty) // { // strProductID = info3.ID.ToString(); // } // else // { // strProductID = strProductID + "," + info3.ID.ToString(); // } //} //if (strProductID != string.Empty) //{ // this.memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); //} //this.textLinkList = LinkBLL.ReadLinkCacheListByClass(1); //this.pictureLinkList = LinkBLL.ReadLinkCacheListByClass(2); attributeRecordList = AttributeRecordBLL.ReadList("1,2,3", ProductBLL.ReadProductIdStr(this.newProductList)); //每日快报 ArticleSearchInfo articleSearch = new ArticleSearchInfo(); articleSearch.ClassID = "|29|"; this.newsList = ArticleBLL.SearchArticleList(1, 12, articleSearch, ref base.Count); //证书 certList = PostPassBLL.GetTheLatestPostCert(10); }
private string GetReportList() { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = searchCourseName; productSearch.NotInClassID = "3644|5235|5298"; productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString() + "," + companyID.ToString(); List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); decimal[,] averageInfo = new decimal[productList.Count, 6]; StringBuilder TempStr = new StringBuilder(); TempStr.Append("<table class=\"evaluation_sheet\">\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"" + (productList.Count + 3) + "\">" + companyName); if (startDate != DateTime.MinValue || endDate != DateTime.MinValue) { if (startDate != DateTime.MinValue && endDate != DateTime.MinValue) { TempStr.Append(" [ " + startDate.ToString("d") + "—" + endDate.ToString("d") + " ]"); } else if (startDate == DateTime.MinValue) { TempStr.Append(" [ 截止到:" + endDate.ToString("d") + " ]"); } if (endDate != DateTime.MinValue) { endDate = ShopCommon.SearchEndDate(endDate); } } //TempStr.Append(" <input id=\"Button2\" type=\"button\" value=\"导出报表\" Class=\"button\" OnClick=\"ExcelGetCatId();\" /></th>\n\r"); TempStr.Append("</th>\n\r"); TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th style=\"min-width:60px\">序号</th>\n\r"); TempStr.Append("<th style=\"min-width:60px\">姓名</th>\n\r"); TempStr.Append("<th style=\"min-width:60px\">职位</th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th style=\"min-width:100px;\">" + productList[i].Name + "</th>\n\r"); } //TempStr.Append("<td>平均分</td>\n\r"); TempStr.Append("</tr>\n\r"); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.InCompanyID = companyID.ToString(); userSearch.Status = (int)UserState.Normal; userSearch.InGroupID = groupID; userSearch.InWorkingPostID = postIdCondition; userSearch.InStudyPostID = studyPostIdCondition; List <UserInfo> userList = UserBLL.SearchUserList(userSearch); int userNum = 0;//序号 if (userList.Count > 0) { //系统先调取公司月内的所有成绩,减少循环体中调用的对数据库操作的重复性 List <TestPaperInfo> testReportList = TestPaperBLL.ReadReportList(companyID.ToString(), ProductBLL.ReadProductIdStr(productList), startDate, endDate); foreach (UserInfo user in userList) { userNum = userNum + 1; TempStr.Append("<tr>\n\r"); TempStr.Append("<td width=\"35px\">" + userNum.ToString() + "</td>\n\r"); TempStr.Append("<td width=\"100px\">" + user.RealName + "</td>\n\r"); TempStr.Append("<td width=\"200px\">" + PostBLL.ReadPost(user.WorkingPostID).PostName + "</td>\n\r"); decimal userAverageScore = 0; int courseHasTest = 0; for (int i = 0; i < productList.Count; i++) { ProductInfo product = productList[i]; string courseState = "--"; //if (user.RegisterDate < CateIdEndDate[i]) //{ averageInfo[i, 5] = averageInfo[i, 5] + 1; //} //else //{ // courseState = "不作计算"; //} TestPaperInfo testPaperModel = TestPaperBLL.ReadReportInfo(testReportList, user.ID, product.ID); if (testPaperModel != null) { TempStr.Append("<td>" + testPaperModel.Scorse.ToString() + "</td>\n\r"); userAverageScore = userAverageScore + testPaperModel.Scorse; courseHasTest = courseHasTest + 1; //科目总分计算 averageInfo[i, 0] = averageInfo[i, 0] + testPaperModel.Scorse; //有成绩的人数计算 averageInfo[i, 1] = averageInfo[i, 1] + 1; if (testPaperModel.IsPass == 1) { averageInfo[i, 2] = averageInfo[i, 2] + 1; } } else { TempStr.Append("<td>" + courseState + "</td>\n\r"); } } //人均分 //if (courseHasTest > 0) //{ // TempStr.Append("<td>" + Math.Round(userAverageScore / courseHasTest, 2) + "</td>\n\r"); //} //else //{ // TempStr.Append("<td>--</td>\n\r"); //} TempStr.Append("</tr>\n\r"); } } TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>应到人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + averageInfo[i, 5].ToString() + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>实际参加考试人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 1] != 0 ? averageInfo[i, 1].ToString() : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>到考率</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 5] != 0 ? Math.Round(averageInfo[i, 1] / averageInfo[i, 5], 4).ToString("P") : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>到考平均分</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 1] != 0 ? Math.Round(averageInfo[i, 0] / averageInfo[i, 1], 2) : 0) + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr>\n\r"); TempStr.Append("<th colspan=\"3\"><B>考试通过人数</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + averageInfo[i, 2] + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("<tr class=\"listTableFoot\">\n\r"); TempStr.Append("<th colspan=\"3\"><B>课程通过率</B></th>\n\r"); for (int i = 0; i < productList.Count; i++) { TempStr.Append("<th>" + (averageInfo[i, 5] != 0 ? Math.Round(averageInfo[i, 2] / averageInfo[i, 5], 4).ToString("P") : "0") + "</th>\n\r"); } TempStr.Append("</tr>\n\r"); TempStr.Append("</table>\n\r"); return(TempStr.ToString()); }
private PostCateInfo GetPostClassList() { string QuestType = RequestHelper.GetForm <string>("questType"); int classID = RequestHelper.GetForm <int>("ClassID"); int studyPostID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); Dictionary <string, Dictionary <string, string> > postProductClassList = new Dictionary <string, Dictionary <string, string> >(); string postCourseID = PostBLL.ReadPostCourseID(base.UserCompanyID, studyPostID); string passPostCourseID = string.IsNullOrEmpty(postCourseID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, postCourseID, 1)); postCourseID = StringHelper.SubString(postCourseID, passPostCourseID); //加载认证考试 PostPassInfo passpost = new PostPassInfo(); passpost.UserId = base.UserID; passpost.IsRZ = 0; RenZhengCateInfo rzCate = new RenZhengCateInfo(); rzCate.InPostID = PostPassBLL.PassPostString(passpost); string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate); postCourseID = string.IsNullOrEmpty(rzProductID) ? postCourseID : string.IsNullOrEmpty(postCourseID) ? rzProductID : postCourseID + "," + rzProductID; //加载大课件 ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsSale = 1; productSearch.ClassID = "|5298|"; List <ProductInfo> dkjProductList = ProductBLL.SearchProductList(productSearch); if (dkjProductList.Count > 0) { string dkjCourseID = ProductBLL.ReadProductIdStr(dkjProductList); postCourseID = string.IsNullOrEmpty(postCourseID) ? dkjCourseID : postCourseID + "," + dkjCourseID; } if (!string.IsNullOrEmpty(postCourseID)) { postProductClassList = ProductClassBLL.ReadProductClassListByProductID(postCourseID, 1); } if (postProductClassList.Count > 1) { postProductClassList = ProductClassBLL.productClassSort(postProductClassList); } List <Dictionary <string, string> > productClassList = new List <Dictionary <string, string> >(); foreach (string key in postProductClassList.Keys) { Dictionary <string, string> productClassDic = new Dictionary <string, string>(); productClassDic.Add("ID", key); productClassDic.Add("Name", ProductClassBLL.ReadProductClassCache(int.Parse(key)).ClassName); productClassList.Add(productClassDic); } PostCateInfo studyPost = new PostCateInfo(); studyPost.EncryptFcateID = studyPostID.ToString(); studyPost.Title = PostBLL.ReadPost(studyPostID).PostName; studyPost.ChildCourseFCateView = productClassList; return(studyPost); //三个岗位加载 竞品选修 //if (StringHelper.CompareSingleString("4,5,64", studyPostID.ToString())) //{ // ProductSearchInfo productSearch = new ProductSearchInfo(); // productSearch.ClassID = "|6|"; // productSearch.InBrandID = base.CompanyBrandID; // productSearch.IsSale = 1; // productSearch.NotLikeName = "必修"; // string xxCourseID = ProductBLL.ReadProductIdStr(ProductBLL.SearchProductList(productSearch)); // string passXXCourseID = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, xxCourseID, 1)); // //if (passType == 1) // // xxCourseID = passXXCourseID; // //else if (passType == 0) // xxCourseID = StringHelper.SubString(xxCourseID, passXXCourseID); // if (!string.IsNullOrEmpty(xxCourseID)) // this.xxProductClassList = ProductClassBLL.ReadProductClassListByProductID(xxCourseID, 1); //} //if (!string.IsNullOrEmpty(QuestType)) //{ // List<PostInfo> PostCateList = new List<PostInfo>(); // PostCateList.Add(PostBLL.ReadPost(PostId)); // return ConvertToPostCate(PostCateList, true); //} //else //{ // return ConvertToPostCate(PostBLL.ReadPostCateRootList(), true); //} }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ReadProduct", PowerCheckType.Single); foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList()) { ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|")); } ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty)); BrandID.DataSource = ProductBrandBLL.ReadList(); BrandID.DataTextField = "Name"; BrandID.DataValueField = "ID"; BrandID.DataBind(); BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty)); ClassID.Text = RequestHelper.GetQueryString <string>("ClassID"); BrandID.Text = RequestHelper.GetQueryString <string>("BrandID"); Key.Text = RequestHelper.GetQueryString <string>("Key"); StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate"); EndAddDate.Text = RequestHelper.GetQueryString <string>("EndAddDate"); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = RequestHelper.GetQueryString <string>("Key"); productSearch.ClassId = RequestHelper.GetQueryString <string>("ClassID"); productSearch.BrandId = RequestHelper.GetQueryString <int>("BrandID"); productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate"); productSearch.EndAddDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate")); productSearch.IsDelete = 1;//逻辑删除的商品 //PageSize = 10; PageSize = Session["AdminPageSize"] == null ? 20 : Convert.ToInt32(Session["AdminPageSize"]); AdminPageSize.Text = Session["AdminPageSize"] == null ? "20" : Session["AdminPageSize"].ToString(); List <ProductInfo> productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count); BindControl(productList, RecordList, MyPager); var pid = RequestHelper.GetQueryString <int>("ID"); switch (RequestHelper.GetQueryString <string>("Action")) { case "Recover": if (pid > 0) { ProductBLL.Recover(pid); AdminLogBLL.Add(ShopLanguage.ReadLanguage("RecoverRecord"), ShopLanguage.ReadLanguage("Product"), pid); ScriptHelper.Alert(ShopLanguage.ReadLanguage("RecoverOK"), Request.UrlReferrer.ToString()); } break; case "Delete": if (pid > 0) { ProductBLL.Delete(pid); AdminLogBLL.Add(ShopLanguage.ReadLanguage("DeleteRecordCompletely"), ShopLanguage.ReadLanguage("Product"), pid); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteCompletelyOK"), Request.UrlReferrer.ToString()); } break; default: break; } } }
public static List <ProductInfo> SearchList(int currentPage, int pageSize, ProductSearchInfo searchInfo, ref int count) { return(dal.SearchList(currentPage, pageSize, searchInfo, ref count)); }
protected void SearchCondition() { string keyword = RequestHelper.GetQueryString <string>("Keyword"); string tags = RequestHelper.GetQueryString <string>("Tags"); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsSale = 1; productSearch.IsSpecial = 1; if (!string.IsNullOrEmpty(brandID)) { List <ProductBrandInfo> productBrandList = ProductBrandBLL.ReadProductBrandCacheList(brandID); foreach (ProductBrandInfo info in productBrandList) { showCondition += ShowCondition("BrandID", info.Name); } productSearch.InBrandID = brandID; } if (postID > 0) { PostInfo studyPost = PostBLL.ReadPost(postID); showCondition += ShowCondition("PostID", studyPost.PostName); productSearch.InProductID = studyPost.PostPlan; } if (classID > 0) { ProductClassInfo productClass = ProductClassBLL.ReadProductClassCache(classID); showCondition += ShowCondition("ClassID", productClass.ClassName); productSearch.ClassID = "|" + classID.ToString() + "|"; } if (keyword != string.Empty) { showCondition += "“" + keyword + "”"; productSearch.Key = keyword; } productSearchList = ProductBLL.SearchProductList(base.CurrentPage, 15, productSearch, ref Count); this.commonPagerClass.CurrentPage = base.CurrentPage; this.commonPagerClass.PageSize = 15; this.commonPagerClass.Count = Count; if (string.IsNullOrEmpty(showCondition)) { showCondition = "<li class=\"select-no\">您暂无选择筛选条件<span class=\"count-result\">共<span style=\"margin:0 4px;\">" + base.Count.ToString() + "</span>个结果</span></li>"; } //this.searchCondition = "ClassID=" + classID.ToString() + "&ProductName=" + keyword + "&BrandID=" + brandID.ToString() + "&Tags=" + tags; //if (classID > 0) //{ // ProductClassInfo info = ProductClassBLL.ReadProductClassCache(classID); // this.showCondition = "分类:<span>" + info.ClassName + "</span>"; // this.showTitle = info.ClassName; // //showDescription = info.Description; // this.searchType = 2; // int iD = info.ID; // if (ProductClassBLL.ReadProductClassChildList(info.ID).Count == 0) // { // iD = info.FatherID; // } // foreach (ProductClassInfo info2 in ProductClassBLL.ReadProductClassChildList(iD)) // { // this.relationSearch = string.Concat(new object[] { relationSearch, "<a href=\"/Product-C", info2.ID, ".aspx\">", info2.ClassName, "</a>" }); // } //} //if (brandID > 0) //{ // ProductBrandInfo Info = ProductBrandBLL.ReadProductBrandCache(brandID); // this.showCondition = "品牌:<span>" + Info.Name + "</span>"; // this.showTitle = Info.Name; // //showDescription = Info.Description; // this.searchType = 2; // foreach (ProductBrandInfo info3 in base.topProductBrandList) // { // this.relationSearch = string.Concat(new object[] { relationSearch, "<a href=\"/Product-B", info3.ID, ".aspx\">", info3.Name, "</a>" }); // } //} //if (tags != string.Empty) //{ // this.showCondition = "标签:<span>" + tags + "</span>"; // this.showTitle = tags; // this.searchType = 2; // foreach (TagsInfo info4 in base.tagsList) // { // this.relationSearch = this.relationSearch + "<a href=\"/Product/Tags/" + base.Server.UrlEncode(info4.Word) + ".aspx\" style=\"font-size:" + info4.Size.ToString() + "px; color:" + info4.Color + "\">" + info4.Word + "</a>"; // } //} //if (RequestHelper.GetQueryString<int>("IsNew") == 1) //{ // this.showCondition = "新品上市"; // this.showTitle = "新品上市"; // this.searchCondition = "IsNew=1"; //} //if (RequestHelper.GetQueryString<int>("IsHot") == 1) //{ // this.showCondition = "热销商品"; // this.showTitle = "热销商品"; // this.searchCondition = "IsHot=1"; //} //if (RequestHelper.GetQueryString<int>("IsSpecial") == 1) //{ // this.showCondition = "特价商品"; // this.showTitle = "特价商品"; // this.searchCondition = "IsSpecial=1"; //} //if (RequestHelper.GetQueryString<int>("IsTop") == 1) //{ // this.showCondition = "推荐商品"; // this.showTitle = "推荐商品"; // this.searchCondition = "IsTop=1"; //} //if (keyword != string.Empty) //{ // this.showCondition = this.showCondition + "关键字:<span>" + keyword + "</span>"; // this.showTitle = this.showTitle + keyword; // this.searchType = 2; // foreach (string str3 in ShopConfig.ReadConfigInfo().HotKeyword.Split(new char[] { ',' })) // { // this.relationSearch = this.relationSearch + "<a href=\"/Product/Keyword/" + base.Server.UrlEncode(str3) + ".aspx\">" + str3 + "</a>"; // } //} //if (this.searchType == 1) //{ // if (this.showCondition != string.Empty) // { // this.showCondition = "首页 > " + this.showCondition; // } // else // { // this.showCondition = "首页 > 全部商品"; // this.showTitle = "全部商品"; // } //} //else //{ // this.showCondition = "您搜索的" + this.showCondition; //} base.Title = this.showTitle + " - 商品展示"; }
protected bool isPL = true;//是否已评论 /// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int orderID = RequestHelper.GetQueryString <int>("OrderID"); order = OrderBLL.Read(orderID, base.UserId); if (order.OrderStatus != (int)OrderStatus.ReceiveShipping) { ScriptHelper.AlertFront("只能评论已收货订单"); } orderDetailList = OrderDetailBLL.ReadList(orderID); #region 加载订单下商品 foreach (OrderDetailInfo orderDetail in orderDetailList) { if (strProductID2 == string.Empty) { strProductID2 = orderDetail.ProductId.ToString(); } else { strProductID2 += "," + orderDetail.ProductId.ToString(); } } if (strProductID2 != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = strProductID2; productList = ProductBLL.SearchList(productSearch); } #endregion #region 判断是否已评论 List <ProductCommentInfo>[] listPinfoArr = new List <ProductCommentInfo> [productList.Count]; int pi = 0; foreach (ProductInfo item in productList) { ProductCommentSearchInfo psi = new ProductCommentSearchInfo(); psi.ProductId = item.Id; psi.UserId = base.UserId; psi.OrderID = orderID; listPinfoArr[pi] = ProductCommentBLL.SearchProductCommentList(psi); if (listPinfoArr[pi].Count <= 0) { isPL = false; } } if (isPL) { string url = ""; if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0) { url = "/mobile/User/UserProductComment.html"; } else { url = "/User/UserProductComment.html"; } Response.Redirect(url); } #endregion //ProductCommentSearchInfo productCommentSearch = new ProductCommentSearchInfo(); //productCommentSearch.UserId = base.UserId; //productCommentSearch.OrderID = orderID; //if (ProductCommentBLL.SearchProductCommentList(productCommentSearch).Count >= productList.Count) //{ // string url = ""; // if (Request.RawUrl.ToLower().IndexOf("/mobile/") >= 0) // { // url = "/mobile/User/UserProductComment.html"; // } // else // { // url = "/User/UserProductComment.html"; // } // Response.Redirect(url); Title = "订单评价 - 会员中心"; }
public List <Product> SearchProduct(ProductSearchInfo info) { return(DbHelper.FillListPaged <Product>("SearchProduct", info)); }
protected void AddOrderProduct(int orderID) { List <CartInfo> list = CartBLL.ReadCartList(base.UserID); string strProductID = string.Empty; foreach (CartInfo info in list) { if (strProductID == string.Empty) { strProductID = info.ProductID.ToString(); } else { strProductID = strProductID + "," + info.ProductID.ToString(); } } List <ProductInfo> productList = new List <ProductInfo>(); if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = strProductID; productList = ProductBLL.SearchProductList(productSearch); } List <MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); Dictionary <string, bool> dictionary = new Dictionary <string, bool>(); Dictionary <int, int> dictionary2 = new Dictionary <int, int>(); foreach (CartInfo info in list) { ProductInfo product = ProductBLL.ReadProductByProductList(productList, info.ProductID); OrderDetailInfo orderDetail = new OrderDetailInfo(); orderDetail.OrderID = orderID; orderDetail.ProductID = info.ProductID; orderDetail.ProductName = info.ProductName; orderDetail.ProductWeight = product.Weight; orderDetail.SendPoint = product.SendPoint; if (info.GiftPackID == 0) { orderDetail.ProductPrice = MemberPriceBLL.ReadCurrentMemberPrice(memberPriceList, base.GradeID, product); } else if (dictionary.ContainsKey(info.RandNumber + "|" + info.GiftPackID.ToString())) { orderDetail.ProductPrice = 0M; } else { orderDetail.ProductPrice = GiftPackBLL.ReadGiftPack(info.GiftPackID).Price; dictionary.Add(info.RandNumber + "|" + info.GiftPackID.ToString(), true); } orderDetail.BuyCount = info.BuyCount; if (info.FatherID > 0) { orderDetail.FatherID = dictionary2[info.FatherID]; } orderDetail.RandNumber = info.RandNumber; orderDetail.GiftPackID = info.GiftPackID; int num = OrderDetailBLL.AddOrderDetail(orderDetail); dictionary2.Add(info.ID, num); } CartBLL.ClearCart(base.UserID); Sessions.ProductTotalPrice = 0M; Sessions.ProductBuyCount = 0; Sessions.ProductTotalWeight = 0M; }
/// <summary> /// 添加订单产品 /// </summary> /// <param name="orderID"></param> protected void AddOrderProduct(int orderID) { List <CartInfo> cartList = CartBLL.ReadList(base.UserId); //读取产品 checkCart = HttpUtility.UrlDecode(CookiesHelper.ReadCookieValue("CheckCart")); int[] cartIds = Array.ConvertAll <string, int>(checkCart.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); cartList = CartBLL.ReadList(base.UserId); cartList = cartList.Where(k => cartIds.Contains(k.Id)).ToList(); string strProductID = string.Empty; foreach (CartInfo cart in cartList) { if (strProductID == string.Empty) { strProductID = cart.ProductId.ToString(); } else { strProductID += "," + cart.ProductId.ToString(); } } List <ProductInfo> productList = new List <ProductInfo>(); if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = strProductID; productList = ProductBLL.SearchList(productSearch); } //会员价格 //List<MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); //添加订单产品 Dictionary <string, bool> cartDic = new Dictionary <string, bool>(); Dictionary <int, int> cartOrderDetailDic = new Dictionary <int, int>(); foreach (CartInfo cart in cartList) { ProductInfo product = ProductBLL.ReadProductByProductList(productList, cart.ProductId); OrderDetailInfo orderDetail = new OrderDetailInfo(); orderDetail.OrderId = orderID; orderDetail.ProductId = cart.ProductId; orderDetail.ProductName = cart.ProductName; orderDetail.StandardValueList = cart.StandardValueList; orderDetail.ProductWeight = product.Weight; orderDetail.SendPoint = product.SendPoint; if (!string.IsNullOrEmpty(cart.StandardValueList)) { var standardRecord = ProductTypeStandardRecordBLL.Read(cart.ProductId, cart.StandardValueList); orderDetail.ProductPrice = ProductBLL.GetCurrentPrice(standardRecord.SalePrice, base.GradeID); } else { orderDetail.ProductPrice = ProductBLL.GetCurrentPrice(cart.Product.SalePrice, base.GradeID); } orderDetail.BuyCount = cart.BuyCount; orderDetail.RandNumber = cart.RandNumber; int orderDetailID = OrderDetailBLL.Add(orderDetail); cartOrderDetailDic.Add(cart.Id, orderDetailID); } /*-----------删除购物车中已下单的商品-----------------------------------*/ CartBLL.Delete(cartIds, base.UserId); CookiesHelper.DeleteCookie("CheckCart"); /*----------------------------------------------------------------------*/ }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int count = int.MinValue; int id = RequestHelper.GetQueryString <int>("ID"); if (id <= 0) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } string fromwhere = RequestHelper.GetQueryString <string>("fw"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { if (fromwhere.ToLower() != "admin") { ScriptHelper.Alert("该产品未上市,不能查看"); } else { if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录 { ScriptHelper.Alert("该产品未上市,不能查看"); } } } navList = ProductClassBLL.ProductClassNameList(product.ClassId); //更新查看数量 ProductBLL.ChangeViewCount(id, 1); //会员等级 userGradeList = UserGradeBLL.ReadList(); //产品图片 ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo.Replace("Original", "75-75"); productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); // 关联产品,配件,浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct; tempStrProductID = tempStrProductID.Replace(",,", ","); if (tempStrProductID.StartsWith(",")) { tempStrProductID = tempStrProductID.Substring(1); } if (tempStrProductID.EndsWith(",")) { tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = tempStrProductID; productSearch.IsDelete = (int)BoolType.False; tempProductList = ProductBLL.SearchList(productSearch); //产品规格 standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } //计算剩余库存量 if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem) { leftStorageCount = product.TotalStorageCount - product.OrderCount; } else { leftStorageCount = product.ImportVirtualStorageCount; } //搜索优化 Title = product.Name; Keywords = (product.Keywords == string.Empty) ? product.Name : product.Keywords; Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); if (CookiesHelper.ReadCookieValue("ProductShowWay") != string.Empty) { productShowWay = Convert.ToInt32(CookiesHelper.ReadCookieValue("ProductShowWay")); } int currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 20; if (productShowWay == (int)ProductShowWay.List) { pageSize = 10; } int count = 0; //搜索条件处理 ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsSale = (int)BoolType.True; productSearch.ProductOrderType = CookiesHelper.ReadCookieValue("ProductOrderType"); int searchType = RequestHelper.GetQueryString <int>("SearchType"); //if (searchType == (int)ProductSearchType.Key) //{ string classID = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("cat")); if (classID != int.MinValue.ToString() && classID != "") { classID = "|" + classID + "|"; } else { classID = string.Empty; } productSearch.ClassId = classID; productSearch.Key = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("ProductName")); productSearch.BrandId = RequestHelper.GetQueryString <int>("BrandID"); //} //else //{ productSearch.IsNew = RequestHelper.GetQueryString <int>("IsNew"); productSearch.IsHot = RequestHelper.GetQueryString <int>("IsHot"); productSearch.IsSpecial = RequestHelper.GetQueryString <int>("IsSpecial"); productSearch.IsTop = RequestHelper.GetQueryString <int>("IsTop"); //} //搜索产品 productList = ProductBLL.SearchList(currentPage, pageSize, productSearch, ref count); //读取会员价格 countPriceSingle = true; string strProductID = string.Empty; foreach (ProductInfo product in productList) { if (strProductID == string.Empty) { strProductID = product.Id.ToString(); } else { strProductID += "," + product.Id.ToString(); } } ajaxPagerClass.CurrentPage = currentPage; ajaxPagerClass.PageSize = pageSize; ajaxPagerClass.Count = count; ajaxPagerClass.FirstPage = "<<首页"; ajaxPagerClass.PreviewPage = "<<上一页"; ajaxPagerClass.NextPage = "下一页>>"; ajaxPagerClass.LastPage = "末页>>"; ajaxPagerClass.ListType = false; ajaxPagerClass.DisCount = false; ajaxPagerClass.PrenextType = true; }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack) { base.CheckAdminPower("ProductBatchEdit", PowerCheckType.Single); if (RequestHelper.GetQueryString <string>("Action") == "SingleEdit") { this.SingleEdit(); } foreach (ProductClassInfo info in ProductClassBLL.ReadProductClassNamedList()) { this.ClassID.Items.Add(new ListItem(info.ClassName, "|" + info.ID + "|")); } this.ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty)); this.BrandID.DataSource = ProductBrandBLL.ReadProductBrandCacheList(); this.BrandID.DataTextField = "Name"; this.BrandID.DataValueField = "ID"; this.BrandID.DataBind(); this.BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty)); ProductSearchInfo product = new ProductSearchInfo(); product.Name = RequestHelper.GetQueryString <string>("Name"); product.ClassID = RequestHelper.GetQueryString <string>("ClassID"); product.InBrandID = RequestHelper.GetQueryString <string>("BrandID"); product.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate"); product.EndAddDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate")); this.ClassID.Text = RequestHelper.GetQueryString <string>("ClassID"); this.BrandID.Text = RequestHelper.GetQueryString <string>("BrandID"); this.Name.Text = RequestHelper.GetQueryString <string>("Name"); this.StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate"); this.EndAddDate.Text = RequestHelper.GetQueryString <string>("EndAddDate"); this.productList = ProductBLL.SearchProductList(base.CurrentPage, base.PageSize, product, ref this.Count); base.BindControl(this.MyPager); string strProductID = string.Empty; foreach (ProductInfo info3 in this.productList) { if (strProductID == string.Empty) { strProductID = info3.ID.ToString(); } else { strProductID = strProductID + "," + info3.ID.ToString(); } } this.userGradeList = UserGradeBLL.ReadUserGradeCacheList(); this.memberPriceList = MemberPriceBLL.ReadMemberPriceByProduct(strProductID); foreach (UserGradeInfo info4 in this.userGradeList) { if (this.userGradeIDList == string.Empty) { this.userGradeIDList = info4.ID.ToString(); this.userGradeNameList = info4.Name; } else { this.userGradeIDList = this.userGradeIDList + "," + info4.ID.ToString(); this.userGradeNameList = this.userGradeNameList + "," + info4.Name; } } } }
public static List <ProductInfo> SearchList(ProductSearchInfo searchInfo) { return(dal.SearchList(searchInfo)); }
private List <MCourseInfo> GetCoursesByKeyWord() { string Keyword = StringHelper.SearchSafe(RequestHelper.GetForm <string>("keyWord")); int PageIndex = RequestHelper.GetForm <int>("pageIndex"); int PageSize = RequestHelper.GetForm <int>("pageSize"); List <MCourseInfo> CourseList = new List <MCourseInfo>(); int i = 1; ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Key = Keyword; productSearch.IsSale = 1; productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString(); productSearch.InBrandID = CookiesHelper.ReadCookieValue("UserCompanyBrandID"); List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); if (productList.Count > 0) { //通过的课程ID string PassCourseId = TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, 1)); string PostCourseId = PostBLL.ReadPostCourseID(base.UserCompanyID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); string perpaidCourseId = BLLMTestCate.ReadPrepaidTestCate(base.UserID); foreach (ProductInfo Info in productList) { if (i >= PageSize * (PageIndex - 1) && i < PageSize * PageIndex) { MCourseInfo CourseModel = new MCourseInfo(); CourseModel.ClassID = Info.ID.ToString(); CourseModel.Title = Info.Name; TestPaperInfo Model = new TestPaperInfo(); Model.UserId = base.UserID; Model.CateIdCondition = Info.ID.ToString(); Model.GroupCondition = "CateId"; TestPaperInfo TestPaperModel = TestPaperBLL.ReadList(Model).Find(delegate(TestPaperInfo TempModel) { return(TempModel.CateId == Info.ID); }); if (TestPaperModel != null) { CourseModel.TestCount = TestPaperModel.TestNum; } else { CourseModel.TestCount = 0; } CourseModel.IsPass = StringHelper.CompareSingleString(PassCourseId, Info.ID.ToString()); CourseModel.PageCount = (int)Math.Ceiling((double)productList.Count / (double)PageSize); if (!string.IsNullOrEmpty(Info.ProductNumber)) { CourseModel.IsVideo = true; } if (!string.IsNullOrEmpty(Info.Accessory)) { CourseModel.IsTest = true; } CourseModel.IsPostCourse = StringHelper.CompareSingleString(PostCourseId, Info.ID.ToString()); if (!CourseModel.IsPostCourse && CourseModel.Title.ToLower().IndexOf("vs") < 0) { continue; } CourseModel.OriginalPrice = Info.MarketPrice.ToString(); List <AttributeRecordInfo> attributeRecordList = AttributeRecordBLL.ReadList("5", Info.ID.ToString()); if (attributeRecordList.Count > 0) { CourseModel.IsRC = true; CourseModel.RCUrl = attributeRecordList[0].Value; } //选修也列为可以查看对象 if (!CourseModel.IsPostCourse && Info.Name.ToUpper().Contains("VS")) { CourseModel.IsPostCourse = true; } CourseModel.IsPrepaidCourse = StringHelper.CompareSingleString(perpaidCourseId, Info.ID.ToString()); CourseList.Add(CourseModel); } if (i >= PageSize * PageIndex) { break; } i++; } } return(CourseList); }
/// <summary> /// 产品销量分析 /// </summary> public static DataTable StatisticsProductSale(int currentPage, int pageSize, ProductSearchInfo productSearch, ref int count, DateTime startDate, DateTime endDate) { return(dal.StatisticsProductSale(currentPage, pageSize, productSearch, ref count, startDate, endDate)); }
//private List<PostCateInfo> ConvertToPostCate(List<PostInfo> PostList, bool ChildList) //{ // List<PostCateInfo> PostCateList = new List<PostCateInfo>(); // if (PostList != null) // { // foreach (PostInfo Info in PostList) // { // PostCateInfo PostCateModel = new PostCateInfo(); // PostCateModel.EncryptFcateID = Info.PostId.ToString(); // PostCateModel.Title = Info.PostName; // if (ChildList) PostCateModel.ChildCourseFCateView = ConvertToPostCate(PostBLL.ReadPostList(Info.PostId), false); // PostCateList.Add(PostCateModel); // } // } // return PostCateList; //} private List <MCourseInfo> GetCourseList() { int postID = RequestHelper.GetForm <int>("postID"); int page = RequestHelper.GetForm <int>("pageIndex"); int pageSize = RequestHelper.GetForm <int>("pageSize"); int classID = RequestHelper.GetForm <int>("classID"); if (pageSize <= 0) { pageSize = base.PageSize; } List <MCourseInfo> CourseList = new List <MCourseInfo>(); int userID = base.UserID; string prepaidCourseId = BLLMTestCate.ReadPrepaidTestCate(userID); if (postID < 0) { postID = int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId")); } List <ProductInfo> productList = new List <ProductInfo>(); string inProductID = PostBLL.ReadPostCourseID(base.UserCompanyID, postID); string passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1)); inProductID = StringHelper.SubString(inProductID, passPostCourseID); ProductSearchInfo productSearch = new ProductSearchInfo(); if (!string.IsNullOrEmpty(inProductID)) { productSearch.InProductID = inProductID; productSearch.IsSale = 1; if (classID > 0) { productSearch.ClassID = "|" + classID + "|"; } productSearch.OrderField = "[IsTop],[ClassID],[Sort],[ID]"; productList = ProductBLL.SearchProductList(page, pageSize, productSearch, ref base.Count); } int pageCount = (int)Math.Ceiling((double)base.Count / pageSize); //加载选修课程(岗位课程罗列完成后,再加载选修) if ((classID < 0 || classID == 6) && (page == pageCount) && StringHelper.CompareSingleString("4,5,64", UserBLL.ReadUser(base.UserID).StudyPostID.ToString())) { productSearch.InProductID = string.Empty; productSearch.ClassID = "|6|"; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = "必修"; productSearch.IsSale = 1; productList.AddRange(ProductBLL.SearchProductList(productSearch)); } //加载认证考试 if ((classID < 0 && page == 1) || classID == 4387) { PostPassInfo passpost = new PostPassInfo(); passpost.UserId = base.UserID; passpost.IsRZ = 0; RenZhengCateInfo rzCate = new RenZhengCateInfo(); rzCate.InPostID = PostPassBLL.PassPostString(passpost); string rzProductID = RenZhengCateBLL.ReadTestCateID(rzCate); if (!string.IsNullOrEmpty(rzProductID)) { productSearch.InProductID = rzProductID; productSearch.ClassID = string.Empty; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; productList.InsertRange(0, ProductBLL.SearchProductList(productSearch)); } } //加载大课件 if ((classID < 0 && page == 1) || classID == 5298) { productSearch.InProductID = string.Empty; productSearch.InBrandID = string.Empty; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; productSearch.ClassID = "|5298|"; productList.InsertRange(0, ProductBLL.SearchProductList(productSearch)); } //加载指定时间考试 if (classID < 0 && page == 1) { string parentCompanyID = base.ParentCompanyID; if (string.IsNullOrEmpty(parentCompanyID)) { parentCompanyID = base.UserCompanyID.ToString(); } else { parentCompanyID += "," + base.UserCompanyID.ToString(); } List <TestSettingInfo> specialTestList = TestSettingBLL.ReadSpecialTestList(parentCompanyID); if (specialTestList.Count > 0) { string specialCourseID = TestSettingBLL.ReadSpecialTestCourseID(specialTestList); if (!string.IsNullOrEmpty(specialCourseID)) { productSearch.InProductID = specialCourseID; productSearch.ClassID = string.Empty; productSearch.InBrandID = base.CompanyBrandID; productSearch.NotLikeName = string.Empty; productSearch.IsSale = 1; List <ProductInfo> specialProductList = ProductBLL.SearchProductList(productSearch); productList.InsertRange(0, specialProductList); } } } //重新获取产品ID串 inProductID = ProductBLL.ReadProductIdStr(productList); passPostCourseID = string.IsNullOrEmpty(inProductID) ? "" : TestPaperBLL.ReadCourseIDStr(TestPaperBLL.ReadList(base.UserID, inProductID, 1)); //获取未通过的最新记录 string noPassCourseID = StringHelper.SubString(inProductID, passPostCourseID); List <TestPaperReportInfo> noPassTestPaperList = string.IsNullOrEmpty(noPassCourseID) ? new List <TestPaperReportInfo>() : TestPaperBLL.ReadThelatestList(base.UserID, noPassCourseID); List <AttributeRecordInfo> attributeRecordList = AttributeRecordBLL.ReadList("5", noPassCourseID); foreach (ProductInfo Info in productList) { //通过的课程不用显示 //if (!StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString())) { TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(base.UserCompanyID, Info.ID); MCourseInfo CourseModel = new MCourseInfo(); CourseModel.ClassID = Info.ID.ToString(); CourseModel.Title = Info.Name; CourseModel.IsPass = false; CourseModel.PageCount = pageCount; TestPaperReportInfo currentPaper = noPassTestPaperList.Find(delegate(TestPaperReportInfo tempPaper) { return(tempPaper.CourseID == Info.ID); }); if (currentPaper != null) { //剩余时间 int remainingTime = (testSetting.TestInterval - (int)(DateTime.Now - currentPaper.TestDate).TotalHours); CourseModel.ValidDateShow = remainingTime > 0 ? remainingTime.ToString() : ""; } CourseModel.OriginalPrice = Info.MarketPrice.ToString(); if (!string.IsNullOrEmpty(Info.ProductNumber)) { CourseModel.IsVideo = true; } if (!string.IsNullOrEmpty(Info.Accessory)) { CourseModel.IsTest = true; //通过的课程不用再考 if (StringHelper.CompareSingleString(passPostCourseID, Info.ID.ToString())) { CourseModel.IsTest = false; } if (testSetting != null && (testSetting.TestStartTime != null || testSetting.TestEndTime != null)) { //指定时间考试考过了就不要再考了 if (!string.IsNullOrEmpty(CourseModel.ValidDateShow)) { CourseModel.IsTest = false; } if (DateTime.Now < testSetting.TestStartTime || DateTime.Now > testSetting.TestEndTime) { CourseModel.IsTest = false; } } } CourseModel.IsPostCourse = true; CourseModel.IsPrepaidCourse = StringHelper.CompareSingleString(prepaidCourseId, Info.ID.ToString()); //产品知识 练车剧本地址 { CourseModel.RCUrl = AttributeRecordBLL.ReadAttributeRecord(attributeRecordList, 5, Info.ID).Value; if (!string.IsNullOrEmpty(CourseModel.RCUrl)) { CourseModel.IsRC = true; } } CourseList.Add(CourseModel); } } return(CourseList); }
public List <ProductInfo> SearchList(int currentPage, int pageSize, ProductSearchInfo searchInfo, ref int count) { using (var conn = new SqlConnection(connectString)) { ShopMssqlPagerClass pc = new ShopMssqlPagerClass(); //pc.TableName = "Product"; pc.TableName = "View_productStorage";//视图统计规格库存 pc.Fields = "[Id], [ShopId], [Name], [SubTitle], [ClassId], [Spelling], [Color], [FontStyle], [BrandId], [ProductNumber], [ProductCode], [MarketPrice], [BidPrice], [SalePrice], [Weight], [SendPoint], [Photo], [Keywords], [Summary], [Remark], [IsSpecial], [IsNew], [IsHot], [IsSale], [IsTop], [Accessory], [RelationProduct], [RelationArticle], [ViewCount], [AllowComment], [CommentCount], [SumPoint], [PerPoint], [PhotoCount], [CollectCount], [TotalStorageCount], [OrderCount], [SendCount], [ImportActualStorageCount], [ImportVirtualStorageCount], [LowerCount], [UpperCount], [AddDate], [TaobaoId], [OrderId], [Unit], [TaxRate], [LikeNum], [UnLikeNum], [ProductionPlace], [GrossRate],[StandardType],[SellPoint],[IsDelete],[Qrcode],[VirtualOrderCount],[UseVirtualOrder],[OpenGroup],[GroupPrice],[GroupQuantity],[GroupPhoto],[YejiRatio]"; pc.CurrentPage = currentPage; pc.PageSize = pageSize; //如果只用一个排序字段,分页存储过程则使用top方式。否则,使用row_number方式进行分页 //pc.OrderField = "[OrderId]"; pc.OrderField = "[OrderId],[Id]"; pc.OrderType = searchInfo.OrderType; if (searchInfo.ProductOrderType != string.Empty) { switch (searchInfo.ProductOrderType) { case "CommentCount": pc.OrderField = "[CommentCount],[OrderId],[ID]"; break; case "SalePriceDown": pc.OrderField = "[SalePrice],[OrderId],[ID]"; pc.OrderType = OrderType.Desc; break; case "SalePriceUp": pc.OrderField = "[SalePrice],[OrderId],[ID]"; pc.OrderType = OrderType.Asc; break; case "CollectCount": pc.OrderField = "[CollectCount],[OrderId],[ID]"; break; case "ViewCount": pc.OrderField = "[ViewCount],[OrderId],[ID]"; break; case "OrderCount": pc.OrderField = "[OrderCount],[OrderId],[ID]"; break; case "LikeNum": pc.OrderField = "[LikeNum],[OrderId],[ID]"; break; case "AddDate": pc.OrderField = "[AddDate],[OrderId],[ID]"; break; default: break; } } //pc.OrderType =OrderType.Desc; pc.MssqlCondition = PrepareCondition(searchInfo); count = pc.Count; var temppc = conn.Query <ProductInfo>(pc); return(conn.Query <ProductInfo>(pc).ToList()); } }
private void ReadCart() { this.cartList = CartBLL.ReadCartList(base.UserID); string strProductID = string.Empty; foreach (CartInfo info in this.cartList) { if (strProductID == string.Empty) { strProductID = info.ProductID.ToString(); } else { strProductID = strProductID + "," + info.ProductID.ToString(); } } if (strProductID != string.Empty) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = strProductID; this.productList = ProductBLL.SearchProductList(productSearch); } List <MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); foreach (CartInfo info in this.cartList) { ProductInfo product = ProductBLL.ReadProductByProductList(this.productList, info.ProductID); info.ProductWeight = product.Weight; info.SendPoint = product.SendPoint; if (ShopConfig.ReadConfigInfo().ProductStorageType == 1) { info.LeftStorageCount = product.TotalStorageCount - product.OrderCount; } else { info.LeftStorageCount = product.ImportVirtualStorageCount; } info.ProductPrice = MemberPriceBLL.ReadCurrentMemberPrice(memberPriceList, base.GradeID, product); } CartBLL.HandlerCartList(this.cartList, ref this.cartGiftPackVirtualList, ref this.cartCommonProductVirtualList); int num = 0; decimal num2 = 0M; decimal num3 = 0M; foreach (CartGiftPackVirtualInfo info4 in this.cartGiftPackVirtualList) { num3 += info4.TotalProductWeight * info4.GiftPackBuyCount; num2 += info4.TotalPrice * info4.GiftPackBuyCount; } foreach (CartCommonProductVirtualInfo info5 in this.cartCommonProductVirtualList) { num3 += info5.FatherCart.ProductWeight * info5.FatherCart.BuyCount; num2 += info5.FatherCart.ProductPrice * info5.FatherCart.BuyCount; } foreach (CartInfo info in this.cartList) { if (info.FatherID == 0) { num += info.BuyCount; } } Sessions.ProductBuyCount = num; Sessions.ProductTotalPrice = num2; Sessions.ProductTotalWeight = num3; }
public MssqlCondition PrepareCondition(ProductSearchInfo productSearch) { MssqlCondition mssqlCondition = new MssqlCondition(); string condition = string.Empty; if (!string.IsNullOrEmpty(productSearch.Key)) { condition = "([Name]" + " LIKE '%" + StringHelper.SearchSafe(productSearch.Key) + "%' OR "; condition += "[Spelling]" + " LIKE '%" + StringHelper.SearchSafe(productSearch.Key) + "%' OR "; condition += "[ProductNumber]" + " LIKE '%" + StringHelper.SearchSafe(productSearch.Key) + "%')"; mssqlCondition.Add(condition); } mssqlCondition.Add("[Name]", productSearch.Name, ConditionType.Like); mssqlCondition.Add("[Spelling]", productSearch.Spelling, ConditionType.Like); mssqlCondition.Add("[ProductNumber]", productSearch.ProductNumber, ConditionType.Like); mssqlCondition.Add("[Keywords]", productSearch.Keywords, ConditionType.Like); mssqlCondition.Add("[BrandId]", productSearch.BrandId, ConditionType.Equal); mssqlCondition.Add("[ClassId]", productSearch.ClassId, ConditionType.Like); mssqlCondition.Add("[IsSpecial]", productSearch.IsSpecial, ConditionType.Equal); mssqlCondition.Add("[IsNew]", productSearch.IsNew, ConditionType.Equal); mssqlCondition.Add("[IsHot]", productSearch.IsHot, ConditionType.Equal); mssqlCondition.Add("[IsSale]", productSearch.IsSale, ConditionType.Equal); mssqlCondition.Add("[IsTop]", productSearch.IsTop, ConditionType.Equal); mssqlCondition.Add("[AddDate]", productSearch.StartAddDate, ConditionType.MoreOrEqual); mssqlCondition.Add("[AddDate]", productSearch.EndAddDate, ConditionType.Less); mssqlCondition.Add("[Id]", productSearch.InProductId, ConditionType.In); mssqlCondition.Add("[Id]", productSearch.NotInProductId, ConditionType.NotIn); mssqlCondition.Add("[StandardType]", productSearch.StandardType, ConditionType.Equal); mssqlCondition.Add("[ShopId]", productSearch.InShopId, ConditionType.In); mssqlCondition.Add("[IsDelete]", productSearch.IsDelete, ConditionType.Equal); mssqlCondition.Add("[Id]", productSearch.InProductId, ConditionType.In); mssqlCondition.Add("[OpenGroup]", productSearch.OpenGroup, ConditionType.Equal); if (productSearch.StockStart > 0) { mssqlCondition.Add("[TotalStorageCount]-[OrderCount]", productSearch.StockStart, ConditionType.MoreOrEqual); } if (productSearch.StockEnd > 0) { mssqlCondition.Add("[TotalStorageCount]-[OrderCount]", productSearch.StockEnd, ConditionType.LessOrEqual); } if (productSearch.StorageAnalyse != 0) { string field = "[TotalStorageCount]-[OrderCount]"; if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.ImportStorageSystem) { field = "[ImportActualStorageCount]"; } //edit by suano at 2116-11-8, change to normal storage type; switch (productSearch.StorageAnalyse) { case (int)StorageAnalyseType.Lack: mssqlCondition.Add(field + "<=[LowerCount]"); break; case (int)StorageAnalyseType.Safe: mssqlCondition.Add(field + ">[LowerCount]"); break; case (int)StorageAnalyseType.Over: mssqlCondition.Add(field + ">[UpperCount]"); break; default: break; } } //售价筛选 if (productSearch.LowerSalePrice >= 0) { mssqlCondition.Add("[SalePrice]", productSearch.LowerSalePrice, ConditionType.MoreOrEqual); } if (productSearch.UpperSalePrice >= 0) { mssqlCondition.Add("[SalePrice]", productSearch.UpperSalePrice, ConditionType.LessOrEqual); } //销量筛选 if (productSearch.LowerOrderCount >= 0) { mssqlCondition.Add("[OrderCount]", productSearch.LowerOrderCount, ConditionType.MoreOrEqual); } if (productSearch.UpperOrderCount >= 0) { mssqlCondition.Add("[OrderCount]", productSearch.UpperOrderCount, ConditionType.LessOrEqual); } //if (productSearch.Tags != string.Empty) //{ // mssqlCondition.Add("[Id] IN(SELECT [ProductId] FROM " + ShopMssqlHelper.TablePrefix + "Tags WHERE [Word]='" + StringHelper.SearchSafe(productSearch.Tags) + "')"); //} return(mssqlCondition); }
protected override void PageLoad() { base.PageLoad(); int queryString = RequestHelper.GetQueryString <int>("ID"); this.product = ProductBLL.ReadProduct(queryString); if (this.product.IsSale == 0) { ScriptHelper.Alert("该产品未上市,不能查看"); } ProductBLL.ChangeProductViewCount(queryString, 1); this.userGradeList = UserGradeBLL.ReadUserGradeCacheList(); this.memberPriceList = MemberPriceBLL.ReadMemberPriceByProduct(queryString); this.currentMemberPrice = (this.product.MarketPrice * UserGradeBLL.ReadUserGradeCache(base.GradeID).Discount) / 100M; foreach (MemberPriceInfo info in this.memberPriceList) { if (info.GradeID == base.GradeID) { this.currentMemberPrice = info.Price; break; } } this.currentMemberPrice = Math.Round(this.currentMemberPrice, 2); ProductPhotoInfo item = new ProductPhotoInfo(); item.Name = this.product.Name; item.Photo = this.product.Photo; this.productPhotoList.Add(item); this.productPhotoList.AddRange(ProductPhotoBLL.ReadProductPhotoByProduct(queryString)); this.strHistoryProduct = base.Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); string strProductID = (this.product.RelationProduct + "," + this.product.Accessory + "," + this.strHistoryProduct).Replace(",,", ","); if (strProductID.StartsWith(",")) { strProductID = strProductID.Substring(1); } if (strProductID.EndsWith(",")) { strProductID = strProductID.Substring(0, strProductID.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = strProductID; this.tempProductList = ProductBLL.SearchProductList(productSearch); if (strProductID != string.Empty) { this.tempMemberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, base.GradeID); } this.attributeRecordList = AttributeRecordBLL.ReadAttributeRecordByProduct(queryString); TagsSearchInfo tags = new TagsSearchInfo(); tags.ProductID = queryString; this.productTagsList = TagsBLL.SearchTagsList(tags); if (this.product.RelationArticle != string.Empty) { ArticleSearchInfo articleSearch = new ArticleSearchInfo(); articleSearch.InArticleID = this.product.RelationArticle; this.productArticleList = ArticleBLL.SearchArticleList(articleSearch); } this.standardRecordList = StandardRecordBLL.ReadStandardRecordByProduct(this.product.ID, this.product.StandardType); if ((this.standardRecordList.Count > 0) && (this.product.StandardType == 1)) { string[] strArray = this.standardRecordList[0].StandardIDList.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { StandardInfo info6 = StandardBLL.ReadStandardCache(Convert.ToInt32(strArray[i])); string[] strArray2 = info6.ValueList.Split(new char[] { ',' }); string[] strArray3 = info6.PhotoList.Split(new char[] { ',' }); string str2 = string.Empty; string str3 = string.Empty; for (int j = 0; j < strArray2.Length; j++) { foreach (StandardRecordInfo info7 in this.standardRecordList) { string[] strArray4 = info7.ValueList.Split(new char[] { ',' }); if (strArray2[j] == strArray4[i]) { str2 = str2 + strArray2[j] + ","; str3 = str3 + strArray3[j] + ","; goto Label_043B; } } Label_043B :; } if (str2 != string.Empty) { str2 = str2.Substring(0, str2.Length - 1); str3 = str3.Substring(0, str3.Length - 1); } info6.ValueList = str2; info6.PhotoList = str3; this.standardList.Add(info6); } foreach (StandardRecordInfo info7 in this.standardRecordList) { object standardRecordValueList = this.standardRecordValueList; this.standardRecordValueList = string.Concat(new object[] { standardRecordValueList, info7.ProductID, ",", info7.ValueList, "|" }); } } if (ShopConfig.ReadConfigInfo().ProductStorageType == 1) { this.leftStorageCount = this.product.TotalStorageCount - this.product.OrderCount; } else { this.leftStorageCount = this.product.ImportVirtualStorageCount; } base.Title = this.product.Name; base.Keywords = (this.product.Keywords == string.Empty) ? this.product.Name : this.product.Keywords; base.Description = (this.product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(this.product.Introduction), 200) : this.product.Summary; }
public DataTable StatisticsSaleDetail(int currentPage, int pageSize, OrderSearchInfo orderSearch, ProductSearchInfo productSearch, ref int count) { ShopMssqlPagerClass pc = new ShopMssqlPagerClass(); pc.TableName = "View_SaleDetail"; pc.Fields = "[Id],[Name],[ClassId],[BrandId],[BuyCount],[Money],[OrderNumber],[AddDate],[UserName]"; pc.CurrentPage = currentPage; pc.PageSize = pageSize; pc.OrderField = "[AddDate],[Id]"; pc.OrderType = OrderType.Desc; pc.MssqlCondition = PrepareCondition(orderSearch, productSearch); count = pc.Count; return(pc.ExecuteDataTable()); }
protected void ExportButton_Click(object sender, EventArgs e) { ProductSearchInfo productSearch = new ProductSearchInfo(); OrderSearchInfo orderSearch = new OrderSearchInfo(); productSearch.IsSale = (int)BoolType.True; productSearch.Name = ShopCommon.ConvertToT <string>(Name.Text); productSearch.ClassId = ShopCommon.ConvertToT <string>(ClassID.Text); productSearch.BrandId = ShopCommon.ConvertToT <int>(BrandID.Text); orderSearch.StartAddDate = ShopCommon.ConvertToT <DateTime>(StartAddDate.Text); orderSearch.EndAddDate = ShopCommon.SearchEndDate(ShopCommon.ConvertToT <DateTime>(EndAddDate.Text)); orderSearch.UserName = ShopCommon.ConvertToT <string>(UserName.Text); orderSearch.OrderNumber = ShopCommon.ConvertToT <string>(OrderNumber.Text); var data = OrderDetailBLL.StatisticsSaleDetail(1, 1000, orderSearch, productSearch, ref Count); NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); NPOI.SS.UserModel.ISheet sheet = book.CreateSheet("Sheet1"); sheet.DefaultColumnWidth = 18; sheet.CreateFreezePane(0, 1, 0, 1); NPOI.SS.UserModel.IRow row = sheet.CreateRow(0); row.Height = 20 * 20; row.CreateCell(0).SetCellValue("时间"); row.CreateCell(1).SetCellValue("单号"); row.CreateCell(2).SetCellValue("商品名称"); row.CreateCell(3).SetCellValue("数量"); row.CreateCell(4).SetCellValue("金额"); row.CreateCell(5).SetCellValue("用户名"); //设置表头格式 var headFont = book.CreateFont(); headFont.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold; headFont.FontHeightInPoints = 10; var headStyle = book.CreateCellStyle(); headStyle.SetFont(headFont); headStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; headStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; foreach (var cell in row.Cells) { cell.CellStyle = headStyle; } foreach (DataRow dr in data.Rows) { NPOI.SS.UserModel.IRow dataRow = sheet.CreateRow(data.Rows.IndexOf(dr) + 1); dataRow.CreateCell(0).SetCellValue(Convert.ToString(dr["AddDate"])); dataRow.CreateCell(1).SetCellValue(Convert.ToString(dr["OrderNumber"])); dataRow.CreateCell(2).SetCellValue(Convert.ToString(dr["Name"])); dataRow.CreateCell(3).SetCellValue(Convert.ToString(dr["BuyCount"])); dataRow.CreateCell(4).SetCellValue(Convert.ToString(dr["Money"])); dataRow.CreateCell(5).SetCellValue(Convert.ToString(dr["UserName"])); var style = book.CreateCellStyle(); style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left; foreach (var cell in dataRow.Cells) { cell.CellStyle = style; } } System.IO.MemoryStream ms = new System.IO.MemoryStream(); book.Write(ms); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff"))); Response.BinaryWrite(ms.ToArray()); book = null; ms.Close(); ms.Dispose(); Response.End(); }
protected void ExportButton_Click(object sender, EventArgs e) { ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.IsSale = (int)BoolType.True; productSearch.Name = ShopCommon.ConvertToT <string>(Name.Text); productSearch.ClassId = ShopCommon.ConvertToT <string>(ClassID.Text); productSearch.BrandId = ShopCommon.ConvertToT <int>(BrandID.Text); productSearch.StorageAnalyse = ShopCommon.ConvertToT <int>(StorageAnalyse.Text); var data = ProductBLL.SearchList(1, 1000, productSearch, ref Count); NPOI.HSSF.UserModel.HSSFWorkbook book = new NPOI.HSSF.UserModel.HSSFWorkbook(); NPOI.SS.UserModel.ISheet sheet = book.CreateSheet("Sheet1"); sheet.DefaultColumnWidth = 18; sheet.CreateFreezePane(0, 1, 0, 1); NPOI.SS.UserModel.IRow row = sheet.CreateRow(0); row.Height = 20 * 20; row.CreateCell(0).SetCellValue("商品名称"); row.CreateCell(1).SetCellValue("剩余库存量"); row.CreateCell(2).SetCellValue("库存下限"); row.CreateCell(3).SetCellValue("库存上限"); //设置表头格式 var headFont = book.CreateFont(); headFont.Boldweight = (short)NPOI.SS.UserModel.FontBoldWeight.Bold; headFont.FontHeightInPoints = 10; var headStyle = book.CreateCellStyle(); headStyle.SetFont(headFont); headStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.Center; headStyle.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin; headStyle.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin; foreach (var cell in row.Cells) { cell.CellStyle = headStyle; } foreach (var entity in data) { NPOI.SS.UserModel.IRow dataRow = sheet.CreateRow(data.IndexOf(entity) + 1); dataRow.CreateCell(0).SetCellValue(entity.Name); dataRow.CreateCell(1).SetCellValue(ShowStorageCount(entity.TotalStorageCount - entity.SendCount, entity.ImportActualStorageCount)); dataRow.CreateCell(2).SetCellValue(Convert.ToString(entity.LowerCount)); dataRow.CreateCell(3).SetCellValue(Convert.ToString(entity.UpperCount)); var style = book.CreateCellStyle(); style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left; foreach (var cell in dataRow.Cells) { cell.CellStyle = style; } } System.IO.MemoryStream ms = new System.IO.MemoryStream(); book.Write(ms); Response.AddHeader("Content-Disposition", string.Format("attachment; filename={0}.xls", DateTime.Now.ToString("yyyyMMddHHmmssfff"))); Response.BinaryWrite(ms.ToArray()); book = null; ms.Close(); ms.Dispose(); Response.End(); }
public void PrepareCondition(MssqlCondition mssqlCondition, OrderSearchInfo orderSearch, ProductSearchInfo productSearch) { mssqlCondition.Add("[OrderNumber]", orderSearch.OrderNumber, ConditionType.Like); mssqlCondition.Add("[AddDate]", orderSearch.StartAddDate, ConditionType.MoreOrEqual); mssqlCondition.Add("[AddDate]", orderSearch.EndAddDate, ConditionType.LessOrEqual); mssqlCondition.Add("[UserName]", orderSearch.UserName, ConditionType.Like); mssqlCondition.Add("[Name]", productSearch.Name, ConditionType.Like); //mssqlCondition.Add("[BrandID]", productSearch.BrandID, ConditionType.Equal); mssqlCondition.Add("[ClassID]", productSearch.ClassID, ConditionType.Like); mssqlCondition.Add("[ProductID]", productSearch.InProductID, ConditionType.In); }
protected override void PageLoad() { base.PageLoad(); var queryClass = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("cat"))).Split(','); int classLevel1 = 0, classLevel2 = 0, classLevel3 = 0; if (queryClass.Length > 0) { classLevel1 = ShopCommon.ConvertToT <int>(queryClass[0]); } if (queryClass.Length > 1) { classLevel2 = ShopCommon.ConvertToT <int>(queryClass[1]); } if (queryClass.Length > 2) { classLevel3 = ShopCommon.ConvertToT <int>(queryClass[2]); } int currentClassId = classLevel3 > 0 ? classLevel3 : classLevel2 > 0 ? classLevel2 : classLevel1; //if (currentClassId < 1) ResponseHelper.Redirect("/"); if (currentClassId < 1) { currentClassId = 0; } if (classLevel1 > 0) { switch (classLevel1) { case 1: topNav = 2; break; case 2: topNav = 3; break; case 4: topNav = 4; break; case 6: topNav = 5; break; } } //面包屑区域--分类 showClassList = ProductClassBLL.ReadList(); currentClass = showClassList.FirstOrDefault(k => k.Id == currentClassId) ?? new ProductClassInfo(); levelClass.Add("level1", showClassList.FirstOrDefault(k => k.Id == classLevel1) ?? new ProductClassInfo()); levelClass.Add("level2", showClassList.FirstOrDefault(k => k.Id == classLevel2) ?? new ProductClassInfo()); levelClass.Add("level3", showClassList.FirstOrDefault(k => k.Id == classLevel3) ?? new ProductClassInfo()); if (currentClassId < 1) { currentClassId = 0; } //热门商品 int hotCount = 0; if (currentClassId > 0) { hotProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo { IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False, ClassId = "|" + currentClassId + "|" }, ref hotCount); } else { hotProductList = ProductBLL.SearchList(1, 5, new ProductSearchInfo { IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False }, ref hotCount); } //商品列表 currentPage = RequestHelper.GetQueryString <int>("Page"); if (currentPage < 1) { currentPage = 1; } int pageSize = 20; int count = 0; string brandIds = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("brand"))); string attributeIds = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("at"))); string attributeValues = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("ex"))); string orderField = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("sort"))); string orderType = ""; var orderParams = orderField.Split('_'); if (orderParams.Length > 1) { orderField = orderParams[0]; orderType = orderParams[1]; } int minPrice = RequestHelper.GetQueryString <int>("min"); int maxPrice = RequestHelper.GetQueryString <int>("max"); keywords = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("kw"))); string stf_Keyword = StringHelper.AddSafe(HttpUtility.UrlDecode(RequestHelper.GetQueryString <string>("stf_Keyword"))); if (!string.IsNullOrEmpty(stf_Keyword)) { if (string.IsNullOrEmpty(keywords)) { keywords = stf_Keyword; } } int isNew = RequestHelper.GetQueryString <int>("isNew"); int isHot = RequestHelper.GetQueryString <int>("isHot"); int isSpecial = RequestHelper.GetQueryString <int>("isSpecial"); int isTop = RequestHelper.GetQueryString <int>("isTop"); productList = ProductBLL.SearchList(currentPage, pageSize, currentClassId, brandIds, attributeIds, attributeValues, orderField, orderType, minPrice, maxPrice, keywords, stf_Keyword, isNew, isHot, isSpecial, isTop, ref count, ref showAttributeList, ref showBrandList); pagecount = (int)Math.Round((double)(count + 0.1) / pageSize, 0); if (pagecount <= 0) { pagecount = 1; } pager.Init(currentPage, pageSize, count, !string.IsNullOrEmpty(isMobile)); pager.ShowType = 3; #region 如果没有查找到商品则显示RequestHelper.GetQueryString<string>("brand")获取的所有品牌 if (count <= 0) { string[] _brandids = brandIds.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); int[] _showbrandids = Array.ConvertAll <string, int>(_brandids, s => Convert.ToInt32(s)); showBrandList = ProductBrandBLL.ReadList(_showbrandids); } #endregion #region 添加热门关键词 //如果有搜索结果且关键词不为空 if (productList.Count > 0 && !string.IsNullOrEmpty(keywords)) { var theSearchKey = HotSearchKeyBLL.Read(keywords); //之前没有则增加 if (theSearchKey.Id <= 0) { theSearchKey.Name = StringHelper.AddSafe(HttpUtility.HtmlEncode(keywords)); theSearchKey.SearchTimes = 1; HotSearchKeyBLL.Add(theSearchKey); } else { //有则修改更新搜索次数 theSearchKey.SearchTimes += 1; HotSearchKeyBLL.Update(theSearchKey); } } #endregion if (classLevel3 > 0) { thisProductClass = ProductClassBLL.Read(classLevel3); } else if (classLevel2 > 0) { thisProductClass = ProductClassBLL.Read(classLevel2); } else { thisProductClass = ProductClassBLL.Read(classLevel1); } //浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); if (strHistoryProduct.StartsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(1); } if (strHistoryProduct.EndsWith(",")) { strHistoryProduct = strHistoryProduct.Substring(0, strHistoryProduct.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = strHistoryProduct; productSearch.IsSale = 1; productSearch.IsDelete = 0; tempProductList = ProductBLL.SearchList(productSearch); Title = thisProductClass.PageTitle.Trim() == "" ? thisProductClass.Name : thisProductClass.PageTitle; Keywords = thisProductClass.PageKeyWord.Trim() == "" ? thisProductClass.Name : thisProductClass.PageKeyWord; //Description = thisProductClass.PageSummary.Trim() == "" ? thisProductClass.Remark : thisProductClass.PageSummary; Description = thisProductClass.PageSummary; }