protected void ApplicationNo_Changed(object sender, EventArgs e) { string OrderCode = this.txtOrderCode.Text.Trim(); var list = base.XMOrderInfoProductDetailsService.GetXMOrderInfoProductDetailsListByOrderCode(OrderCode); List <XMClaimFormDetail> ClaimList = new List <XMClaimFormDetail>(); int no = 0; foreach (XMOrderInfoProductDetails info in list) { no++; XMClaimFormDetail one = new XMClaimFormDetail(); one.ID = no; one.ProductName = info.ProductName; one.Model = info.Specifications; ClaimList.Add(one); } GridViewDataBind(ClaimList); }
protected void btnSave_Click(object sender, EventArgs e) { bool IsReturn = this.chkIsReturn.Checked; string ApplicationNo = this.txtApplicationNo.Text.Trim(); string OrderCode = this.txtOrderCode.Text.Trim(); int ClaimType = int.Parse(this.ddlClaimType.SelectedValue); string Amount = this.txtAmount.Text.Trim(); string ConsignorName = this.txtConsignorName.Text.Trim(); string CompanyName = this.txtCompanyName.Text.Trim(); string BeginDate = this.txtBeginDate.Value.Trim(); string EndDate = this.txtEndDate.Value.Trim(); string ReturnTime = this.txtReturnTime.Text.Trim(); string LogisticsNumber = this.txtLogisticsNumber.Text.Trim(); string GoodsName = this.txtGoodsName.Text.Trim(); string Count = this.txtCount.Text.Trim(); string InsuredAmount = this.txtInsuredAmount.Text.Trim(); string BeginPlace = this.txtBeginPlace.Text.Trim(); string EndPlace = this.txtEndPlace.Text.Trim(); string BrokenPieces = this.txtBrokenPieces.Text.Trim(); string BrokenStatus = ""; if (this.CheckBox1.Checked) { BrokenStatus = BrokenStatus + ",1"; } if (this.CheckBox2.Checked) { BrokenStatus = BrokenStatus + ",2"; } if (this.CheckBox3.Checked) { BrokenStatus = BrokenStatus + ",3"; } if (this.CheckBox4.Checked) { BrokenStatus = BrokenStatus + ",4"; } if (this.CheckBox5.Checked) { BrokenStatus = BrokenStatus + ",5"; } if (this.CheckBox6.Checked) { BrokenStatus = BrokenStatus + ",6"; } if (this.CheckBox7.Checked) { BrokenStatus = BrokenStatus + ",7"; } if (chkIsReturn.Checked && ApplicationNo == "") { base.ShowMessage("请输入退换货单号!"); return; } if (OrderCode == "") { base.ShowMessage("请输入订单号!"); return; } decimal a = 0; int b = 0; if (Amount == "" || decimal.TryParse(Amount, out a) == false) { base.ShowMessage("索赔金额输入不正确!"); return; } if (InsuredAmount == "" || decimal.TryParse(InsuredAmount, out a) == false) { base.ShowMessage("保价金额输入不正确!"); return; } if (Count == "" || int.TryParse(Count, out b) == false) { base.ShowMessage("托运数量输入不正确!"); return; } if (BrokenPieces == "" || int.TryParse(BrokenPieces, out b) == false) { base.ShowMessage("受损数量输入不正确!"); return; } if (BrokenStatus == "") { base.ShowMessage("受损状态至少勾选1项!"); return; } if (ConsignorName == "") { base.ShowMessage("请输入发货人!"); return; } if (CompanyName == "") { base.ShowMessage("请输入托运公司!"); return; } if (BeginDate == "" || EndDate == "") { base.ShowMessage("发货时间和到达时间不能为空!"); return; } for (int i = 0; i < this.grdvZYNewsList.Rows.Count; i++) { TextBox ClaimAmount = (TextBox)grdvZYNewsList.Rows[i].Cells[4].FindControl("txtAmount"); decimal c = 0; if (decimal.TryParse(ClaimAmount.Text, out c) == false) { base.ShowMessage("受损金额输入错误!"); return; } } int PlatformType = int.Parse(this.hidPlatformType.Value.Trim()); int Nick = int.Parse(this.hidNick.Value.Trim()); //一个退换货只能有一个索赔单 if (IsReturn) { var IsExist = base.XMClaimFormService.GetXMClaimFormListByApplicationNo(ApplicationNo); if (IsExist != null && IsExist.Count > 0 && IsExist[0].ID != Id) { base.ShowMessage("该退换货单号已有相关联的索赔单!"); return; } } if (Id == -1) { XMClaimForm info = new XMClaimForm(); info.ClaimNumber = DateTime.Now.ToString("yyMMddHHmmssfff"); info.ApplicationNo = ApplicationNo; info.IsReturn = IsReturn; if (IsReturn && !string.IsNullOrEmpty(ReturnTime)) { info.ReturnTime = DateTime.Parse(ReturnTime); } info.ClaimDate = DateTime.Now; info.OrderCode = OrderCode; info.NickId = Nick; info.PlatformTypeId = PlatformType; info.ClaimType = ClaimType; info.Amount = decimal.Parse(Amount); info.FinancialStatus = false; info.ConsignorName = ConsignorName; info.CompanyName = CompanyName; info.BeginDate = DateTime.Parse(BeginDate); info.EndDate = DateTime.Parse(EndDate); info.LogisticsNumber = LogisticsNumber; info.GoodsName = GoodsName; info.Count = int.Parse(Count); info.InsuredAmount = decimal.Parse(InsuredAmount); info.BeginPlace = BeginPlace; info.EndPlace = EndPlace; info.BrokenPieces = int.Parse(BrokenPieces); info.BrokenStatus = BrokenStatus; info.IsEnable = false; info.CreateID = HozestERPContext.Current.User.CustomerID; info.CreateDate = DateTime.Now; info.UpdateID = HozestERPContext.Current.User.CustomerID; info.UpdateDate = DateTime.Now; base.XMClaimFormService.InsertXMClaimForm(info); for (int i = 0; i < this.grdvZYNewsList.Rows.Count; i++) { Label ProductName = (Label)grdvZYNewsList.Rows[i].Cells[0].FindControl("lblProductName"); Label Model = (Label)grdvZYNewsList.Rows[i].Cells[1].FindControl("lblModel"); TextBox ProductValue = (TextBox)grdvZYNewsList.Rows[i].Cells[2].FindControl("txtProductValue"); TextBox Description = (TextBox)grdvZYNewsList.Rows[i].Cells[3].FindControl("txtDescription"); TextBox ClaimAmount = (TextBox)grdvZYNewsList.Rows[i].Cells[4].FindControl("txtAmount"); XMClaimFormDetail one = new XMClaimFormDetail(); one.ClaimFormID = info.ID; one.ProductName = ProductName.Text; one.Model = Model.Text; one.ProductValue = ProductValue.Text; one.Description = Description.Text; one.Amount = decimal.Parse(ClaimAmount.Text); one.IsEnable = false; one.CreateID = HozestERPContext.Current.User.CustomerID; one.CreateDate = DateTime.Now; one.UpdateID = HozestERPContext.Current.User.CustomerID; one.UpdateDate = DateTime.Now; base.XMClaimFormDetailService.InsertXMClaimFormDetail(one); } base.ShowMessage("保存成功!"); } else { XMClaimForm info = base.XMClaimFormService.GetXMClaimFormByID(Id); info.ApplicationNo = ApplicationNo; info.OrderCode = OrderCode; info.NickId = Nick; info.PlatformTypeId = PlatformType; info.ClaimType = ClaimType; info.Amount = decimal.Parse(Amount); info.ConsignorName = ConsignorName; info.CompanyName = CompanyName; info.BeginDate = DateTime.Parse(BeginDate); info.EndDate = DateTime.Parse(EndDate); info.LogisticsNumber = LogisticsNumber; info.GoodsName = GoodsName; info.Count = int.Parse(Count); info.InsuredAmount = decimal.Parse(InsuredAmount); info.BeginPlace = BeginPlace; info.EndPlace = EndPlace; info.BrokenPieces = int.Parse(BrokenPieces); info.BrokenStatus = BrokenStatus; info.UpdateID = HozestERPContext.Current.User.CustomerID; info.UpdateDate = DateTime.Now; base.XMClaimFormService.UpdateXMClaimForm(info); var list = base.XMClaimFormDetailService.GetXMClaimFormDetailListByClaimFormID(Id); if (list != null && list.Count > 0) { foreach (XMClaimFormDetail one in list) { base.XMClaimFormDetailService.DeleteXMClaimFormDetail(one.ID); } } for (int i = 0; i < this.grdvZYNewsList.Rows.Count; i++) { Label ProductName = (Label)grdvZYNewsList.Rows[i].Cells[0].FindControl("lblProductName"); Label Model = (Label)grdvZYNewsList.Rows[i].Cells[1].FindControl("lblModel"); TextBox ProductValue = (TextBox)grdvZYNewsList.Rows[i].Cells[2].FindControl("txtProductValue"); TextBox Description = (TextBox)grdvZYNewsList.Rows[i].Cells[3].FindControl("txtDescription"); TextBox ClaimAmount = (TextBox)grdvZYNewsList.Rows[i].Cells[4].FindControl("txtAmount"); XMClaimFormDetail one = new XMClaimFormDetail(); one.ClaimFormID = info.ID; one.ProductName = ProductName.Text; one.Model = Model.Text; one.ProductValue = ProductValue.Text; one.Description = Description.Text; one.Amount = decimal.Parse(ClaimAmount.Text); one.IsEnable = false; one.CreateID = HozestERPContext.Current.User.CustomerID; one.CreateDate = DateTime.Now; one.UpdateID = HozestERPContext.Current.User.CustomerID; one.UpdateDate = DateTime.Now; base.XMClaimFormDetailService.InsertXMClaimFormDetail(one); } base.ShowMessage("保存成功!"); } }