Beispiel #1
0
        void btnAddExtra_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                Facade.IJobExtra facExtra = new Facade.Job();
                Entities.Extra   extra    = new Orchestrator.Entities.Extra();

                if ((eExtraState)Enum.Parse(typeof(eExtraState), cboExtraState.SelectedValue.Replace(" ", "")) == eExtraState.Accepted && txtClientContact.Text == "")
                {
                    pnlError.Visible = true;
                    lblError.Text    = "If the Extra has been accepted please state whom by.";
                    return;
                }

                if (m_extraId > 0)
                {
                    UpdateExtra();
                }
                else
                {
                    CreateExtra();
                }

                this.ReturnValue = "refresh";
                this.Close();
            }
        }
Beispiel #2
0
        private void CreateExtra()
        {
            Entities.Extra extra = new Orchestrator.Entities.Extra();


            if (m_orderId > 0)
            {
                extra.OrderID = m_orderId;
            }

            extra.ExtraType     = (eExtraType)Enum.Parse(typeof(eExtraType), cboExtraType.SelectedValue.Replace(" ", ""));
            extra.ExtraState    = (eExtraState)Enum.Parse(typeof(eExtraState), cboExtraState.SelectedValue.Replace(" ", ""));
            extra.ClientContact = txtClientContact.Text;
            extra.ExtraAmount   = decimal.Parse(txtAmount.Text, System.Globalization.NumberStyles.Currency);
            extra.OrderID       = int.Parse(cboClient.SelectedValue);

            //if (extra.ExtraType == eExtraType.Demurrage)
            //{
            //    extra.DemurrageComments = txtDemurrageComments.Text;
            //    extra.InstructionId = m_instructionId;
            //}

            //if (extra.ExtraType == eExtraType.Custom)
            extra.CustomDescription = txtCustomDescription.Text;

            string userId = ((Entities.CustomPrincipal)Page.User).UserName;

            Facade.IJobExtra facExtra = new Facade.Job();
            int extraId = facExtra.AddExtra(extra, userId);

            if (extraId > 0)
            {
                this.ReturnValue = bool.TrueString;
                this.Close("AddExtra");
            }
            else
            {
                lblError.Text    = "There was a problem trying to Add this extra.";
                pnlError.Visible = true;
            }
        }
Beispiel #3
0
        //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;
            }
        }