private void btnConfirmOrders_Click(object sender, EventArgs e) { List <int> orderIDs = this.GetSelectedOrderIds(); if (orderIDs.Count > 0) { using (TransactionScope ts = new TransactionScope()) { Facade.IOrder facOrder = new Facade.Order(); facOrder.Update(orderIDs, eOrderStatus.Approved, ((Entities.CustomPrincipal)Page.User).UserName); Facade.IOrderApproval facOrderApproval = new Facade.Order(); // Insert Order approval rows facOrderApproval.Create(orderIDs, eOrderStatus.Approved, "", DateTime.Now, this.Page.User.Identity.Name); // Send email to client user try { facOrderApproval.SendClientOrderApprovalEmail(orderIDs, eOrderStatus.Approved, txtRejectionReasonTop.Text, this.Page.User.Identity.Name); } catch { /* Swallow error: We dont care if the email approval/rejection email failed */ } ts.Complete(); } } this.ordersRadGrid.Rebind(); }
private void btnRejectOrders_Click(object sender, EventArgs e) { List <int> orderIDs = this.GetSelectedOrderIds(); if (orderIDs.Count > 0) { using (TransactionScope ts = new TransactionScope()) { Facade.IOrder facOrder = new Facade.Order(); //Change status to rejected when the new type is added. facOrder.Update(orderIDs, eOrderStatus.Rejected, ((Entities.CustomPrincipal)Page.User).UserName); Facade.IOrderApproval facOrderApproval = new Facade.Order(); // Insert Order approval rows facOrderApproval.Create(orderIDs, eOrderStatus.Rejected, txtRejectionReasonTop.Text, DateTime.Now, this.Page.User.Identity.Name); // Send email to client user facOrderApproval.SendClientOrderApprovalEmail(orderIDs, eOrderStatus.Rejected, txtRejectionReasonTop.Text, this.Page.User.Identity.Name); ts.Complete(); } } this.ordersRadGrid.Rebind(); }
//private void UpdateVigoNotes1(int orderId) //{ // // Update the order palletforce notes 1 field to reflect the addition of the extra // Facade.IVigoOrder facVigoOrder = new Orchestrator.Facade.Order(); // Entities.VigoOrder vigoOrder = facVigoOrder.GetForOrderId(m_orderID); // Facade.IOrderExtra facExtra = new Facade.Order(); // Facade.IOrder facOrder = new Facade.Order(); // Entities.Order order = facOrder.GetForOrderID(m_orderID); // Facade.ExtraType facExtraType = new Orchestrator.Facade.ExtraType(); // List<Entities.ExtraType> ets = facExtraType.GetForIsEnabled(new bool?()); // string vigoNotes1_ForSurchargeDescriptions = string.Empty; // if (vigoOrder != null) // { // DataSet dsExtras = facExtra.GetExtrasForOrderID(m_orderID); // if (dsExtras != null && dsExtras.Tables[0] != null) // { // if (dsExtras.Tables[0].Rows.Count > 0) // { // foreach (DataRow row in dsExtras.Tables[0].Rows) // { // if (row["ExtraAppliesToID"].ToString() == "1") // These are client extras not network extras. // { // Entities.ExtraType extraType = ets.Find(et => et.ExtraTypeId == int.Parse(row["ExtraTypeId"].ToString())); // if (extraType != null) // { // //Some hard coded nastiness that will need to be changed at some point... // //BW Delivery between [deliver from time] – [deliver by time] hrs. // //BI Please book in. // //AM AM delivery. // //TB Deliver at [deliver by time] hrs. or if not A service: Deliver on [delivery date] at [deliver by time] hrs. // //EB Deliver on [delivery date]. // //TL Tail-lift delivery. // //SA SATURDAY AM DELIVERY. // //TA Deliver by 10am. // string textToAppend = string.Empty; // switch (extraType.ShortDescription.ToUpper()) // { // case "BW": // textToAppend = string.Format("Delivery between {0} – {1} hrs", order.DeliveryFromDateTime.ToString("hh:mm"), order.DeliveryDateTime.ToString("hh:mm")); // break; // case "BI": // textToAppend = "Please book in"; // break; // case "AM": // textToAppend = "AM dellivery"; // break; // case "TB": // textToAppend = string.Format("Deliver on {0} at {1} hrs", order.DeliveryDateTime.ToString("dd/MM/yy"), order.DeliveryDateTime.ToString("hh:mm")); // break; // case "EB": // textToAppend = string.Format("Deliver on {0}", order.DeliveryDateTime.ToString("dd/MM/yy")); // break; // case "SA": // textToAppend = "SATURDAY AM DELIVERY"; // break; // case "TA": // textToAppend = "Deliver by 10am"; // break; // default: // break; // } // if (textToAppend != string.Empty) // vigoNotes1_ForSurchargeDescriptions = AppendToVigoNotes(vigoNotes1_ForSurchargeDescriptions, textToAppend, ":"); // } // } // } // // Update the vigo order with the new notes 1 information // if (vigoOrder.Note1 != vigoNotes1_ForSurchargeDescriptions) // { // vigoOrder.Note1 = vigoNotes1_ForSurchargeDescriptions; // facVigoOrder.CreateOrUpdate(vigoOrder, this.User.Identity.Name); // } // } // else // { // // Update the vigo order with the new notes 1 information (which should be blank as there are no surcharges). // if (vigoOrder.Note1 != "") // { // vigoOrder.Note1 = ""; // facVigoOrder.CreateOrUpdate(vigoOrder, this.User.Identity.Name); // } // } // } // } //} private void CreateExtra() { Entities.Extra extra = new Orchestrator.Entities.Extra(); extra.JobId = m_jobId; if (m_instructionId > 0) { m_orderID = int.Parse(cboClient.SelectedValue); } extra.OrderID = m_orderID; extra = PopulateExtra(extra); //if (extra.ExtraType == eExtraType.Demurrage) //{ // extra.DemurrageComments = txtDemurrageComments.Text; // extra.InstructionId = m_instructionId; //} string userId = ((Entities.CustomPrincipal)Page.User).UserName; Facade.IOrderExtra facExtra = new Facade.Order(); int extraId = facExtra.Create(extra, this.Page.User.Identity.Name); if (extraId > 0) { //lblInjectScript.Text = "<script>window.close()</script>"; // If this is an order extra.... //if (m_orderID != 0) // UpdateVigoNotes1(m_orderID); } else { lblError.Text = "There was a problem trying to Add this extra."; pnlError.Visible = true; } }