protected void btnCheck_Click(object sender, EventArgs e) { try { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); RequiredFieldValidator rfvType = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvType")); RequiredFieldValidator rfvTransportMethod = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvTransportMethod")); //add by ljz //modify by ljz start //if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid) if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid || !rfvType.IsValid || !rfvTransportMethod.IsValid) //modify by ljz end { return; } btnSave_Click(sender, e); ShowSuccessMessage("Transportation.TransportationOrder.Checked.Successfully", this.OrderNo); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Status = "Checked"; order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); UpdateView(); this.FV_Order.DataBind(); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void btnStart_Click(object sender, EventArgs e) { try { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid) { return; } TransportationOrder order = PrepareOrder(); order.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(order); TheTransportationOrderMgr.StartTransportationOrder(this.OrderNo, this.CurrentUser); ShowSuccessMessage("Transportation.TransportationOrder.StartTransportationOrder.Successfully", this.OrderNo); UpdateView(); this.FV_Order.DataBind(); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void btnSave_Click(object sender, EventArgs e) { RequiredFieldValidator rfvCarrier = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrier")); RequiredFieldValidator rfvCarrierBillAddress = (RequiredFieldValidator)(this.FV_Order.FindControl("rfvCarrierBillAddress")); if (!rfvCarrier.IsValid || !rfvCarrierBillAddress.IsValid) { return; } try { TheTransportationOrderMgr.UpdateTransportationOrder(PrepareOrder()); ShowSuccessMessage("Transportation.TransportationOrder.UpdateTransportationOrder.Successfully", this.OrderNo); UpdateView(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } catch (Exception ex) { ShowErrorMessage(ex.Message); } }
protected void btnRestore_Click(object sender, EventArgs e) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo, true); if (to.IsValuated == true) { try { string connstring = getCONN(); string sql = "select * from tactbill where orderno ='" + to.OrderNo + "' and status='Create'"; DataSet ds = SqlHelper.ExecuteDataset(connstring, CommandType.Text, sql); DataTable dt = ds.Tables[0]; if (dt.Rows.Count == 0) { ShowErrorMessage("该运单已经开票,无法还原状态!"); } else { string updSql = "update tactbill set status='Close' where id='" + dt.Rows[0]["id"].ToString() + "'"; SqlHelper.ExecuteNonQuery(connstring, CommandType.Text, updSql); to.IsValuated = false; to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); ShowSuccessMessage("运单状态还原成功!"); } } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } catch (Exception ex) { ShowErrorMessage(ex.Message); } } else { ShowSuccessMessage("运单状态还原成功!"); to.Status = "Create"; TheTransportationOrderMgr.UpdateTransportationOrder(to); UpdateView(); UpdateViewButton(); } }
protected void btnCancel_Click(object sender, EventArgs e) { try { TheTransportationOrderMgr.CancelTransportationOrder(this.OrderNo, this.CurrentUser); TransportationOrder order = TheTransportationOrderMgr.LoadTransportationOrder(this.OrderNo); order.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(order); ShowSuccessMessage("Transportation.TransportationOrder.CancelTransportationOrder.Successfully", this.OrderNo); UpdateViewButton(); } catch (BusinessErrorException ex) { ShowErrorMessage(ex); } }
protected void lbtnCreate_Click(object sender, EventArgs e) { string code = ((LinkButton)sender).CommandArgument; try { Expense ex = TheExpenseMgr.LoadExpense(code); string s_remark = ex.Remark; string[] remarks = ex.Remark.Split(new char[] { ';' }); ex.Remark = ""; ex.LastModifyUser = this.CurrentUser; ex.LastModifyDate = DateTime.Now; TheExpenseMgr.UpdateExpense(ex); TransportationOrder transportationOrder = TheTransportationOrderMgr.CreateTransportationOrder(code, this.CurrentUser); foreach (string s in remarks) { if (s.Split(new char[] { ':' })[0] == "PriceMethod") { transportationOrder.PricingMethod = s.Split(new char[] { ':' })[1]; } if (s.Split(new char[] { ':' })[0] == "VehicleType") { transportationOrder.VehicleType = s.Split(new char[] { ':' })[1]; } } ex.Remark = ex.Code; ex.Remark += s_remark; TheExpenseMgr.UpdateExpense(ex); transportationOrder.Status = BusinessConstants.CODE_MASTER_STATUS_VALUE_COMPLETE; TheTransportationOrderMgr.UpdateTransportationOrder(transportationOrder); ShowSuccessMessage("Transportation.TransportationOrder.AddTransportationOrder.Successfully", transportationOrder.OrderNo); UpdateView(); } catch { ShowErrorMessage("Transportation.TransportationOrder.AddTransportationOrder.Fail"); } }
protected void btnComplete_Click(object sender, EventArgs e) { try { ds = needCaluate(); if (onlyWSNFlag == false) { TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "In-Process"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); TheTransportationOrderMgr.CompleteTransportationOrder(this.OrderNo, this.CurrentUser); } else { createTBill(); TransportationOrder to = TheTransportationOrderMgr.LoadTransportationOrder(OrderNo); to.Status = "Complete"; to.Remark = ((TextBox)(this.FV_Order.FindControl("tbRemark"))).Text.Trim(); TheTransportationOrderMgr.UpdateTransportationOrder(to); } if (ds != null)//djin { Caluate(); } ShowSuccessMessage("Transportation.TransportationOrder.CompleteTransportationOrder.Successfully", this.OrderNo); if (ds != null) { Restore(ds); } UpdateViewButton(); } catch (BusinessErrorException ex) { Restore(ds); ShowErrorMessage(ex); } }