コード例 #1
0
        //[PrincipalPermission(SecurityAction.Demand,Role = "Billing Supervisor")]
        public bool ApproveLTLClient(int clientID, string clientNumber, bool approve, string username)
        {
            //Approve a new LTL client
            bool approved = false;

            try {
                //Apply simple business rules

                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                using (TransactionScope scope = new TransactionScope()) {
                    //
                    approved = new LTLGateway().ApproveLTLClient(clientID, clientNumber, approve, username);

                    //Send email notification to customer
                    LTLClient client   = ReadLTLClient(clientID);
                    LTLClient salesRep = null;
                    if (client.SalesRepClientID > 0)
                    {
                        salesRep = ReadLTLClient(client.SalesRepClientID);
                    }
                    new NotifyService().NotifyClientApproval(client, approve, salesRep);

                    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                    scope.Complete();
                }
            }
            catch (FaultException <LTLFault> lfe) { throw new FaultException <LTLFault>(new LTLFault(lfe.Detail.Message), "Internal Error"); }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(approved);
        }
コード例 #2
0
 public void NotifyShipmentCreated(LTLClient client, LTLShipper shipper, LTLConsignee consignee, LTLShipment shipment, int shipmentID, LTLClient salesRep)
 {
     try {
         //Send conformation email
         if (client.ContactEmail.Trim().Length > 0)
         {
             string body = getHTMLBody(System.Web.Hosting.HostingEnvironment.MapPath(HTML_SHIPMENT_CREATED));
             body = body.Replace("*shipmentNumber*", shipmentID.ToString());
             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 Booked", true, body);
             if (salesRep != null)
             {
                 new Argix.Enterprise.SMTPGateway().SendMailMessage(this.mEmailAdmin, salesRep.ContactEmail, "Shipment Booked", true, body);
             }
         }
     }
     catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
 }
コード例 #3
0
 public void NotifyClientApproval(LTLClient client, bool approved, LTLClient 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); }
 }
