protected void SubmitButton_Click(object sender, EventArgs e) { string text = this.UserName.Text; int queryString = RequestHelper.GetQueryString <int>("ID"); int groupID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "GroupID"); int oldCompanyID = int.MinValue; int oldStudyPostID = int.MinValue; UserInfo user = new UserInfo(); if (queryString > 0) { user = UserBLL.ReadUser(queryString); oldCompanyID = user.CompanyID; oldStudyPostID = user.StudyPostID; } else { Regex regex = new Regex("^([a-zA-Z0-9_一-龥])+$"); if (!regex.IsMatch(text)) { ScriptHelper.Alert("用户名只能包含字母、数字、下划线、中文", RequestHelper.RawUrl); } user.UserPassword = StringHelper.Password(this.UserPassword.Text, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); } user.ID = queryString; companyID = RequestHelper.GetForm <int>("CompanyID"); if (companyID < 0) { ScriptHelper.Alert("请选择公司"); } user.CompanyID = companyID; user.RealName = RealName.Text; user.UserName = text; user.GroupID = groupID; if (user.GroupID <= 0) { ScriptHelper.Alert("请选择管理组"); } user.Email = this.Email.Text; user.Sex = Convert.ToInt32(this.Sex.Text); user.Tel = this.Tel.Text; user.Mobile = this.Mobile.Text; //验证手机号码是否存在 //if (UserBLL.IsExistMobile(user.Mobile, user.ID)) // ScriptHelper.Alert("手机号码已存在"); user.RegisterDate = RequestHelper.DateNow; user.LastLoginDate = RequestHelper.DateNow; user.FindDate = RequestHelper.DateNow; //判断是否需要恢复考试记录 bool isRecoveryTestPaper = false; int userState = Convert.ToInt32(this.Status.Text); if (user.Status == (int)UserState.Del && userState != (int)UserState.Del) { isRecoveryTestPaper = true; } user.Status = userState; string department = this.Department.SelectedValue; user.Department = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "Department"); if (user.Department <= 0) { ScriptHelper.Alert("请选择部门"); } user.WorkingPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "PostList"); if (user.WorkingPostID <= 0) { ScriptHelper.Alert("请选择工作岗位"); } user.PostName = this.PostName.Text; user.StudyPostID = RequestHelper.GetForm <int>(ShopConfig.ReadConfigInfo().NamePrefix + "StudyPostId"); if (user.StudyPostID <= 0) { ScriptHelper.Alert("请选择学习岗位"); } //user.Introduce = this.Introduce.Text; //user.Photo = this.Photo.Text; //user.MSN = this.MSN.Text; //user.QQ = this.QQ.Text; //user.RegionID = this.UserRegion.ClassID; //user.Address = this.Address.Text; //user.Birthday = this.Birthday.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (user.ID == -2147483648) { user.PostStartDate = RequestHelper.DateNow; base.CheckAdminPower("AddUser", PowerCheckType.Single); if (UserBLL.IsUserNumOverflow(user.CompanyID)) { ScriptHelper.Alert("超过用户数量,暂不能添加!"); } int id = UserBLL.AddUser(user); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("User"), id); } else { base.CheckAdminPower("UpdateUser", PowerCheckType.Single); if (!string.IsNullOrEmpty(PostStartDate.Text)) { user.PostStartDate = Convert.ToDateTime(PostStartDate.Text); } //变换学习岗位,如果岗位已通过则更新注册时间,以便岗位计划按新时间重新计数,否则不更改原有岗位计划统计时间 PostInfo studyPost = PostBLL.ReadPost(user.StudyPostID); PostInfo oldStudyPost = PostBLL.ReadPost(oldStudyPostID); if (oldCompanyID != user.CompanyID || (user.StudyPostID != oldStudyPostID && (studyPost.ParentId == 3 || oldStudyPost.ParentId == 3) && studyPost.ParentId != oldStudyPost.ParentId)) { if (user.PostStartDate < DateTime.Today) { user.PostStartDate = DateTime.Today; } } UserBLL.UpdateUser(user); if (isRecoveryTestPaper) { TestPaperBLL.RecoveryPaperByUserID(user.ID.ToString()); } //如果公司ID更改,相应修改成绩列表 //if (oldCompanyID != user.CompanyID) //{ // TestPaperBLL.UpdatePaperCompanyId(user.ID, user.CompanyID); //} AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("User"), user.ID); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
protected void SubmitButton_Click(object sender, EventArgs e) { var ID = RequestHelper.GetQueryString <int>("ID"); var bargain = BargainBLL.ReadBargain(ID); if (bargain.Id > 0 && bargain.EndDate < DateTime.Now) { ScriptHelper.Alert("活动已结束,不能编辑"); } if (bargain.Id > 0 && bargain.EndDate >= DateTime.Now && bargain.StartDate <= DateTime.Now) { ScriptHelper.Alert("活动进行中,不能编辑"); } bargain.Name = Name.Text; bargain.StartDate = DateTime.Parse(StartDate.Text); bargain.EndDate = DateTime.Parse(EndDate.Text); if (bargain.StartDate >= bargain.EndDate) { ScriptHelper.Alert("结束时间不能小于开始时间"); } //if (!Unlimited.Checked && string.IsNullOrEmpty(LimitCount.Text)) //{ // ScriptHelper.Alert("请填写助力限制次数"); //} //bargain.LimitCount = Unlimited.Checked ? int.MaxValue : int.Parse(LimitCount.Text); if (string.IsNullOrEmpty(LimitCount.Text)) { ScriptHelper.Alert("请填写助力限制次数"); } bargain.LimitCount = int.Parse(LimitCount.Text); bargain.NumberPeople = int.Parse(NumberPeople.Text); //bargain.SuccessRate = int.Parse(SuccessRate.Text); //砍价成功率默认100% bargain.SuccessRate = 100; //记录改变前的状态 int original_Status = bargain.Status; bargain.Status = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$Status") <= 0 ? 0 : 1; string alertMessage = string.Empty; try { #region 参加活动的商品 //原始 List <BargainDetailsInfo> original_b_details = BargainDetailsBLL.ReadByBargainId(bargain.Id); //待新增、修改 List <BargainDetailsInfo> B_Details = new List <BargainDetailsInfo>(); var Ids = Array.ConvertAll(RequestHelper.GetForm <string>("Id").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); var Product_Id = Array.ConvertAll(RequestHelper.GetForm <string>("Product_Id").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); var BargainId = Array.ConvertAll(RequestHelper.GetForm <string>("BargainId").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); var Product_Name = RequestHelper.GetForm <string>("Product_Name").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); //var Product_OriginalPrice = RequestHelper.GetForm<string>("Product_OriginalPrice"); var product_OriginalPrice = Array.ConvertAll(RequestHelper.GetForm <string>("product_OriginalPrice").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => decimal.Parse(k)); var Product_ReservePrice = Array.ConvertAll(RequestHelper.GetForm <string>("Product_ReservePrice").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(decimal.Parse(s)); }); var Stock = Array.ConvertAll(RequestHelper.GetForm <string>("Stock").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); var Sort = Array.ConvertAll(RequestHelper.GetForm <string>("Sort").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); //是否在售 var Product_IsSale = string.IsNullOrWhiteSpace(RequestHelper.GetForm <string>("Product_IsSale")) ? null : Array.ConvertAll(RequestHelper.GetForm <string>("Product_IsSale").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); //是否删除 var Product_IsDelete = string.IsNullOrWhiteSpace(RequestHelper.GetForm <string>("Product_IsDelete")) ? null : Array.ConvertAll(RequestHelper.GetForm <string>("Product_IsDelete").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); //商品表编号 var Product_Real_Id = string.IsNullOrWhiteSpace(RequestHelper.GetForm <string>("Product_Real_Id")) ? null : Array.ConvertAll(RequestHelper.GetForm <string>("Product_Real_Id").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), delegate(string s) { return(int.Parse(s)); }); //正在参加砍价的商品 var _bargainProducts = BargainDetailsBLL.ReadBargainProducts(); for (int i = 0; i < Product_Id.Length; i++) { //添加:Product_Id[i]>0 //修改:Product_Id[i] > 0 && Product_Real_Id[i]==Product_Id[i] 商品表必须存在此商品 if ((Ids[i] <= 0 && Product_Id[i] > 0) || (Ids[i] > 0 && Product_Id[i] > 0 && Product_Real_Id != null && Product_Real_Id[i] == Product_Id[i])) { #region 是否下架或删除 if (Product_IsSale != null && Product_IsSale.Length > i) { if (Product_IsSale[i] != 1) { alertMessage = "商品:【" + Product_Name[i] + "】已下架,不能添加"; } } if (Product_IsDelete != null && Product_IsDelete.Length > i) { if (Product_IsDelete[i] != 0) { alertMessage = "商品:【" + Product_Name[i] + "】已删除,不能添加"; } } #endregion #region 一商品同时只能参加1个砍价活动 if (_bargainProducts.Any(k => k.ProductID == Product_Id[i]) && Ids[i] <= 0) { alertMessage = "商品:【" + Product_Name[i] + "】正在参与砍价活动,不得重复添加"; } #endregion if (string.IsNullOrEmpty(alertMessage)) { //判断商品底价不得超过原价 if (product_OriginalPrice[i] <= Product_ReservePrice[i]) { alertMessage = "商品底价必须小于原价"; //ScriptHelper.Alert("商品:【"+Product_Name[i]+"】底价必须大于【"+(product_OriginalPrice[i] - product_OriginalPrice[i] * bargain.SuccessRate/100) +"】"); //return; } B_Details.Add(new BargainDetailsInfo() { Id = Ids[i], ProductID = Product_Id[i], ReservePrice = Product_ReservePrice[i], Sort = Sort[i], Stock = Stock[i], BargainId = BargainId[i], ProductName = Product_Name[i], ShareImage1 = (original_b_details.FirstOrDefault(k => k.Id == Ids[i]) ?? new BargainDetailsInfo()).ShareImage1 }); } } } #endregion if (string.IsNullOrEmpty(alertMessage)) { alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (ID <= 0) { CheckAdminPower("AddBargain", PowerCheckType.Single); int id = BargainBLL.AddBargain(bargain); B_Details.ForEach(item => { item.BargainId = id; item.ShareImage1 = CreateBargainShareImage(item.ReservePrice, item.ProductID); BargainDetailsBLL.AddBargainDetails(item); }); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Bargain"), id); } else { CheckAdminPower("UpdateBargain", PowerCheckType.Single); BargainBLL.UpdateBargain(bargain); #region 修改时关闭活动,则将未支付成功的砍价全部置为“砍价失败”,原“活动已取消,砍价失败” if (original_Status == (int)Bargain_Status.OnGoing && bargain.Status == (int)Bargain_Status.ShutDown) { //异步 关闭 ShutDownBargain(bargain.Id); } #endregion B_Details.ForEach(item => { item.BargainId = bargain.Id; item.ShareImage1 = CreateBargainShareImage(item.ReservePrice, item.ProductID, item.ShareImage1); if (item.Id > 0) { BargainDetailsBLL.UpdateBargainDetails(item); } else { BargainDetailsBLL.AddBargainDetails(item); } }); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Bargain"), bargain.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } } } catch (Exception ex) { new TxtLog(Server.MapPath("/apilog/")).Write("-----bargainadd error:" + ex); ScriptHelper.Alert("商品底价、库存、排序号 填写不规范,请检查"); } if (alertMessage == ShopLanguage.ReadLanguage("AddOK") || alertMessage == ShopLanguage.ReadLanguage("UpdateOK")) { ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); } else { ScriptHelper.Alert(alertMessage); } }
protected void shoppingCartItemSelector_OnAddToShoppingCart(object sender, CancelEventArgs e) { // If donations page path specified if (!String.IsNullOrEmpty(DonationsPagePath)) { // Redirect to donations page URLHelper.Redirect(CMSContext.GetUrl(DonationsPagePath)); // Cancel further processing e.Cancel = true; return; } // If donation not selected if (DonationGUID == Guid.Empty) { // Show alert ScriptHelper.Alert(Page, GetString("com.donate.donationnotspecified")); // Cancel further processing e.Cancel = true; return; } // If donate form should be opened in dialog and donation parameters are not fixed if (ShowInDialog && !DonationIsFixed) { // Get donation parameters from hidden fields double donationAmount = ValidationHelper.GetDouble(hdnDonationAmount.Value, 0.0); bool donationIsPrivate = ValidationHelper.GetBoolean(hdnDonationIsPrivate.Value, false); int donationUnits = ValidationHelper.GetInteger(hdnDonationUnits.Value, 1); // If donation parameters set if (donationAmount > 0.0) { // Set donation properties for item to be added shoppingCartItemSelector.SetDonationProperties(donationAmount, donationIsPrivate, donationUnits); // Clear hidden fields hdnDonationAmount.Value = ""; hdnDonationIsPrivate.Value = ""; hdnDonationUnits.Value = ""; } else { // Set dialog parameters Hashtable dialogParameters = new Hashtable(); dialogParameters["DonationGUID"] = DonationGUID.ToString(); dialogParameters["DonationAmount"] = DonationAmount; dialogParameters["DonationAmountElementID"] = hdnDonationAmount.ClientID; dialogParameters["DonationIsPrivateElementID"] = hdnDonationIsPrivate.ClientID; dialogParameters["DonationUnitsElementID"] = hdnDonationUnits.ClientID; dialogParameters["ShowDonationAmount"] = ShowAmountTextbox.ToString(); dialogParameters["ShowCurrencyCode"] = ShowCurrencyCode.ToString(); dialogParameters["ShowDonationUnits"] = ShowUnitsTextbox.ToString(); dialogParameters["ShowDonationIsPrivate"] = AllowPrivateDonation.ToString(); dialogParameters["PostBackEventReference"] = ControlsHelper.GetPostBackEventReference(shoppingCartItemSelector.AddToCartControl, null); WindowHelper.Add(DialogIdentifier, dialogParameters); // Register startup script that opens donate dialog string url = URLHelper.ResolveUrl("~/CMSModules/Ecommerce/CMSPages/Donate.aspx"); url = URLHelper.AddParameterToUrl(url, "params", DialogIdentifier); string startupScript = String.Format("openDonateDialog('{0}')", url); ScriptHelper.RegisterStartupScript(Page, typeof(string), "StartupDialogOpen", ScriptHelper.GetScript(startupScript)); // Cancel further processing e.Cancel = true; } return; } // If donation properties form is valid if (String.IsNullOrEmpty(donationProperties.Validate())) { // Set donation properties for item to be added shoppingCartItemSelector.SetDonationProperties(donationProperties.DonationAmount, donationProperties.DonationIsPrivate, donationProperties.DonationUnits); } else { if (donationProperties.HasEditableFieldsVisible) { if (!donationProperties.ShowDonationAmount) { // Display error messega on page lblError.Text = donationProperties.ErrorMessage; } } else { // Display error message as alert ScriptHelper.Alert(Page, donationProperties.ErrorMessage); } // Cancel further processing e.Cancel = true; } }
protected void UploadImage(object sender, EventArgs e) { //取得传递值 string control = RequestHelper.GetQueryString <string>("Control"); int tableID = RequestHelper.GetQueryString <int>("TableID"); string filePath = RequestHelper.GetQueryString <string>("FilePath"); string fileType = ShopConfig.ReadConfigInfo().UploadImage; if (FileHelper.SafeFullDirectoryName(filePath)) { try { //上传文件 UploadHelper upload = new UploadHelper(); upload.Path = "/Upload/" + filePath + "/" + RequestHelper.DateNow.ToString("yyyyMM") + "/"; upload.FileType = fileType; upload.FileNameType = FileNameType.Guid; upload.MaxWidth = ShopConfig.ReadConfigInfo().AllImageWidth; //整站图片压缩开启后的压缩宽度 upload.AllImageIsNail = ShopConfig.ReadConfigInfo().AllImageIsNail; //整站图片压缩开关 int needNail = RequestHelper.GetQueryString <int>("NeedNail"); if (needNail == 0) { upload.AllImageIsNail = 0; //如果页面有传值且值为0不压缩图片,以页面传值为准; } int curMaxWidth = RequestHelper.GetQueryString <int>("CurMaxWidth"); //页面传值最大宽度 if (curMaxWidth > 0) { upload.AllImageIsNail = 1; upload.MaxWidth = curMaxWidth;//如果有页面传值设置图片最大宽度,以页面传值为准 } FileInfo file = null; int waterType = ShopConfig.ReadConfigInfo().WaterType; if (waterType == 2 || waterType == 3) { string needMark = RequestHelper.GetQueryString <string>("NeedMark"); if (needMark == string.Empty || needMark == "1") { int waterPossition = ShopConfig.ReadConfigInfo().WaterPossition; string text = ShopConfig.ReadConfigInfo().Text; string textFont = ShopConfig.ReadConfigInfo().TextFont; int textSize = ShopConfig.ReadConfigInfo().TextSize; string textColor = ShopConfig.ReadConfigInfo().TextColor; string waterPhoto = Server.MapPath(ShopConfig.ReadConfigInfo().WaterPhoto); file = upload.SaveAs(waterType, waterPossition, text, textFont, textSize, textColor, waterPhoto); } else if (needMark == "0") { file = upload.SaveAs(); } } else { file = upload.SaveAs(); } //生成处理 string originalFile = upload.Path + file.Name; string otherFile = string.Empty; string makeFile = string.Empty; Dictionary <int, int> dic = new Dictionary <int, int>(); if (tableID == ProductBLL.TableID) { foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.Product)) { dic.Add(phototype.Width, phototype.Height); } if (!dic.ContainsKey(90)) { dic.Add(90, 90); //后台商品列表默认使用尺寸(如果不存在则手动添加) } } else if (tableID == ProductBrandBLL.TableID) { dic.Add(88, 31); } else if (tableID == ThemeActivityBLL.TableID) { dic.Add(300, 150); } else if (tableID == ArticleBLL.TableID) { foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.Article)) { dic.Add(phototype.Width, phototype.Height); } } else if (tableID == FavorableActivityGiftBLL.TableID) { dic.Add(100, 100); } else { } if (dic.Count > 0) { foreach (KeyValuePair <int, int> kv in dic) { makeFile = originalFile.Replace("Original", kv.Key.ToString() + "-" + kv.Value.ToString()); otherFile += makeFile + "|"; ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(originalFile), ServerHelper.MapPath(makeFile), kv.Key, kv.Value, ThumbnailType.InBox); } otherFile = otherFile.Substring(0, otherFile.Length - 1); } ResponseHelper.Write("<script>alert('上传成功'); window.parent.o('" + IDPrefix + control + "').value='" + originalFile + "';window.parent.loadFirstPhoto();</script>"); //保存数据库 UploadInfo tempUpload = new UploadInfo(); tempUpload.TableID = tableID; tempUpload.ClassID = 0; tempUpload.RecordID = 0; tempUpload.UploadName = originalFile; tempUpload.OtherFile = otherFile; tempUpload.Size = Convert.ToInt32(file.Length); tempUpload.FileType = file.Extension; tempUpload.RandomNumber = Cookies.Admin.GetRandomNumber(false); tempUpload.Date = RequestHelper.DateNow; tempUpload.IP = ClientHelper.IP; UploadBLL.AddUpload(tempUpload); } catch (Exception ex) { //ExceptionHelper.ProcessException(ex, false); ResponseHelper.Write("<script>alert('" + ex.Message + "'); </script>"); } } else { ScriptHelper.Alert(ShopLanguage.ReadLanguage("ErrorPathName")); } }
protected void SubmitButton_Click(object sender, EventArgs e) { CompanyInfo CompanyModel = new CompanyInfo(); CompanyModel.CompanyId = RequestHelper.GetQueryString <int>("ID"); CompanyModel.CompanyName = CompanyName.Text.Trim(); if (CompanyModel.CompanyName.Length < 5) { ScriptHelper.Alert("请输入完整的公司名称!"); } CompanyModel.Post = RequestHelper.GetIntsForm("Post"); CompanyModel.CompanySimpleName = CompanySimpleName.Text.Trim(); CompanyModel.CompanyTel = CompanyTel.Text.Trim(); CompanyModel.CompanyPost = this.CompanyPost.Text.Trim(); CompanyModel.CompanyAddress = CompanyAddress.Text.Trim(); if (!string.IsNullOrEmpty(PostStartDate.Text)) { CompanyModel.PostStartDate = PostStartDate.Text; } if (!string.IsNullOrEmpty(EndDate.Text)) { CompanyModel.EndDate = EndDate.Text; } CompanyModel.State = Convert.ToInt32(State.SelectedValue); CompanyModel.BrandId = RequestHelper.GetIntsForm("BrandId"); if (CompanyType.Text == "") { ScriptHelper.Alert("请选择公司类型!"); } CompanyModel.GroupId = Convert.ToInt32(CompanyType.Text); CompanyModel.UserNum = Convert.ToInt32(UserNum.Text); CompanyModel.IsTest = IsTest.Checked; CompanyModel.Sort = Convert.ToInt32(Sort.Text); if (CompanyModel.GroupId == 2 || CompanyModel.GroupId == 3) { CompanyModel.ParentId = GroupListId.Value; if (string.IsNullOrEmpty(CompanyModel.ParentId)) { ScriptHelper.Alert("请选择隶属公司"); } if (CompanyModel.GroupId == 2 && CompanyModel.CompanyId != int.MinValue) { if (StringHelper.CompareString(CompanyBLL.ReadCompanyIdList(companyID.ToString()), CompanyModel.ParentId.ToString())) { ScriptHelper.Alert("如果要转移到旗下公司,请先将旗下公司移动出去!"); } } } else { if (CompanyModel.CompanyId != int.MinValue) { CompanyModel.ParentId = CompanyBLL.ReadCompany(CompanyModel.CompanyId).ParentId; } else { CompanyModel.ParentId = CompanyBLL.SystemCompanyId.ToString(); } } string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (CompanyModel.CompanyId == int.MinValue) { base.CheckAdminPower("AddCompany", PowerCheckType.Single); int id = CompanyBLL.AddCompany(CompanyModel); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Company"), id); } else { base.CheckAdminPower("UpdateCompany", PowerCheckType.Single); CompanyBLL.UpdateCompany(CompanyModel); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Company"), CompanyModel.CompanyId); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } AdminBasePage.Alert(alertMessage, RequestHelper.RawUrl); }
/// <summary> /// 彻底删除 /// </summary> /// <param name="ids"></param> public static void Delete(string ids) { string[] delArr = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (delArr.Length > 0) { foreach (string did in delArr) { int id = 0; if (int.TryParse(did, out id)) { bool canDel = true; if (OrderDetailBLL.ReadListByProductId(id).Count > 0) { foreach (OrderDetailInfo myOD in OrderDetailBLL.ReadListByProductId(id)) { OrderInfo tempOrder = OrderBLL.Read(myOD.OrderId, 0); if (tempOrder.IsDelete == 0) { canDel = false; break; } } if (!canDel) { ScriptHelper.Alert("该产品存在相关订单,不能删除。"); } else { var product = Read(id); if (product.Id > 0) { UploadBLL.DeleteUploadByRecordID(TableID, id.ToString()); dal.Delete(id); ProductPhotoBLL.DeleteList(id, 0); int[] classIds = Array.ConvertAll <string, int>(product.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); ProductClassBLL.ChangeProductCount(classIds, ChangeAction.Minus); CacheHelper.Remove("ProductClass"); } } } else { var product = Read(id); if (product.Id > 0) { UploadBLL.DeleteUploadByRecordID(TableID, id.ToString()); dal.Delete(id); ProductPhotoBLL.DeleteList(id, 0); int[] classIds = Array.ConvertAll <string, int>(product.ClassId.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); ProductClassBLL.ChangeProductCount(classIds, ChangeAction.Minus); CacheHelper.Remove("ProductClass"); } } } } } }
/// <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; }
protected void cmdAdd1_Click ( object sender, EventArgs e ) { // 创建 ScriptHelper 对象 ScriptHelper scriptHelper = new ScriptHelper (); string name = this.txtName1.Text; string ageString = this.txtAge1.Text; bool isInfoValid = true; int age = 0; if ( name == string.Empty ) { // 没有写姓名, 添加弹出消息框的脚本 scriptHelper.Alert ( "'请填写姓名'" ); isInfoValid = false; } else if ( name.Length < 2 || name.Length > 4 ) { // 姓名格式错误, 添加弹出消息框的脚本 scriptHelper.Alert ( "'姓名应有 2 到 4 个字'" ); isInfoValid = false; } else if ( !int.TryParse ( ageString, out age ) ) { // 年龄格式错误, 添加弹出消息框的脚本 scriptHelper.Alert ( "'年龄应该是数字'" ); isInfoValid = false; } if ( !isInfoValid ) { // 因为存在错误, 生成脚本到页面并返回 scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); return; } int result = 0; // 在这里将数据提交到数据库, 并将下面的语句去掉 result = new Random ().Next ( 0, 2 ); switch ( result ) { case 0: // 添加成功, 添加显示成功消息的脚本 scriptHelper.Alert ( "'添加成功'" ); // 设置页面的标签 span1 为绿色并显示姓名和年龄 ScriptHelper.RegisterAttribute ( this, "span1", "innerHTML", string.Format ( "被添加内容: {0}, {1}", name, age ) ); ScriptHelper.RegisterAttribute ( this, "span1", "style.color", "#00ff00" ); break; case 1: // 添加失败, 添加显示失败消息的脚本 scriptHelper.Alert ( "'添加失败'" ); // 设置页面的标签 span1 为红色并显示姓名和年龄 ScriptHelper.RegisterAttribute ( this, "span1", "innerHTML", string.Format ( "被添加内容: {0}, {1}", name, age ) ); ScriptHelper.RegisterAttribute ( this, "span1", "style.color", "#ff0000" ); break; } // 生成脚本到页面 scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
protected void btnOK_Click(object sender, EventArgs e) { string gotoUrl = "WF_STEPManage.aspx"; if (Request["preUrl"] != null) { gotoUrl = Request["preUrl"]; } else { gotoUrl = "../ok.aspx"; } int Num = Convert.ToInt32(Request["hidCondNum"]); StringBuilder sb = new StringBuilder(); for (int i = 1; i <= Num; i++) { if (!string.IsNullOrEmpty(Request["txtCond_" + i.ToString()])) { string conddata = Request["txtCond_" + i.ToString()]; if (sb.Length > 0) { sb.Append("|"); } sb.Append(conddata); } } //if (Request["open"] == null) //{ if (Request["setPathCond"] != null)//设置路径条件 { WF_STEPATH_TPL cond = new WF_STEPATH_TPL(); cond.STEP_ID = int.Parse(Request["StepID"]); cond.NEXT_ID = int.Parse(Request["NextID"]); WF_STEPATH_TPL upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond); } if (from == "1")//显示步骤条件--无用 { WF_STEP_TPL upStep = new WF_STEP_TPL(); upStep.STEP_ID = keyid; upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEP_TPL> .Factory(conn).Update(upStep, WF_STEP_TPL.Attribute.STEP_ID); } else if (from == "2")//普通路径条件 { WF_STEPATH_TPL cond = new WF_STEPATH_TPL(); cond.STEP_ID = keyid; cond.NEXT_ID = int.Parse(Request["NextID"]); cond.PATH_TYPE = int.Parse(Request["PATH_TYPE"]); WF_STEPATH_TPL upStep = new WF_STEPATH_TPL(); upStep.CONDITION = sb.ToString(); if (upStep.CONDITION.Length > 1) { upStep.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upStep.FORMULAR = ""; } BLLTable <WF_STEPATH_TPL> .Factory(conn).Update(upStep, cond); } else if (from == "3")//审核人条件设置 { WF_CHECKER_TPL upCh = new WF_CHECKER_TPL(); upCh.CHECKER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable <WF_CHECKER_TPL> .Factory(conn).Update(upCh, WF_CHECKER_TPL.Attribute.CHECKER_ID); } else if (from == "4")//选择过程条件 { WF_PROCESS_TPL upSet = new WF_PROCESS_TPL(); upSet.PROCID = keyid; upSet.CONDITION = sb.ToString(); if (upSet.CONDITION.Length > 1) { upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upSet.FORMULAR = ""; } BLLTable <WF_PROCESS_TPL> .Factory(conn).Update(upSet, WF_PROCESS_TPL.Attribute.PROCID); } else if (from == "5")//通知人条件设置 { WF_NOTIFIER_TPL upCh = new WF_NOTIFIER_TPL(); upCh.NOTIFIER_ID = keyid; upCh.CONDITION = sb.ToString(); if (upCh.CONDITION.Length > 1) { upCh.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); } else { upCh.FORMULAR = ""; } BLLTable <WF_NOTIFIER_TPL> .Factory(conn).Update(upCh, WF_NOTIFIER_TPL.Attribute.NOTIFIER_ID); } //else if (from == "6") //{ // WF_STEPState upSet = new WF_STEPState(); // upSet.StateID = keyid; // upSet.CONDITION = sb.ToString(); // if (upSet.CONDITION.Length > 1) // { // upSet.FORMULAR = selIsShow.Value + ":" + txtGongShi.Value.Trim(); // } // else // { // upSet.FORMULAR = ""; // } // BLLTable<WF_STEPState>.Factory(conn).Update(upSet); //} if (Request["setpSetting"] != null) { //Response.Write(Request.Url.AbsoluteUri); string randStr = StringHelperExd.GetRandomCode(6); string url = Request.Url.AbsoluteUri; if (url.IndexOf("&r=") != -1) { Regex reg = new Regex(@"&r=\w+"); url = reg.Replace(url, "&r=" + randStr); } else { url += "&r=" + randStr; } //Response.Write(url); //ScriptHelper.AlertAndGo(Page, "条件保存成功!", url); ScriptHelper.Alert(Page, "条件保存成功!"); //Response.Redirect(Request.Url.AbsoluteUri); } else { AgileFrame.Core.ScriptHelper.ResponseScript(Page, "if (window.opener){window.opener.returnValue = \"ok\";}else{window.returnValue = \"ok\";}window.close();", true); } //Response.Redirect(gotoUrl); //} //else//打开条件配制窗口,无论是修改还是新增条件,都只需要返回条件和公式即可 //{ // AgileFrame.Core.ScriptHelper.ResponseScript(Page, "window.returnValue=\"" + sb.ToString() + "`" + txtGongShi.Value.Trim() + "\";window.close();", false); //} }
/// <summary> /// 保存事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSave_OnClick(object sender, EventArgs e) { var imageFile = GetImage(); if (string.IsNullOrEmpty(StrGuid)) { var info = new CategoryInfo(); info.Name = tbName.Text; info.OrderId = ConvertHelper.GetInt(tbOrderId.Text); info.ParentGuid = ddlParentCategory.SelectedValue; var user = HttpContext.Current.Session["UserInfo"] as UserInfo; if (user != null) { info.UserGuid = user.Guid; } var blog = HttpContext.Current.Session["BlogInfo"] as BlogInfo; if (blog != null) { info.BlogGuid = blog.Guid; } if (imageFile != null) { var ret = QiniuHelper.GetResult(imageFile); if (ret.OK) { info.ImageUrl = QiniuHelper.GetUrl(ret.key); info.ImageKey = ret.key; } else { ScriptHelper.Alert("图片上传失败"); } } CategoryBll.Add(info); } else { var info = CategoryBll.GetModel(StrGuid); info.Name = tbName.Text; info.OrderId = ConvertHelper.GetInt(tbOrderId.Text); info.ParentGuid = ddlParentCategory.SelectedValue; if (imageFile != null) { var ret = QiniuHelper.GetResult(imageFile); if (ret.OK) { info.ImageUrl = QiniuHelper.GetUrl(ret.key); info.ImageKey = ret.key; } else { ScriptHelper.Alert("图片上传失败"); } } CategoryBll.Update(info); } Response.Redirect("CategoryList.aspx"); }
protected void ImportProducts(object sender, EventArgs e) { string categoryId = ProductClass.ClassID; int saleStatus = Convert.ToInt32(IsSale.SelectedValue); string selectedValue = dropFiles.SelectedValue; selectedValue = Path.Combine(_dataPath, selectedValue); if (!File.Exists(selectedValue)) { ScriptHelper.Alert("选择的数据包文件有问题!"); } else { PrepareDataFiles(new object[] { selectedValue }); string path = Path.Combine(_dataPath, Path.GetFileNameWithoutExtension(selectedValue)); DataTable productData = (DataTable)ProductBLL.ParseProductData(new object[] { path })[0]; if ((productData != null) && (productData.Rows.Count > 0)) { foreach (DataRow row in productData.Rows) { ProductInfo product = new ProductInfo { ClassId = categoryId, Name = (string)row["ProductName"], ProductNumber = (string)row["SKU"], BrandId = 0 }; if (row["Description"] != DBNull.Value) { product.Introduction1 = (string)row["Description"]; } product.AddDate = DateTime.Now; product.IsSale = saleStatus; product.MarketPrice = (decimal)row["SalePrice"]; product.TotalStorageCount = (int)row["Stock"]; product.Spelling = ChineseCharacterHelper.GetFirstLetter((string)row["ProductName"]); product.SendPoint = 0; product.Weight = 0; product.IsSpecial = 0; product.IsNew = 0; product.IsHot = 0; if (row["Has_ShowCase"] != DBNull.Value) { product.IsTop = Convert.ToInt32(row["Has_ShowCase"]); } product.AllowComment = 0; product.LowerCount = 0; product.UpperCount = 0; product.StandardType = 0; product.AddDate = RequestHelper.DateNow; product.OrderId = 0; product.SalePrice = (decimal)row["SalePrice"]; if (row["ImageUrl1"] != DBNull.Value) { product.Photo = (string)row["ImageUrl1"]; } int proID = ProductBLL.Add(product); #region 生成缩略图和产品相册图 if (!(string.IsNullOrEmpty(product.Photo) || (product.Photo.Length <= 0))) { UploadImage(product.Photo, PhotoType.Product); } if (row["ImageUrl2"] != DBNull.Value) { ProductPhotoInfo tempPhoto = new ProductPhotoInfo() { ProductId = proID, Name = "ImageUrl2", ImageUrl = (string)row["ImageUrl2"], AddDate = DateTime.Now }; ProductPhotoBLL.Add(tempPhoto); UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto); } if (row["ImageUrl3"] != DBNull.Value) { ProductPhotoInfo tempPhoto = new ProductPhotoInfo() { ProductId = proID, Name = "ImageUrl3", ImageUrl = (string)row["ImageUrl3"], AddDate = DateTime.Now }; ProductPhotoBLL.Add(tempPhoto); UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto); } if (row["ImageUrl4"] != DBNull.Value) { ProductPhotoInfo tempPhoto = new ProductPhotoInfo() { ProductId = proID, Name = "ImageUrl4", ImageUrl = (string)row["ImageUrl4"], AddDate = DateTime.Now }; ProductPhotoBLL.Add(tempPhoto); UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto); } if (row["ImageUrl5"] != DBNull.Value) { ProductPhotoInfo tempPhoto = new ProductPhotoInfo() { ProductId = proID, Name = "ImageUrl5", ImageUrl = (string)row["ImageUrl5"], AddDate = DateTime.Now }; ProductPhotoBLL.Add(tempPhoto); UploadImage(tempPhoto.ImageUrl, PhotoType.ProductPhoto); } #endregion } File.Delete(selectedValue); Directory.Delete(path, true); BindFiles(); ScriptHelper.Alert("此次商品批量导入操作已成功!", RequestHelper.RawUrl); } } }
protected void UploadImage(object sender, EventArgs e) { string queryString = RequestHelper.GetQueryString <string>("Control"); int num = RequestHelper.GetQueryString <int>("TableID"); string directoryName = RequestHelper.GetQueryString <string>("FilePath"); string uploadFile = ShopConfig.ReadConfigInfo().UploadFile; if (FileHelper.SafeFullDirectoryName(directoryName)) { //try { UploadHelper helper = new UploadHelper(); helper.Path = "/Upload/" + directoryName + "/" + RequestHelper.DateNow.ToString("yyyyMM") + "/"; helper.FileType = uploadFile; helper.FileNameType = FileNameType.Guid; FileInfo info = helper.SaveAs(); string filePath = helper.Path + info.Name; string str5 = string.Empty; string str6 = string.Empty; Dictionary <int, int> dictionary = new Dictionary <int, int>(); if (num == ProductBLL.TableID) { dictionary.Add(60, 60); dictionary.Add(120, 120); dictionary.Add(340, 340); } else if (num == ProductBrandBLL.TableID) { dictionary.Add(0x58, 0x1f); } else if (num == LinkBLL.TableID) { dictionary.Add(0x58, 0x1f); } else if (num == StandardBLL.TableID) { dictionary.Add(0x19, 0x19); } else if (num == ThemeActivityBLL.TableID) { dictionary.Add(300, 150); } else if (num == GiftPackBLL.TableID) { dictionary.Add(150, 60); } else if (num == FavorableActivityBLL.TableID) { dictionary.Add(300, 120); } else if (num == GiftBLL.TableID) { dictionary.Add(100, 100); } if (dictionary.Count > 0) { foreach (KeyValuePair <int, int> pair in dictionary) { str6 = filePath.Replace("Original", pair.Key.ToString() + "-" + pair.Value.ToString()); str5 = str5 + str6 + "|"; ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(filePath), ServerHelper.MapPath(str6), pair.Key, pair.Value, ThumbnailType.InBox); } str5 = str5.Substring(0, str5.Length - 1); } ResponseHelper.Write("<script> window.parent.o('" + base.IDPrefix + queryString + "').value='" + filePath + "';</script>"); UploadInfo upload = new UploadInfo(); upload.TableID = num; upload.ClassID = 0; upload.RecordID = 0; upload.UploadName = filePath; upload.OtherFile = str5; upload.Size = Convert.ToInt32(info.Length); upload.FileType = info.Extension; upload.RandomNumber = Cookies.Admin.GetRandomNumber(false); upload.Date = RequestHelper.DateNow; upload.IP = ClientHelper.IP; UploadBLL.AddUpload(upload); } //catch (Exception exception) //{ // ExceptionHelper.ProcessException(exception, false); //} } else { ScriptHelper.Alert(ShopLanguage.ReadLanguage("ErrorPathName")); } }
protected override void PostBack() { string userName = StringHelper.SearchSafe(RequestHelper.GetForm <string>("UserName")); //string email = StringHelper.SearchSafe(RequestHelper.GetForm<string>("Email")); //string form = RequestHelper.GetForm<string>("SafeCode"); string mobile = StringHelper.SearchSafe(RequestHelper.GetForm <string>("phone")); string code = StringHelper.SearchSafe(RequestHelper.GetForm <string>("inputmovecode")); //int id = 0; if (userName == string.Empty) { this.errorMessage = "用户名不能为空"; } if (string.IsNullOrEmpty(mobile)) { this.errorMessage = "手机号码不能为空"; } if (this.errorMessage == string.Empty) { //id = UserBLL.CheckUserName(userName); //if (id == 0) //{ // this.errorMessage = "不存在该用户名"; //} UserSearchInfo userSearch = new UserSearchInfo(); userSearch.Mobile = mobile; userSearch.UserName = UserName; if (UserBLL.SearchUserList(userSearch).Count <= 0) { this.errorMessage = "不存在该用户名"; } } if (this.errorMessage == string.Empty) { bool IsSend = false; //从Cookies中读取验证码并解密 string SrcCheckCode = StringHelper.Decode(CookiesHelper.ReadCookieValue("SMSCheckCode"), "SMS"); //如果验证码值不为空(cookies的有效期只有几分钟) if (!string.IsNullOrEmpty(SrcCheckCode)) { if (SrcCheckCode == code) { IsSend = true; } } else { int TimeOutSeconds = 2 * 60; SMSRecordInfo SMSRecordModel = SMSRecordBLL.ReadSMSRecord(mobile, code); if (SMSRecordModel != null) { if ((DateTime.Now - SMSRecordModel.DataCreateDate).TotalSeconds <= TimeOutSeconds) { if (SMSRecordModel.VerCode == code) { IsSend = true; } } } } if (!IsSend) { this.errorMessage = "手机验证码错误!"; } } //if ((this.errorMessage == string.Empty) && (email == string.Empty)) //{ // this.errorMessage = "Email不能为空"; //} //if ((this.errorMessage == string.Empty) && !UserBLL.CheckEmail(email)) //{ // this.errorMessage = "不存在该Email"; //} //if ((this.errorMessage == string.Empty) && (form.ToLower() != Cookies.Common.checkcode.ToLower())) //{ // this.errorMessage = "验证码错误"; //} //if ((this.errorMessage == string.Empty) && (UserBLL.ReadUser(id).Email != email)) //{ // this.errorMessage = "用户名和Email不匹配"; //} if (this.errorMessage == string.Empty) { //string safeCode = Guid.NewGuid().ToString(); //UserBLL.ChangeUserSafeCode(id, safeCode, RequestHelper.DateNow); //string newValue = "http://" + base.Request.ServerVariables["HTTP_HOST"] + "/User/ResetPassword.aspx?CheckCode=" + StringHelper.Encode(string.Concat(new object[] { id, "|", email, "|", userName, "|", safeCode }), ShopConfig.ReadConfigInfo().SecureKey); //EmailContentInfo info2 = EmailContentHelper.ReadSystemEmailContent("FindPassword"); //EmailSendRecordInfo emailSendRecord = new EmailSendRecordInfo(); //emailSendRecord.Title = info2.EmailTitle; //emailSendRecord.Content = info2.EmailContent.Replace("$Url$", newValue); //emailSendRecord.IsSystem = 1; //emailSendRecord.EmailList = email; //emailSendRecord.IsStatisticsOpendEmail = 0; //emailSendRecord.SendStatus = 1; //emailSendRecord.AddDate = RequestHelper.DateNow; //emailSendRecord.SendDate = RequestHelper.DateNow; //emailSendRecord.ID = EmailSendRecordBLL.AddEmailSendRecord(emailSendRecord); //EmailSendRecordBLL.SendEmail(emailSendRecord); //this.result = "您的申请已提交,请登录邮箱重设你的密码!<a href=\"http://mail." + email.Substring(email.IndexOf("@") + 1) + "\" target=\"_blank\">马上登录</a>"; //ResponseHelper.Redirect("/User/FindPassword.aspx?Result=" + base.Server.UrlEncode(this.result)); string userPassword = RequestHelper.GetForm <string>("password"); UserSearchInfo userSearch = new UserSearchInfo(); userSearch.Mobile = mobile; userSearch.UserName = userName; userSearch.StatusNoEqual = (int)UserState.Del; List <UserInfo> userList = UserBLL.SearchUserList(userSearch); if (userList.Count < 5) //限制一下,安全第一,以免条件出错,把所有的都改了 { foreach (UserInfo user in userList) { user.UserPassword = StringHelper.Password(userPassword, (PasswordType)ShopConfig.ReadConfigInfo().PasswordType); UserBLL.ChangePassword(user.ID, user.UserPassword); } } ScriptHelper.Alert("修改成功!", "/User/Login.aspx"); } else { ResponseHelper.Redirect("/User/FindPassword.aspx?ErrorMessage=" + base.Server.UrlEncode(this.errorMessage)); } }
protected void Page_Load(object sender, EventArgs e) { base.ClearCache(); int companyID = base.UserCompanyID; int userID = base.UserID; filePath = TestPaperBLL.ReadTestPaperPath(userID, productID); if (!IsPostBack) { if (productID < 0) { ScriptHelper.Alert("选择课程后,进行考试!"); Response.End(); } TestSettingInfo testSetting = TestSettingBLL.ReadTestSetting(companyID, productID); ProductInfo product = ProductBLL.ReadProduct(productID); RenZhengCateInfo renZhengProduct = RenZhengCateBLL.ReadTestCateByID(product.ID); if (renZhengProduct != null) { PostApprover postApprover = new PostApprover(PostPassBLL.ReadPostPassList(new PostPassInfo() { UserId = userID, IsRZ = 1 })); if (!postApprover.IsTest(renZhengProduct.PostId)) { Response.Write("<script>alert('请先完成 " + PostBLL.ReadPost(postApprover.NextPostID).PostName + " 的岗位综合认证!');history.go(-1);</script>"); Response.End(); } } if (testSetting.TestStartTime != null && testSetting.TestEndTime != null) { if (testSetting.TestStartTime > DateTime.Now || testSetting.TestEndTime < DateTime.Now) { Response.Write("<script>alert('不在 该门课程 设定的考试时间内!');history.go(-1);</script>"); Response.End(); } } TestPaperInfo PaperModel = new TestPaperInfo(); PaperModel.CateIdCondition = productID.ToString(); PaperModel.UserIdCondition = userID.ToString(); List <TestPaperInfo> PaperList = TestPaperBLL.NewReadList(PaperModel); if (PaperList.Count > 0) { foreach (TestPaperInfo Item in PaperList) { if (Item.IsPass == 1)// && Item.CateId != 5368//孟特销售工具应用与说明 需要多次考试 { Response.Write("<script>alert('您已通过,请选择其它课程!');</script>"); Response.End(); } if ((DateTime.Now - Item.TestDate).TotalHours < testSetting.TestInterval) { if (testSetting.TestStartTime != null || testSetting.TestEndTime != null) { Response.Write("<script>alert('您已经参加过考试,暂不能重考!');window.close();</script>"); } else { Response.Write("<script>alert('考完" + testSetting.TestInterval + "小时后才能重考,请选择其它课程!');history.go(-1);</script>"); } Response.End(); } } } if ((File.Exists(filePath) && (DateTime.Now - File.GetLastWriteTime(filePath)).TotalHours < testSetting.TestInterval))//TempPaperInfo != null && (DateTime.Now - TempPaperInfo.TestDate).TotalHours < 72 { bool HaveTest = false; XmlHelper XmlDoc1 = new XmlHelper(filePath); for (int StyleId = 1; StyleId <= 3; StyleId++) { string NodeName = "TestPaper"; if (StyleId == 1) { NodeName = NodeName + "/Single"; } else if (StyleId == 2) { NodeName = NodeName + "/Multi"; } else if (StyleId == 3) { NodeName = NodeName + "/PanDuan"; } //判断题型库里是否有考题 XmlNode Node = XmlDoc1.ReadNode(NodeName); if (Node != null && Node.HasChildNodes) { XmlNodeList NodeList = XmlDoc1.ReadChildNodes(NodeName); //遍历节点 foreach (XmlNode node in NodeList) { if (!string.IsNullOrEmpty(node.ChildNodes[6].InnerText)) { HaveTest = true; } } } } if (HaveTest) { AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("TestPaperRecord"), ShopLanguage.ReadLanguage("TestPaper"), productID); TestPaperInfo testpaper = TestPaperBLL.CalcTestResult(companyID, userID, productID); if (testpaper.IsPass == 1) { PostPassBLL.CheckPostPass(UserID, productID); //孟特销售工具应用与说明 课程处理 //if (productID == 5368) // TestSettingBLL.SpecialTestHandle(userID, int.Parse(CookiesHelper.ReadCookieValue("UserStudyPostId"))); } ResponseHelper.Write("<script>alert('您上次未完成交卷,此时系统自动为您补交!得分:" + testpaper.Scorse + "分。');window.location.href='CourseCenter.aspx';</script>"); Response.End(); } } TestName.Text = product.Name; endTimer = testSetting.TestTimeLength * 60; QuestionBLL.ReadQuestionXmlList(productID, product.Accessory, companyID, userID); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("StartTest"), ShopLanguage.ReadLanguage("TestCate"), productID); AdminLogBLL.AddAdminLog(Request.Browser.Browser + "|" + Request.Browser.Version, productID); } }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { int id = RequestHelper.GetQueryString <int>("ID"); ProductInfo product = new ProductInfo(); //if (id > 0) product = ProductBLL.Read(id); product.Name = Name.Text; product.SellPoint = SellPoint.Text; product.Spelling = ChineseCharacterHelper.GetFirstLetter(Name.Text); product.Color = RequestHelper.GetForm <string>("ProductColor"); product.FontStyle = FontStyle.Text; product.ProductNumber = ProductNumber.Text; //product.ClassId = ProductClass.ClassID; product.ClassId = string.IsNullOrEmpty(RequestHelper.GetQueryString <string>("classId")) ? ProductBLL.Read(id).ClassId : RequestHelper.GetQueryString <string>("classId"); product.Keywords = Keywords.Text; product.BrandId = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$BrandID"); product.MarketPrice = Convert.ToDecimal(MarketPrice.Text); product.SendPoint = Convert.ToInt32(SendPoint.Text); product.Photo = Photo.Text; product.Summary = Summary.Text; product.Introduction1 = Introduction.Value; product.Weight = Convert.ToDecimal(Weight.Text); product.IsSpecial = Convert.ToInt32(IsSpecial.Checked); product.IsNew = Convert.ToInt32(IsNew.Checked); product.IsHot = Convert.ToInt32(IsHot.Checked); product.IsSale = Convert.ToInt32(IsSale.Checked); product.IsTop = Convert.ToInt32(IsTop.Checked); //保存时如果售后服务为空则自动获取所属分类的售后服务并保存 product.Remark = string.IsNullOrEmpty(StringHelper.KillHTML(Remark.Value)) ? GetProductClassRemark(product.ClassId) : Remark.Value; product.Accessory = RequestHelper.GetForm <string>("RelationAccessoryID"); product.RelationProduct = RequestHelper.GetForm <string>("RelationProductID"); product.RelationArticle = RequestHelper.GetForm <string>("RelationArticleID"); product.AllowComment = Convert.ToInt32(AllowComment.Checked); product.TotalStorageCount = Convert.ToInt32(TotalStorageCount.Text); if (TotalStorageCount.ReadOnly) { product.TotalStorageCount = Convert.ToInt32(HidTotalStorageCount.Value); } product.LowerCount = 0; product.UpperCount = 0; product.StandardType = Convert.ToInt32(RequestHelper.GetForm <string>("StandardType")); product.AddDate = RequestHelper.DateNow; product.OrderId = Convert.ToInt32(OrderID.Text.Trim()); product.SalePrice = Convert.ToDecimal(SalePrice.Text); product.Unit = Units.Text; product.Introduction1_Mobile = Introduction_Mobile.Value; product.SubTitle = Sub_Title.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); CheckAdminPower("AddProduct", PowerCheckType.Single); int pid = ProductBLL.Add(product); AddProductPhoto(pid); #region 添加时生成二维码 string ewmName = string.Empty;//二维码路径 CreateQRcode("http://" + HttpContext.Current.Request.Url.Host + (HttpContext.Current.Request.Url.Port > 0 ? ":" + HttpContext.Current.Request.Url.Port : "") + "/mobile/ProductDetail-i" + pid + ".html", "pro_" + pid.ToString(), ref ewmName); ProductInfo tmpProduct = ProductBLL.Read(pid); tmpProduct.Qrcode = ewmName; ProductBLL.Update(tmpProduct); #endregion AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Product"), pid); HanderAttribute(product); HanderProductStandard(product); ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void cmdTestClear_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Clear(string)<br />"; scriptHelper.Confirm ( "'有名字?'", "n" ); scriptHelper.Alert ( "'一句话'" ); tracer.Execute ( scriptHelper, null, "Clear", FunctionType.Method, null, null, null, null, new object[][] { new object[] { } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected override void PostBack() { string url = "/CheckOut.aspx"; string str2 = StringHelper.AddSafe(RequestHelper.GetForm <string>("Consignee")); if (str2 == string.Empty) { ScriptHelper.Alert("收货人姓名不能为空", url); } string str3 = StringHelper.AddSafe(RequestHelper.GetForm <string>("Tel")); string str4 = StringHelper.AddSafe(RequestHelper.GetForm <string>("Mobile")); if ((str3 == string.Empty) && (str4 == string.Empty)) { ScriptHelper.Alert("固定电话,手机必须得填写一个", url); } string str5 = StringHelper.AddSafe(RequestHelper.GetForm <string>("ZipCode")); if (str5 == string.Empty) { ScriptHelper.Alert("邮编不能为空", url); } string str6 = StringHelper.AddSafe(RequestHelper.GetForm <string>("Address")); if (str6 == string.Empty) { ScriptHelper.Alert("地址不能为空", url); } int form = RequestHelper.GetForm <int>("ShippingID"); if (form == -2147483648) { ScriptHelper.Alert("请选择配送方式", url); } decimal productTotalPrice = Sessions.ProductTotalPrice; decimal num3 = RequestHelper.GetForm <decimal>("FavorableMoney"); decimal num4 = RequestHelper.GetForm <decimal>("ShippingMoney"); decimal num5 = RequestHelper.GetForm <decimal>("Balance"); decimal num6 = RequestHelper.GetForm <decimal>("CouponMoney"); if (((((productTotalPrice - num3) + num4) - num5) - num6) < 0M) { ScriptHelper.Alert("金额有错误,请重新检查", url); } string key = RequestHelper.GetForm <string>("Pay"); PayPluginsInfo info = PayPlugins.ReadPayPlugins(key); OrderInfo order = new OrderInfo(); order.OrderNumber = ShopCommon.CreateOrderNumber(); order.IsActivity = 0; if ((((((productTotalPrice - num3) + num4) - num5) - num6) == 0M) || (info.IsCod == 1)) { order.OrderStatus = 2; } else { order.OrderStatus = 1; } order.OrderNote = string.Empty; order.ProductMoney = productTotalPrice; order.Balance = num5; order.FavorableMoney = num3; order.OtherMoney = 0M; order.CouponMoney = num6; order.Consignee = str2; SingleUnlimitClass class2 = new SingleUnlimitClass(); order.RegionID = class2.ClassID; order.Address = str6; order.ZipCode = str5; order.Tel = str3; if (base.UserID == 0) { order.Email = StringHelper.AddSafe(RequestHelper.GetForm <string>("Email")); } else { order.Email = CookiesHelper.ReadCookieValue("UserEmail"); } order.Mobile = str4; order.ShippingID = form; order.ShippingDate = RequestHelper.DateNow; order.ShippingNumber = string.Empty; order.ShippingMoney = num4; order.PayKey = key; order.PayName = info.Name; order.PayDate = RequestHelper.DateNow; order.IsRefund = 0; order.FavorableActivityID = RequestHelper.GetForm <int>("FavorableActivityID"); order.GiftID = RequestHelper.GetForm <int>("GiftID"); order.InvoiceTitle = StringHelper.AddSafe(RequestHelper.GetForm <string>("InvoiceTitle")); order.InvoiceContent = StringHelper.AddSafe(RequestHelper.GetForm <string>("InvoiceContent")); order.UserMessage = StringHelper.AddSafe(RequestHelper.GetForm <string>("UserMessage")); order.AddDate = RequestHelper.DateNow; order.IP = ClientHelper.IP; order.UserID = base.UserID; order.UserName = base.UserName; int orderID = OrderBLL.AddOrder(order); if (num5 > 0M) { UserAccountRecordBLL.AddUserAccountRecord(-num5, 0, "支付订单:" + order.OrderNumber, base.UserID, base.UserName); } string str8 = RequestHelper.GetForm <string>("UserCoupon"); if ((num6 > 0M) && (str8 != "0|0")) { UserCouponInfo userCoupon = UserCouponBLL.ReadUserCoupon(Convert.ToInt32(str8.Split(new char[] { '|' })[0]), base.UserID); userCoupon.IsUse = 1; userCoupon.OrderID = orderID; UserCouponBLL.UpdateUserCoupon(userCoupon); } this.AddOrderProduct(orderID); ProductBLL.ChangeProductOrderCountByOrder(orderID, ChangeAction.Plus); ResponseHelper.Redirect("/Finish-I" + orderID.ToString() + ".aspx"); }
protected void cmdNext3_Click ( object sender, EventArgs e ) { // 创建 ScriptHelper 对象 ScriptHelper scriptHelper = new ScriptHelper (); string name = this.txtName3.Text; if ( name == string.Empty ) // 没有写用户名, 添加弹出消息框的脚本 scriptHelper.Alert ( "'请填写用户名'" ); else { // 隐藏第一步, 显示第二步, 记录用户名到隐藏字段 ScriptHelper.RegisterAttribute ( this, "r1", "style.display", "none" ); ScriptHelper.RegisterAttribute ( this, "r2", "style.display", "block" ); ScriptHelper.RegisterHidden ( this, "r1name", name ); } // 生成脚本 scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestVal_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery1 = new JQuery ( "'#myTextBox1'" ); JQuery jQuery2 = new JQuery ( jQuery1 ); result += "测试方法 JQuery.Val()<br />"; tracer.Execute ( jQuery1, null, "Val", FunctionType.Method, new Type[] { }, null, null, null, new object[][] { new object[] { } }, false ); result += "jQuery1.Code = " + jQuery1.Code + "<br />"; result += "测试方法 JQuery.Val(string)<br />"; tracer.Execute ( jQuery2, null, "Val", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'jack'" } }, false ); result += "jQuery2.Code = " + jQuery2.Code + "<br />"; ScriptHelper scriptHelper = new ScriptHelper (); scriptHelper.Alert ( "'myTextBox1.value = ' + " + jQuery1.Code ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); jQuery2.Build ( this, option: ScriptBuildOption.Startup ); }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { CheckAdminPower("UpdateConfig", PowerCheckType.Single); ShopConfigInfo config = ShopConfig.ReadConfigInfo(); config.CommentDefaultStatus = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$CommentDefaultStatus"); int allImageWidth = 0; if (!int.TryParse(AllImageWidth.Text.Trim(), out allImageWidth)) { ScriptHelper.Alert("图片宽度必须是数字"); } config.AllImageWidth = allImageWidth < 0 ? 0 : allImageWidth; //config.AllImageWidth = Convert.ToInt32(AllImageWidth.Text) < 0 ? 0 : Convert.ToInt32(AllImageWidth.Text); config.AllImageIsNail = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$AllImageIsNail"); #region 启用整站压缩 图片宽度不得小于600px if (config.AllImageIsNail == 1 && config.AllImageWidth < 600) { ScriptHelper.Alert("整站图片压缩宽度不得小于600PX"); } #endregion config.SelfPick = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$SelfPick"); config.GroupBuyDays = Convert.ToInt32(GroupBuyDays.Text) < 0 ? 2 : Convert.ToInt32(GroupBuyDays.Text); config.PrintSN = PrintSN.Text; //分销商是否需要审核 config.CheckToBeDistributor = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$CheckToBeDistributor"); decimal _d1 = 0, _d2 = 0; //1级分销返佣 if (decimal.TryParse(FirstLevelDistributorRebatePercent.Text.Trim(), out _d1)) { if (_d1 > 0 && _d1 <= 40) { config.FirstLevelDistributorRebatePercent = _d1; } else { ScriptHelper.Alert("1级返佣比例必须是0~40之间的数字"); } } else { ScriptHelper.Alert("1级返佣比例必须大于0且不超过40"); } //2级分销返佣 if (decimal.TryParse(SecondLevelDistributorRebatePercent.Text.Trim(), out _d2)) { if (_d2 > 0 && _d2 <= _d1) { config.SecondLevelDistributorRebatePercent = _d2; } else { ScriptHelper.Alert("2级返佣比例必须大于0且不超过1级返佣比例"); } } else { ScriptHelper.Alert("2级返佣比例必须大于0且不超过1级返佣比例"); } ShopConfig.UpdateConfigInfo(config); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateConfig")); ScriptHelper.Alert(ShopLanguage.ReadLanguage("UpdateOK"), RequestHelper.RawUrl); }
protected void cmdTestIs_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'li'" ); result += "测试方法 JQuery.Is(string)<br />"; tracer.Execute ( jQuery, null, "Is", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'.happy'" } }, false ); result += "jQuery.Code = " + jQuery.Code + "<br />"; ScriptHelper scriptHelper = new ScriptHelper (); scriptHelper.Alert ( "'li is(.happay) = ' + " + jQuery.Code ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int id = RequestHelper.GetQueryString <int>("ID"); string Action = RequestHelper.GetQueryString <string>("Action"); if (Action == "Delete") { if (id != int.MinValue) { base.CheckAdminPower("DeleteTestPaper", PowerCheckType.Single); TestPaperInfo TestPaperModel = TestPaperBLL.ReadPaper(id); string FilePath = ServerHelper.MapPath("~/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } FilePath = ServerHelper.MapPath("~/m/xml/" + TestPaperModel.UserId.ToString() + "_" + TestPaperModel.CateId.ToString() + ".xml"); if (File.Exists(FilePath)) { File.Delete(FilePath); } TestPaperBLL.DeletePaper(id); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("TestPaper"), id); ScriptHelper.Alert(ShopLanguage.ReadLanguage("DeleteOK"), Request.UrlReferrer.ToString()); } } if (Action == "Search") { string searchUserName = RequestHelper.GetQueryString <string>("username"); string searchRealName = RequestHelper.GetQueryString <string>("realname"); string searchCompanyName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("companyname").Trim()); string searchCourseName = StringHelper.SearchSafe(RequestHelper.GetQueryString <string>("coursename").Trim()); DateTime startDate = RequestHelper.GetQueryString <DateTime>("StartDate"); DateTime endDate = RequestHelper.GetQueryString <DateTime>("EndDate"); int isPass = RequestHelper.GetQueryString <int>("IsPass"); CompanyName.Text = searchCompanyName; RealName.Text = searchRealName; UserName.Text = searchUserName; CourseName.Text = searchCourseName; if (startDate != DateTime.MinValue) { SearchStartDate.Text = startDate.ToString("d"); } if (endDate != DateTime.MinValue) { SearchEndDate.Text = endDate.ToString("d"); } if (isPass >= 0) { IsPass.Text = isPass.ToString(); } base.CheckAdminPower("ReadTestPaper", PowerCheckType.Single); deleteTestPaperPower = base.CompareAdminPower("DeleteTestPaper", PowerCheckType.Single); TestPaperInfo testPaperSearch = new TestPaperInfo(); testPaperSearch.TestMinDate = startDate; testPaperSearch.TestMaxDate = ShopCommon.SearchEndDate(endDate); testPaperSearch.IsPass = isPass; testPaperSearch.PaperName = searchCourseName; if (!string.IsNullOrEmpty(searchCompanyName)) { testPaperSearch.CompanyIdCondition = CompanyBLL.ReadCompanyIdStr(searchCompanyName, 1); } if (!string.IsNullOrEmpty(searchRealName) || !string.IsNullOrEmpty(searchUserName)) { UserSearchInfo user = new UserSearchInfo(); user.UserName = searchUserName; user.RealName = searchRealName; testPaperSearch.UserIdCondition = UserBLL.ReadUserIdStr(UserBLL.SearchUserList(user)); if (string.IsNullOrEmpty(testPaperSearch.UserIdCondition)) { testPaperSearch.UserIdCondition = "0"; } } base.BindControl(TestPaperBLL.ReadList(testPaperSearch, base.CurrentPage, base.PageSize, ref this.Count), this.RecordList, this.MyPager); } } }
protected override void PostBack() { post = PostBLL.ReadPost(id); post.PostName = StringHelper.SearchSafe(RequestHelper.GetForm <string>("PostName")); post.OrderIndex = 0; post.CompanyID = base.UserCompanyID; post.IsPost = 0; if (action == "Training") { post.ParentId = RequestHelper.GetForm <int>("ParentID"); post.IsPost = 1; } string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (id > 0) { PostBLL.UpdatePost(post); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Post"), id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); string returnURL = ServerHelper.UrlDecode(RequestHelper.GetQueryString <string>("ReturnURL")); if (string.IsNullOrEmpty(returnURL)) { ScriptHelper.Alert(alertMessage, "/User/TrainingAdd.aspx?Action=" + action); } else { ScriptHelper.Alert(alertMessage, returnURL); } } else { //添加培训分类时,设置ParentID的值 if (action == "TrainingClass") { List <PostInfo> companyTrainingList = PostBLL.ReadPostCateRootList(base.UserCompanyID.ToString()); if (companyTrainingList.Count > 0) { post.ParentId = companyTrainingList[0].PostId; } else { CompanyInfo company = CompanyBLL.ReadCompany(base.UserCompanyID); PostInfo firstPost = new PostInfo(); firstPost.CompanyID = company.CompanyId; firstPost.PostName = company.CompanySimpleName; firstPost.ParentId = 0; firstPost.IsPost = 0; id = PostBLL.AddPost(firstPost); post.ParentId = id; AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Post"), id); } } id = PostBLL.AddPost(post); //更新公司里的岗位设定 if (post.IsPost == 1) { CompanyInfo company = CompanyBLL.ReadCompany(base.UserCompanyID); company.Post = string.IsNullOrEmpty(company.Post) ? id.ToString() : string.Concat(company.Post, ",", id.ToString()); CompanyBLL.UpdateCompany(company); } Session["TrainingID"] = id.ToString(); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Post"), id); if (post.IsPost == 1) { ResponseHelper.Redirect("/User/TrainingAdd.aspx?Action=" + action + "&Result=Success"); } else { ScriptHelper.Alert(alertMessage, "/User/TrainingAdd.aspx?Action=" + action); } } }
protected void SubmitButton_Click(object sender, EventArgs e) { base.CheckAdminPower("UpdateConfig", PowerCheckType.Single); ShopConfigInfo config = ShopConfig.ReadConfigInfo(); config.Title = this.Title.Text; config.Copyright = this.Copyright.Text; config.Author = this.Author.Text; config.Keywords = this.Keywords.Text; config.Description = this.Description.Text; config.CodeType = Convert.ToInt32(this.CodeType.Text); config.CodeLength = Convert.ToInt32(this.CodeLength.Text); config.CodeDot = Convert.ToInt32(this.CodeDot.Text); config.StartYear = Convert.ToInt32(this.StartYear.Text); config.EndYear = Convert.ToInt32(this.EndYear.Text); config.Tel = this.Tel.Text; config.RecordCode = this.RecordCode.Text; config.StaticCode = this.StaticCode.Text; config.VoteID = Convert.ToInt32(this.VoteID.Text); config.AllowAnonymousVote = Convert.ToInt32(this.AllowAnonymousVote.Text); config.VoteRestrictTime = Convert.ToInt32(this.VoteRestrictTime.Text); config.SaveAutoClosePop = Convert.ToInt32(this.SaveAutoClosePop.Text); config.PopCloseRefresh = Convert.ToInt32(this.PopCloseRefresh.Text); config.UploadFile = this.UploadFile.Text; config.HotKeyword = this.HotKeyword.Text; config.ProductStorageType = Convert.ToInt32(this.ProductStorageType.Text); config.AllowAnonymousComment = Convert.ToInt32(this.AllowAnonymousComment.Text); config.CommentDefaultStatus = Convert.ToInt32(this.CommentDefaultStatus.Text); config.CommentRestrictTime = Convert.ToInt32(this.CommentRestrictTime.Text); config.AllowAnonymousCommentOperate = Convert.ToInt32(this.AllowAnonymousCommentOperate.Text); config.CommentOperateRestrictTime = Convert.ToInt32(this.CommentOperateRestrictTime.Text); config.AllowAnonymousReply = Convert.ToInt32(this.AllowAnonymousReply.Text); config.ReplyRestrictTime = Convert.ToInt32(this.ReplyRestrictTime.Text); config.AllowAnonymousAddTags = Convert.ToInt32(this.AllowAnonymousAddTags.Text); config.AddTagsRestrictTime = Convert.ToInt32(this.AddTagsRestrictTime.Text); config.EmailUserName = this.EmailUserName.Text; config.EmailPassword = this.EmailPassword.Text; config.EmailServer = this.EmailServer.Text; config.EmailServerPort = Convert.ToInt32(this.EmailServerPort.Text); config.ForbiddenName = this.ForbiddenName.Text; config.PasswordMinLength = Convert.ToInt32(this.PasswordMinLength.Text); config.PasswordMaxLength = Convert.ToInt32(this.PasswordMaxLength.Text); config.UserNameMinLength = Convert.ToInt32(this.UserNameMinLength.Text); config.UserNameMaxLength = Convert.ToInt32(this.UserNameMaxLength.Text); config.RegisterCheck = Convert.ToInt32(this.RegisterCheck.Text); config.Agreement = this.Agreement.Text; config.FindPasswordTimeRestrict = Convert.ToDouble(this.FindPasswordTimeRestrict.Text); config.AllowAnonymousAddCart = Convert.ToInt32(this.AllowAnonymousAddCart.Text); config.PayOrder = Convert.ToInt32(this.PayOrder.Text); config.CancleOrder = Convert.ToInt32(this.CancleOrder.Text); config.CheckOrder = Convert.ToInt32(this.CheckOrder.Text); config.SendOrder = Convert.ToInt32(this.SendOrder.Text); config.ReceivedOrder = Convert.ToInt32(this.ReceivedOrder.Text); config.ChangeOrder = Convert.ToInt32(this.ChangeOrder.Text); config.ReturnOrder = Convert.ToInt32(this.ReturnOrder.Text); config.BackOrder = Convert.ToInt32(this.BackOrder.Text); config.RefundOrder = Convert.ToInt32(this.RefundOrder.Text); config.WaterType = Convert.ToInt32(this.WaterType.Text); config.WaterPossition = Convert.ToInt32(this.WaterPossition.Text); config.Text = this.Text.Text; config.TextFont = this.TextFont.Text; config.TextSize = Convert.ToInt32(this.TextSize.Text); config.TextColor = this.TextColor.Text; config.WaterPhoto = this.WaterPhoto.Text; config.TestInterval = Convert.ToInt32(this.TestInterval.Text); config.IconFontPath = this.IconFontPath.Text; config.ManageIconFontPath = this.ManageIconFontPath.Text; ShopConfig.UpdateConfigInfo(config); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UpdateConfig")); ScriptHelper.Alert(ShopLanguage.ReadLanguage("UpdateOK"), RequestHelper.RawUrl); }
protected override void PageLoad() { base.PageLoad(); base.Title = "т╠╧╓ап╠М"; this.dt = UserBLL.CompanyIndexStatistics(base.UserCompanyID); this.currentCompany = CompanyBLL.ReadCompany(base.UserCompanyID); string companyPostSetting = CookiesHelper.ReadCookieValue("UserCompanyPostSetting"); workingPostList = PostBLL.ReadPostListByPostId(companyPostSetting); string action = RequestHelper.GetQueryString <string>("Action"); if (!string.IsNullOrEmpty(action)) { string selectID = RequestHelper.GetQueryString <string>("SelectID"); if (!string.IsNullOrEmpty(selectID)) { string alertMessage = string.Empty; if (action == "Delete") { base.CheckUserPower("DeleteUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Del); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("DeleteOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("DeleteRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "Freeze") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Frozen); TestPaperBLL.DeletePaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("FreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } else if (action == "UnFreeze") { base.CheckUserPower("UnFreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Normal); TestPaperBLL.RecoveryPaperByUserID(selectID); alertMessage = ShopLanguage.ReadLanguage("UnFreezeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("UnFreezeRecord"), ShopLanguage.ReadLanguage("User"), selectID); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("RecoveryRecord"), ShopLanguage.ReadLanguage("TestPaperRecord"), selectID); } else if (action == "Free") { base.CheckUserPower("FreezeUser", PowerCheckType.Single); UserBLL.ChangeUserStatus(selectID, (int)UserState.Free); alertMessage = ShopLanguage.ReadLanguage("FreeOK"); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("FreeRecord"), ShopLanguage.ReadLanguage("User"), selectID); } ScriptHelper.Alert(alertMessage, Request.UrlReferrer.ToString()); } } else { base.CheckUserPower("ReadUser", PowerCheckType.Single); UserSearchInfo userSearch = new UserSearchInfo(); if (companyID > 0) { userSearch.InCompanyID = companyID.ToString(); } else { userSearch.InCompanyID = base.SonCompanyID; } //userSearch.OutUserID = base.UserID.ToString(); userSearch.UserName = RequestHelper.GetQueryString <string>("UserId"); userSearch.RealName = RequestHelper.GetQueryString <string>("RealName"); userSearch.Email = RequestHelper.GetQueryString <string>("Email"); userSearch.Mobile = RequestHelper.GetQueryString <string>("Mobile"); userSearch.InWorkingPostID = RequestHelper.GetQueryString <string>("WorkingPostID"); if (state < 0) { state = (int)UserState.Normal; } //userSearch.Status = state; if (state == (int)UserState.Free) { userSearch.InStatus = string.Concat(state, ",", (int)UserState.Other); } else { userSearch.Status = state; } //userSearch.GroupId = 36; //userSearch.Sex = RequestHelper.GetQueryString<int>("Sex"); //userSearch.StartRegisterDate = RequestHelper.GetQueryString<DateTime>("StartRegisterDate"); //userSearch.EndRegisterDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString<DateTime>("EndRegisterDate")); //if (UserDel > 0) user.Del = UserDel; userList = UserBLL.SearchUserList(base.CurrentPage, base.PageSize, userSearch, ref this.Count); base.BindPageControl(ref base.CommonPager); } }
/// <summary> /// 按纽提交结束 /// </summary> protected void ButtonEnd(OrderInfo order, string note, OrderOperate orderOperate, int startOrderStatus) { OrderBLL.AdminUpdateOrderAddAction(order, note, (int)orderOperate, startOrderStatus); string result = OrderOperateSendEmail(order, orderOperate); if (orderOperate == OrderOperate.Pay) { #region 拼团订单付款:团长付款--开团+增加参团记录;成员付款--增加参团记录 if (order.IsActivity == (int)OrderKind.GroupBuy) { var orderDetail = OrderDetailBLL.ReadList(order.Id).FirstOrDefault() ?? new OrderDetailInfo(); if (orderDetail.Id > 0) { var product = ProductBLL.Read(orderDetail.ProductId); //团长付款 if (order.FavorableActivityId <= 0) { //开团 int groupId = GroupBuyBLL.Add(new GroupBuyInfo { Leader = order.UserId, ProductId = product.Id, StartTime = DateTime.Now, EndTime = DateTime.Now.AddDays(ShopConfig.ReadConfigInfo().GroupBuyDays), Quantity = product.GroupQuantity, //团购订单支付成功之后计数加1 SignCount = 1 }); //订单绑定团购Id Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("[FavorableActivityId]", groupId); OrderBLL.UpdatePart("[Order]", dict, order.Id); //增加参团记录 GroupSignBLL.Add(new GroupSignInfo { GroupId = groupId, UserId = order.UserId, OrderId = order.Id, SignTime = DateTime.Now }); } else//参团者付款 { //增加参团记录 GroupSignBLL.Add(new GroupSignInfo { GroupId = order.FavorableActivityId, UserId = order.UserId, OrderId = order.Id, SignTime = DateTime.Now }); //开团表signcount加1 GroupBuyBLL.PlusSignCount(order.FavorableActivityId); } } } #endregion #region 自提订单 生成提货码 //避免重复数据,一个订单对应一个提货码,提货码没有有效期,使用过后失效 if (order.SelfPick == 1 && PickUpCodeBLL.ReadByOrderId(order.Id).Id <= 0) { PickUpCodeInfo pkCode = new PickUpCodeInfo(); pkCode.OrderId = order.Id; pkCode.Status = 0; pkCode.PickCode = PickUpCodeBLL.CreatePickUpCode(); int pickCodeId = PickUpCodeBLL.Add(pkCode); //if (pickCodeId <= 0) //{ // return Json(new { flag = false, msg = "生成提货码失败" }); //} } #endregion //付款操作时触发sianalr ScriptHelper.Alert("订单" + ShopLanguage.ReadLanguage("OperateOK") + "。" + result, RequestHelper.RawUrl.IndexOf("?") >= 0 ? RequestHelper.RawUrl + "&paysuccess=1" : RequestHelper.RawUrl + "?paysuccess=1"); } else { ScriptHelper.Alert("订单" + ShopLanguage.ReadLanguage("OperateOK") + "。" + result, RequestHelper.RawUrl); } }
protected void SubmitButton_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(userid.Text)) { ScriptHelper.Alert("会员ID不能为空"); return; } OtherDuihuanInfo model = new OtherDuihuanInfo(); model.id = RequestHelper.GetQueryString <int>("ID"); if (model.id > 0) { //model = OtherDuihuanBLL.Read(model.id); //model.truename = name.Text; //model.mobile = mobile.Text; //model.note = note.Text; //model.integral = integral.Text; //model.adminid = Cookies.Admin.GetAdminID(true); //model.addtime = RequestHelper.DateNow; //OtherDuihuanBLL.Update(model); //AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), "修改兑换记录", model.id); } else { UserInfo usermodel = UserBLL.Read(Convert.ToInt32(userid.Text)); if (usermodel.Id > 0) { if (string.IsNullOrEmpty(integral.Text) || Convert.ToInt32(integral.Text) <= 0) { ScriptHelper.Alert("请填写兑换积分"); return; } if (usermodel.PointLeft < Convert.ToInt32(integral.Text)) { ScriptHelper.Alert("会员可用积分不足"); return; } model.userid = usermodel.Id; model.truename = name.Text; model.mobile = mobile.Text; model.note = note.Text; model.integral = integral.Text; model.adminid = Cookies.Admin.GetAdminID(true); model.addtime = RequestHelper.DateNow; //CheckAdminPower("UpdateUserMessage", PowerCheckType.Single); int _id = OtherDuihuanBLL.Add(model); if (_id > 0) { //会员积分扣除 usermodel.PointLeft -= Convert.ToInt32(integral.Text); UserBLL.Update(usermodel); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), "添加兑换记录", _id); } } else { ScriptHelper.Alert("会员ID不存在或已删除"); return; } } ScriptHelper.Alert(ShopLanguage.ReadLanguage("OperateOK"), RequestHelper.RawUrl); }
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; } } }
protected void HanderTestSetting(ProductInfo product) { try { string paperScore = PaperScore.Text.Trim(); string testTimeLength = TestTimeLength.Text.Trim(); string testQuestionsCount = QuestionsNum.Text.Trim(); string lowScore = LowScore.Text.Trim(); string testStartTime = TestStartTime.Text.Trim(); string testEndTime = TestEndTime.Text.Trim(); string testInterval = TestInterval.Text.Trim(); TestSettingInfo testSetting = new TestSettingInfo(); if (!string.IsNullOrEmpty(paperScore)) { testSetting.PaperScore = Convert.ToInt32(paperScore); } if (!string.IsNullOrEmpty(testTimeLength)) { testSetting.TestTimeLength = Convert.ToInt32(testTimeLength); } if (!string.IsNullOrEmpty(testQuestionsCount)) { testSetting.TestQuestionsCount = Convert.ToInt32(testQuestionsCount); } if (!string.IsNullOrEmpty(lowScore)) { testSetting.LowScore = Convert.ToInt32(lowScore); } if (!string.IsNullOrEmpty(testStartTime) && !string.IsNullOrEmpty(testEndTime)) { testSetting.TestStartTime = Convert.ToDateTime(testStartTime); testSetting.TestEndTime = Convert.ToDateTime(testEndTime); } if (!string.IsNullOrEmpty(testInterval)) { testSetting.TestInterval = Convert.ToInt32(testInterval); } TestSettingBLL.UpdateTestSetting(product.CompanyID, product.ID, testSetting); } catch (Exception ex) { ScriptHelper.Alert("考试时间设置出现异常!"); } //TestSettingInfo systemTestSetting = TestSettingBLL.ReadCompanyTestSetting(product.CompanyID, product.ID); //if (!string.IsNullOrEmpty(paperScore) || !string.IsNullOrEmpty(testTimeLength) || !string.IsNullOrEmpty(testQuestionsCount) || !string.IsNullOrEmpty(testQuestionsCount) || !string.IsNullOrEmpty(lowScore) || !string.IsNullOrEmpty(testStartTime) || !string.IsNullOrEmpty(testEndTime)) //{ // if (systemTestSetting == null) // { // systemTestSetting = TestSettingBLL.ReadTestSetting(product.CompanyID); // systemTestSetting.CompanyId = product.CompanyID; // systemTestSetting.CourseId = product.ID; // } // if (!string.IsNullOrEmpty(paperScore)) systemTestSetting.PaperScore = Convert.ToInt32(paperScore); // if (!string.IsNullOrEmpty(testTimeLength)) systemTestSetting.TestTimeLength = Convert.ToInt32(testTimeLength); // if (!string.IsNullOrEmpty(testQuestionsCount)) systemTestSetting.TestQuestionsCount = Convert.ToInt32(testQuestionsCount); // if (!string.IsNullOrEmpty(lowScore)) systemTestSetting.LowScore = Convert.ToInt32(lowScore); // //下面两项同时为空或同时不为空时可以修改 // if ((!string.IsNullOrEmpty(testStartTime) && !string.IsNullOrEmpty(testEndTime)) || (string.IsNullOrEmpty(testStartTime) && string.IsNullOrEmpty(testEndTime))) // { // systemTestSetting.TestStartTime = testStartTime; // systemTestSetting.TestEndTime = testEndTime; // } // TestSettingBLL.AddTestSetting(systemTestSetting); //} //else //{ // if (systemTestSetting != null) // { // TestSettingBLL.DeleteTestSetting(systemTestSetting.Id); // } //} }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { //try //{ //上传文件 //UploadHelper upload = new UploadHelper(); //upload.Path = "/Upload/ProductPhoto/Original/" + RequestHelper.DateNow.ToString("yyyyMM") + "/"; //upload.FileNameType = FileNameType.Guid; //upload.FileType = ShopConfig.ReadConfigInfo().UploadFile; //FileInfo file = upload.SaveAs(); string filePath = "/Upload/ProductPhoto/Original/" + RequestHelper.DateNow.ToString("yyyyMM") + "/"; if (FileHelper.SafeFullDirectoryName(filePath)) { try { //上传文件 UploadHelper upload = new UploadHelper(); upload.Path = "/Upload/ProductPhoto/Original/" + RequestHelper.DateNow.ToString("yyyyMM") + "/"; upload.FileType = ShopConfig.ReadConfigInfo().UploadFile; upload.FileNameType = FileNameType.Guid; upload.MaxWidth = ShopConfig.ReadConfigInfo().AllImageWidth; //整站图片压缩开启后的压缩宽度 upload.AllImageIsNail = ShopConfig.ReadConfigInfo().AllImageIsNail; //整站图片压缩开关 int needNail = RequestHelper.GetQueryString <int>("NeedNail"); if (needNail <= 0) { upload.AllImageIsNail = 0; //如果页面传值不压缩图片,以页面传值为准; } int curMaxWidth = RequestHelper.GetQueryString <int>("CurMaxWidth"); //页面传值最大宽度 if (curMaxWidth > 0) { upload.AllImageIsNail = 1; upload.MaxWidth = curMaxWidth;//如果有页面传值设置图片最大宽度,以页面传值为准 } FileInfo file = null; int waterType = ShopConfig.ReadConfigInfo().WaterType; if (waterType == 2 || waterType == 3) { string needMark = RequestHelper.GetQueryString <string>("NeedMark"); if (needMark == string.Empty || needMark == "1") { int waterPossition = ShopConfig.ReadConfigInfo().WaterPossition; string text = ShopConfig.ReadConfigInfo().Text; string textFont = ShopConfig.ReadConfigInfo().TextFont; int textSize = ShopConfig.ReadConfigInfo().TextSize; string textColor = ShopConfig.ReadConfigInfo().TextColor; string waterPhoto = Server.MapPath(ShopConfig.ReadConfigInfo().WaterPhoto); file = upload.SaveAs(waterType, waterPossition, text, textFont, textSize, textColor, waterPhoto); } else if (needMark == "0") { file = upload.SaveAs(); } } else { file = upload.SaveAs(); } //生成处理 string originalFile = upload.Path + file.Name; string otherFile = string.Empty; string makeFile = string.Empty; //Hashtable ht = new Hashtable(); //ht.Add("60", "60"); //ht.Add("90", "60"); //ht.Add("240", "180"); //ht.Add("340", "340"); //ht.Add("418", "313"); Dictionary <int, int> dic = new Dictionary <int, int>(); foreach (var phototype in PhotoSizeBLL.SearchList((int)PhotoType.ProductPhoto)) { dic.Add(phototype.Width, phototype.Height); } if (!dic.ContainsKey(75)) { dic.Add(75, 75); //后台商品图集默认使用尺寸(如果不存在则手动添加) } foreach (KeyValuePair <int, int> de in dic) { makeFile = originalFile.Replace("Original", de.Key + "-" + de.Value); otherFile += makeFile + "|"; ImageHelper.MakeThumbnailImage(ServerHelper.MapPath(originalFile), ServerHelper.MapPath(makeFile), Convert.ToInt32(de.Key), Convert.ToInt32(de.Value), ThumbnailType.AllFix); } otherFile = otherFile.Substring(0, otherFile.Length - 1); int proStyle = RequestHelper.GetQueryString <int>("proStyle"); if (proStyle < 0) { proStyle = 0; } ResponseHelper.Write("<script>window.parent.addProductPhoto('" + originalFile.Replace("Original", "75-75") + "','" + Name.Text + "','" + proStyle + "');</script>"); //保存数据库 UploadInfo tempUpload = new UploadInfo(); tempUpload.TableID = ProductPhotoBLL.TableID; tempUpload.ClassID = 0; tempUpload.RecordID = 0; tempUpload.UploadName = originalFile; tempUpload.OtherFile = otherFile; tempUpload.Size = Convert.ToInt32(file.Length); tempUpload.FileType = file.Extension; tempUpload.RandomNumber = Cookies.Admin.GetRandomNumber(false); tempUpload.Date = RequestHelper.DateNow; tempUpload.IP = ClientHelper.IP; UploadBLL.AddUpload(tempUpload); } catch (Exception ex) { //ExceptionHelper.ProcessException(ex, false); ResponseHelper.Write("<script>alert('" + ex.Message + "'); </script>"); } } else { ScriptHelper.Alert(ShopLanguage.ReadLanguage("ErrorPathName")); } }
protected void SubmitButton_Click(object sender, EventArgs e) { FavorableActivityInfo favorableActivity = new FavorableActivityInfo(); favorableActivity.Id = RequestHelper.GetQueryString <int>("ID"); favorableActivity.Name = Name.Text; favorableActivity.Photo = Photo.Text; favorableActivity.Content = Content.Text; favorableActivity.StartDate = Convert.ToDateTime(StartDate.Text); favorableActivity.EndDate = Convert.ToDateTime(EndDate.Text).AddDays(1).AddSeconds(-1); favorableActivity.UserGrade = ControlHelper.GetCheckBoxListValue(UserGrade); favorableActivity.OrderProductMoney = Convert.ToDecimal(OrderProductMoney.Text); favorableActivity.Type = RequestHelper.GetForm <int>("FavorableType") < 0 ? 0 : RequestHelper.GetForm <int>("FavorableType"); int shippingWay = RequestHelper.GetForm <int>("ShippingWay"); string regionID = string.Empty; if (UserGradeBLL.ReadList().Count > 0 && string.IsNullOrEmpty(favorableActivity.UserGrade)) { ScriptHelper.Alert("至少选择1个会员等级", RequestHelper.RawUrl); } if (favorableActivity.EndDate < favorableActivity.StartDate) { ScriptHelper.Alert("结束日期不得小于开始日期"); } //如果是订单优惠类型并选择了运费优惠 if (favorableActivity.Type == (int)FavorableType.AllOrders && shippingWay == 1) { //regionID = RegionID.ClassIDList; favorableActivity.RegionId = RegionID.ClassIDList; } //如果是商品分类优惠 if (favorableActivity.Type == (int)FavorableType.ProductClass) { favorableActivity.ClassIds = ProductClass.ClassIDList; } favorableActivity.ShippingWay = shippingWay; int reduceWay = RequestHelper.GetForm <int>("ReduceWay"); decimal reduceMoney = 0; decimal reduceDiscount = 0; if (reduceWay == 1) { reduceMoney = Convert.ToDecimal(ReduceMoney.Text); } else if (reduceWay == 2) { reduceDiscount = Convert.ToDecimal(ReduceDiscount.Text); } favorableActivity.ReduceWay = reduceWay; favorableActivity.ReduceMoney = reduceMoney; favorableActivity.ReduceDiscount = reduceDiscount; favorableActivity.GiftId = RequestHelper.GetIntsForm("GiftList"); string alertMessage = string.Empty; //限制同一时间段只能有一种优惠方式 //if (FavorableActivityBLL.Read(favorableActivity.StartDate, favorableActivity.EndDate, favorableActivity.Id).Id > 0) //{ // alertMessage = ShopLanguage.ReadLanguage("OneTimeManyFavorableActivity"); //} //else //{ alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (favorableActivity.Id == int.MinValue) { CheckAdminPower("AddFavorableActivity", PowerCheckType.Single); int id = FavorableActivityBLL.Add(favorableActivity); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("FavorableActivity"), id); } else { CheckAdminPower("UpdateFavorableActivity", PowerCheckType.Single); FavorableActivityBLL.Update(favorableActivity); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("FavorableActivity"), favorableActivity.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } //} ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void cmdTestAppendScript_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.AppendScript(string)<br />"; scriptHelper.Confirm ( "'有名字?'", "n" ); tracer.Execute ( scriptHelper, null, "AppendScript", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "if(n){n = '有名字';}else{n = '没有名字';}" } }, false ); scriptHelper.Alert ( "'名字? ' + n" ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
/// <summary> /// 提交按钮点击方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SubmitButton_Click(object sender, EventArgs e) { int id = RequestHelper.GetQueryString <int>("ID"); ProductInfo product = new ProductInfo(); if (id > 0) { product = ProductBLL.Read(id); } product.YejiRatio = YejiRatio.Text; product.Name = Name.Text; product.SellPoint = SellPoint.Text; product.Spelling = ChineseCharacterHelper.GetFirstLetter(Name.Text); product.Color = RequestHelper.GetForm <string>("ProductColor"); product.FontStyle = FontStyle.Text; product.ProductNumber = ProductNumber.Text; //product.ClassId = ProductClass.ClassID; if (!string.IsNullOrEmpty(RequestHelper.GetQueryString <string>("classId"))) { product.ClassId = RequestHelper.GetQueryString <string>("classId"); } product.Keywords = Keywords.Text; product.BrandId = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$BrandID"); product.MarketPrice = Convert.ToDecimal(MarketPrice.Text); product.SendPoint = Convert.ToInt32(SendPoint.Text); product.Photo = Photo.Text; product.Summary = Summary.Text; product.Introduction1 = Introduction.Value; product.Weight = Convert.ToDecimal(Weight.Text); product.IsSpecial = Convert.ToInt32(IsSpecial.Checked); product.IsNew = Convert.ToInt32(IsNew.Checked); product.IsHot = Convert.ToInt32(IsHot.Checked); product.IsSale = Convert.ToInt32(IsSale.Checked); product.IsTop = Convert.ToInt32(IsTop.Checked); //保存时如果售后服务为空则自动获取所属分类的售后服务并保存 product.Remark = string.IsNullOrEmpty(StringHelper.KillHTML(Remark.Value)) ? GetProductClassRemark(product.ClassId) : Remark.Value; product.Accessory = RequestHelper.GetForm <string>("RelationAccessoryID"); product.RelationProduct = RequestHelper.GetForm <string>("RelationProductID"); product.RelationArticle = RequestHelper.GetForm <string>("RelationArticleID"); product.AllowComment = Convert.ToInt32(AllowComment.Checked); product.TotalStorageCount = Convert.ToInt32(TotalStorageCount.Text); if (TotalStorageCount.ReadOnly) { product.TotalStorageCount = Convert.ToInt32(HidTotalStorageCount.Value); } product.LowerCount = Convert.ToInt32(LowerCount.Text.Trim()); product.UpperCount = 0; product.StandardType = Convert.ToInt32(RequestHelper.GetForm <string>("StandardType")); product.AddDate = RequestHelper.DateNow; product.OrderId = Convert.ToInt32(OrderID.Text.Trim()); product.SalePrice = Convert.ToDecimal(SalePrice.Text); product.Unit = Units.Text; product.Introduction1_Mobile = Introduction_Mobile.Value; product.SubTitle = Sub_Title.Text; #region 商品开团 //是否开启开团 product.OpenGroup = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$OpenGroup") <= 0 ? 0 : 1; decimal _groupPrice = 0; decimal.TryParse(GroupPrice.Text.Trim(), out _groupPrice); product.GroupPrice = _groupPrice < 0 ? 0 : _groupPrice; int _groupQuantity = 0; int.TryParse(GroupQuantity.Text.Trim(), out _groupQuantity); product.GroupQuantity = _groupQuantity < 0 ? 0 : _groupQuantity; product.GroupPhoto = GroupPhoto.Text; #endregion //是否启用不限库存 product.UnlimitedStorage = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$UnlimitedStorage"); #region 虚拟库存 //是否启用虚拟销量 product.UseVirtualOrder = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$UseVirtualOrder") <= 0 ? 0 : 1; //虚拟销量数 product.VirtualOrderCount = Convert.ToInt32(VirtualOrderCount.Text) <= 0 ? 0 : Convert.ToInt32(VirtualOrderCount.Text); #endregion string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (id <= 0) { CheckAdminPower("AddProduct", PowerCheckType.Single); int pid = ProductBLL.Add(product); AddProductPhoto(pid); #region 添加时生成手机网站二维码 //string ewmName = string.Empty;//二维码路径 //CreateQRcode("http://" + HttpContext.Current.Request.Url.Host + (HttpContext.Current.Request.Url.Port > 0 ? ":" + HttpContext.Current.Request.Url.Port : "") + "/mobile/ProductDetail-i" + pid + ".html", "pro_" + pid.ToString(), ref ewmName); //Dictionary<string, object> dict = new Dictionary<string, object>(); //dict.Add("[Qrcode]", ewmName); //ProductBLL.UpdatePart("[Product]", dict, pid); #endregion #region 添加时生成小程序商品推广码(扫码进入小程序商品详情页) string product_miniProramCode = string.Empty; CreateMiniProgramCode(pid, ref product_miniProramCode, product.Qrcode); Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("[Qrcode]", product_miniProramCode); ProductBLL.UpdatePart("[Product]", dict, pid); #endregion AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Product"), pid); } else { CheckAdminPower("UpdateProduct", PowerCheckType.Single); #region 添加时生成小程序商品推广码(扫码进入小程序商品详情页) string product_miniProramCode = string.Empty; CreateMiniProgramCode(id, ref product_miniProramCode, product.Qrcode); product.Qrcode = product_miniProramCode; #endregion ProductBLL.Update(product); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("Product"), product.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } HanderAttribute(product); //HanderMemberPrice(product.ID); HanderProductStandard(product); ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void cmdTestBuild_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Build(Page)<br />"; scriptHelper.Alert ( "'测试 Build 1'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ) }, null, null, null, new object[][] { new object[] { this } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, ScriptBuildOption)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 2'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( ScriptBuildOption ) }, null, null, null, new object[][] { new object[] { this, ScriptBuildOption.OnlyCode } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, string)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 3'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "myscript" }, new object[] { this, "myscript" } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, string, ScriptBuildOption)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 4'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( ScriptBuildOption ) }, null, null, null, new object[][] { new object[] { this, "myscript1", ScriptBuildOption.None }, new object[] { this, "myscript2", ScriptBuildOption.OnlyCode }, new object[] { this, "myscript3", ScriptBuildOption.Startup }, new object[] { this, "myscript3", ScriptBuildOption.Startup } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; }
/// <summary> /// 保存草稿 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void DraftButton_Click(object sender, EventArgs e) { int id = RequestHelper.GetQueryString <int>("ID"); ProductInfo product = new ProductInfo(); if (id > 0) { product = ProductBLL.Read(id); } product.Name = Name.Text; product.Spelling = ChineseCharacterHelper.GetFirstLetter(Name.Text); product.Color = RequestHelper.GetForm <string>("ProductColor"); product.FontStyle = FontStyle.Text; product.ProductNumber = ProductNumber.Text; //product.ClassId = ProductClass.ClassID; if (!string.IsNullOrEmpty(RequestHelper.GetQueryString <string>("classId"))) { product.ClassId = RequestHelper.GetQueryString <string>("classId"); } product.Keywords = Keywords.Text; product.BrandId = RequestHelper.GetForm <int>("ctl00$ContentPlaceHolder$BrandID"); product.MarketPrice = Convert.ToDecimal(MarketPrice.Text); product.SendPoint = Convert.ToInt32(SendPoint.Text); product.Photo = Photo.Text; product.Summary = Summary.Text; product.Introduction1 = Introduction.Value; product.Weight = Convert.ToDecimal(Weight.Text); product.IsSpecial = Convert.ToInt32(IsSpecial.Checked); product.IsNew = Convert.ToInt32(IsNew.Checked); product.IsHot = Convert.ToInt32(IsHot.Checked); product.IsSale = 2;//草稿状态 product.IsTop = Convert.ToInt32(IsTop.Checked); product.Remark = Remark.Value; product.Accessory = RequestHelper.GetForm <string>("RelationAccessoryID"); product.RelationProduct = RequestHelper.GetForm <string>("RelationProductID"); product.RelationArticle = RequestHelper.GetForm <string>("RelationArticleID"); product.AllowComment = Convert.ToInt32(AllowComment.Checked); product.TotalStorageCount = Convert.ToInt32(TotalStorageCount.Text); if (TotalStorageCount.ReadOnly) { product.TotalStorageCount = Convert.ToInt32(HidTotalStorageCount.Value); } product.LowerCount = Convert.ToInt32(LowerCount.Text.Trim()); product.UpperCount = 0; product.StandardType = Convert.ToInt32(RequestHelper.GetForm <string>("StandardType")); product.AddDate = RequestHelper.DateNow; product.OrderId = Convert.ToInt32(OrderID.Text.Trim()); product.SalePrice = Convert.ToDecimal(SalePrice.Text); product.Unit = Units.Text; product.Introduction1_Mobile = Introduction_Mobile.Value; product.SubTitle = Sub_Title.Text; string alertMessage = ShopLanguage.ReadLanguage("AddOK"); CheckAdminPower("AddProduct", PowerCheckType.Single); int pid = ProductBLL.Add(product); AddProductPhoto(pid); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Product"), pid); HanderAttribute(product); //HanderMemberPrice(product.ID); HanderProductStandard(product); ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
protected void cmdRun2_Click ( object sender, EventArgs e ) { // 创建 ScriptHelper 对象 ScriptHelper scriptHelper = new ScriptHelper (); string code = this.txtCode2.Text; if ( code == string.Empty ) { // 没有脚本, 添加弹出消息框的脚本 scriptHelper.Alert ( "'没有任何脚本'" ); scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); return; } ScriptHelper.RegisterAttribute ( this, this.lblCode2.ClientID, "innerText", code ); scriptHelper.AppendCode ( code ); // 生成脚本到页面 scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
private void CheckAdminPower(string powerKey, string powerString, PowerCheckType powerCheckType, ref int adminID) { string power = AdminGroupBLL.ReadAdminGroupCache(Cookies.Admin.GetGroupID(false)).Power; bool flag = false; switch (powerCheckType) { case PowerCheckType.Single: if (power.IndexOf("|" + powerKey + powerString + "|") > -1) { flag = true; } break; case PowerCheckType.OR: foreach (string str2 in powerString.Split(new char[] { ',' })) { if (power.IndexOf("|" + powerKey + str2 + "|") > -1) { flag = true; break; } } break; case PowerCheckType.AND: flag = true; foreach (string str2 in powerString.Split(new char[] { ',' })) { if (power.IndexOf("|" + powerKey + str2 + "|") == -1) { flag = false; break; } } break; } if (!flag) { adminID = -1; } else { bool flag2 = false; Hashtable hashtable = this.ReadAllNeedOther(); foreach (DictionaryEntry entry in hashtable) { if (entry.Key.ToString() == powerString) { flag2 = Convert.ToBoolean(entry.Value); if (!flag2) { break; } } } if (flag2) { if (power.IndexOf("|" + powerKey + "ManageOther|") > -1) { adminID = -2147483648; } else { adminID = Cookies.Admin.GetAdminID(false); } } else { adminID = -2147483648; } } if (adminID == -1) { ScriptHelper.Alert(ShopLanguage.ReadLanguage("NoPower")); } }
protected void cmdOK3_Click ( object sender, EventArgs e ) { // 创建 ScriptHelper 对象 ScriptHelper scriptHelper = new ScriptHelper (); string password = this.txtPassword3.Text; // 隐藏第一步, 设置记录的用户名到隐藏字段 ScriptHelper.RegisterAttribute ( this, "r1", "style.display", "none" ); ScriptHelper.RegisterHidden ( this, "r1name", this.Request["r1name"] ); if ( password == string.Empty ) { // 没有写密码, 添加弹出消息框的脚本, 并显示第二步 scriptHelper.Alert ( "'请填写密码'" ); ScriptHelper.RegisterAttribute ( this, "r2", "style.display", "block" ); } else { // 显示注册结果 ScriptHelper.RegisterAttribute ( this, "r3", "style.display", "block" ); ScriptHelper.RegisterAttribute ( this, "rr1", "innerText", string.Format ( "用户名: {0}, 密码: {1}", this.Request["r1name"], password ) ); } // 生成脚本 scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
protected override void PageLoad() { base.PageLoad(); base.Title = "添加KPI指标"; base.CheckUserPower("AddEvaluate", PowerCheckType.Single); if (companyID <= 0) { companyID = base.UserCompanyID; } string tempKPI = string.Empty; //临时指标ID string fixedKPI = string.Empty; //永久指标ID //获取岗位ID后,加载岗位KPI列表 if (Action == "step1") { if (userId == int.MinValue) { userName = RequestHelper.GetForm <string>("UserName"); UserSearchInfo user = new UserSearchInfo(); user.EqualRealName = userName; user.InCompanyID = companyID.ToString(); List <UserInfo> userList = UserBLL.SearchUserList(user); if (userList.Count > 0) { userId = userList[0].ID; } else { ScriptHelper.Alert("找不到此用户"); } } workPostId = RequestHelper.GetForm <int>("PostId"); evaluateNameId = RequestHelper.GetForm <int>("EvaluationName"); //获取UserId值 if (workPostId > 0) { KPISearchInfo kpiSearch = new KPISearchInfo(); kpiSearch.IdStr = WorkingPostBLL.ReadWorkingPostView(workPostId).KPIContent; if (!string.IsNullOrEmpty(kpiSearch.IdStr)) { List <KPIInfo> kpiList = KPIBLL.SearchKPIList(kpiSearch); List <KPIInfo> tempList1 = new List <KPIInfo>(); List <KPIInfo> tempList2 = new List <KPIInfo>(); List <KPIInfo> tempList3 = new List <KPIInfo>(); foreach (KPIInfo info in kpiList) { if (info.Type == KPIType.Fixed) { if (string.IsNullOrEmpty(fixedKPI)) { fixedKPI = info.ID.ToString(); } else { fixedKPI = fixedKPI + "," + info.ID.ToString(); } } else { if (string.IsNullOrEmpty(tempKPI)) { tempKPI = info.ID.ToString(); } else { tempKPI = tempKPI + "," + info.ID.ToString(); } } switch (info.ParentId) { case 1: tempList1.Add(info); break; case 2: tempList2.Add(info); break; case 3: tempList3.Add(info); break; } } int i = 1; foreach (KPIInfo info in tempList1) { trHtml.AppendLine("<tr>"); if (i == 1) { trHtml.AppendLine(" <td rowspan=\"" + tempList1.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>"); } if (info.Type == KPIType.Fixed) { trHtml.AppendLine(" <td class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } else { trHtml.AppendLine(" <td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } trHtml.AppendLine(" <td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine("</tr>"); i++; } i = 1; foreach (KPIInfo info in tempList2) { trHtml.AppendLine("<tr>"); if (i == 1) { trHtml.AppendLine(" <td rowspan=\"" + tempList2.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>"); } if (info.Type == KPIType.Fixed) { trHtml.AppendLine(" <td class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } else { trHtml.AppendLine(" <td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } trHtml.AppendLine(" <td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine("</tr>"); i++; } i = 1; foreach (KPIInfo info in tempList3) { trHtml.AppendLine("<tr>"); if (i == 1) { trHtml.AppendLine(" <td rowspan=\"" + tempList3.Count + "\" class=\"indicator_name\">" + KPIBLL.ReadKPI(info.ParentId).Name + "</td>"); } if (info.Type == KPIType.Fixed) { trHtml.AppendLine(" <td class=\"forever\">" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } else { trHtml.AppendLine(" <td>" + EnumHelper.ReadEnumChineseName <KPIType>((int)info.Type) + "</td>"); } trHtml.AppendLine(" <td class=\"evaluation_content\" data-id=\"" + info.ID + "\">" + i.ToString() + "." + info.Name + "</td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine(" <td class=\"schedule\"></td>"); trHtml.AppendLine("</tr>"); i++; } } } if (userId > 0) { KPIEvaluateSearchInfo kpiEvaluate = new KPIEvaluateSearchInfo(); kpiEvaluate.UserId = userId.ToString(); kpiEvaluate.EvaluateNameId = evaluateNameId; kpiEvaluate.PostId = workPostId.ToString(); //取得临时指标的值 if (!string.IsNullOrEmpty(tempKPI)) { kpiEvaluate.KPIdStr = tempKPI; foreach (KPIEvaluateInfo info in KPIEvaluateBLL.SearchKPIEvaluateList(kpiEvaluate)) { if (string.IsNullOrEmpty(kpiIdStr)) { kpiIdStr = info.KPIId + ":" + info.Rate; } else { kpiIdStr = kpiIdStr + "," + info.KPIId + ":" + info.Rate; } } } //取得永久指标的值 if (!string.IsNullOrEmpty(fixedKPI)) { kpiEvaluate.KPIdStr = fixedKPI; List <KPIEvaluateInfo> fixedKPIEValuateList = KPIEvaluateBLL.SearchKPIEvaluateList(kpiEvaluate); //如果临时指标和永久指标的记录都为空的话,则为新增评估,调取永久指标记录 if (string.IsNullOrEmpty(kpiIdStr) && fixedKPIEValuateList.Count <= 0) { kpiEvaluate.EvaluateNameId = int.MinValue; kpiEvaluate.PostId = string.Empty; //所有岗位的评估记录都有效(包括已删除岗位的评估记录) fixedKPIEValuateList = KPIEvaluateBLL.SearchFixedKPIEvaluateList(kpiEvaluate); } foreach (KPIEvaluateInfo info in fixedKPIEValuateList)//BLLKPIEvaluate.SearchFixedKPIEvaluateList(kpiEvaluate) { if (string.IsNullOrEmpty(kpiIdStr)) { kpiIdStr = info.KPIId + ":" + info.Rate; } else { kpiIdStr = kpiIdStr + "," + info.KPIId + ":" + info.Rate; } } } } } else if (Action == "step2") { kpiIdStr = RequestHelper.GetForm <string>("kpiidstr"); //workPostId = RequestHelper.GetForm<int>("PostId"); string alertMessage = ShopLanguage.ReadLanguage("AddOK"); base.CheckUserPower("AddEvaluate", PowerCheckType.Single); if (!string.IsNullOrEmpty(kpiIdStr)) { KPIEvaluateBLL.DeleteKPIEvaluate(userId, workPostId, evaluateNameId); foreach (string item in kpiIdStr.Split(',')) { KPIEvaluateInfo kpiEvaluate = new KPIEvaluateInfo(); kpiEvaluate.KPIId = int.Parse(item.Split(':')[0]); kpiEvaluate.Scorse = float.Parse(item.Split(':')[1]); kpiEvaluate.UserId = userId; //kpiEvaluate.EvaluateDate = evaluateDate; kpiEvaluate.EvaluateNameId = evaluateNameId; kpiEvaluate.PostId = workPostId; kpiEvaluate.Rate = int.Parse(item.Split(':')[1]); int id = KPIEvaluateBLL.AddKPIEvaluate(kpiEvaluate); AdminLogBLL.AddAdminLog(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("Evaluate"), id); } } ScriptHelper.Alert(alertMessage, "EvaluateAdd.aspx"); } }