예제 #1
0
 public void NotifyShipmentCancelled2(LTLClient2 client, LTLShipper2 shipper, LTLConsignee2 consignee, LTLShipment2 shipment, string shipmentNumber, LTLClient2 salesRep)
 {
     try {
         //Send conformation email
         if (client.ContactEmail.Trim().Length > 0)
         {
             string body = getHTMLBody(System.Web.Hosting.HostingEnvironment.MapPath(HTML_SHIPMENT_CANCELLED));
             body = body.Replace("*shipmentNumber*", shipmentNumber);
             body = body.Replace("*clientName*", client.Name);
             body = body.Replace("*clientAddress*", client.AddressLine1 + " " + client.City + ", " + client.State + " " + client.Zip);
             body = body.Replace("*clientContact*", client.ContactName);
             body = body.Replace("txtShipDate", shipment.ShipDate.ToString("MM/dd/yyyy"));
             body = body.Replace("txtOrigin", shipper.Name + " (" + shipper.Zip + ")");
             body = body.Replace("txtDest", consignee.Name + " (" + consignee.Zip + ")");
             body = body.Replace("txtPallets", shipment.Pallets.ToString());
             body = body.Replace("txtWeight", shipment.Weight.ToString());
             body = body.Replace("txtRate", shipment.PalletRate.ToString());
             body = body.Replace("txtFSC", shipment.FuelSurcharge.ToString());
             body = body.Replace("txtAccessorial", shipment.AccessorialCharge.ToString());
             body = body.Replace("txtInsurance", shipment.InsuranceCharge.ToString());
             body = body.Replace("txtTSC", shipment.TollCharge.ToString());
             body = body.Replace("txtCharges", shipment.TotalCharge.ToString());
             new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, client.ContactEmail, "Shipment Cancelled", true, body);
             if (salesRep != null)
             {
                 new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, salesRep.ContactEmail, "Shipment Cancelled", true, body);
             }
         }
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }
예제 #2
0
    //Interface
    protected void Page_Load(object sender, EventArgs e)
    {
        //Page load event handler
        try {
            if (!Page.IsPostBack)
            {
                string number = Request.QueryString["number"];
                if (number.Trim().Length > 0)
                {
                    this.mConsignee = new FreightGateway().ReadLTLConsignee(int.Parse(number), Master.CurrentClient.Number);
                }
                ViewState.Add("Consignee", this.mConsignee);

                this.mAddressValid = this.mConsignee != null;      //No address validation required on existing
                ViewState.Add("AddressValid", this.mAddressValid);

                this.mCallingURI = Page.Request.UrlReferrer.AbsoluteUri.Split('?')[0];
                ViewState.Add("CallingURI", this.mCallingURI);

                //Setup UI; disable client change for new/update
                Master.ClientsEnabled   = false;
                this.lblClientName.Text = Master.CurrentClient.Name;
                if (this.mConsignee != null)
                {
                    this.txtName.Text         = this.mConsignee.Name.Trim();
                    this.txtAddressLine1.Text = this.mConsignee.AddressLine1.Trim();
                    this.txtAddressLine2.Text = this.mConsignee.AddressLine2.Trim();
                    this.txtCity.Text         = this.mConsignee.City.Trim();
                    this.txtState.Text        = this.mConsignee.State.Trim();
                    this.txtZip5.Text         = this.mConsignee.Zip.Trim();
                    this.txtZip4.Text         = this.mConsignee.Zip4.Trim();
                    this.txtContactName.Text  = this.mConsignee.ContactName.Trim();
                    this.txtContactPhone.Text = this.mConsignee.ContactPhone.Trim();
                    this.txtContactEmail.Text = this.mConsignee.ContactEmail.Trim();
                    this.txtWindowOpen.Text   = this.mConsignee.WindowTimeStart.ToString("hh:mm tt");
                    this.txtWindowClose.Text  = this.mConsignee.WindowTimeEnd.ToString("hh:mm tt");
                }
                else
                {
                    this.txtWindowOpen.Text  = "09:00 AM";
                    this.txtWindowClose.Text = "05:00 PM";
                }
                this.txtCity.ReadOnly        = this.txtState.ReadOnly = this.txtZip5.ReadOnly = this.mConsignee != null;
                this.mvwPage.ActiveViewIndex = 0;
            }
            else
            {
                this.mConsignee    = ViewState["Consignee"] != null ? (LTLConsignee2)ViewState["Consignee"] : null;
                this.mAddressValid = ViewState["AddressValid"] != null ? (bool)ViewState["AddressValid"] : false;
                this.mCallingURI   = ViewState["CallingURI"].ToString();
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 3); }
        finally { OnValidateForm(null, EventArgs.Empty); }
    }
예제 #3
0
 protected void OnConsigneeChanged(object sender, EventArgs e)
 {
     //
     try {
         if (this.ddlConsignees.SelectedValue == "New")
         {
             Response.Redirect("~/Client/Consignee.aspx?number=", false);
         }
         LTLConsignee2 consignee = this.ddlConsignees.SelectedValue != null ? new FreightGateway().ReadLTLConsignee(int.Parse(this.ddlConsignees.SelectedValue), Master.CurrentClient.Number) : null;
         this.lblConsigneeAddress.Text = consignee != null?consignee.AddressLine1.Trim() + "     " + consignee.City.Trim() + ", " + consignee.State + " " + consignee.Zip : "";
     }
     catch (Exception ex) { Master.ReportError(ex, 3); }
 }