コード例 #4
0
ファイル: FreightGateway.cs プロジェクト: jpheary/Argix10
        public int CreateLTLClient(LTLClient ltlClient)
        {
            //Create a new LTL client
            int clientID = 0;
            LTLClientServiceClient client = new LTLClientServiceClient();

            try {
                clientID = client.CreateLTLClient(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);
        }
コード例 #5
0
ファイル: FreightGateway.cs プロジェクト: jpheary/Argix10
        public bool UpdateLTLClient(LTLClient ltlClient)
        {
            //Update an existing LTL client
            bool updated = false;
            LTLClientServiceClient client = new LTLClientServiceClient();

            try {
                updated = client.UpdateLTLClient(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);
        }
コード例 #6
0
ファイル: FreightGateway.cs プロジェクト: jpheary/Argix10
        public LTLClient ReadLTLClient(int clientID)
        {
            LTLClient ltlClient           = new LTLClient();
            LTLClientServiceClient client = new LTLClientServiceClient();

            try {
                ltlClient = client.ReadLTLClient(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);
        }
コード例 #7
0
        public LTLClient ReadLTLClient(int clientID)
        {
            LTLClient client = new LTLClient();

            try {
                DataSet ds = new LTLGateway().ReadLTLClient(clientID);
                if (ds != null && ds.Tables["LTLClientTable"] != null && ds.Tables["LTLClientTable"].Rows.Count > 0)
                {
                    DataRow _client = ds.Tables["LTLClientTable"].Rows[0];
                    client                       = new LTLClient();
                    client.ID                    = int.Parse(_client["ID"].ToString());
                    client.Number                = _client["Number"].ToString();
                    client.Name                  = _client["Name"].ToString();
                    client.AddressLine1          = _client["AddressLine1"].ToString();
                    client.AddressLine2          = _client["AddressLine2"].ToString();
                    client.City                  = _client["City"].ToString();
                    client.State                 = _client["State"].ToString();
                    client.Zip                   = _client["Zip"].ToString();
                    client.Zip4                  = _client["Zip4"].ToString();
                    client.ContactName           = _client["ContactName"].ToString();
                    client.ContactPhone          = _client["ContactPhone"].ToString();
                    client.ContactEmail          = _client["ContactEmail"].ToString();
                    client.CorporateName         = _client["CorporateName"].ToString();
                    client.CorporateAddressLine1 = _client["CorporateAddressLine1"].ToString();
                    client.CorporateAddressLine2 = _client["CorporateAddressLine2"].ToString();
                    client.CorporateCity         = _client["CorporateCity"].ToString();
                    client.CorporateState        = _client["CorporateState"].ToString();
                    client.CorporateZip          = _client["CorporateZip"].ToString();
                    client.CorporateZip4         = _client["CorporateZip4"].ToString();
                    client.TaxIDNumber           = _client["TaxIDNumber"].ToString();
                    client.BillingAddressLine1   = _client["BillingAddressLine1"].ToString();
                    client.BillingAddressLine2   = _client["BillingAddressLine2"].ToString();
                    client.BillingCity           = _client["BillingCity"].ToString();
                    client.BillingState          = _client["BillingState"].ToString();
                    client.BillingZip            = _client["BillingZip"].ToString();
                    client.BillingZip4           = _client["BillingZip4"].ToString();
                    client.Approved              = !_client.IsNull("Approved") ? bool.Parse(_client["Approved"].ToString()) : false;
                    client.ApprovedDate          = !_client.IsNull("ApprovedDate") ? DateTime.Parse(_client["ApprovedDate"].ToString()) : DateTime.MinValue;
                    client.ApprovedUser          = !_client.IsNull("ApprovedUser") ? _client["ApprovedDate"].ToString() : "";
                    client.Status                = _client["Status"].ToString();
                    client.LastUpdated           = DateTime.Parse(_client["LastUpdated"].ToString());
                    client.UserID                = _client["UserID"].ToString();
                    client.SalesRepClientID      = !_client.IsNull("SalesRepClientID") ? int.Parse(_client["SalesRepClientID"].ToString()) : 0;
                }
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(client);
        }
コード例 #8
0
ファイル: LTLGateway.cs プロジェクト: jpheary/Argix10
        public bool UpdateLTLClient(LTLClient client)
        {
            //Update an existing LTL client
            bool updated = false;

            try {
                string usp = this.mUseDispatchClient ? USP_DISPATCHCLIENT_UPDATE : USP_CLIENT_UPDATE;
                updated = new DataService().ExecuteNonQuery(SQL_CONNID, usp,
                                                            new object[] {
                    client.ID,
                    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.TaxIDNumber,
                    client.BillingAddressLine1, client.BillingAddressLine2, client.BillingCity, client.BillingState, client.BillingZip, client.BillingZip4,
                    client.LastUpdated, client.UserID
                });
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(updated);
        }
コード例 #9
0
        public bool UpdateLTLClient(LTLClient client)
        {
            //Update an existing LTL client
            bool updated = false;

            try {
                //Apply simple business rules

                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                using (TransactionScope scope = new TransactionScope()) {
                    //
                    updated = new LTLGateway().UpdateLTLClient(client);

                    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(updated);
        }
コード例 #10
0
 public void NotifyClientCreated(LTLClient 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); }
 }
コード例 #11
0
ファイル: LTLGateway.cs プロジェクト: jpheary/Argix10
        public int CreateLTLClient(LTLClient client)
        {
            //Create a new LTL client
            int id = 0;

            try {
                string usp = this.mUseDispatchClient ? USP_DISPATCHCLIENT_CREATE : USP_CLIENT_CREATE;
                object o   = new DataService().ExecuteNonQueryWithReturn(SQL_CONNID, usp,
                                                                         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.TaxIDNumber,
                    client.BillingAddressLine1, client.BillingAddressLine2, client.BillingCity, client.BillingState, client.BillingZip, client.BillingZip4,
                    (client.SalesRepClientID > 0?client.SalesRepClientID:null as object), client.Status, client.LastUpdated, client.UserID
                });
                id = (int)o;
            }
            catch (Exception ex) { throw new ApplicationException(ex.Message, ex); }
            return(id);
        }
コード例 #12
0
ファイル: NotifyService.cs プロジェクト: jpheary/Argix10
 public void NotifyWelcome(string userName, string email, string password, LTLClient 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); }
 }
コード例 #13
0
        public int CreateLTLClient(LTLClient client)
        {
            //Add a new LTL client
            int id = 0;

            try {
                //Apply simple business rules

                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                using (TransactionScope scope = new TransactionScope()) {
                    //
                    id = new LTLGateway().CreateLTLClient(client);

                    //Send email notification to Finance
                    client.ID = id;
                    new NotifyService().NotifyClientCreated(client);

                    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(id);
        }
コード例 #14
0
        public int CreateLTLShipment(LTLShipment shipment)
        {
            //Add a new LTL shipment
            int shipmentID = 0;

            try {
                //Apply simple business rules

                //Create the TransactionScope to execute the commands, guaranteeing that both commands can commit or roll back as a single unit of work
                using (TransactionScope scope = new TransactionScope()) {
                    //Create the shipment
                    LTLGateway gateway = new LTLGateway();
                    shipmentID  = gateway.CreateLTLShipment(shipment);
                    shipment.ID = shipmentID;

                    //Create the pallets
                    LTLPallet pallet = new LTLPallet();
                    pallet.ShipmentID = shipmentID;
                    if (shipment.Pallet1Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet1Weight; pallet.InsuranceValue = shipment.Pallet1InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet2Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet2Weight; pallet.InsuranceValue = shipment.Pallet2InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet3Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet3Weight; pallet.InsuranceValue = shipment.Pallet3InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet4Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet4Weight; pallet.InsuranceValue = shipment.Pallet4InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }
                    if (shipment.Pallet5Weight > 0)
                    {
                        pallet.Weight = shipment.Pallet5Weight; pallet.InsuranceValue = shipment.Pallet5InsuranceValue; gateway.CreateLTLPallet(pallet);
                    }

                    //Schedule pickup request
                    LTLClient    client    = ReadLTLClient(shipment.ClientID);
                    LTLShipper   shipper   = ReadLTLShipper(shipment.ShipperID);
                    LTLConsignee consignee = ReadLTLConsignee(shipment.ConsigneeID);
                    //bool useBizTalk = bool.Parse(WebConfigurationManager.AppSettings["UseBizTalk"].ToString());
                    //if (useBizTalk) {
                    //    Argix.BizTalk.LTLShipment _shipment = new BizTalk.LTLShipment();
                    //    _shipment.ID = shipmentID;
                    //    _shipment.Created = shipment.Created;
                    //    _shipment.ShipDate = shipment.ShipDate;
                    //    _shipment.ShipmentNumber = shipment.ShipmentNumber;
                    //    _shipment.ClientID = shipment.ClientID;
                    //    _shipment.ClientNumber = client.Number;
                    //    _shipment.ClientName = client.Name;
                    //    _shipment.ShipperNumber = "";
                    //    _shipment.ShipperName = shipper.Name;
                    //    _shipment.ShipperAddress = shipper.AddressLine1 + "\n" + shipper.City + ", " + shipper.State + " " + shipper.Zip;
                    //    _shipment.ShipperContactName = shipper.ContactName;
                    //    _shipment.ShipperContactPhone = shipper.ContactPhone;
                    //    _shipment.ShipperWindowStartTime = shipper.WindowStartTime;
                    //    _shipment.ShipperWindowEndTime = shipper.WindowEndTime;
                    //    _shipment.ConsigneeID = shipment.ConsigneeID;
                    //    _shipment.Pallets = shipment.Pallets;
                    //    _shipment.Weight = int.Parse(shipment.Weight.ToString());
                    //    _shipment.PalletRate = shipment.PalletRate;
                    //    _shipment.FuelSurcharge = shipment.FuelSurcharge;
                    //    _shipment.AccessorialCharge = shipment.AccessorialCharge;
                    //    _shipment.InsuranceCharge = shipment.InsuranceCharge;
                    //    _shipment.TollCharge = shipment.TollCharge;
                    //    _shipment.TotalCharge = shipment.TotalCharge;
                    //    _shipment.LastUpdated = shipment.LastUpdated;
                    //    _shipment.UserID = shipment.UserID;
                    //    new Argix.BizTalk.BizTalkGateway().ScheduleLTLPickup(_shipment);
                    //}
                    //else {
                    //Direct to Pickup Log
                    PickupRequest request = new PickupRequest();
                    request.RequestID      = 0;
                    request.ScheduleDate   = shipment.ShipDate;
                    request.CallerName     = "Online";
                    request.ClientNumber   = client.Number;
                    request.Client         = client.Name;
                    request.ShipperNumber  = "";
                    request.Shipper        = shipper.Name;
                    request.ShipperAddress = shipper.AddressLine1 + "\n" + shipper.City + ", " + shipper.State + " " + shipper.Zip;
                    request.ShipperPhone   = shipper.ContactPhone;
                    request.WindowOpen     = shipper.WindowStartTime.CompareTo(DateTime.MinValue) > 0 ? int.Parse(shipper.WindowStartTime.ToString("HHmm")) : 0;
                    request.WindowClose    = shipper.WindowEndTime.CompareTo(DateTime.MinValue) > 0 ? int.Parse(shipper.WindowEndTime.ToString("HHmm")) : 0;
                    request.Amount         = shipment.Pallets;
                    request.AmountType     = "Pallets";
                    request.FreightType    = "Tsort";
                    request.OrderType      = "B";
                    request.Weight         = int.Parse(shipment.Weight.ToString());
                    request.Comments       = "";
                    request.IsTemplate     = false;
                    request.Created        = DateTime.Now;
                    request.CreateUserID   = "PSP";
                    request.TerminalNumber = "";
                    request.Terminal       = "";
                    request.LastUpdated    = shipment.LastUpdated;
                    request.UserID         = shipment.UserID;
                    int pickupID = new DispatchGateway().InsertPickupRequest3(request);

                    //Update shipment with PickupID
                    shipment.PickupID = pickupID;
                    new LTLGateway().DispatchLTLShipment(shipment);
                    //}

                    //Send email notification to customer
                    ServiceLocation location = ReadPickupLocation(shipper.Zip);
                    LTLClient       salesRep = null;
                    if (client.SalesRepClientID > 0)
                    {
                        salesRep = ReadLTLClient(client.SalesRepClientID);
                    }
                    new NotifyService().NotifyShipmentCreated(client, shipper, consignee, shipment, shipmentID, salesRep);

                    //Commits the transaction; if an exception is thrown, Complete is not called and the transaction is rolled back
                    scope.Complete();
                }
            }
            catch (Exception ex) { throw new FaultException <LTLFault>(new LTLFault(ex.Message), "Service Error"); }
            return(shipmentID);
        }