/// <summary> /// 读取指定分类的岗位课程ID串 /// </summary> /// <param name="companyID"></param> /// <param name="postID"></param> /// <param name="classID"></param> /// <param name="postProductList"></param> /// <returns></returns> public static string ReadPostCourseID(int companyID, int postID, int classID, ref List <ProductInfo> postProductList) { string postCourseID = string.Empty; ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = ReadPostCourseID(companyID, postID); productSearch.ClassID = "|" + classID.ToString() + "|"; //productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString(); productSearch.OrderField = "Order by [Sort],[Name],[ID] desc"; if (!string.IsNullOrEmpty(productSearch.InProductID)) { postProductList = ProductBLL.SearchProductList(productSearch); foreach (ProductInfo product in postProductList) { postCourseID += "," + product.ID.ToString(); } if (postCourseID.StartsWith(",")) { postCourseID = postCourseID.Substring(1); } } return(postCourseID); }
/// <summary> /// 读取品牌内的岗位课程ID串 /// </summary> /// <param name="postID"></param> /// <param name="brandID"></param> /// <returns></returns> public static string ReadPostCourseID(int postID, string brandID) { string postCourseID = string.Empty; ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductID = ReadPostCourseID(postID); productSearch.IsSale = 1; productSearch.InBrandID = brandID; //productSearch.InCompanyID = CompanyBLL.SystemCompanyId.ToString(); if (!string.IsNullOrEmpty(productSearch.InProductID)) { List <ProductInfo> productList = ProductBLL.SearchProductList(productSearch); foreach (ProductInfo product in productList) { postCourseID += "," + product.ID.ToString(); } if (postCourseID.StartsWith(",")) { postCourseID = postCourseID.Substring(1); } } return(postCourseID); }
/// <summary> /// 删除题库名称及题库 /// </summary> /// <param name="Id"></param> public static void DeleteCourse(int Id) { ProductBLL.UpdateProductAccessoryByCourseId(Id); QuestionBLL.DeleteQuestionByCateId(Id); dal.DeleteCourse(Id); }
/// <summary> /// 计算考试成绩 /// </summary> /// <returns></returns> public static TestPaperInfo CalcTestResult(int companyID, int userID, int productID) { TestPaperInfo PaperModel = new TestPaperInfo(); string filePath = ReadTestPaperPath(userID, productID); TestPaperReportInfo testPaper = ReadTheLatestPaper(userID, productID); TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); if (File.Exists(filePath) && (testPaper.TestDate == DateTime.MinValue || (DateTime.Now - testPaper.TestDate).TotalHours >= testSetting.TestInterval)) { XmlHelper XmlDoc = new XmlHelper(filePath); int QuestionNum = int.Parse(XmlDoc.ReadAttribute("TestPaper", "QuestionNum")); decimal Scorse = 0; //试卷得分 int RightNum = 0; //正确的题目数量 //从xml里读取答案,进行校卷 string QuestionList = string.Empty; string UserAnswerList = string.Empty; for (int StyleId = 1; StyleId <= 3; StyleId++) { string NodeName = GetTestPaperStyleNodeName(StyleId); //判断题型库里是否有考题 XmlNode Node = XmlDoc.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc.ReadChildNodes(NodeName); //遍历节点 foreach (XmlNode node in NodeList) { QuestionList = QuestionList + "," + node.ChildNodes[9].InnerText; UserAnswerList = UserAnswerList + "," + node.ChildNodes[6].InnerText; if (node.ChildNodes[6].InnerText.ToLower() == node.ChildNodes[5].InnerText.ToLower()) { RightNum = RightNum + 1; } } } } //UserInfo user = UserBLL.ReadUser(userID); //TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); if (QuestionNum == 0) { Scorse = 0; } else { Scorse = Convert.ToDecimal(Math.Round((decimal.Parse(testSetting.PaperScore.ToString()) * RightNum / QuestionNum), 1));//这样计算的总分更准备 } if (QuestionList != string.Empty && QuestionList.StartsWith(",")) { QuestionList = QuestionList.Substring(1); UserAnswerList = UserAnswerList.Substring(1); } PaperModel.CateId = productID; PaperModel.PaperName = ProductBLL.ReadProduct(productID).Name; PaperModel.CompanyId = companyID; PaperModel.UserId = userID; PaperModel.QuestionId = QuestionList; PaperModel.Answer = UserAnswerList; PaperModel.Scorse = Scorse; if (Scorse >= testSetting.LowScore) { PaperModel.Point = 2; PaperModel.IsPass = 1; } else { PaperModel.IsPass = 0; } UserLogBLL.AddUserLog(ShopLanguage.ReadLanguage("ApplyTest"), ShopLanguage.ReadLanguage("TestPaper"), ProductBLL.ReadProduct(productID).Name); TestPaperBLL.AddPaper(PaperModel); File.SetLastWriteTime(filePath, DateTime.Now); } if ((testPaper.TestDate > DateTime.MinValue && (DateTime.Now - testPaper.TestDate).TotalHours < testSetting.TestInterval)) { PaperModel.Scorse = testPaper.Score; } //解除本课程的考试限制 //TestSettingBLL.TestEnd(userID, productID); return(PaperModel); }
public static void StaticsCart(int userID, int gradeID) { List <CartGiftPackVirtualInfo> cartGiftPackVirtualList = new List <CartGiftPackVirtualInfo>(); List <CartCommonProductVirtualInfo> cartCommonProductVirtualList = new List <CartCommonProductVirtualInfo>(); List <ProductInfo> productList = new List <ProductInfo>(); List <CartInfo> cartList = ReadCartList(userID); string strProductID = string.Empty; foreach (CartInfo info in 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; } productList = ProductBLL.SearchProductList(productSearch); } List <MemberPriceInfo> memberPriceList = MemberPriceBLL.ReadMemberPriceByProductGrade(strProductID, gradeID); foreach (CartInfo info in cartList) { ProductInfo product = ProductBLL.ReadProductByProductList(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, gradeID, product); } HandlerCartList(cartList, ref cartGiftPackVirtualList, ref cartCommonProductVirtualList); int num = 0; decimal num2 = 0M; decimal num3 = 0M; foreach (CartGiftPackVirtualInfo info4 in cartGiftPackVirtualList) { num3 += info4.TotalProductWeight * info4.GiftPackBuyCount; num2 += info4.TotalPrice * info4.GiftPackBuyCount; } foreach (CartCommonProductVirtualInfo info5 in cartCommonProductVirtualList) { num3 += info5.FatherCart.ProductWeight * info5.FatherCart.BuyCount; num2 += info5.FatherCart.ProductPrice * info5.FatherCart.BuyCount; } foreach (CartInfo info in cartList) { if (info.FatherID == 0) { num += info.BuyCount; } } Sessions.ProductBuyCount = num; Sessions.ProductTotalPrice = num2; Sessions.ProductTotalWeight = num3; }
public static int AddProductCollect(ProductCollectInfo productCollect) { productCollect.ID = dal.AddProductCollect(productCollect); ProductBLL.ChangeProductCollectCount(productCollect.ProductID, ChangeAction.Plus); return(productCollect.ID); }
public static int AddProductComment(ProductCommentInfo productComment) { productComment.ID = dal.AddProductComment(productComment); ProductBLL.ChangeProductCommentCountAndRank(productComment.ProductID, productComment.Rank, ChangeAction.Plus); return(productComment.ID); }
public static void DeleteProductPhoto(string strID) { UploadBLL.DeleteUploadByRecordID(TableID, strID); ProductBLL.ChangeProductPhotoCountByGeneral(strID, ChangeAction.Minus); dal.DeleteProductPhoto(strID); }