예제 #4
0
 //Interface
 public dlgLTLConsignee(LTLConsignee2 consignee)
 {
     //Constructor
     try {
         InitializeComponent();
         this.mConsignee = consignee;
         if (this.mConsignee == null)
         {
             throw new ApplicationException("Consignee cannot be null.");
         }
         this.wbMap.Url = new Uri(global::Argix.Properties.Settings.Default.MapUrl);
     }
     catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
 }
예제 #5
0
        private void OnItemClick(object sender, System.EventArgs e)
        {
            //Menu services
            int             number    = 0;
            LTLConsignee2   consignee = null;
            dlgLTLConsignee dlg       = null;

            try {
                ToolStripItem menu = (ToolStripItem)sender;
                switch (menu.Name)
                {
                case "csNew":
                    consignee = new LTLConsignee2();
                    consignee.ClientNumber = this.cboClient.SelectedValue.ToString();
                    consignee.Number       = 0;
                    dlg      = new dlgLTLConsignee(consignee);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        number      = FreightGateway.CreateLTLConsignee(consignee);
                        MessageBox.Show(this, "New consignee created.", App.Product, MessageBoxButtons.OK);
                        Refresh();
                    }
                    break;

                case "csOpen":
                    number    = int.Parse(this.grdConsignees.Selected.Rows[0].Cells["ConsigneeNumber"].Value.ToString());
                    consignee = FreightGateway.ReadLTLConsignee(number, this.cboClient.SelectedValue.ToString());
                    dlg       = new dlgLTLConsignee(consignee);
                    dlg.Font  = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        FreightGateway.UpdateLTLConsignee(consignee);
                        MessageBox.Show(this, "Consignee updated.", App.Product, MessageBoxButtons.OK);
                        Refresh();
                    }
                    break;

                case "csRefresh":
                    this.Cursor = Cursors.WaitCursor;
                    Refresh();
                    break;
                }
            }
            catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
            finally { setUserServices(); this.Cursor = Cursors.Default; }
        }
예제 #6
0
        public static bool UpdateLTLConsignee(LTLConsignee2 ltlConsignee)
        {
            //Update an existing LTL consignee
            bool updated = false;
            LTLAdminService2Client client = new LTLAdminService2Client();

            try {
                updated = client.UpdateLTLConsigneeForAdmin(ltlConsignee);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <LTLFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(updated);
        }
예제 #7
0
        public static LTLConsignee2 ReadLTLConsignee(int consigneeNumber, string clientNumber)
        {
            LTLConsignee2          consignee = new LTLConsignee2();
            LTLAdminService2Client client    = new LTLAdminService2Client();

            try {
                consignee = client.ReadLTLConsigneeForAdmin(consigneeNumber, clientNumber);
                client.Close();
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <LTLFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(consignee);
        }
예제 #8
0
        public static int CreateLTLConsignee(LTLConsignee2 ltlConsignee)
        {
            //Create a new LTL consignee
            int number = 0;
            LTLAdminService2Client client = new LTLAdminService2Client();

            try {
                number = client.CreateLTLConsigneeForAdmin(ltlConsignee);
            }
            catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); }
            catch (FaultException <LTLFault> cfe) { client.Abort(); throw new ApplicationException(cfe.Detail.Message); }
            catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); }
            catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); }
            return(number);
        }
