Exemplo n.º 1
0
        public bool IsAuthenticated(string username, string password)
        {
            bool result = false;

            try
            {
                var a = pEntity.ref_user_Login(username, password).FirstOrDefault();
                if (a.userid > 0)
                {
                    _userId   = a.userid.ToString();
                    _position = a.position;
                    result    = true;
                }
                else
                {
                    _err   = "Username or passwod is incorrect.";
                    result = false;
                }
            }
            catch (Exception e)
            {
                _err          = e.ToString();
                a.logModule   = "User CS";
                a.logError    = e.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                result = false;
            }
            return(result);
        }
Exemplo n.º 2
0
        public bool Create(trn_productDetail _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.trn_productdetail_Insert(_ref.product_detail_id,
                                                 _ref.product_id,
                                                 _ref.measurement,
                                                 _ref.measurevalue,
                                                 _ref.supplierprice,
                                                 _ref.retailprice,
                                                 _ref.QTY,
                                                 _ref.dateupdated,
                                                 _ref.datecreated,
                                                 _ref.updatedby,
                                                 _ref.isActive,
                                                 _ref.isDelete,
                                                 _ref.ExpiryDate
                                                 );
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Product Detail CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 3
0
        public bool Create(TransactionDetails trx)
        {
            bool rtval = false;

            try
            {
                pEntity.trn_transactionsales_detail_Insert(trx.productcode, trx.sales_id,
                                                           trx.product_id,
                                                           trx.RetailPrice,
                                                           trx.QTY,
                                                           trx.TotalAmount,
                                                           trx.isCheckedout
                                                           );
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Sales Detail CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 4
0
        public bool Create(Transactions trx)
        {
            bool rtval = false;

            try
            {
                pEntity.trn_transactionsales_Insert(trx.referenceNo,
                                                    trx.TotalAmount,
                                                    trx.Discounted,
                                                    trx.GrandTotal,
                                                    trx.AmountPaid,
                                                    trx.PayBalance,
                                                    trx.status,
                                                    trx.isPaid,
                                                    trx.isVoided,
                                                    trx.TransactionType,
                                                    trx.CustomerId,
                                                    trx.DateCreated,
                                                    trx.dateUpdated,
                                                    trx.processed_by
                                                    );
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Sales CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 5
0
        public bool Create(trn_transaction_log trx)
        {
            bool rtval = false;

            try
            {
                pEntity.trn_transaction_log_Insert(trx.sales_id,
                                                   trx.current_status,
                                                   trx.statusby,
                                                   trx.DateUpdated
                                                   );
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Sales Logs CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 6
0
        public bool DeductStocks(int productId, int QTY, int updatedby)
        {
            bool result = false;

            try
            {
                pEntity.trn_stock_qty_update(productId, QTY, updatedby, 2);
                pEntity.SaveChanges();
                result = true;
            }
            catch (Exception e)
            {
                _err          = e.ToString();
                a.logModule   = "InventoryStocks CS";
                a.logError    = e.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                result = false;
            }
            return(result);
        }
Exemplo n.º 7
0
        public bool Create(supplier _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.ref_supplier_Insert(_ref.Supplier_name, _ref.Supplier_address, _ref.Supplier_contact, _ref.isDelete, _ref.isActive);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Suppliers CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 8
0
        public bool Create(Category _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.ref_category_Insert(_ref.category_id, _ref.categoryname);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Category";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 9
0
        public bool Create(Truckers _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.ref_trucking_Insert(_ref.trucking_id, _ref.trucking_name, _ref.platenos);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Trucking CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 10
0
        public bool Create(PurchaseRequest _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.trn_porequest_Insert(_ref.poRef, _ref.TotalAmount, _ref.DateCreated, _ref.Createdby, false, _ref.status);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Purchase CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 11
0
        public bool Create(product _ref)
        {
            bool rtval = false;

            try
            {
                pEntity.ref_product_Insert(_ref.product_id, _ref.category_id, _ref.ProductCode, _ref.ProductName, _ref.ProductDescription,
                                           _ref.Barcode, _ref.measurement, _ref.supplierprice, _ref.retailprice, _ref.QTY, _ref.criticalQTY, _ref.unitWeight, _ref.Weight, _ref.Expirydate, _ref.isDelete, _ref.isActive, _ref.supplier_id, _ref.dateCreated,
                                           _ref.updatedBy, _ref.dateUpdated);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "Product CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return(rtval);
        }
Exemplo n.º 12
0
        public bool Create(measure _ref)
        {
            bool rtval = false;
            try
            {
                pEntity.ref_measurement_Insert(_ref.measure_id,_ref.measurement);
                pEntity.SaveChanges();
                rtval = true;
            }
            catch (Exception ex)
            {

                _err = ex.ToString();
                a.logModule = "Measures";
                a.logError = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                rtval = false;
            }
            return rtval;
        }
Exemplo n.º 13
0
        private void toolStripButton5_Click(object sender, EventArgs e)
        {
            //TODO Void Order

            try
            {
                if (MessageBox.Show("Item will be cancelled", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    CancelOrder();
                }
            }
            catch (Exception ex)
            {
                a.logModule   = "Cancel Order : " + lbltxnid.Text;
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                MessageBox.Show("Nothing to cancel");
                this.Close();
            }
        }
Exemplo n.º 14
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (lblcatid.Text != "")
         {
             UpdateRecord();
         }
         else
         {
             Insert();
         }
         MessageBox.Show("Record has been saved.");
     }
     catch (Exception ex)
     {
         a.logModule   = "Supplier Entry";
         a.logError    = ex.ToString();
         a.DateCreated = DateTime.Now;
         lg.InsertLog(a);
         MessageBox.Show("No Record created data must be wrong please try again.");
     }
     this.Close();
 }
Exemplo n.º 15
0
        public bool ProductRelease(int sales_detail_id, int productid, int qty, bool ischeckout)
        {
            bool result = false;

            try
            {
                pEntity.trn_transactionsales_detail_releasing_update(sales_detail_id, productid, qty, ischeckout);
                pEntity.SaveChanges();
                result = true;
            }
            catch (Exception ex)
            {
                _err          = ex.ToString();
                a.logModule   = "ReleaseRepositories CS";
                a.logError    = ex.ToString();
                a.DateCreated = DateTime.Now;
                lg.InsertLog(a);
                result = false;
            }
            return(result);
        }