protected void grv_Packge_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DisEndable") { var str = e.CommandArgument.ToString(); if (str.Split('|')[1] == "True") { try { SMSProductService.Disable(Guid.Parse(str.Split('|')[0]), CurrentUser.UserName); InitDataGrid(); } catch (Exception ex) { ShowExceptionMessage(ex, "禁用短信套餐"); } } if (str.Split('|')[1] == "False") { try { SMSProductService.Enable(Guid.Parse(str.Split('|')[0]), CurrentUser.UserName); InitDataGrid(); } catch (Exception ex) { ShowExceptionMessage(ex, "禁用短信套餐"); } } } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { txtStartTime.Text = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-dd"); txtEndTime.Text = DateTime.Now.ToString("yyyy-MM-dd"); ddlPackback.DataSource = from item in SMSProductService.Query() orderby item.Amount select new { value = item.Id, text = item.Amount }; ddlPackback.DataValueField = "value"; ddlPackback.DataTextField = "text"; ddlPackback.DataBind(); ddlPackback.Items.Insert(0, "所有"); if (!string.IsNullOrEmpty(Request.QueryString["id"])) { ddlPackback.SelectedValue = Request.QueryString["id"]; } InitDataGrid(new Pagination() { PageSize = pager.PageSize, PageIndex = 1, GetRowCount = true }); } this.pager.CurrentPageChanged += pager_CurrentPageChanged; }
void InitDataGrid() { var query = SMSProductService.Query(); grv_Packge.DataSource = from item in query select new { Amount = item.Amount.TrimInvaidZero(), item.Count, EffectiveDate = item.EffectiveDate.ToString("yyyy-MM-dd"), ExpiredDate = item.ExpiredDate.ToString("yyyy-MM-dd"), item.Id, item.SortLevel, item.Enable, item.UnitPrice, item.ExChangeIntegral }; grv_Packge.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { hidFlag.Value = "0"; if (string.IsNullOrEmpty(hidId.Value.Trim())) { ProductDetail detail = new ProductDetail(); detail.Amount = decimal.Parse(txtAounmt.Text.Trim()); detail.Count = int.Parse(txtNum.Text.Trim()); detail.EffectiveDate = DateTime.Parse(txtStartTime.Text); detail.ExpiredDate = DateTime.Parse(txtEndTime.Text); detail.Enable = true; detail.SortLevel = int.Parse(txtSort.Text); detail.ExChangeIntegral = txtExChangeIntegral.Text == "" ? 0 : int.Parse(txtExChangeIntegral.Text); try { SMSProductService.Publish(detail, CurrentUser.UserName); } catch (Exception ex) { hidFlag.Value = "1"; ShowExceptionMessage(ex, "添加套餐设置"); } } else { try { SMSProductService.Update(Guid.Parse(hidId.Value), DateTime.Parse(txtStartTime.Text), DateTime.Parse(txtEndTime.Text), int.Parse(txtSort.Text), txtExChangeIntegral.Text == "" ? 0 : int.Parse(txtExChangeIntegral.Text), CurrentUser.UserName); } catch (Exception ex) { hidFlag.Value = "1"; ShowExceptionMessage(ex, "修改套餐设置"); } } InitDataGrid(); }