Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();
            toolStripStatusLabel4.Text = "Klar";
            baseDB = new inventoryBaseEntities();
            _appCore = new AppCore();
            _appServiceExcel = new AppService_ExcelImport();
            _appCore.OnUpdateStatus += new AppCore.StatusUpdateHandler(ShowLoadDBUpdate);
            _appServiceExcel.OnUpdateStatus += new AppService_ExcelImport.StatusUpdateHandler(ShowLoadExcelUpdate);
            _appEventlog = new AppEventLogger();

            tabControl1.SelectedIndex = 1;

            try
            {
                baseDB.Database.Connection.Open();
            }
            catch (Exception ex)
            {
                _appEventlog.writeError(ex.Message, ex.StackTrace);
                MessageBox.Show("Fejl i forbindelse til databasen! Se eventuelt eventlog", "Fejl", MessageBoxButtons.OK);
                System.Threading.Thread.Sleep(2000);
                EndApplication();
            }

            //Preloading suppliers and productCatalog to Dictonaries in _appCore
            _appCore.preloadSuppliers();
            _appCore.preloadProducCatalog();
        }
Beispiel #2
0
 public object findProductByNumber(string barCodeIn)
 {
     object oProduct = null;
     using (inventoryBaseEntities ivb = new inventoryBaseEntities())
     {
         try
         {
             var query = (from q in ivb.activeInventory
                          where q.serialNo.Equals(barCodeIn)
                          select q).FirstOrDefault();
             oProduct = query;
         }
         catch (Exception ex)
         {
             AppEventLogger log = new AppEventLogger();
             log.writeError(ex.Message, ex.StackTrace);
         }
         finally
         {
             ivb.Dispose();
         }
     }
     return oProduct;
 }
Beispiel #3
0
        public void findProductNr(string barcode)
        {
            using (inventoryBaseEntities ivb = new inventoryBaseEntities())
            {
                try
                {

                }
                catch(Exception ex)
                {
                    AppEventLogger log = new AppEventLogger();
                    log.writeError(ex.Message, ex.StackTrace);
                }
            }
        }
Beispiel #4
0
 public string getCity(string postCode)
 {
     int code = Int32.Parse(postCode);
     string city = "";
     using (inventoryBaseEntities ivb = new inventoryBaseEntities())
     {
         try
         {
             var query = (from q in ivb.postCodes
                          where q.postCode == code
                          select q.cityName).FirstOrDefault();
             city = query.ToString();
         }
         catch (Exception ex)
         {
             AppEventLogger log = new AppEventLogger();
             log.writeError(ex.Message, ex.StackTrace);
         }
         finally
         {
             ivb.Dispose();
         }
     }
     return city;
 }