示例#1
0
        private static bool CreateReferencesDetailsRecord(int InvoicesId, string Reference1, string Reference2)
        {
            try
            {
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    ReferenceDetails details = new ReferenceDetails()
                    {
                        InvoicesId   = InvoicesId,
                        ReferenceOne = Reference1,
                        ReferenceTwo = Reference2
                    };
                    fbdb.ReferenceDetails.InsertOnSubmit(details);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateReferencesDetailsRecord {0}", InvoicesId));

                writelog(ex.Message);
                return(false);
            }
        }
示例#2
0
        private static bool CreateInvoiceDetailsRecord(int InvoicesId, string InvoiceNumber, DateTime?InvoiceDate, DateTime?DueDate)
        {
            try
            {
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    InvoiceDetails detail = new InvoiceDetails()
                    {
                        InvoicesId    = InvoicesId,
                        InvoiceNumber = InvoiceNumber,
                        InvoiceDate   = InvoiceDate,
                        DueDate       = DueDate
                    };
                    fbdb.InvoiceDetails.InsertOnSubmit(detail);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateInvoiceDetailsRecord {0}", InvoiceNumber));

                writelog(ex.Message);
                return(false);
            }
        }
示例#3
0
        private static bool CreateBillsInDisputeDReasonRecord(int InvoicesId, int BillInDisputeReasonsId, string BIDReasonOther, decimal?BIDOrgAmt, decimal?BIDSBAmt, int?BIDActualWeight)
        {
            try
            {
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    BillInDisputeDetails reason = new BillInDisputeDetails()
                    {
                        InvoicesId = InvoicesId,
                        BillsInDisputeReasonsId = BillInDisputeReasonsId,
                        Notes          = BIDReasonOther,
                        OriginalAmount = BIDOrgAmt,
                        ActualAmount   = BIDSBAmt,
                        ActualWeight   = BIDActualWeight
                    };
                    fbdb.BillInDisputeDetails.InsertOnSubmit(reason);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateBillsInDisputeDReasonRecord {0}", InvoicesId));

                writelog(ex.Message);
                return(false);
            }
        }
示例#4
0
        private static bool CreateInvoice_FreightClassesRecord(int InvoicesId, int FreightClassId, int?Actual_Weight, int?Bill_Weight, double?Piece)
        {
            try
            {
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    if (Actual_Weight == null)
                    {
                        Actual_Weight = 0;
                    }
                    if (Bill_Weight == null)
                    {
                        Bill_Weight = 0;
                    }
                    FreightClassesDetails fclass = new FreightClassesDetails()
                    {
                        InvoicesId     = InvoicesId,
                        FreightClassId = FreightClassId,
                        Weight         = (int)Actual_Weight,
                        BilledWeight   = Bill_Weight
                    };
                    fbdb.FreightClassesDetails.InsertOnSubmit(fclass);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateInvoice_FreightClassesRecord {0}", InvoicesId));

                writelog(ex.Message);
                return(false);
            }
        }
示例#5
0
        private static bool CreateProTansNoteDetailsRecord(int InvoicesId, int ProTransNoteId, string PRO_Transaction_Note)
        {
            try
            {
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    ProTransNoteDetails detail = new ProTransNoteDetails()
                    {
                        InvoicesId      = InvoicesId,
                        ProTransNotesId = ProTransNoteId,
                        Notes           = PRO_Transaction_Note
                    };
                    fbdb.ProTransNoteDetails.InsertOnSubmit(detail);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateProTansNoteDetailsRecord {0}", InvoicesId));

                writelog(ex.Message);
                return(false);
            }
        }
示例#6
0
        private static bool CheckForDupePro(String ProNum)
        {
            try
            {
                //current system does not contain the accessorial code - so we cannot save it
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    var pro = from p in fbdb.Invoices
                              where p.ProNumber == ProNum
                              select p.ProNumber;
                    if (pro.Count() > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateAccessorialRecord {0}", ProNum));

                writelog(ex.Message);
                return(true);
            }
        }
示例#7
0
        }   // end QueryBillOfLadingInformation()

        private static bool CreateAccessorialRecord(int id, decimal?total)
        {
            try
            {
                //current system does not contain the accessorial code - so we cannot save it
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    AccessorialsDetails acc = new AccessorialsDetails()
                    {
                        InvoicesId        = id,
                        AccessorialCharge = Convert.ToDecimal(total)
                    };
                    fbdb.AccessorialsDetails.InsertOnSubmit(acc);
                    fbdb.SubmitChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! CreateAccessorialRecord {0}", id));

                writelog(ex.Message);
                return(false);
            }
        }
示例#8
0
 private static int GetCarrierSCACsId(string code)
 {
     using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
     {
         int scac = (from s in fbdb.CarrierSCACs
                     where s.Code == code
                     select s.CarrierSCACsId).FirstOrDefault();
         return(scac);
     }
 }
示例#9
0
 private static int GetInvoiceStatusesId(string code)
 {
     using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
     {
         int id = (from c in fbdb.InvoiceStatuses
                   where c.Code == code
                   select c.InvoiceStatusesId).FirstOrDefault();
         return(id);
     }
 }
示例#10
0
 private static int GetBillInDisputeReasonsId(string reason)
 {
     using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
     {
         int id = (from r in fbdb.BillInDisputeReasons
                   where r.Reason == reason
                   select r.ReasonsId).FirstOrDefault();
         return(id);
     }
 }
示例#11
0
 private static int GetLoadCodeId(string code)
 {
     //if (code == "L")
     //    code = "LTL";
     using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
     {
         int id = (from l in fbdb.Loads
                   where l.Code == code
                   select l.LoadsId).FirstOrDefault();
         return(id);
     }
 }
示例#12
0
        private static int GetPaymentTypeId(string type)
        {
            //get the CW type from the translations table
            UPSCodeDataClassesDataContext upsdb = new UPSCodeDataClassesDataContext();
            var Ptype = (from p in upsdb.UPSCodeTranslations
                         where p.UPSCode == type
                         select p.CWPaymentType).SingleOrDefault();

            using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
            {
                int id = (from t in fbdb.PaymentTypes
                          where t.Type == Ptype
                          select t.PaymentTypesId).FirstOrDefault();
                return(id);
            }
        }
示例#13
0
 private static int GetFreightClassId(double?code)
 {
     using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
     {
         int id = (from c in fbdb.FreightClasses
                   where c.Number == code
                   select c.FreightClassId).FirstOrDefault();
         if (id != 0)
         {
             return(id);
         }
         else
         {
             return(0);
         }
     }
 }
示例#14
0
        private static int GetProTransNoteId(string note)
        {
            int    index        = 0;
            string searchstring = String.Empty;

            try
            {
                index = note.IndexOf("~");
                if (index < 1)
                {
                    index = note.IndexOf("ATTACHED") + 7;
                }
                if (index > 0)
                {
                    searchstring = note.Substring(0, index);
                }
                else
                {
                    searchstring = note;
                }
                using (FreightBillDataClassesDataContext fbdb = new FreightBillDataClassesDataContext())
                {
                    int id = (from n in fbdb.ProTransNotes
                              where n.Note.Contains(searchstring)
                              select n.ProTransNoteId).FirstOrDefault();
                    return(id);
                }
            }
            catch (Exception ex)
            {
                writelog(String.Format("error! GetProTransNoteId {0}", ex.Message));

                writelog(ex.Message);
                return(0);
            }
        }