public void Delete(HttpContext context) { int?intParam = base.GetIntParam(context, "preSaleId", false); if (!intParam.HasValue) { throw new HidistroAshxException("错误的编号"); } if (ProductPreSaleHelper.IsPreSaleHasOrder(intParam.Value)) { throw new HidistroAshxException("该预售已产生订单,不能删除!"); } if (ProductPreSaleHelper.DeletePreSale(intParam.Value)) { base.ReturnSuccessResult(context, "删除成功", 0, true); return; } throw new HidistroAshxException("删除失败!"); }
private DataGridViewModel <Dictionary <string, object> > GetDataList(ProductPreSaleQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { PageModel <ProductPreSaleInfo> preSaleList = ProductPreSaleHelper.GetPreSaleList(query); dataGridViewModel.rows = new List <Dictionary <string, object> >(); dataGridViewModel.total = preSaleList.Total; foreach (ProductPreSaleInfo model in preSaleList.Models) { Dictionary <string, object> dictionary = model.ToDictionary(); dictionary.Add("IsPreSaleEnd", !this.IsPreSaleEnd(model.PreSaleEndDate)); dictionary.Add("IsPreSaleHasOrder", ProductPreSaleHelper.IsPreSaleHasOrder(model.PreSaleId)); dataGridViewModel.rows.Add(dictionary); } } return(dataGridViewModel); }
protected void Page_Load(object sender, EventArgs e) { this.btnAddPreSale.Click += this.btnAddPreSale_Click; this.PreSaleEndDate.CalendarParameter["format"] = "yyyy-mm-dd hh:ii:00"; this.PreSaleEndDate.CalendarParameter["minView"] = "0"; if (!base.IsPostBack) { if (!int.TryParse(this.Page.Request.QueryString["preSaleId"], out this.preSaleId)) { base.GotoResourceNotFound(); } else { if (ProductPreSaleHelper.IsPreSaleHasOrder(this.preSaleId)) { this.ShowMsg("该预售已产生订单,不能修改!", false, "ProductPreSale.aspx"); } ProductPreSaleInfo preSaleInfoWithNameAndPrice = ProductPreSaleHelper.GetPreSaleInfoWithNameAndPrice(this.preSaleId); if (preSaleInfoWithNameAndPrice != null) { HiddenField hiddenField = this.hidPreSaleId; int num = preSaleInfoWithNameAndPrice.PreSaleId; hiddenField.Value = num.ToString(); HiddenField hiddenField2 = this.hidProductId; num = preSaleInfoWithNameAndPrice.ProductId; hiddenField2.Value = num.ToString(); this.hidProductName.Value = preSaleInfoWithNameAndPrice.ProductName; this.hidSalePrice.Value = preSaleInfoWithNameAndPrice.SalePrice.F2ToString("f2"); if (preSaleInfoWithNameAndPrice.DepositPercent > 0) { this.radDepositPercent.Checked = true; TextBox textBox = this.txtDepositPercent; num = preSaleInfoWithNameAndPrice.DepositPercent; textBox.Text = num.ToString(); } else if (preSaleInfoWithNameAndPrice.Deposit > decimal.Zero) { this.radDeposit.Checked = true; this.txtDeposit.Text = preSaleInfoWithNameAndPrice.Deposit.ToString(); } this.PreSaleEndDate.SelectedDate = preSaleInfoWithNameAndPrice.PreSaleEndDate; this.PaymentStartDate.SelectedDate = preSaleInfoWithNameAndPrice.PaymentStartDate; this.PaymentEndDate.SelectedDate = preSaleInfoWithNameAndPrice.PaymentEndDate; if (preSaleInfoWithNameAndPrice.DeliveryDays > 0) { this.radDeliveryDays.Checked = true; TextBox textBox2 = this.txtDeliveryDays; num = preSaleInfoWithNameAndPrice.DeliveryDays; textBox2.Text = num.ToString(); } else if (preSaleInfoWithNameAndPrice.DeliveryDate.HasValue) { this.radDeliveryDate.Checked = true; this.DeliveryDate.SelectedDate = preSaleInfoWithNameAndPrice.DeliveryDate; } } else { base.GotoResourceNotFound(); } } } }