private void DataBindDiscount() { this.id = Globals.RequestQueryNum("id"); if (this.id > 0) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id); if (discountInfo != null) { this.actionName = discountInfo.ActivityName; } } ProductQuery productQuery = new ProductQuery { Keywords = this.txtProductName.Text, ProductCode = "", CategoryId = this.dropCategories.SelectedValue, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence" }; if (this.dropCategories.SelectedValue.HasValue && this.dropCategories.SelectedValue > 0) { productQuery.MaiCategoryPath = CatalogHelper.GetCategory(this.dropCategories.SelectedValue.Value).Path; } DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(productQuery); this.grdProducts.DataSource = discountProduct.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = discountProduct.TotalRecords; }
protected void Page_Load(object sender, System.EventArgs e) { if (!base.IsPostBack) { this.id = Globals.RequestQueryNum("id"); if (this.id > 0) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id); if (discountInfo != null) { this.txtActivityName.Text = discountInfo.ActivityName; this.dateBeginTime.Text = discountInfo.BeginTime.ToString(); this.dateEndTime.Text = discountInfo.EndTime.ToString(); this.txtDescription.Text = discountInfo.Description; this.txtLimitNumber.Text = discountInfo.LimitNumber.ToString(); System.Web.UI.WebControls.HiddenField hiddenField = this.memberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField2 = this.memberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField3 = this.memberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField; this.memberRange.Grade = discountInfo.ApplyMembers; this.memberRange.CustomGroup = discountInfo.CustomGroup; this.memberRange.DefualtGroup = discountInfo.DefualtGroup; hiddenField.Value = discountInfo.ApplyMembers; hiddenField2.Value = discountInfo.DefualtGroup; hiddenField3.Value = discountInfo.CustomGroup; } } } }
private void IsDiscountProduct(System.Web.HttpContext context) { int num = Globals.RequestFormNum("productId"); if (num > 0) { LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(num); if (discountProductInfoByProductId != null) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); int num2 = 0; int num3 = discountInfo.LimitNumber; if (discountInfo != null) { if (currentMember != null) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId)) { int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(discountProductInfoByProductId.LimitedTimeDiscountId, null, num, currentMember.UserId, false); if (discountInfo.LimitNumber == 0) { num2 = discountInfo.LimitedTimeDiscountId; } else if (discountInfo.LimitNumber - limitedTimeDiscountUsedNum > 0) { num2 = discountInfo.LimitedTimeDiscountId; num3 = discountInfo.LimitNumber - limitedTimeDiscountUsedNum; } else { num3 = 0; } } } else { num2 = discountInfo.LimitedTimeDiscountId; } } if (discountInfo != null) { context.Response.Write(string.Concat(new object[] { "{\"msg\":\"success\",\"ActivityName\":\"", Globals.String2Json(discountInfo.ActivityName), "\",\"FinalPrice\":\"", discountProductInfoByProductId.FinalPrice.ToString("f2"), "\",\"LimitedTimeDiscountId\":\"", num2, "\",\"LimitNumber\":\"", discountInfo.LimitNumber, "\",\"RemainNumber\":\"", num3, "\"}" })); } } } }
private void SaveDiscountProduct(HttpContext context) { Globals.RequestFormNum("id"); foreach (string str2 in Globals.RequestFormStr("discountProductList").Trim(new char[] { ',' }).Split(new char[] { ',' })) { string[] strArray2 = str2.Split(new char[] { '^' }); LimitedTimeDiscountProductInfo info = new LimitedTimeDiscountProductInfo(); if (((!string.IsNullOrEmpty(strArray2[0]) && !string.IsNullOrEmpty(strArray2[1])) && !string.IsNullOrEmpty(strArray2[4])) && (!string.IsNullOrEmpty(strArray2[2]) || !string.IsNullOrEmpty(strArray2[3]))) { int id = Globals.ToNum(strArray2[0]); LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id); info.LimitedTimeDiscountId = id; info.ProductId = Globals.ToNum(strArray2[1]); info.Discount = (string.IsNullOrEmpty(strArray2[2]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[2]); info.Minus = (string.IsNullOrEmpty(strArray2[3]) || (strArray2[2] == "undefined")) ? 0M : decimal.Parse(strArray2[3]); info.FinalPrice = decimal.Parse(strArray2[4]); if (discountInfo != null) { info.BeginTime = discountInfo.BeginTime; info.EndTime = discountInfo.EndTime; } info.CreateTime = DateTime.Now; info.Status = 1; LimitedTimeDiscountHelper.AddLimitedTimeDiscountProduct(info); } } context.Response.Write("{\"msg\":\"success\"}"); }
public bool UpdateLimitedTimeDiscount(LimitedTimeDiscountInfo info) { DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE [Hishop_LimitedTimeDiscount] SET [ActivityName]=@ActivityName,[BeginTime]=@BeginTime,[EndTime]=@EndTime,[Description]=@Description,[LimitNumber]=@LimitNumber,[ApplyMembers]=@ApplyMembers,[DefualtGroup]=@DefualtGroup,[CustomGroup]=@CustomGroup,[CreateTime]=@CreateTime,[Status]=@Status,[IsCommission]=@IsCommission,[CommissionDiscount]=@CommissionDiscount WHERE LimitedTimeDiscountId=@LimitedTimeDiscountId"); this.database.AddInParameter(sqlStringCommand, "ActivityName", DbType.String, info.ActivityName); this.database.AddInParameter(sqlStringCommand, "BeginTime", DbType.DateTime, info.BeginTime); this.database.AddInParameter(sqlStringCommand, "EndTime", DbType.DateTime, info.EndTime); this.database.AddInParameter(sqlStringCommand, "Description", DbType.String, info.Description); this.database.AddInParameter(sqlStringCommand, "LimitNumber", DbType.Int32, info.LimitNumber); this.database.AddInParameter(sqlStringCommand, "ApplyMembers", DbType.String, info.ApplyMembers); this.database.AddInParameter(sqlStringCommand, "DefualtGroup", DbType.String, info.DefualtGroup); this.database.AddInParameter(sqlStringCommand, "CustomGroup", DbType.String, info.CustomGroup); this.database.AddInParameter(sqlStringCommand, "CreateTime", DbType.DateTime, info.CreateTime); this.database.AddInParameter(sqlStringCommand, "Status", DbType.Int32, info.Status); this.database.AddInParameter(sqlStringCommand, "IsCommission", DbType.Boolean, info.IsCommission); this.database.AddInParameter(sqlStringCommand, "CommissionDiscount", DbType.Decimal, info.CommissionDiscount); this.database.AddInParameter(sqlStringCommand, "LimitedTimeDiscountId", DbType.Int32, info.LimitedTimeDiscountId); bool flag = this.database.ExecuteNonQuery(sqlStringCommand) > 0; if (flag) { DbCommand command = this.database.GetSqlStringCommand("UPDATE [Hishop_LimitedTimeDiscountProduct] SET [BeginTime]=@BeginTime,[EndTime]=@EndTime WHERE LimitedTimeDiscountId=@LimitedTimeDiscountId"); this.database.AddInParameter(command, "BeginTime", DbType.DateTime, info.BeginTime); this.database.AddInParameter(command, "EndTime", DbType.DateTime, info.EndTime); this.database.AddInParameter(command, "LimitedTimeDiscountId", DbType.Int32, info.LimitedTimeDiscountId); this.database.ExecuteNonQuery(command); } return(flag); }
protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack) { this.id = Globals.RequestQueryNum("id"); if (this.id > 0) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id); if (discountInfo != null) { this.IsCommision.Checked = discountInfo.IsCommission; this.discount.Text = (((double)discountInfo.CommissionDiscount) / 10.0).ToString(); this.txtActivityName.Text = discountInfo.ActivityName; this.dateBeginTime.Text = discountInfo.BeginTime.ToString(); this.dateEndTime.Text = discountInfo.EndTime.ToString(); this.txtDescription.Text = discountInfo.Description; this.txtLimitNumber.Text = discountInfo.LimitNumber.ToString(); HiddenField field = this.memberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.memberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.memberRange.FindControl("txt_CustomGroup") as HiddenField; this.memberRange.Grade = discountInfo.ApplyMembers; this.memberRange.CustomGroup = discountInfo.CustomGroup; this.memberRange.DefualtGroup = discountInfo.DefualtGroup; field.Value = discountInfo.ApplyMembers; field2.Value = discountInfo.DefualtGroup; field3.Value = discountInfo.CustomGroup; } } } }
protected void btnSave_Click(object sender, System.EventArgs e) { string text = this.txtActivityName.Text; System.DateTime?textToDate = this.dateBeginTime.TextToDate; System.DateTime?textToDate2 = this.dateEndTime.TextToDate; string text2 = this.txtDescription.Text; int limitNumber = 0; System.Web.UI.WebControls.HiddenField hiddenField = this.memberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField2 = this.memberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField3 = this.memberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField; if (string.IsNullOrEmpty(text)) { this.ShowMsg("活动名称不能为空!", false); return; } if (!textToDate.HasValue || !textToDate2.HasValue) { this.ShowMsg("开始时间和结束时间都不能为空!", false); return; } if (textToDate.Value >= textToDate2.Value) { this.ShowMsg("开始时间不能大于或等于结束时间!", false); return; } if (!int.TryParse(this.txtLimitNumber.Text, out limitNumber)) { this.ShowMsg("每人限购格式不对!", false); return; } if (hiddenField.Value == "-1" && hiddenField2.Value == "-1" && hiddenField3.Value == "-1") { this.ShowMsg("请选择适用会员!", false); return; } LimitedTimeDiscountInfo limitedTimeDiscountInfo = new LimitedTimeDiscountInfo(); limitedTimeDiscountInfo.ActivityName = text; limitedTimeDiscountInfo.BeginTime = textToDate.Value; limitedTimeDiscountInfo.EndTime = textToDate2.Value; limitedTimeDiscountInfo.Description = text2; limitedTimeDiscountInfo.LimitNumber = limitNumber; limitedTimeDiscountInfo.ApplyMembers = hiddenField.Value; limitedTimeDiscountInfo.DefualtGroup = hiddenField2.Value; limitedTimeDiscountInfo.CustomGroup = hiddenField3.Value; limitedTimeDiscountInfo.CreateTime = System.DateTime.Now; limitedTimeDiscountInfo.Status = 1.ToString(); int num = Globals.RequestQueryNum("id"); if (num > 0) { limitedTimeDiscountInfo.LimitedTimeDiscountId = num; LimitedTimeDiscountHelper.UpdateLimitedTimeDiscount(limitedTimeDiscountInfo); } this.ShowMsgAndReUrl("保存成功!", true, "EditLimitedTimeDiscount.aspx?id=" + Globals.RequestQueryNum("id")); }
protected void btnSave_Click(object sender, EventArgs e) { string text = this.txtActivityName.Text; DateTime? textToDate = this.dateBeginTime.TextToDate; DateTime? nullable2 = this.dateEndTime.TextToDate; string str2 = this.txtDescription.Text; int result = 0; HiddenField field = this.memberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.memberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.memberRange.FindControl("txt_CustomGroup") as HiddenField; if (string.IsNullOrEmpty(text)) { this.ShowMsg("活动名称不能为空!", false); } else if (!textToDate.HasValue || !nullable2.HasValue) { this.ShowMsg("开始时间和结束时间都不能为空!", false); } else if (textToDate.Value >= nullable2.Value) { this.ShowMsg("开始时间不能大于或等于结束时间!", false); } else if (!int.TryParse(this.txtLimitNumber.Text, out result)) { this.ShowMsg("每人限购格式不对!", false); } else if (((field.Value == "-1") && (field2.Value == "-1")) && (field3.Value == "-1")) { this.ShowMsg("请选择适用会员!", false); } else { LimitedTimeDiscountInfo info = new LimitedTimeDiscountInfo { ActivityName = text, BeginTime = textToDate.Value, EndTime = nullable2.Value, Description = str2, LimitNumber = result, ApplyMembers = field.Value, DefualtGroup = field2.Value, CustomGroup = field3.Value, CreateTime = DateTime.Now }; info.Status = 1.ToString(); int num2 = Globals.RequestQueryNum("id"); if (num2 > 0) { info.LimitedTimeDiscountId = num2; LimitedTimeDiscountHelper.UpdateLimitedTimeDiscount(info); } this.ShowMsgAndReUrl("保存成功!", true, "EditLimitedTimeDiscount.aspx?id=" + Globals.RequestQueryNum("id")); } }
public LimitedTimeDiscountInfo GetDiscountInfo(int Id) { LimitedTimeDiscountInfo result = null; System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("SELECT * FROM Hishop_LimitedTimeDiscount WHERE LimitedTimeDiscountId = @ID and Status!=2"); this.database.AddInParameter(sqlStringCommand, "ID", System.Data.DbType.Int32, Id); using (System.Data.IDataReader dataReader = this.database.ExecuteReader(sqlStringCommand)) { result = ReaderConvert.ReaderToModel <LimitedTimeDiscountInfo>(dataReader); } return(result); }
public LimitedTimeDiscountProductInfo GetLimitedTimeDiscountProductByLimitIdAndProductIdAndUserId(int limitedTimeDiscountId, int productId, int userId) { LimitedTimeDiscountProductInfo info = null; LimitedTimeDiscountProductInfo limitedTimeDiscountProductByLimitIdAndProductId = this.GetLimitedTimeDiscountProductByLimitIdAndProductId(limitedTimeDiscountId, productId); if (limitedTimeDiscountProductByLimitIdAndProductId != null) { LimitedTimeDiscountInfo discountInfo = this.GetDiscountInfo(limitedTimeDiscountProductByLimitIdAndProductId.LimitedTimeDiscountId); if ((discountInfo != null) && new MemberDao().CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, userId)) { info = limitedTimeDiscountProductByLimitIdAndProductId; } } return(info); }
public int AddLimitedTimeDiscount(LimitedTimeDiscountInfo info) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO [Hishop_LimitedTimeDiscount] ([ActivityName],[BeginTime],[EndTime],[Description],[LimitNumber],[ApplyMembers],[DefualtGroup],[CustomGroup],[CreateTime],[Status]) VALUES (@ActivityName,@BeginTime,@EndTime,@Description,@LimitNumber,@ApplyMembers,@DefualtGroup,@CustomGroup,@CreateTime,@Status); SELECT CAST(scope_identity() AS int);"); this.database.AddInParameter(sqlStringCommand, "ActivityName", System.Data.DbType.String, info.ActivityName); this.database.AddInParameter(sqlStringCommand, "BeginTime", System.Data.DbType.DateTime, info.BeginTime); this.database.AddInParameter(sqlStringCommand, "EndTime", System.Data.DbType.DateTime, info.EndTime); this.database.AddInParameter(sqlStringCommand, "Description", System.Data.DbType.String, info.Description); this.database.AddInParameter(sqlStringCommand, "LimitNumber", System.Data.DbType.Int32, info.LimitNumber); this.database.AddInParameter(sqlStringCommand, "ApplyMembers", System.Data.DbType.String, info.ApplyMembers); this.database.AddInParameter(sqlStringCommand, "DefualtGroup", System.Data.DbType.String, info.DefualtGroup); this.database.AddInParameter(sqlStringCommand, "CustomGroup", System.Data.DbType.String, info.CustomGroup); this.database.AddInParameter(sqlStringCommand, "CreateTime", System.Data.DbType.DateTime, info.CreateTime); this.database.AddInParameter(sqlStringCommand, "Status", System.Data.DbType.Int32, info.Status); return((int)this.database.ExecuteScalar(sqlStringCommand)); }
private void DataBindDiscount() { string str = Globals.RequestQueryStr("key").Trim(); if (!string.IsNullOrEmpty(str)) { this.txtProductName.Text = str; } int num = Globals.RequestQueryNum("cid"); this.id = Globals.RequestQueryNum("id"); if (this.id > 0) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id); if (discountInfo != null) { this.actionName = discountInfo.ActivityName; } int?nullable = null; if (num > 0) { nullable = new int?(num); this.dropCategories.SelectedValue = new int?(num); } ProductQuery query = new ProductQuery { Keywords = str, ProductCode = "", CategoryId = nullable, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence" }; if (num > 0) { query.MaiCategoryPath = CatalogHelper.GetCategory(num).Path; } DbQueryResult discountProduct = LimitedTimeDiscountHelper.GetDiscountProduct(query); this.grdProducts.DataSource = discountProduct.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = discountProduct.TotalRecords; } else { base.Response.Redirect("LimitedTimeDiscountList.aspx"); } }
public bool UpdateLimitedTimeDiscount(LimitedTimeDiscountInfo info) { System.Data.Common.DbCommand sqlStringCommand = this.database.GetSqlStringCommand("UPDATE [Hishop_LimitedTimeDiscount] SET [ActivityName]=@ActivityName,[BeginTime]=@BeginTime,[EndTime]=@EndTime,[Description]=@Description,[LimitNumber]=@LimitNumber,[ApplyMembers]=@ApplyMembers,[DefualtGroup]=@DefualtGroup,[CustomGroup]=@CustomGroup,[CreateTime]=@CreateTime,[Status]=@Status WHERE LimitedTimeDiscountId=@LimitedTimeDiscountId"); this.database.AddInParameter(sqlStringCommand, "ActivityName", System.Data.DbType.String, info.ActivityName); this.database.AddInParameter(sqlStringCommand, "BeginTime", System.Data.DbType.DateTime, info.BeginTime); this.database.AddInParameter(sqlStringCommand, "EndTime", System.Data.DbType.DateTime, info.EndTime); this.database.AddInParameter(sqlStringCommand, "Description", System.Data.DbType.String, info.Description); this.database.AddInParameter(sqlStringCommand, "LimitNumber", System.Data.DbType.Int32, info.LimitNumber); this.database.AddInParameter(sqlStringCommand, "ApplyMembers", System.Data.DbType.String, info.ApplyMembers); this.database.AddInParameter(sqlStringCommand, "DefualtGroup", System.Data.DbType.String, info.DefualtGroup); this.database.AddInParameter(sqlStringCommand, "CustomGroup", System.Data.DbType.String, info.CustomGroup); this.database.AddInParameter(sqlStringCommand, "CreateTime", System.Data.DbType.DateTime, info.CreateTime); this.database.AddInParameter(sqlStringCommand, "Status", System.Data.DbType.Int32, info.Status); this.database.AddInParameter(sqlStringCommand, "LimitedTimeDiscountId", System.Data.DbType.Int32, info.LimitedTimeDiscountId); return(this.database.ExecuteNonQuery(sqlStringCommand) > 0); }
private void DataBindDiscount() { string text = Globals.RequestQueryStr("key").Trim(); if (!string.IsNullOrEmpty(text)) { this.txtProductName.Text = text; } int num = Globals.RequestQueryNum("cid"); this.id = Globals.RequestQueryNum("id"); int?categoryId = null; if (num > 0) { categoryId = new int?(num); this.dropCategories.SelectedValue = new int?(num); } if (this.id > 0) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(this.id); if (discountInfo != null) { this.actionName = discountInfo.ActivityName; } ProductQuery productQuery = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = categoryId, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc }; if (num > 0) { productQuery.MaiCategoryPath = CatalogHelper.GetCategory(num).Path; } DbQueryResult discountProducted = LimitedTimeDiscountHelper.GetDiscountProducted(productQuery, this.id); this.grdProducts.DataSource = discountProducted.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = discountProducted.TotalRecords; return; } base.Response.Redirect("LimitedTimeDiscountList.aspx"); }
private void SaveDiscountProduct(System.Web.HttpContext context) { Globals.RequestFormNum("id"); string text = Globals.RequestFormStr("discountProductList").Trim(new char[] { ',' }); string[] array = text.Split(new char[] { ',' }); string[] array2 = array; for (int i = 0; i < array2.Length; i++) { string text2 = array2[i]; string[] array3 = text2.Split(new char[] { '^' }); LimitedTimeDiscountProductInfo limitedTimeDiscountProductInfo = new LimitedTimeDiscountProductInfo(); if (!string.IsNullOrEmpty(array3[0]) && !string.IsNullOrEmpty(array3[1]) && !string.IsNullOrEmpty(array3[4]) && (!string.IsNullOrEmpty(array3[2]) || !string.IsNullOrEmpty(array3[3]))) { int num = Globals.ToNum(array3[0]); LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num); limitedTimeDiscountProductInfo.LimitedTimeDiscountId = num; limitedTimeDiscountProductInfo.ProductId = Globals.ToNum(array3[1]); limitedTimeDiscountProductInfo.Discount = ((string.IsNullOrEmpty(array3[2]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[2])); limitedTimeDiscountProductInfo.Minus = ((string.IsNullOrEmpty(array3[3]) || array3[2] == "undefined") ? 0m : decimal.Parse(array3[3])); limitedTimeDiscountProductInfo.FinalPrice = decimal.Parse(array3[4]); if (discountInfo != null) { limitedTimeDiscountProductInfo.BeginTime = discountInfo.BeginTime; limitedTimeDiscountProductInfo.EndTime = discountInfo.EndTime; } limitedTimeDiscountProductInfo.CreateTime = System.DateTime.Now; limitedTimeDiscountProductInfo.Status = 1; LimitedTimeDiscountHelper.AddLimitedTimeDiscountProduct(limitedTimeDiscountProductInfo); } } context.Response.Write("{\"msg\":\"success\"}"); }
private void IsDiscountProduct(HttpContext context) { int productId = Globals.RequestFormNum("productId"); if (productId > 0) { LimitedTimeDiscountProductInfo discountProductInfoByProductId = LimitedTimeDiscountHelper.GetDiscountProductInfoByProductId(productId); if (discountProductInfoByProductId != null) { LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(discountProductInfoByProductId.LimitedTimeDiscountId); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); int limitedTimeDiscountId = 0; if (discountInfo != null) { if (currentMember != null) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, currentMember.UserId)) { int num3 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(limitedTimeDiscountId, null, productId, currentMember.UserId, false); if ((discountInfo.LimitNumber - num3) > 0) { limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId; } } } else { limitedTimeDiscountId = discountInfo.LimitedTimeDiscountId; } } if (discountInfo != null) { context.Response.Write(string.Concat(new object[] { "{\"msg\":\"success\",\"ActivityName\":\"", discountInfo.ActivityName, "\",\"FinalPrice\":\"", discountProductInfoByProductId.FinalPrice.ToString("f2"), "\",\"LimitedTimeDiscountId\":\"", limitedTimeDiscountId, "\",\"LimitNumber\":\"", discountInfo.LimitNumber, "\"}" })); } } } }
protected override void AttachChildControls() { this.litShipTo = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo"); this.litCellPhone = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone"); this.litAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress"); this.litShowMes = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes"); this.GetUserCoupons = MemberProcessor.GetUserCoupons(); this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.litPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber"); this.litDisplayPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber"); this.aLinkToShipping = (System.Web.UI.HtmlControls.HtmlAnchor) this.FindControl("aLinkToShipping"); this.groupbuyHiddenBox = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox"); this.rptAddress = (VshopTemplatedRepeater)this.FindControl("rptAddress"); this.selectShipTo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo"); this.regionId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId"); this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress"); System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault); if (shippingAddressInfo == null) { shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null); } if (shippingAddressInfo != null) { this.litShipTo.Text = shippingAddressInfo.ShipTo; this.litCellPhone.Text = shippingAddressInfo.CellPhone; this.litAddress.Text = shippingAddressInfo.Address; this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString()); } this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'"; if (shippingAddresses == null || shippingAddresses.Count == 0) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString())); } else { this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()); System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>(); if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy")) { this.productSku = this.Page.Request.QueryString["productSku"]; if (this.isbargain) { int bargainDetialId = Globals.RequestQueryNum("bargainDetialId"); list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0); } else { int num = this.buyAmount; int num2 = Globals.RequestQueryNum("limitedTimeDiscountId"); if (num2 > 0) { bool flag = true; LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2); if (discountInfo == null) { flag = false; } if (flag) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId)) { if (discountInfo.LimitNumber != 0) { int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false); if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum) { num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum; } } } else { num2 = 0; } } else { num2 = 0; } } if (num2 > 0) { ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2); } if (num == 0 && num2 > 0) { num = this.buyAmount; num2 = 0; } list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, num, 0, num2); } } else { list = ShoppingCartProcessor.GetOrderSummitCart(); } if (list == null) { System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>"); } else { if (list.Count > 1) { this.litShowMes.Text = "<div style=\"color: #F60; \"><img src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>"; } this.rptCartProducts.DataSource = list; this.rptCartProducts.DataBind(); decimal d = 0m; decimal num3 = 0m; decimal d2 = 0m; int num4 = 0; foreach (ShoppingCartInfo current in list) { num4 += current.GetPointNumber; d += current.Total; num3 += current.Exemption; d2 += current.ShipCost; } decimal d3 = num3; this.litOrderTotal.Text = (d - d3).ToString("F2"); if (num4 == 0) { this.litDisplayPointNumber.Text = "style=\"display:none;\""; } this.litPointNumber.Text = num4.ToString(); PageTitle.AddSiteNameTitle("订单确认"); } } }
protected override void AttachChildControls() { this.litShipTo = (Literal)this.FindControl("litShipTo"); this.litCellPhone = (Literal)this.FindControl("litCellPhone"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litShowMes = (Literal)this.FindControl("litShowMes"); this.GetUserCoupons = MemberProcessor.GetUserCoupons(); this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPointNumber = (Literal)this.FindControl("litPointNumber"); this.litDisplayPointNumber = (Literal)this.FindControl("litDisplayPointNumber"); this.aLinkToShipping = (HtmlAnchor)this.FindControl("aLinkToShipping"); this.groupbuyHiddenBox = (HtmlInputControl)this.FindControl("groupbuyHiddenBox"); this.rptAddress = (VshopTemplatedRepeater)this.FindControl("rptAddress"); this.selectShipTo = (HtmlInputHidden)this.FindControl("selectShipTo"); this.regionId = (HtmlInputHidden)this.FindControl("regionId"); this.litAddAddress = (Literal)this.FindControl("litAddAddress"); IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); //if (CS$<>9__CachedAnonymousMethodDelegate2 == null) //{ // CS$<>9__CachedAnonymousMethodDelegate2 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__0); //} //this.rptAddress.DataSource = Enumerable.OrderBy<ShippingAddressInfo, bool>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate2); //this.rptAddress.DataBind(); //if (CS$<>9__CachedAnonymousMethodDelegate3 == null) //{ // CS$<>9__CachedAnonymousMethodDelegate3 = new Func<ShippingAddressInfo, bool>(null, (IntPtr) <AttachChildControls>b__1); //} this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault); //ShippingAddressInfo info = Enumerable.FirstOrDefault<ShippingAddressInfo>(shippingAddresses, CS$<>9__CachedAnonymousMethodDelegate3); if (info == null) { info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null; } if (info != null) { this.litShipTo.Text = info.ShipTo; this.litCellPhone.Text = info.CellPhone; this.litAddress.Text = info.Address; this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(info.RegionId.ToString()); } this.litAddAddress.Text = " href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'"; if ((shippingAddresses == null) || (shippingAddresses.Count == 0)) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString())); } else { this.aLinkToShipping.HRef = Globals.ApplicationPath + "/Vshop/ShippingAddresses.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()); List <ShoppingCartInfo> orderSummitCart = new List <ShoppingCartInfo>(); if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy"))) { this.productSku = this.Page.Request.QueryString["productSku"]; if (this.isbargain) { int bargainDetialId = Globals.RequestQueryNum("bargainDetialId"); orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0); } else { int buyAmount = this.buyAmount; int id = Globals.RequestQueryNum("limitedTimeDiscountId"); if (id > 0) { bool flag = true; LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id); if (discountInfo == null) { flag = false; } if (flag) { int num4 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(id, this.productSku, 0, base.CurrentMemberInfo.UserId, false); if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, base.CurrentMemberInfo.UserId)) { if ((discountInfo.LimitNumber > 0) && (this.buyAmount <= (discountInfo.LimitNumber - num4))) { buyAmount = discountInfo.LimitNumber - num4; if (buyAmount > this.buyAmount) { buyAmount = this.buyAmount; } } else if (discountInfo.LimitNumber != 0) { id = 0; } } else { id = 0; } } else { id = 0; } } orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, buyAmount, 0, id); } } else { orderSummitCart = ShoppingCartProcessor.GetOrderSummitCart(); } if (orderSummitCart == null) { HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>"); } else { if (orderSummitCart.Count > 1) { this.litShowMes.Text = "<div style=\"color: #F60; \"><img src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>"; } this.rptCartProducts.DataSource = orderSummitCart; this.rptCartProducts.DataBind(); decimal num5 = 0M; decimal num6 = 0M; decimal num7 = 0M; int num8 = 0; foreach (ShoppingCartInfo info3 in orderSummitCart) { num8 += info3.GetPointNumber; num5 += info3.Total; num6 += info3.Exemption; num7 += info3.ShipCost; } decimal num9 = num6; this.litOrderTotal.Text = (num5 - num9).ToString("F2"); if (num8 == 0) { this.litDisplayPointNumber.Text = "style=\"display:none;\""; } this.litPointNumber.Text = num8.ToString(); PageTitle.AddSiteNameTitle("订单确认"); } } }
protected override void AttachChildControls() { this.litShipTo = (System.Web.UI.WebControls.Literal) this.FindControl("litShipTo"); this.litIsUseBalance = (System.Web.UI.WebControls.Literal) this.FindControl("litIsUseBalance"); this.litCellPhone = (System.Web.UI.WebControls.Literal) this.FindControl("litCellPhone"); this.litAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddress"); this.litShowMes = (System.Web.UI.WebControls.Literal) this.FindControl("litShowMes"); this.GetUserCoupons = MemberProcessor.GetUserCoupons(); this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new System.Web.UI.WebControls.RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litOrderTotal = (System.Web.UI.WebControls.Literal) this.FindControl("litOrderTotal"); this.litPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litPointNumber"); this.litUseMembersPointShow = (System.Web.UI.WebControls.Literal) this.FindControl("litUseMembersPointShow"); this.litDisplayPointNumber = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPointNumber"); this.litDisplayPoint = (System.Web.UI.WebControls.Literal) this.FindControl("litDisplayPoint"); this.BalanceCanPayMoney = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("BalanceCanPayMoney"); this.groupbuyHiddenBox = (System.Web.UI.HtmlControls.HtmlInputControl) this.FindControl("groupbuyHiddenBox"); this.rptAddress = (VshopTemplatedRepeater)this.FindControl("rptAddress"); this.selectShipTo = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("selectShipTo"); this.MembersPointMoney = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("MembersPointMoney"); this.regionId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("regionId"); this.litAddAddress = (System.Web.UI.WebControls.Literal) this.FindControl("litAddAddress"); if (Globals.GetCurrentDistributorId() == CurrentMemberInfo.UserId) { base.GotoResourceNotFound("站点管理员无法在自己店内购买!"); return; } if (Globals.GetCurrentDistributorId() == 0)//CurrentMemberInfo.ReferralUserId ==0 && { base.GotoResourceNotFound("请先扫码关注站点后再下单!"); return; } System.Collections.Generic.IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo shippingAddressInfo = shippingAddresses.FirstOrDefault((ShippingAddressInfo item) => item.IsDefault); if (!string.IsNullOrEmpty(this.Page.Request.QueryString["startDate"])) { this.SendStartDate = DateTime.Parse(this.Page.Request.QueryString["startDate"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["quantityPerDay"])) { this.QuantityPerDay = Convert.ToInt32(this.Page.Request.QueryString["quantityPerDay"]); } if (!string.IsNullOrEmpty(this.Page.Request.QueryString["sendDays"])) { this.SendDays = Convert.ToInt32(this.Page.Request.QueryString["sendDays"]); } if (shippingAddressInfo == null) { shippingAddressInfo = ((shippingAddresses.Count > 0) ? shippingAddresses[0] : null); } if (shippingAddressInfo != null) { this.litShipTo.Text = shippingAddressInfo.ShipTo; this.litCellPhone.Text = shippingAddressInfo.CellPhone; this.litAddress.Text = shippingAddressInfo.Address; this.selectShipTo.SetWhenIsNotNull(shippingAddressInfo.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(shippingAddressInfo.RegionId.ToString()); } this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>"; if (shippingAddresses == null || shippingAddresses.Count == 0) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(System.Web.HttpContext.Current.Request.Url.ToString())); } else { System.Collections.Generic.List <ShoppingCartInfo> list = new System.Collections.Generic.List <ShoppingCartInfo>(); if (int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"]) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"]) && (this.Page.Request.QueryString["from"] == "signBuy" || this.Page.Request.QueryString["from"] == "groupBuy")) { this.productSku = this.Page.Request.QueryString["productSku"]; if (this.isbargain) { int bargainDetialId = Globals.RequestQueryNum("bargainDetialId"); list = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0); } else { int num = this.buyAmount; int num2 = Globals.RequestQueryNum("limitedTimeDiscountId"); if (num2 > 0) { bool flag = true; LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(num2); if (discountInfo == null) { flag = false; } if (flag) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, this.CurrentMemberInfo.UserId)) { if (discountInfo.LimitNumber != 0) { int limitedTimeDiscountUsedNum = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(num2, this.productSku, 0, this.CurrentMemberInfo.UserId, false); if (this.buyAmount > discountInfo.LimitNumber - limitedTimeDiscountUsedNum) { num = discountInfo.LimitNumber - limitedTimeDiscountUsedNum; } } } else { num2 = 0; } } else { num2 = 0; } } if (num2 > 0) { ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, num2); } if (num == 0 && num2 > 0) { num = this.buyAmount; num2 = 0; } list = ShoppingCartProcessor.GetListShoppingCart(SendStartDate, QuantityPerDay, SendDays, this.productSku, num, 0, num2); } } else { list = ShoppingCartProcessor.GetOrderSummitCart(); } if (list == null) { System.Web.HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>"); } else { if (list.Count > 1) { this.litShowMes.Text = "<div style=\"color: #F60; \"><img src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>"; } this.rptCartProducts.DataSource = list; this.rptCartProducts.DataBind(); decimal d = 0m; decimal num3 = 0m; decimal d2 = 0m; int num4 = 0; foreach (ShoppingCartInfo current in list) { num4 += current.GetPointNumber; d += current.Total; num3 += current.Exemption; d2 += current.ShipCost; } decimal d3 = num3; decimal num5 = d - d3; if (num5 <= 0m) { num5 = 0m; } num5 = decimal.Round(num5, 2); this.litOrderTotal.Text = num5.ToString("F2"); if (num4 == 0) { this.litDisplayPointNumber.Text = "style=\"display:none;\""; } this.litPointNumber.Text = num4.ToString(); int num6 = this.CurrentMemberInfo.Points - num4; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); decimal num7; if (num5 * masterSettings.PointToCashRate > this.CurrentMemberInfo.Points) { if (num6 > masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate) { num7 = masterSettings.PonitToCash_MaxAmount; num6 = (int)masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate; } else { num7 = num6 / masterSettings.PointToCashRate; } } else { num7 = masterSettings.PonitToCash_MaxAmount; if (num7 > num5) { num7 = num5; } num7 = decimal.Round(num7, 2); num6 = (int)(num7 * masterSettings.PointToCashRate); } if (num6 <= 0) { num6 = 0; num7 = 0m; } this.MembersPointMoney.Value = num7.ToString("F2"); if (num6 > 0) { this.litUseMembersPointShow.Text = string.Concat(new object[] { "<input type='hidden' id='hdCanUsePoint' value='", num6, "'/><input type='hidden' id='hdCanUsePointMoney' value='", num7.ToString("F2"), "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">", num6, "</span>积分抵 <span class=\"colorr\">¥<span id=\"usepointmoney\">", num7.ToString("F2"), "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input type=\"checkbox\" /></div>" }); } else { this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">0</span>积分 <span id=\"usepointmoney\" style=\"display:none\">" + num7.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>"; } decimal d4; if (num5 > this.CurrentMemberInfo.AvailableAmount) { d4 = this.CurrentMemberInfo.AvailableAmount; this.BalanceCanPayMoney.Value = this.CurrentMemberInfo.AvailableAmount.ToString("F2"); } else { d4 = num5; this.BalanceCanPayMoney.Value = num5.ToString("F2"); } if (this.CurrentMemberInfo.AvailableAmount > 0m && masterSettings.EnableBalancePayment) { this.litIsUseBalance.Text = string.Concat(new string[] { "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">", d4.ToString("F2"), "</span></span>(可用 ¥<span id=\"spAvailableAmount\">", this.CurrentMemberInfo.AvailableAmount.ToString("F2"), "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" ", (d4 > 0m) ? "" : " disabled", " /></div></div>" }); } else { this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">¥<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>"; } if (!masterSettings.PonitToCash_Enable) { this.litDisplayPoint.Text = " style=\"display:none;\""; } PageTitle.AddSiteNameTitle("订单确认"); } } }
protected override void AttachChildControls() { this.objRadio = new HtmlInputRadioButton[3]; this.objRadio[0] = (HtmlInputRadioButton)this.FindControl("OS1"); this.objRadio[1] = (HtmlInputRadioButton)this.FindControl("OS2"); this.objRadio[2] = (HtmlInputRadioButton)this.FindControl("OS3"); this.objRadio[1].Disabled = true; this.objRadio[2].Disabled = true; this.dtGeadeInfo = MemberProcessor.dtGetGradeInfofromUserId(); if (this.dtGeadeInfo.Rows.Count > 0) { if ((bool)this.dtGeadeInfo.Rows[0]["IsDaifa"] == false && (bool)this.dtGeadeInfo.Rows[0]["IsPifa"] == false) { this.objRadio[0].Disabled = false; this.objRadio[0].Checked = true; this.objRadio[1].Checked = false; this.objRadio[2].Checked = false; } if ((bool)this.dtGeadeInfo.Rows[0]["IsDaifa"] == true) { this.objRadio[0].Disabled = true; this.objRadio[1].Disabled = false; this.objRadio[0].Checked = false; this.objRadio[1].Checked = true; this.objRadio[2].Checked = false; } else { this.objRadio[1].Disabled = true; } if ((bool)this.dtGeadeInfo.Rows[0]["IsPifa"] == true) { this.objRadio[0].Disabled = true; this.objRadio[2].Disabled = false; this.objRadio[0].Checked = false; this.objRadio[1].Checked = false; this.objRadio[2].Checked = true; } else { this.objRadio[2].Disabled = true; } } switch (this.Page.Request.QueryString["GSO"]) { case "0": this.objRadio[0].Checked = true; this.objRadio[1].Checked = false; this.objRadio[2].Checked = false; break; case "1": this.objRadio[0].Checked = false; this.objRadio[1].Checked = true; this.objRadio[2].Checked = false; break; case "2": this.objRadio[0].Checked = false; this.objRadio[1].Checked = false; this.objRadio[2].Checked = true; break; } this.litShipTo = (Literal)this.FindControl("litShipTo"); this.litIsUseBalance = (Literal)this.FindControl("litIsUseBalance"); this.litCellPhone = (Literal)this.FindControl("litCellPhone"); this.litAddress = (Literal)this.FindControl("litAddress"); this.litShowMes = (Literal)this.FindControl("litShowMes"); this.GetUserCoupons = MemberProcessor.GetUserCoupons(); this.rptCartProducts = (VshopTemplatedRepeater)this.FindControl("rptCartProducts"); this.rptCartProducts.ItemDataBound += new RepeaterItemEventHandler(this.rptCartProducts_ItemDataBound); this.litOrderTotal = (Literal)this.FindControl("litOrderTotal"); this.litPointNumber = (Literal)this.FindControl("litPointNumber"); this.litUseMembersPointShow = (Literal)this.FindControl("litUseMembersPointShow"); this.litDisplayPointNumber = (Literal)this.FindControl("litDisplayPointNumber"); this.litDisplayPoint = (Literal)this.FindControl("litDisplayPoint"); this.BalanceCanPayMoney = (HtmlInputHidden)this.FindControl("BalanceCanPayMoney"); this.groupbuyHiddenBox = (HtmlInputControl)this.FindControl("groupbuyHiddenBox"); this.rptAddress = (VshopTemplatedRepeater)this.FindControl("rptAddress"); this.selectShipTo = (HtmlInputHidden)this.FindControl("selectShipTo"); this.MembersPointMoney = (HtmlInputHidden)this.FindControl("MembersPointMoney"); this.regionId = (HtmlInputHidden)this.FindControl("regionId"); this.litAddAddress = (Literal)this.FindControl("litAddAddress"); this.litServiceMoney = (Literal)this.FindControl("litServiceMoney"); this.litServiceMoney.Text = "0.00"; IList <ShippingAddressInfo> shippingAddresses = MemberProcessor.GetShippingAddresses(); if (!this.objRadio[2].Checked == true) { this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault); if (info == null) { info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null; } if (info != null) { this.litShipTo.Text = info.ShipTo; this.litCellPhone.Text = info.CellPhone; this.litAddress.Text = info.Address; this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(info.RegionId.ToString()); } this.litAddAddress.Text = "<li><a href='/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString()) + "'>新增收货地址</a></li>"; } else { MemberInfo member = MemberHelper.GetMember(Globals.GetCurrentMemberUserId(false)); ShippingAddressInfo sai = new ShippingAddressInfo(); sai.Address = member.Address; sai.CellPhone = member.CellPhone; sai.IsDefault = true; sai.RegionId = member.RegionId; sai.ShippingId = 999; sai.ShipTo = member.RealName; sai.TelPhone = member.CellPhone; sai.UserId = Globals.GetCurrentMemberUserId(false); sai.Zipcode = ""; shippingAddresses = new List <ShippingAddressInfo>(); shippingAddresses.Add(sai); this.rptAddress.DataSource = from item in shippingAddresses orderby item.IsDefault select item; this.rptAddress.DataBind(); ShippingAddressInfo info = shippingAddresses.FirstOrDefault <ShippingAddressInfo>(item => item.IsDefault); if (info == null) { info = (shippingAddresses.Count > 0) ? shippingAddresses[0] : null; } if (info != null) { this.litShipTo.Text = info.ShipTo; this.litCellPhone.Text = info.CellPhone; this.litAddress.Text = info.Address; this.selectShipTo.SetWhenIsNotNull(info.ShippingId.ToString()); this.regionId.SetWhenIsNotNull(info.RegionId.ToString()); } this.litAddAddress.Text = "<li><a href='" + this.Page.Request.Url.ToString() + "'>批发订单不能指定收货地址,如需修改批发订单收货地址,请与管理员联系</a></li>"; } if (((shippingAddresses == null) || (shippingAddresses.Count == 0)) && !this.objRadio[2].Checked == true) { this.Page.Response.Redirect(Globals.ApplicationPath + "/Vshop/AddShippingAddress.aspx?returnUrl=" + Globals.UrlEncode(HttpContext.Current.Request.Url.ToString())); } else { List <ShoppingCartInfo> orderSummitCart = new List <ShoppingCartInfo>(); if (((int.TryParse(this.Page.Request.QueryString["buyAmount"], out this.buyAmount) && !string.IsNullOrEmpty(this.Page.Request.QueryString["productSku"])) && !string.IsNullOrEmpty(this.Page.Request.QueryString["from"])) && ((this.Page.Request.QueryString["from"] == "signBuy") || (this.Page.Request.QueryString["from"] == "groupBuy"))) { this.productSku = this.Page.Request.QueryString["productSku"]; if (this.isbargain) { int bargainDetialId = Globals.RequestQueryNum("bargainDetialId"); orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, this.buyAmount, bargainDetialId, 0); } else { int buyAmount = this.buyAmount; int id = Globals.RequestQueryNum("limitedTimeDiscountId"); if (id > 0) { bool flag = true; LimitedTimeDiscountInfo discountInfo = LimitedTimeDiscountHelper.GetDiscountInfo(id); if (discountInfo == null) { flag = false; } if (flag) { if (MemberHelper.CheckCurrentMemberIsInRange(discountInfo.ApplyMembers, discountInfo.DefualtGroup, discountInfo.CustomGroup, base.CurrentMemberInfo.UserId)) { if (discountInfo.LimitNumber != 0) { int num4 = ShoppingCartProcessor.GetLimitedTimeDiscountUsedNum(id, this.productSku, 0, base.CurrentMemberInfo.UserId, false); if (this.buyAmount > (discountInfo.LimitNumber - num4)) { buyAmount = discountInfo.LimitNumber - num4; } } } else { id = 0; } } else { id = 0; } } if (id > 0) { ShoppingCartProcessor.RemoveLineItem(this.productSku, 0, id); } if ((buyAmount == 0) && (id > 0)) { buyAmount = this.buyAmount; id = 0; } orderSummitCart = ShoppingCartProcessor.GetListShoppingCart(this.productSku, buyAmount, 0, id); } } else { orderSummitCart = ShoppingCartProcessor.GetOrderSummitCart(); } if (orderSummitCart == null) { HttpContext.Current.Response.Write("<script>alert('商品已下架或没有需要结算的订单!');location.href='/Vshop/ShoppingCart.aspx'</script>"); } else { if (orderSummitCart.Count > 1) { this.litShowMes.Text = "<div style=\"color: #F60; \"><img src=\"/Utility/pics/u77.png\">您所购买的商品不支持同一个物流规则发货,系统自动拆分成多个子订单处理</div>"; } this.rptCartProducts.DataSource = orderSummitCart; this.rptCartProducts.DataBind(); decimal num5 = 0M; decimal num6 = 0M; decimal num7 = 0M; int num8 = 0; int intOrderNum = 0; foreach (ShoppingCartInfo info3 in orderSummitCart) { num8 += info3.GetPointNumber; num5 += info3.Total; num6 += info3.Exemption; num7 += info3.ShipCost; intOrderNum += info3.GetQuantity(); } decimal num9 = num6; decimal d = num5 - num9; if (d <= 0M) { d = 0M; } d = decimal.Round(d, 2); if (this.objRadio[1].Checked == true) { this.litServiceMoney.Text = (intOrderNum * intPerServiceMoney).ToString("0.00"); d += decimal.Round(intOrderNum * intPerServiceMoney, 2); } else { this.litServiceMoney.Text = "0.00"; } this.litOrderTotal.Text = d.ToString("F2"); if (num8 == 0) { this.litDisplayPointNumber.Text = "style=\"display:none;\""; } this.litPointNumber.Text = num8.ToString(); int num11 = base.CurrentMemberInfo.Points - num8; decimal num12 = 0M; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if ((d * masterSettings.PointToCashRate) > base.CurrentMemberInfo.Points) { if (num11 > (masterSettings.PonitToCash_MaxAmount * masterSettings.PointToCashRate)) { num12 = masterSettings.PonitToCash_MaxAmount; num11 = ((int)masterSettings.PonitToCash_MaxAmount) * masterSettings.PointToCashRate; } else { num12 = num11 / masterSettings.PointToCashRate; } } else { num12 = masterSettings.PonitToCash_MaxAmount; if (num12 > d) { num12 = d; } num12 = decimal.Round(num12, 2); num11 = (int)(num12 * masterSettings.PointToCashRate); } if (num11 <= 0) { num11 = 0; num12 = 0M; } this.MembersPointMoney.Value = num12.ToString("F2"); if (num11 > 0) { this.litUseMembersPointShow.Text = string.Concat(new object[] { "<input type='hidden' id='hdCanUsePoint' value='", num11, "'/><input type='hidden' id='hdCanUsePointMoney' value='", num12.ToString("F2"), "'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">", num11, "</span>积分抵 <span class=\"colorr\">\x00a5<span id=\"usepointmoney\">", num12.ToString("F2"), "</span></span>元</div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\"><input type=\"checkbox\" /></div>" }); } else { this.litUseMembersPointShow.Text = "<input type='hidden' id='hdCanUsePoint' value='0'/><input type='hidden' id='hdCanUsePointMoney' value='0'/><div class=\"prompt-text pull-left\" id=\"divUseMembersPointShow\">可用<span id=\"usepointnum\">0</span>积分 <span id=\"usepointmoney\" style=\"display:none\">" + num12.ToString("F2") + "</span></div><div class=\"switch pull-right\" id=\"mySwitchUseMembersPoint\" style=\"display:none\"><input type=\"checkbox\" disabled /></div>"; } decimal availableAmount = 0M; if (d > base.CurrentMemberInfo.AvailableAmount) { availableAmount = base.CurrentMemberInfo.AvailableAmount; this.BalanceCanPayMoney.Value = base.CurrentMemberInfo.AvailableAmount.ToString("F2"); } else { availableAmount = d; this.BalanceCanPayMoney.Value = d.ToString("F2"); } if ((base.CurrentMemberInfo.AvailableAmount > 0M) && masterSettings.EnableBalancePayment) { this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\">余额支付 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">" + availableAmount.ToString("F2") + "</span></span>(可用 \x00a5<span id=\"spAvailableAmount\">" + base.CurrentMemberInfo.AvailableAmount.ToString("F2") + "</span>)</div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\"><input type=\"checkbox\" " + ((availableAmount > 0M) ? "" : " disabled") + " /></div></div>"; } else { this.litIsUseBalance.Text = "<div class=\"prompt-text pull-left\"" + (masterSettings.EnableBalancePayment ? "" : " style=\"display:none\"") + ">余额可用 <span class=\"colorr\">\x00a5<span id=\"spCanpayMoney\">0.00</span></span><span id=\"spAvailableAmount\" style=\"display:none\">0.00</span></div><div class=\"switch pull-right\" id=\"mySwitchUseBalance\" style=\"display:none\"><input type=\"checkbox\" disabled /></div></div>"; } if (!masterSettings.PonitToCash_Enable) { this.litDisplayPoint.Text = " style=\"display:none;\""; } PageTitle.AddSiteNameTitle("订单确认"); } } }
protected void btnSaveAndNext_Click(object sender, EventArgs e) { string text = this.txtActivityName.Text; DateTime? textToDate = this.dateBeginTime.TextToDate; DateTime? nullable2 = this.dateEndTime.TextToDate; string str2 = this.txtDescription.Text; int result = 0; bool flag = this.IsCommision.Checked; string str3 = this.discount.Text; HiddenField field = this.memberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.memberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.memberRange.FindControl("txt_CustomGroup") as HiddenField; if (string.IsNullOrEmpty(text)) { this.ShowMsg("活动名称不能为空!", false); } else if (!textToDate.HasValue || !nullable2.HasValue) { this.ShowMsg("开始时间和结束时间都不能为空!", false); } else if (textToDate.Value >= nullable2.Value) { this.ShowMsg("开始时间不能大于或等于结束时间!", false); } else if (!int.TryParse(this.txtLimitNumber.Text, out result)) { this.ShowMsg("每人限购格式不对!", false); } else if (((field.Value == "-1") && (field2.Value == "-1")) && (field3.Value == "-1")) { this.ShowMsg("请选择适用会员!", false); } else if (flag && string.IsNullOrEmpty(str3)) { this.ShowMsg("请填写商品佣金折数!", false); } else if (flag && (str3 == "0")) { this.ShowMsg("佣金折扣值必须大于0!", false); } else { LimitedTimeDiscountInfo info = new LimitedTimeDiscountInfo { ActivityName = text, BeginTime = textToDate.Value, EndTime = nullable2.Value, Description = str2, LimitNumber = result, ApplyMembers = field.Value, DefualtGroup = field2.Value, CustomGroup = field3.Value, CreateTime = DateTime.Now }; info.Status = 1.ToString(); info.IsCommission = flag; info.CommissionDiscount = flag ? ((int)(float.Parse(str3) * 10f)) : 0; int num2 = LimitedTimeDiscountHelper.AddLimitedTimeDiscount(info); if (num2 > 0) { this.ShowMsgAndReUrl("添加成功", true, "LimitedTimeDiscountAddProduct.aspx?id=" + num2); } } }
public static int AddLimitedTimeDiscount(LimitedTimeDiscountInfo info) { return(_act.AddLimitedTimeDiscount(info)); }
public static bool UpdateLimitedTimeDiscount(LimitedTimeDiscountInfo info) { return(_act.UpdateLimitedTimeDiscount(info)); }