Example #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); }
 }
Example #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.Length > 0)
                {
                    this.mShipper = new FreightGateway().ReadLTLShipper(number);
                }
                ViewState.Add("Shipper", this.mShipper);

                this.mAddressValid = this.mShipper != 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.mShipper != null)
                {
                    this.txtName.Text         = this.mShipper.Name.Trim();
                    this.txtAddressLine1.Text = this.mShipper.AddressLine1.Trim();
                    this.txtAddressLine2.Text = this.mShipper.AddressLine2.Trim();
                    this.txtCity.Text         = this.mShipper.City.Trim();
                    this.txtState.Text        = this.mShipper.State.Trim();
                    this.txtZip5.Text         = this.mShipper.Zip.Trim();
                    this.txtZip4.Text         = this.mShipper.Zip4.Trim();
                    this.txtContactName.Text  = this.mShipper.ContactName.Trim();
                    this.txtContactPhone.Text = this.mShipper.ContactPhone.Trim();
                    this.txtContactEmail.Text = this.mShipper.ContactEmail.Trim();
                    this.txtWindowOpen.Text   = this.mShipper.WindowTimeStart.ToString("hh:mm tt");
                    this.txtWindowClose.Text  = this.mShipper.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.mShipper != null;
                this.mvwPage.ActiveViewIndex = 0;
            }
            else
            {
                this.mShipper      = ViewState["Shipper"] != null ? (LTLShipper2)ViewState["Shipper"] : null;
                this.mAddressValid = ViewState["AddressValid"] != null ? (bool)ViewState["AddressValid"] : false;
                this.mCallingURI   = ViewState["CallingURI"].ToString();
            }
        }
        catch (Exception ex) { Master.ReportError(ex, 3); }
    }
Example #3
0
 protected void OnShipperChanged(object sender, EventArgs e)
 {
     //
     try {
         if (this.ddlShippers.SelectedValue == "New")
         {
             Response.Redirect("~/Client/Shipper.aspx?number=", false);
         }
         LTLShipper2 shipper = this.ddlShippers.SelectedValue != null ? new FreightGateway().ReadLTLShipper(this.ddlShippers.SelectedValue) : null;
         this.lblShipperAddress.Text = shipper != null?shipper.AddressLine1.Trim() + "     " + shipper.City.Trim() + ", " + shipper.State + " " + shipper.Zip : "";
     }
     catch (Exception ex) { Master.ReportError(ex, 3); }
 }
Example #4
0
 //Interface
 public dlgLTLShipper(LTLShipper2 shipper)
 {
     //Constructor
     try {
         InitializeComponent();
         this.mShipper = shipper;
         if (this.mShipper == null)
         {
             throw new ApplicationException("Shipper cannot be null.");
         }
         this.wbMap.Url = new Uri(global::Argix.Properties.Settings.Default.MapUrl);
     }
     catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); }
 }
Example #5
0
        private void OnItemClick(object sender, System.EventArgs e)
        {
            //Menu services
            string        number  = "";
            LTLShipper2   shipper = null;
            dlgLTLShipper dlg     = null;

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

                case "csOpen":
                    number   = this.grdShippers.Selected.Rows[0].Cells["ShipperNumber"].Value.ToString();
                    shipper  = FreightGateway.ReadLTLShipper(number);
                    dlg      = new dlgLTLShipper(shipper);
                    dlg.Font = this.Font;
                    if (dlg.ShowDialog(this) == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        FreightGateway.UpdateLTLShipper(shipper);
                        MessageBox.Show(this, "Shipper 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; }
        }
Example #6
0
        public static bool UpdateLTLShipper(LTLShipper2 ltlShipper)
        {
            //Update an existing LTL shipper
            bool updated = false;
            LTLAdminService2Client client = new LTLAdminService2Client();

            try {
                updated = client.UpdateLTLShipperForAdmin(ltlShipper);
            }
            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);
        }
Example #7
0
        public static LTLShipper2 ReadLTLShipper(string shipperNumber)
        {
            LTLShipper2            shipper = new LTLShipper2();
            LTLAdminService2Client client  = new LTLAdminService2Client();

            try {
                shipper = client.ReadLTLShipperForAdmin(shipperNumber);
                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(shipper);
        }
Example #8
0
        public static string CreateLTLShipper(LTLShipper2 ltlShipper)
        {
            //Create a new LTL shipper
            string number = "";
            LTLAdminService2Client client = new LTLAdminService2Client();

            try {
                number = client.CreateLTLShipperForAdmin(ltlShipper);
            }
            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);
        }
Example #9
0
        public bool UpdateLTLShipper(LTLShipper2 shipper)
        {
            //Update an existing LTL shipper
            bool updated = false;

            try {
                updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_SHIPPER_UPDATE,
                                                            new object[] {
                    shipper.Number, shipper.Name, shipper.AddressLine1, shipper.AddressLine2,
                    shipper.ContactName, shipper.ContactPhone, shipper.ContactEmail,
                    shipper.WindowTimeStart, shipper.WindowTimeEnd,
                    shipper.UserID, shipper.Rowversion
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(updated);
        }
Example #10
0
        public string CreateLTLShipper(LTLShipper2 shipper)
        {
            //Create a new LTL shipper
            string number = "";

            try {
                object o = new DataService().ExecuteNonQueryWithReturn(SQL_CONNID, USP_SHIPPER_CREATE,
                                                                       new object[] {
                    0, shipper.ClientNumber,
                    shipper.Name, shipper.AddressLine1, shipper.AddressLine2, shipper.City, shipper.State, shipper.Zip, shipper.Zip4,
                    shipper.ContactName, shipper.ContactPhone, shipper.ContactEmail,
                    shipper.WindowTimeStart, shipper.WindowTimeEnd, shipper.UserID
                });
                number = (string)o;
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(number);
        }
Example #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("Address is valid.");
                }
                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.mShipper == 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)
                    {
                        LTLShipper2 shipper = new LTLShipper2();
                        shipper.ClientNumber    = Master.CurrentClient.Number;
                        shipper.Name            = this.txtName.Text;
                        shipper.AddressLine1    = this.txtAddressLine1.Text;
                        shipper.AddressLine2    = this.txtAddressLine2.Text;
                        shipper.City            = this.txtCity.Text;
                        shipper.State           = this.txtState.Text;
                        shipper.Zip             = this.txtZip5.Text;
                        shipper.Zip4            = this.txtZip4.Text;
                        shipper.WindowTimeStart = DateTime.Parse("01-01-2000 " + this.txtWindowOpen.Text);
                        shipper.WindowTimeEnd   = DateTime.Parse("01-01-2000 " + this.txtWindowClose.Text);
                        shipper.ContactName     = this.txtContactName.Text;
                        shipper.ContactPhone    = this.txtContactPhone.Text;
                        shipper.ContactEmail    = this.txtContactEmail.Text;
                        shipper.UserID          = Membership.GetUser().UserName;
                        shipper.LastUpdated     = DateTime.Now;
                        string number = new FreightGateway().CreateLTLShipper(shipper);

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

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

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