private static int GetShippersId(Guid cid, string name, string city, string state, string zip)
 {
     using (ClientsDataClassesDataContext clientdb = new ClientsDataClassesDataContext())
     {
         int id = (from a in clientdb.ClientAddresses
                   where a.Name == name
                   select a.ClientAddressesId).FirstOrDefault();
         if (id != 0)
         {
             return(id);
         }
         else if (name != null)
         {
             //create the address and return the id
             ClientAddresses address = new ClientAddresses
             {
                 ClientsId = cid,
                 Name      = name,
                 City      = city,
                 State     = state,
                 ZipCode   = zip,
                 Active    = true,
                 Type      = "Shipper"
             };
             clientdb.ClientAddresses.InsertOnSubmit(address);
             clientdb.SubmitChanges();
             return(address.ClientAddressesId);
         }
     }
     return(0);
 }
        public static String QueryGLInformation(String billOfLading)
        {
            ClientsDataClassesDataContext clientdb = new ClientsDataClassesDataContext();
            HopesDataClassesDataContext   hdb      = new HopesDataClassesDataContext();

            Hopes hope = null; //init

            hope = (from Hopes h in hdb.Hopes.ToArray <Hopes>()
                    where h.Waybill == billOfLading
                    select h).FirstOrDefault <Hopes>();

            if (hope == null)
            {
                return(String.Empty);
            }
            else
            {
                return(hope.GeneralLedgerCode);
            }
        }   // end QueryBillOfLadingInformation()