예제 #9
0
        public bool UpdateLTLConsignee(LTLConsignee2 consignee)
        {
            //Update an existing LTL consignee
            bool updated = false;

            try {
                updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_CONSIGNEE_UPDATE,
                                                            new object[] {
                    consignee.Number, consignee.ClientNumber, consignee.Name, consignee.AddressLine1, consignee.AddressLine2,
                    consignee.ContactName, consignee.ContactPhone, consignee.ContactEmail,
                    consignee.WindowTimeStart, consignee.WindowTimeEnd,
                    consignee.UserID, consignee.Rowversion
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(updated);
        }
예제 #10
0
        public int CreateLTLConsignee(LTLConsignee2 consignee)
        {
            //Create a new LTL consignee
            int number = 0;

            try {
                object o = new DataService().ExecuteNonQueryWithReturn(SQL_CONNID, USP_CONSIGNEE_CREATE,
                                                                       new object[] {
                    0, consignee.ClientNumber,
                    consignee.Name, consignee.AddressLine1, consignee.AddressLine2, consignee.City, consignee.State, consignee.Zip, consignee.Zip4,
                    consignee.ContactName, consignee.ContactPhone, consignee.ContactEmail,
                    consignee.WindowTimeStart, consignee.WindowTimeEnd, consignee.UserID
                });
                number = (int)o;
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(number);
        }
예제 #11
0
    protected void OnCommand(object sender, CommandEventArgs e)
    {
        //
        try {
            switch (e.CommandName)
            {
            case "Validate":
                bool verified = verifyAddress(this.txtName.Text, this.txtAddressLine1.Text, this.txtAddressLine2.Text, this.txtCity.Text, this.txtState.Text, this.txtZip5.Text, this.txtZip4.Text);
                if (verified)
                {
                    ViewState["AddressValid"] = true;
                    Master.ShowMessageBox("The Address has been validated.");
                }
                break;

            case "ChooseAddress":
                //Choose user address as valid address
                this.txtName.Text         = this.txtSrcName.Text;
                this.txtAddressLine1.Text = this.txtSrcAddressLine1.Text;
                this.txtAddressLine2.Text = this.txtSrcAddressLine2.Text;
                this.txtCity.Text         = this.txtSrcCity.Text;
                this.txtState.Text        = this.txtSrcState.Text;
                this.txtZip5.Text         = this.txtSrcZip5.Text;
                this.txtZip4.Text         = this.txtSrcZip4.Text;

                ViewState["AddressValid"]    = true;
                this.mvwPage.ActiveViewIndex = 0;
                break;

            case "ChooseUSPSAddress":
                //Choose USPS address as valid address
                this.txtName.Text         = this.txtUSPSName.Text;
                this.txtAddressLine1.Text = this.txtUSPSAddressLine1.Text;
                this.txtAddressLine2.Text = this.txtUSPSAddressLine2.Text;
                this.txtCity.Text         = this.txtUSPSCity.Text;
                this.txtState.Text        = this.txtUSPSState.Text;
                this.txtZip5.Text         = this.txtUSPSZip5.Text;
                this.txtZip4.Text         = this.txtUSPSZip4.Text;

                ViewState["AddressValid"]    = true;
                this.mvwPage.ActiveViewIndex = 0;
                break;

            case "Submit":
                if (this.mConsignee == null)
                {
                    //New- ensure the address is valid
                    if (!this.mAddressValid)
                    {
                        this.mAddressValid        = verifyAddress(this.txtName.Text, this.txtAddressLine1.Text, this.txtAddressLine2.Text, this.txtCity.Text, this.txtState.Text, this.txtZip5.Text, this.txtZip4.Text);
                        ViewState["AddressValid"] = this.mAddressValid;
                    }
                    if (this.mAddressValid)
                    {
                        LTLConsignee2 consignee = new LTLConsignee2();
                        consignee.ClientNumber    = Master.CurrentClient.Number;
                        consignee.Name            = this.txtName.Text;
                        consignee.AddressLine1    = this.txtAddressLine1.Text;
                        consignee.AddressLine2    = this.txtAddressLine2.Text;
                        consignee.City            = this.txtCity.Text;
                        consignee.State           = this.txtState.Text;
                        consignee.Zip             = this.txtZip5.Text;
                        consignee.Zip4            = this.txtZip4.Text;
                        consignee.WindowTimeStart = DateTime.Parse("01-01-2000 " + this.txtWindowOpen.Text);
                        consignee.WindowTimeEnd   = DateTime.Parse("01-01-2000 " + this.txtWindowClose.Text);
                        consignee.ContactName     = this.txtContactName.Text;
                        consignee.ContactPhone    = this.txtContactPhone.Text;
                        consignee.ContactEmail    = this.txtContactEmail.Text;
                        consignee.UserID          = Membership.GetUser().UserName;
                        consignee.LastUpdated     = DateTime.Now;
                        int number = new FreightGateway().CreateLTLConsignee(consignee);

                        this.btnValidate.Enabled = this.btnSubmit.Enabled = false;
                        this.btnCancel.Text      = "Close";
                        Master.ShowMessageBox("New consignee " + consignee.Name + " has been created.");
                    }
                }
                else
                {
                    //Update
                    this.mConsignee.Name            = this.txtName.Text;
                    this.mConsignee.AddressLine1    = this.txtAddressLine1.Text;
                    this.mConsignee.AddressLine2    = this.txtAddressLine2.Text;
                    this.mConsignee.Zip4            = this.txtZip4.Text;
                    this.mConsignee.WindowTimeStart = DateTime.Parse("01-01-2000 " + this.txtWindowOpen.Text);
                    this.mConsignee.WindowTimeEnd   = DateTime.Parse("01-01-2000 " + this.txtWindowClose.Text);
                    this.mConsignee.ContactName     = this.txtContactName.Text;
                    this.mConsignee.ContactPhone    = this.txtContactPhone.Text;
                    this.mConsignee.ContactEmail    = this.txtContactEmail.Text;
                    this.mConsignee.UserID          = Membership.GetUser().UserName;
                    this.mConsignee.LastUpdated     = DateTime.Now;
                    bool updated = new FreightGateway().UpdateLTLConsignee(this.mConsignee);

                    this.btnValidate.Enabled = this.btnSubmit.Enabled = false;
                    this.btnCancel.Text      = "Close";
                    Master.ShowMessageBox("Consignee " + this.mConsignee.Name + " has been updated.");
                }
                break;

            case "Cancel":
                Response.Redirect(this.mCallingURI + "?view=consignees", false);
                break;
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 4); }
    }