protected void btnSave_Click(object sender, EventArgs e) { try { IntegralParameterView view = new IntegralParameterView { IsSignIn = this.radEnableGongNeng.Checked, IsDrop = this.radEnableXiaJia.Checked, AvailabilityRatio = decimal.Parse(this.txtKeYong.Text) / 100, SignIntegral = int.Parse(this.txtSheZhi.Text), ConsumptionIntegral = int.Parse(this.txtXiaoFei.Text), Multiple = decimal.Parse(this.txtJianLi.Text), MostBuckle = int.Parse(txtMostBuckle.Text), SpecifiedDate = this.selZhouQi.SelectedIndex != 7 ? (DateTime?)null : DateTime.Parse(txtZhiDing.Text), RangeReset = (Common.Enums.IntegralRangeTime) this.selZhouQi.SelectedIndex }; IntegralServer.UpdateIntegralParameter(view); NewMethod(); ShowMessage("保存成功"); } catch (Exception ex) { ShowExceptionMessage(ex, "保存"); } }
protected void btnSave_Click(object sender, EventArgs e) { try { IntegralParameterView paraemter = IntegralServer.GetIntegralParameter(); IntegralCount counts = IntegralServer.GetIntegralByAccountIdZong(CurrentCompany.CompanyId); if (counts == null) { throw new Exception("积分不够,暂不能兑换该短信!"); } if (counts.IntegralAvailable < int.Parse(hidjf.Value)) { throw new Exception("积分不够,暂不能兑换该短信!"); } var consumtion = new IntegralConsumption { CompnayId = CurrentCompany.CompanyId, CompanyShortName = CurrentCompany.AbbreviateName, AccountName = CurrentUser.Name, AccountNo = CurrentUser.UserName, AccountPhone = "", DeliveryAddress = "", CommodityCount = int.Parse(hidsmsNumber.Value), CommodityId = Guid.Empty, CommodityName = hidName.Value, Exchange = ExchangeState.Success, ExchangeTiem = DateTime.Now, ExpressCompany = "", ExpressDelivery = "", Reason = "", Remark = "积分兑换商品", Way = IntegralWay.ExchangeSms, ConsumptionIntegral = int.Parse(hidjf.Value) }; IntegralServer.InsertIntegralConsumption(consumtion); IntegralServer.UpdateIntegralCountByConsumption(0 - consumtion.ConsumptionIntegral, CurrentUser.Owner); var acc = from item in AccountService.Query(CurrentCompany.CompanyId) where item.Type == Common.Enums.AccountType.Payment select new { No = item.No }; SMSOrderService.ExChangeSms(CurrentCompany.CompanyId, int.Parse(hidjf.Value), int.Parse(hidsmsNumber.Value), int.Parse(hidjfNum.Value), acc.First().No); hidShow.Value = "0"; } catch (Exception ex) { ShowExceptionMessage(ex, "兑换短信套餐"); hidShow.Value = "1"; } if (hidShow.Value == "0") { RegisterScript("alert('兑换短信成功。');window.location.href='./SMSBuy.aspx';", true); } }
void Query(Pagination pagination) { try { Range <DateTime> time = new Range <DateTime> { Lower = DateTime.Parse(txtStartTime.Text), Upper = DateTime.Parse(txtEndTime.Text) }; var query_list = IntegralServer.GetIntegralConsumptionList(time, null, IntegralWay.Exchange, (ExchangeState)int.Parse(XiaoFei.Value), CurrentCompany.CompanyType == CompanyType.Platform ? Common.Enums.OEMCommodityState.Success : (OEMCommodityState?)null, "1", null, pagination); var list = from item in query_list select new { ID = item.Id, item.ExchangeTiem, item.CommodityName, item.CompanyShortName, item.AccountNo, item.AccountName, Count = item.CommodityCount, Integral = item.ConsumptionIntegral, Phone = item.AccountPhone, Exchange = item.Exchange.GetDescription(), item.ConsumptionIntegral, OEMName = item.OEMName, Remark = item.Exchange == ExchangeState.Processing ? "<a href='CommodityExChange.aspx?id=" + item.Id + "&type=chuli'>兑换处理</a>" : "<a href='CommodityExChange.aspx?id=" + item.Id + "&type=look'>查看详细</a>" }; grv_xiaofei.DataSource = list; grv_xiaofei.DataBind(); if (query_list.Any()) { this.pager.Visible = true; showempty.Visible = false; if (pagination.GetRowCount) { this.pager.RowCount = pagination.RowCount; } grv_xiaofei.HeaderRow.TableSection = TableRowSection.TableHeader; } else { pager.Visible = false; showempty.Visible = true; } } catch (Exception ex) { pager.Visible = false; showempty.Visible = true; ShowExceptionMessage(ex, "查询"); } }
void Query(Pagination pagination) { try { var oem = OEMService.QueryOEM(CurrentCompany.CompanyId); Range <DateTime> time = new Range <DateTime> { Lower = DateTime.Parse(txtStartTime.Text), Upper = DateTime.Parse(txtEndTime.Text) }; var query_list = IntegralServer.GetIntegralConsumptionList(time, null, IntegralWay.Exchange, (ExchangeState)int.Parse(XiaoFei.Value), null, "1", oem == null ? (Guid?)null : oem.Id, pagination); var list = from item in query_list select new { ID = item.Id, item.ExchangeTiem, item.CommodityName, item.CompanyShortName, item.AccountNo, item.AccountName, Count = item.CommodityCount, Integral = item.ConsumptionIntegral, Phone = item.AccountPhone, Exchange = item.Exchange.GetDescription(), item.ConsumptionIntegral, Remark = item.Way == IntegralWay.ExchangeSms ? "" : (item.OEMCommodityState == OEMCommodityState.Processing ? "<a href='javascript:shengqi(\"" + item.Id + "\");'>申请平台处理</a>" : item.Exchange == ExchangeState.Processing ? "平台正在处理" : "平台已处理") }; grv_xiaofei.DataSource = list; grv_xiaofei.DataBind(); if (query_list.Any()) { this.pager.Visible = true; showempty.Visible = false; if (pagination.GetRowCount) { this.pager.RowCount = pagination.RowCount; } grv_xiaofei.HeaderRow.TableSection = TableRowSection.TableHeader; } else { pager.Visible = false; showempty.Visible = true; } } catch (Exception ex) { pager.Visible = false; showempty.Visible = true; ShowExceptionMessage(ex, "查询"); } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { if (Request.QueryString["id"] != null) { IntegralConsumptionView view = IntegralServer.GetIntegralConsumption(Guid.Parse(Request.QueryString["id"].ToString())); if (view != null) { lblId.Text = view.Id + ""; lblAccountName.Text = view.AccountName; lblAccountNo.Text = view.AccountNo; lblCommodityName.Text = view.CommodityName; lblCount.Text = view.CommodityCount + ""; lblIntegral.Text = view.ConsumptionIntegral + ""; lblCompanyName.Text = view.CompanyShortName; lblPhone.Text = view.AccountPhone; txtNo.Text = view.ExpressDelivery; txtAddress.Text = view.DeliveryAddress; txtCompany.Text = view.ExpressCompany; txtRemark.Text = view.Reason; } if (Request.QueryString["type"] == "chuli") { txtNo.ReadOnly = false; txtAddress.ReadOnly = false; txtCompany.ReadOnly = false; txtRemark.ReadOnly = false; btnSave.Enabled = true; btnSave.Visible = true; btnRefuse.Enabled = true; btnRefuse.Visible = true; } else if (Request.QueryString["type"] == "look") { txtNo.ReadOnly = true; txtAddress.ReadOnly = true; txtCompany.ReadOnly = true; txtRemark.ReadOnly = true; btnSave.Enabled = false; btnSave.Visible = false; btnRefuse.Enabled = false; btnRefuse.Visible = false; } } } }
private void BindDefaultAirPort() { WorkingSetting workingSetting = CompanyService.GetWorkingSetting(CurrentCompany.CompanyId); if (workingSetting != null && (!string.IsNullOrWhiteSpace(workingSetting.DefaultDeparture) || !string.IsNullOrWhiteSpace(workingSetting.DefaultDeparture))) { // 默认出发城市 BindDefaultAirportInfo(workingSetting.DefaultDeparture, txtDepartureValue, txtDeparture); // 默认到达城市 BindDefaultAirportInfo(workingSetting.DefaultArrival, txtArrivalValue, txtArrival); // 默认出发日期为三天后 txtGoDate.Value = DateTime.Today.AddDays(1).ToString("yyyy-MM-dd"); } txtIntegral.Text = IntegralServer.GetIntegralByAccountIdZong(CurrentUser.Owner).IntegralAvailable.ToString(); }
protected void btnSave_Click(object sender, EventArgs e) { if (id.Value == "") { return; } try { IntegralServer.UpdateIntegralConsumption(Guid.Parse(id.Value), OEMCommodityState.Success); } catch (Exception ex) { id.Value = ""; ShowExceptionMessage(ex, "提交申请平台兑换"); } NewMethod(pager.CurrentPageIndex); }
protected void btnSave_Click(object sender, EventArgs e) { bool falg = false; try { IntegralServer.UpdateIntegralConsumption(Guid.Parse(lblId.Text), ExchangeState.Success, this.CurrentUser.Name, txtNo.Text, txtCompany.Text, txtAddress.Text, txtRemark.Text); falg = true; } catch (Exception ex) { ShowExceptionMessage(ex, "处理"); } if (falg) { RegisterScript("alert('处理成功!');window.location.href='./CommodityExChangeList.aspx';", true); } }
protected void Page_Load(object sender, EventArgs e) { RegisterOEMSkins("form.css"); RegisterOEMSkins("page.css"); if (!IsPostBack) { IntegralCount count = IntegralServer.GetIntegralByAccountIdZong(this.CurrentUser.Owner); if (count != null) { lblKeYong.Text = count.IntegralAvailable + ""; lblZong.Text = count.IntegralCounts + ""; } else { lblKeYong.Text = "0"; lblZong.Text = "0"; } } }
void Query(Pagination pagination) { try { Range <DateTime> time = new Range <DateTime> { Lower = DateTime.Parse(txtStartTime.Text), Upper = DateTime.Parse(txtEndTime.Text) }; var query_list = IntegralServer.GetIntegralList(time, CurrentUser.Owner, (IntegralWay)int.Parse(XiaoFei.Value), pagination); var list = from item in query_list select new { ExchangeTiem = item.AccessTime, Way = item.IntegralWay.GetDescription(), ConsumptionIntegral = item.Integral, Remark = item.IntegralWay == IntegralWay.Buy ? "<a href = '/OrderModule/Purchase/OrderDetail.aspx?id=" + item.Remark + "'>" + item.Remark + "</a>" : item.IntegralWay == IntegralWay.RefuseExchange ? item.Remark : item.IntegralWay.GetDescription() }; grv_zengzhang.DataSource = list; grv_zengzhang.DataBind(); if (query_list.Any()) { this.pager.Visible = true; showempty.Visible = false; if (pagination.GetRowCount) { this.pager.RowCount = pagination.RowCount; } grv_zengzhang.HeaderRow.TableSection = TableRowSection.TableHeader; } else { pager.Visible = false; showempty.Visible = true; } } catch (Exception ex) { pager.Visible = false; showempty.Visible = true; ShowExceptionMessage(ex, "查询"); } }
void Query(Pagination pagination) { try { Range <DateTime> time = new Range <DateTime> { Lower = DateTime.Parse(txtStartTime.Text), Upper = DateTime.Parse(txtEndTime.Text) }; var query_list = IntegralServer.GetIntegralConsumptionList(time, CurrentUser.Owner, (IntegralWay)int.Parse(XiaoFei.Value), ExchangeState.All, null, "", null, pagination); var list = from item in query_list select new { item.ExchangeTiem, Way = item.Way.GetDescription(), item.ConsumptionIntegral, Remark = item.Exchange == ExchangeState.Refuse ? "拒绝兑换商品,拒绝原因:<br />" + item.Reason + "<br /><a href='javascript:show(\"" + item.CommodityName + "\",\"" + item.CommodityCount + "\",\"" + item.ConsumptionIntegral + "\",\"" + item.DeliveryAddress + "\",\"" + item.ExpressCompany + "\",\"" + item.ExpressDelivery + "\",\"" + item.Exchange + "\");'>" + item.CommodityName + " | " + item.CommodityCount + "件</a>" : item.Way == IntegralWay.Exchange || item.Way == IntegralWay.ExchangeSms ? "<a href='javascript:show(\"" + item.CommodityName + "\",\"" + item.CommodityCount + "\",\"" + item.ConsumptionIntegral + "\",\"" + item.DeliveryAddress + "\",\"" + item.ExpressCompany + "\",\"" + item.ExpressDelivery + "\",\"" + item.Exchange + "\");'>" + item.CommodityName + " | " + item.CommodityCount + "件</a>" : (item.Way == IntegralWay.TuiPiao ? "<a href='/OrderModule/Purchase/RefundApplyformDetail.aspx?id=" + item.Remark + "'>" + item.Remark + "</a>" : item.Way.GetDescription()) }; grv_xiaofei.DataSource = list; grv_xiaofei.DataBind(); if (query_list.Any()) { this.pager.Visible = true; showempty.Visible = false; if (pagination.GetRowCount) { this.pager.RowCount = pagination.RowCount; } grv_xiaofei.HeaderRow.TableSection = TableRowSection.TableHeader; } else { pager.Visible = false; showempty.Visible = true; } } catch (Exception ex) { pager.Visible = false; showempty.Visible = true; ShowExceptionMessage(ex, "查询"); } }
private void NewMethod() { IntegralParameterView view = IntegralServer.GetIntegralParameter(); if (view != null) { radEnableGongNeng.Checked = view.IsSignIn; radDisableGongNeng.Checked = !view.IsSignIn; radEnableXiaJia.Checked = view.IsDrop; radDisableXiaJia.Checked = !view.IsDrop; txtKeYong.Text = (view.AvailabilityRatio * 100).TrimInvaidZero(); txtSheZhi.Text = view.SignIntegral + ""; txtXiaoFei.Text = view.ConsumptionIntegral + ""; txtMostBuckle.Text = view.MostBuckle + ""; txtJianLi.Text = view.Multiple.TrimInvaidZero(); selZhouQi.SelectedIndex = (int)view.RangeReset; txtZhiDing.Text = view.SpecifiedDate == null?DateTime.Today.AddYears(1).ToString("yyyy-MM-dd") : view.SpecifiedDate.Value.ToString("yyyy-MM-dd"); txtZhiDing.Style.Add(HtmlTextWriterStyle.Display, view.SpecifiedDate != null ? "" : "none"); } }
/// <summary> /// 兑换商品 /// </summary> public static void ExChangeCommodity(Guid id, int exChangeNum, CompanyDetailInfo compnay, EmployeeDetailInfo accountinfo, OEMCommodityState stata, string domainName, Guid?oemid) { using (var cmd = Factory.CreateCommand()) { var reposity = Factory.CreateIntegralReposity(cmd); CommodityView commodityview = reposity.GetCommodity(id); if (commodityview.ValidityTime.Date < DateTime.Now.Date) { throw new Exception("该商品上架时间已经到期,不能兑换!"); } if (!commodityview.State) { throw new Exception("该商品未启用,不能兑换!"); } if (commodityview.SurplusNumber == 0) { throw new Exception("该商品已经兑换完毕,不能兑换!"); } if (commodityview.SurplusNumber < exChangeNum) { throw new Exception("该商品库存不足,不能兑换!"); } if (commodityview.NeedIntegral > 0) { IntegralParameterView paraemter = IntegralServer.GetIntegralParameter(); IntegralCount counts = IntegralServer.GetIntegralByAccountIdZong(compnay.CompanyId); if (counts == null) { throw new Exception("积分不够,暂不能兑换该商品!"); } if (counts.IntegralAvailable < commodityview.NeedIntegral * exChangeNum) { throw new Exception("积分不够,暂不能兑换该商品!"); } } commodityview.SurplusNumber = commodityview.SurplusNumber - exChangeNum; commodityview.ExchangeNumber = commodityview.ExchangeNumber + exChangeNum; cmd.BeginTransaction(); try { reposity.Update(commodityview); var consumtion = new IntegralConsumption { CompnayId = compnay.CompanyId, CompanyShortName = compnay.AbbreviateName, AccountName = accountinfo.Name, AccountNo = accountinfo.UserName, AccountPhone = compnay.ContactPhone, DeliveryAddress = commodityview.Type == CommodityType.Entity ? compnay.Address : "", CommodityCount = exChangeNum, CommodityId = commodityview.ID, CommodityName = commodityview.CommodityName, Exchange = commodityview.Type == CommodityType.Entity ? ExchangeState.Processing : ExchangeState.Success, ExchangeTiem = DateTime.Now, ExpressCompany = "", ExpressDelivery = "", Reason = "", Remark = commodityview.CommodityName, Way = commodityview.Type == CommodityType.Entity ? IntegralWay.Exchange : IntegralWay.ExchangeSms, ConsumptionIntegral = commodityview.NeedIntegral * exChangeNum, OEMCommodityState = commodityview.Type == CommodityType.SMS ? OEMCommodityState.Success : stata, OEMName = domainName, OEMID = oemid }; IntegralServer.InsertIntegralConsumption(consumtion); IntegralServer.UpdateIntegralCountByConsumption(0 - consumtion.ConsumptionIntegral, accountinfo.Owner); cmd.CommitTransaction(); } catch (Exception) { cmd.RollbackTransaction(); throw; } if (commodityview.Type == CommodityType.SMS) { var acc = from item in AccountService.Query(compnay.CompanyId) where item.Type == Common.Enums.AccountType.Payment select new { No = item.No }; SMSOrderService.ExChangeSms(compnay.CompanyId, commodityview.NeedIntegral, exChangeNum, commodityview.ExchangSmsNumber, acc.First().No); } } }