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); } }
public void NotifyClientApproval2(LTLClient2 client, bool approved, LTLClient2 salesRep) { try { //Send conformation email if (client.ContactEmail.Trim().Length > 0) { string title = approved ? "Client Status Approved" : "Client Status Declined"; string status = approved ? "APPROVED" : "DECLINED"; string body = getHTMLBody(System.Web.Hosting.HostingEnvironment.MapPath(HTML_CLIENT_APPROVAL)); body = body.Replace("*clientID*", client.ID.ToString()); body = body.Replace("*Status*", status); body = body.Replace("txtCompanyName", client.Name); body = body.Replace("txtCompanyStreet", client.AddressLine1); body = body.Replace("txtCompanyCity", client.City); body = body.Replace("txtCompanyState", client.State); body = body.Replace("txtCompanyZip", client.Zip); body = body.Replace("txtContactName", client.ContactName); body = body.Replace("txtContactPhone", client.ContactPhone); body = body.Replace("txtContactEmail", client.ContactEmail); new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, client.ContactEmail, title, true, body); if (salesRep != null) { new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, salesRep.ContactEmail, title, true, body); } } } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } }
private void OnItemClick(object sender, System.EventArgs e) { //Menu services int id = 0; LTLClient2 client = null; dlgLTLClient dlg = null; try { ToolStripItem menu = (ToolStripItem)sender; switch (menu.Name) { case "csNew": client = new LTLClient2(); dlg = new dlgLTLClient(client); dlg.Font = this.Font; if (dlg.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; id = FreightGateway.CreateLTLClient(client); MessageBox.Show(this, "New client created.", App.Product, MessageBoxButtons.OK); Refresh(); } break; case "csOpen": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; client = FreightGateway.ReadLTLClient(id); dlg = new dlgLTLClient(client); dlg.Font = this.Font; if (dlg.ShowDialog(this) == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; FreightGateway.UpdateLTLClient(client); MessageBox.Show(this, "Client updated.", App.Product, MessageBoxButtons.OK); Refresh(); } break; case "csRefresh": this.Cursor = Cursors.WaitCursor; Refresh(); break; case "csApprove": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; FreightGateway.ApproveLTLClient(id, true); Refresh(); break; case "csDeny": id = (int)this.grdClients.Selected.Rows[0].Cells["ID"].Value; FreightGateway.ApproveLTLClient(id, false); Refresh(); break; } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
//Interface public dlgLTLClient(LTLClient2 client) { //Constructor try { InitializeComponent(); this.mClient = client; if (this.mClient == null) { throw new ApplicationException("Client cannot be null."); } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } }
public static bool UpdateLTLClient(LTLClient2 ltlClient) { //Update an existing LTL client bool updated = false; LTLAdminService2Client client = new LTLAdminService2Client(); try { updated = client.UpdateLTLClientForAdmin(ltlClient); } 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); }
public static LTLClient2 ReadLTLClient(int clientID) { LTLClient2 ltlClient = null; LTLAdminService2Client client = new LTLAdminService2Client(); try { ltlClient = client.ReadLTLClientForAdmin(clientID); 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(ltlClient); }
public static int CreateLTLClient(LTLClient2 ltlClient) { //Create a new LTL client int clientID = 0; LTLAdminService2Client client = new LTLAdminService2Client(); try { clientID = client.CreateLTLClientForAdmin(ltlClient); } 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(clientID); }
public LTLClient2 ReadLTLClientByNumber(string clientNumber) { LTLClient2 ltlClient = new LTLClient2(); LTLClientService2Client client = new LTLClientService2Client(); try { ltlClient = client.ReadLTLClientByNumber(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(ltlClient); }
public bool UpdateLTLClient(LTLClient2 client) { //Update an existing LTL client bool updated = false; try { updated = new DataService().ExecuteNonQuery(SQL_CONNID, USP_CLIENT_UPDATE, new object[] { client.ID, client.Name, client.AddressLine1, client.AddressLine2, client.City, client.State, client.Zip, client.Zip4, client.ContactName, client.ContactPhone, client.ContactEmail, client.CorporateName, client.CorporateAddressLine1, client.CorporateAddressLine2, client.CorporateCity, client.CorporateState, client.CorporateZip, client.CorporateZip4, client.TaxID, client.UserID, (client.SalesRepClientNumber != null && client.SalesRepClientNumber.Trim().Length > 0?client.SalesRepClientNumber:null) }); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(updated); }
public void NotifyClientCreated2(LTLClient2 client) { try { //Notify finance string title = "New Pallet Shipment Client"; string body = getHTMLBody(System.Web.Hosting.HostingEnvironment.MapPath(HTML_CLIENT_CREATED)); body = body.Replace("*clientID*", client.ID.ToString()); body = body.Replace("*Status*", "NEW"); body = body.Replace("txtCompanyName", client.Name); body = body.Replace("txtCompanyStreet", client.AddressLine1); body = body.Replace("txtCompanyCity", client.City); body = body.Replace("txtCompanyState", client.State); body = body.Replace("txtCompanyZip", client.Zip); body = body.Replace("txtContactName", client.ContactName); body = body.Replace("txtContactPhone", client.ContactPhone); body = body.Replace("txtContactEmail", client.ContactEmail); new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, this.mEmailFinance, title, true, body); } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } }
public int CreateLTLClient(LTLClient2 client) { //Create a new LTL client int id = 0; try { object o = new DataService().ExecuteNonQueryWithReturn(SQL_CONNID, USP_CLIENT_CREATE, new object[] { 0, client.Name, client.AddressLine1, client.AddressLine2, client.City, client.State, client.Zip, client.Zip4, client.ContactName, client.ContactPhone, client.ContactEmail, client.CorporateName, client.CorporateAddressLine1, client.CorporateAddressLine2, client.CorporateCity, client.CorporateState, client.CorporateZip, client.CorporateZip4, client.TaxID, client.BillingAddressLine1, client.BillingAddressLine2, client.BillingCity, client.BillingState, client.BillingZip, client.BillingZip4, (client.SalesRepClientNumber != null && client.SalesRepClientNumber.Trim().Length > 0?client.SalesRepClientNumber:null) }); id = (int)o; } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(id); }
public void NotifyWelcome(string userName, string email, string password, LTLClient2 client) { try { //Notify welcome if (email.Trim().Length > 0) { string body = getHTMLBody(System.Web.Hosting.HostingEnvironment.MapPath(HTML_WELCOME)); body = body.Replace("txtUserName", userName); body = body.Replace("txtPassword", password); body = body.Replace("txtCompanyName", client.Name); body = body.Replace("txtCompanyStreet", client.AddressLine1); body = body.Replace("txtCompanyCity", client.City); body = body.Replace("txtCompanyState", client.State); body = body.Replace("txtCompanyZip", client.Zip); body = body.Replace("txtContactName", client.ContactName); body = body.Replace("txtContactPhone", client.ContactPhone); body = body.Replace("txtContactEmail", client.ContactEmail); new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, email, "Pallet Shipment Customer Enrollment", true, body); } } catch (Exception ex) { throw new ApplicationException(ex.Message); } }
protected void OnSubmit(object sender, EventArgs e) { // if (!Page.IsValid) { return; } try { //Validate ApplicationException aex = null; //if (this.txtTaxIDNumber.Text.Length != 10) aex = new ApplicationException("Please enter a valid federal taxID number of the form xx-xxxxxxx."); if (aex == null) { //Set all objects before creating anything LTLClient2 client = new LTLClient2(); client.Name = this.txtCompanyName.Text; client.AddressLine1 = this.txtCompanyStreet.Text; client.AddressLine2 = ""; client.City = this.txtCompanyCity.Text; client.State = this.txtCompanyState.Text; client.Zip = this.txtCompanyZip.Text; client.Zip4 = ""; client.ContactName = this.txtContactName.Text; client.ContactPhone = this.txtContactPhone.Text; client.ContactEmail = this.txtContactEmail.Text; client.CorporateName = this.txtCorporateName.Text; client.CorporateAddressLine1 = this.txtCorporateStreet.Text; client.CorporateAddressLine2 = ""; client.CorporateCity = this.txtCorporateCity.Text; client.CorporateState = this.txtCorporateState.Text; client.CorporateZip = this.txtCorporateZip.Text; client.CorporateZip4 = ""; client.TaxID = ""; client.BillingAddressLine1 = this.txtBillingStreet.Text; client.BillingAddressLine2 = ""; client.BillingCity = this.txtBillingCity.Text; client.BillingState = this.txtBillingState.Text; client.BillingZip = this.txtBillingZip.Text; client.BillingZip4 = ""; //TODO: client.Approved = false; client.UserID = this.txtUserName.Text; client.LastUpdated = DateTime.Today; //Is this created by a salesRep? Then set sales rep reference on new client if (Master.SalesRep != null) { client.SalesRepClientNumber = Master.SalesRep.Number; } //Create a new membership account MembershipCreateStatus status = MembershipCreateStatus.Success; Membership.CreateUser(this.txtUserName.Text, this.txtPassword.Text, this.txtContactEmail.Text, null, null, true, out status); switch (status) { case MembershipCreateStatus.Success: //Add user to the client role Roles.AddUserToRole(this.txtUserName.Text, "client"); //If this fails rollback the new login try { //Create the client int clientID = new FreightGateway().CreateLTLClient(client); client.ID = clientID; //Add the ID for enrolling shippers, consignees, etc //Create user profile and set properties value ProfileCommon profile = Profile.GetProfile(this.txtUserName.Text); profile.ClientID = clientID.ToString(); profile.Save(); //Send welcome message to new client and sales rep (if a sales rep created this enrollment) new NotifyService().NotifyWelcome(this.txtUserName.Text, this.txtContactEmail.Text, this.txtPassword.Text, client); if (Master.SalesRep != null) { new NotifyService().NotifyWelcome(this.txtUserName.Text, Master.SalesRep.ContactEmail, this.txtPassword.Text, client); } //Update client list if there is one (admin or sales rep) if (Master.Clients != null) { if (new MembershipServices().IsAdmin) { Session["clients"] = new FreightGateway().GetLTLClientList(""); } else if (new MembershipServices().IsSalesRep) { Session["clients"] = new FreightGateway().GetLTLClientList(Master.Client.Number); } } //Go to pickup log Response.Redirect("~/Client/Shipments.aspx", false); } catch (Exception ex) { Membership.DeleteUser(this.txtUserName.Text); Master.ReportError(ex, 4); } break; case MembershipCreateStatus.DuplicateUserName: Master.ReportError(new ApplicationException("This login username already exists."), 3); break; case MembershipCreateStatus.InvalidPassword: Master.ReportError(new ApplicationException("Password should be minimum 6 characters long."), 3); break; case MembershipCreateStatus.UserRejected: break; } } else { Master.ReportError(aex, 3); } } catch (Exception ex) { Master.ReportError(ex, 4); } }
protected void OnManageCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "AccountUpdate": ApplicationException aex = null; //if (this.txtTaxID.Text.Length != 10) aex = new ApplicationException("Please enter a valid federal taxID number of the form xx-xxxxxxx."); if (aex == null) { //Get the current client email and id string oldEmail = Master.CurrentClient.ContactEmail; //Update the current client LTLClient2 client = new LTLClient2(); client.ID = Master.CurrentClient.ID; // int.Parse(this.lblID.Text); client.Name = this.txtCompanyName.Text; client.AddressLine1 = this.txtCompanyStreet.Text; client.AddressLine2 = ""; client.City = this.txtCompanyCity.Text; client.State = this.txtCompanyState.Text; client.Zip = this.txtCompanyZip.Text; client.Zip4 = ""; client.ContactName = this.txtContactName.Text; client.ContactPhone = this.txtContactPhone.Text; client.ContactEmail = this.txtContactEmail.Text; client.CorporateName = this.txtCorporateName.Text; client.CorporateAddressLine1 = this.txtCorporateStreet.Text; client.CorporateAddressLine2 = ""; client.CorporateCity = this.txtCorporateCity.Text; client.CorporateState = this.txtCorporateState.Text; client.CorporateZip = this.txtCorporateZip.Text; client.CorporateZip4 = ""; client.TaxID = this.txtTaxID.Text; client.BillingAddressLine1 = this.txtBillingStreet.Text; client.BillingAddressLine2 = ""; client.BillingCity = this.txtBillingCity.Text; client.BillingState = this.txtBillingState.Text; client.BillingZip = this.txtBillingZip.Text; client.BillingZip4 = ""; client.UserID = Master.User.UserName; client.LastUpdated = DateTime.Now; //if(Master.SalesRep != null) client.SalesRepClientID = Master.SalesRep.ID; bool updated = new FreightGateway().UpdateLTLClient(client); //Update Membership account email MembershipUserCollection members = Membership.FindUsersByEmail(oldEmail); foreach (MembershipUser member in members) { ProfileCommon profile = Profile.GetProfile(member.UserName); //if (profile.ClientID == this.lblID.Text && member.Email == oldEmail) { if (profile.ClientID == Master.CurrentClient.ID.ToString() && member.Email == oldEmail) { member.Email = this.txtContactEmail.Text; //member.ChangePassword(oldEmail,this.txtContactEmail.Text); Membership.UpdateUser(member); break; } } //Update Master.CurentClient Master.OnCurrentClientChanged(null, EventArgs.Empty); //Confirmation Master.ShowMessageBox("Client " + client.Name + " has been updated."); } else { Master.ReportError(aex, 3); } break; case "ShipperNew": Response.Redirect("~/Client/Shipper.aspx?number=", false); break; case "ShipperUpdate": Response.Redirect("~/Client/Shipper.aspx?number=" + this.grdShippers.SelectedDataKey.Value.ToString(), false); break; case "ConsigneeNew": Response.Redirect("~/Client/Consignee.aspx?number=", false); break; case "ConsigneeUpdate": Response.Redirect("~/Client/Consignee.aspx?number=" + this.grdConsignees.SelectedDataKey.Value.ToString(), false); break; } } catch (Exception ex) { Master.ReportError(ex, 4); } }