Beispiel #1
0
        }//

        //retrieve startup products from store
        public List <MDB_ProductModel> getStartUpProductsFromStore()
        {
            try
            {
                string q = "SELECT * FROM pos_items WHERE deleted=0 ORDER BY last_updated_trans DESC LIMIT 30";

                DBResults = DBManager.getListFromQuery(q, "MDB_ProductModel");
                if (DBResults.status == 0)
                {
                    List <MDB_ProductModel> list = new List <MDB_ProductModel>(DBResults.result_data.Cast <MDB_ProductModel>());
                    return(list);
                }
                else
                {
                    MessageBox.Show(DBResults.sys_message);
                    return(new List <MDB_ProductModel>());
                }
            }
            catch (Exception ex) {
                return(new List <MDB_ProductModel>());
            }
        }//
Beispiel #2
0
 //get list of all sales0
 public List <MDB_Sale> get_my_sales_list()
 {
     try
     {
         string q = "SELECT * FROM pos_sales WHERE (amt_paid NOT LIKE '%e%' AND amt_change NOT LIKE '%e%') AND worker_id=" + this.getCurrentUser().id + " ORDER BY id DESC LIMIT 800";//AND worker_id=" + this.getCurrentUser().id + "
         //MessageBox.Show(q);
         DBResults = DBManager.getListFromQuery(q, "MDB_Sale");
         if (DBResults.status == 0)
         {
             return(new List <MDB_Sale>(DBResults.result_data.Cast <MDB_Sale>()));
         }
         else
         {
             MessageBox.Show("ERR : " + DBResults.sys_message);
             return(new List <MDB_Sale>());
         }
     }
     catch (Exception ex)
     {
         this.AlertCustomMsg("", "FAIL TO LOAD SALES LIST", 1, ex.Message);
         return(new List <MDB_Sale>());
     }
 }//
Beispiel #3
0
        }//

        //login
        public MDB_UserModel login_user(MDB_UserModel user)
        {
            try {
                string q = "SELECT * FROM workers WHERE username= '******' AND password='******' LIMIT 1;";
                DBResults = DBManager.getListFromQuery(q, "MDB_UserModel");
                // System.Windows.Forms.MessageBox.Show(DBResults.sys_message);
                if (DBResults.status == 0)
                {
                    var li = new List <MDB_UserModel>(DBResults.result_data.Cast <MDB_UserModel>());
                    return(li[0]);
                }
                else
                {
                    MessageBox.Show("" + DBResults.sys_message);
                    //System.Windows.Forms.MessageBox.Show(DBResults.sys_message);
                    return(null);
                }
            }catch (Exception ex) {
                return(null);
            }
        }
Beispiel #4
0
 //get list of all customers
 public List <MDB_CustomerModel> get_customers_list()
 {
     try
     {
         DBResults = DBManager.getListFromQuery("SELECT * FROM customers" + " ORDER BY id", "MDB_CustomerModel");
         if (DBResults.status == 0)
         {
             return(new List <MDB_CustomerModel>(DBResults.result_data.Cast <MDB_CustomerModel>()));
         }
         else
         {
             MessageBox.Show("ERR : " + DBResults.sys_message);
             return(new List <MDB_CustomerModel>());
         }
     }
     catch (Exception ex)
     {
         this.AlertCustomMsg("", "FAIL TO LOAD CUSTOMERS LIST", 1, ex.Message);
         return(new List <MDB_CustomerModel>());
     }
 }//
Beispiel #5
0
 //get list of all companies
 public MDB_CompanyModel get_company_details()
 {
     try
     {
         DBResults = DBManager.getListFromQuery("SELECT * FROM companies" + " ORDER BY id", "MDB_CompanyModel");
         if (DBResults.status == 0)
         {
             var list = new List<MDB_CompanyModel>(DBResults.result_data.Cast<MDB_CompanyModel>());
             if(list.Count >= 1)
                 return list[0];
             return new MDB_CompanyModel();
         }
         else
         {
             MessageBox.Show("ERR : " + DBResults.sys_message);
             return new MDB_CompanyModel();
         }
     }
     catch (Exception ex)
     {
         this.AlertCustomMsg("", "FAIL TO LOAD COMPANY DETAILS", 1, ex.Message);
         return new MDB_CompanyModel();
     }
 }