protected void btnSave_Click(object sender, EventArgs e) { decimal sum = 0; int Type = 0; foreach (GridViewRow row in gvXMProduct.Rows) { var ddlDemand = row.FindControl("ddlDemand") as RadioButtonList; int Demand = int.Parse(ddlDemand.SelectedValue); Type = base.XMZMDemandService.GetXMZMDemandTidByID(Demand); var product = base.XMZMReservationService.GetXMZMReservationListByInstallationID(Id, Type); decimal lblPrice = Convert.ToDecimal(((Label)row.FindControl("lblPrice")).Text.Trim()); sum += lblPrice; XMZMReservation Info2 = new XMZMReservation(); Info2.Remarks = lblPrice.ToString(); Info2.DemandID = Demand; //Info2.TypeID = Type; product.DemandID = Info2.DemandID; product.Remarks = Info2.Remarks; base.XMZMReservationService.UpdateXMZMReservation(Info2); } HozestERP.BusinessLogic.ManageCustomerService.XMInstallationList Info = new HozestERP.BusinessLogic.ManageCustomerService.XMInstallationList(); var product2 = base.XMInstallationListService.GetXMInstallationListByID(Id); Info.InstallationFee = sum; product2.InstallationFee = Info.InstallationFee; base.XMInstallationListService.UpdateXMInstallationList(Info); base.ShowMessage("保存成功!"); this.BindGrid(); }
protected void btnSave_Click(object sender, EventArgs e) { using (TransactionScope scope = new TransactionScope()) { try { XMInstallationList Info = new XMInstallationList(); string OrderCode = this.txtNumber.Text.Trim(); string CustomerName = this.txtName.Text.Trim(); string CustomerTel = this.txtTel.Text.Trim(); string InstallAddress = this.txtAddress.Text.Trim(); string WantID = this.txtWantID.Text.Trim(); int ProjectId = 25; int id = 0; if (OrderCode == "请输入订单编号" || WantID == "请输入买家ID" || CustomerName == "请输入姓名" || CustomerTel == "请输入电话" || InstallAddress == "请输入安装地址") { Response.Write("<script language='javascript'>alert('个人信息不能为空,请重新输入');</script>"); return; } var isRe = IoC.Resolve <IXMInstallationListService>().GetXMInstallationOrderCode(OrderCode); if (isRe == OrderCode) { Response.Write("<script language='javascript'>alert('订单号重复,请重新输入');</script>"); return; } bool c = CheckPhoneIsAble(CustomerTel); if (!c) { Response.Write("<script language='javascript'>alert('手机号不正确,请重新输入');</script>"); return; } Info.OrderCode = OrderCode; Info.CustomerName = CustomerName; Info.CustomerTel = CustomerTel; Info.InstallAddress = InstallAddress; Info.ProjectId = ProjectId; //Info.CreateID = HozestERPContext.Current.User.CustomerID; //Info.IsArrange = false; //Info.IsInstall = false; Info.WantID = WantID; Info.CreateDate = DateTime.Now; IoC.Resolve <IXMInstallationListService>().InsertXMInstallationList(Info); id = IoC.Resolve <IXMInstallationListService>().GetXMInstallationIDByOrderCode(OrderCode); var lbl = IoC.Resolve <IXMInstallationListService>().GetXMInstallationListByID(id); decimal sum = 0; int Type = 0; foreach (GridViewRow row in gvXMProduct.Rows) { var ddlDemand = row.FindControl("ddlDemand") as RadioButtonList; int Demand = int.Parse(ddlDemand.SelectedValue); Type = IoC.Resolve <IXMZMDemandService>().GetXMZMDemandTidByID(Demand); decimal lblPrice = Convert.ToDecimal(((System.Web.UI.WebControls.Label)row.FindControl("lblPrice")).Text.Trim()); sum += lblPrice; XMZMReservation Info2 = new XMZMReservation(); Info2.Remarks = lblPrice.ToString(); Info2.DemandID = Demand; Info2.TypeID = Type; Info2.InstallationID = id; Info.CreateDate = DateTime.Now; IoC.Resolve <IXMZMReservationService>().InsertXMZMReservation(Info2); } Info.InstallationFee = sum; IoC.Resolve <IXMInstallationListService>().UpdateXMInstallationList(Info); Response.Write("<script language='javascript'>alert('提交成功!');</script>"); scope.Complete(); } catch (Exception err) { //this.ProcessException(err); Response.Write(err); } } }