Ejemplo n.º 1
0
        public OnTheSpot.Models.InterogatorInfo getInfoForInterogator(OnTheSpot.Models.AutoSortInfo customerstuff)
        {
            double heatseal = double.Parse(customerstuff.HeatSeal);

            OnTheSpot.Models.InterogatorInfo info = (from cust in dbOTS.Customers
                                                     where cust.CustomerID == customerstuff.CustomerID
                                                     from heat in dbOTS.Heatseals
                                                     where heat.HeatsealID == heatseal
                                                     select new OnTheSpot.Models.InterogatorInfo()
            {
                HomePhone = cust.HomePhone, Email = cust.EMail, InvoiceReminder = cust.InvReminder,
                LastOrder = cust.LastOrder, Notes = cust.Notes, OpenDate = cust.OpenDate, HeatSealMessage = heat.Message
            }).SingleOrDefault();

            List <OnTheSpot.EFStuff.Contacts> contacts = (from contact in dbOTS.Contacts
                                                          where contact.CustomerID == customerstuff.CustomerID
                                                          select contact).ToList();

            info.CustomerID      = customerstuff.CustomerID.ToString();
            info.OpenDateString  = info.OpenDate.Value.ToShortDateString();
            info.LastOrderString = info.LastOrder.Value.ToShortDateString();
            info.issues          = new List <string>();
            info.resolutions     = new List <string>();
            foreach (OnTheSpot.EFStuff.Contacts contact  in contacts)
            {
                info.issues.Add(contact.Issue);
                info.resolutions.Add(contact.Resolution);
            }
            info.currentIssue      = info.issues[0];
            info.currentResolution = info.resolutions[0];
            return(info);
        }
Ejemplo n.º 2
0
        //we used the barcode to get the cutomer info from assembly database as it knows which store the
        //info we need is
        public OnTheSpot.Models.InterogatorInfo getInfoForInterogator(OnTheSpot.Models.AutoSortInfo customerstuff)
        {
            double heatseal = double.Parse(customerstuff.HeatSeal);

            string storeconnectionstring = connectionNames[customerstuff.storeid - 1];
            //retrieve the connection string from app.config
            ConnectionStringSettingsCollection connections = ConfigurationManager.ConnectionStrings;

            StoreContext db = new StoreContext(connections[storeconnectionstring].ConnectionString);

            OnTheSpot.Models.InterogatorInfo info = (from cust in db.Customers
                                                     where cust.CustomerID == customerstuff.CustomerID
                                                     from heat in db.Heatseals
                                                     where heat.HeatsealID == heatseal
                                                     select new OnTheSpot.Models.InterogatorInfo()
            {
                HomePhone = cust.HomePhone, Email = cust.EMail, InvoiceReminder = cust.InvReminder,
                LastOrder = cust.LastOrder, Notes = cust.Notes, OpenDate = cust.OpenDate, HeatSealMessage = heat.Message
            }).SingleOrDefault();

            if (info == null)
            {
                return(null);
            }
            List <Contact> contacts = (from contact in dbStore.Contacts
                                       where contact.CustomerID == customerstuff.CustomerID
                                       select contact).ToList();

            info.CustomerID      = customerstuff.CustomerID.ToString();
            info.OpenDateString  = info.OpenDate.Value.ToShortDateString();
            info.LastOrderString = info.LastOrder.Value.ToShortDateString();
            info.issues          = new List <string>();
            info.resolutions     = new List <string>();
            foreach (Contact contact  in contacts)
            {
                info.issues.Add(contact.Issue);
                info.resolutions.Add(contact.Resolution);
            }
            if (info.issues.Count > 0)
            {
                info.currentIssue = info.issues[0];
            }
            if (info.resolutions.Count > 0)
            {
                info.currentResolution = info.resolutions[0];
            }
            return(info);
        }