Beispiel #1
0
        public List <Price> loadList()
        {
            CMART0Entities DataAccess = new CMART0Entities();
            List <Price>   lst        = DataAccess.Prices.ToList();

            return(lst);
        }
Beispiel #2
0
        public List <Product> loadList()
        {
            CMART0Entities db  = new CMART0Entities();
            List <Product> lst = db.Products.ToList();

            return(lst);
        }
Beispiel #3
0
        public Authority Find(string id, string nameOfAuthority)
        {
            CMART0Entities db  = new CMART0Entities();
            Authority      aut = new Authority();

            return(db.Authorities.FirstOrDefault(x => x.AccountID == id && x.NameOfAuthority == nameOfAuthority));
        }
Beispiel #4
0
        // LOAD LIST
        public List <ProposeReceipt> LoadListProposed()
        {
            CMART0Entities        db  = new CMART0Entities();
            List <ProposeReceipt> lst = db.ProposeReceipts.ToList();

            return(lst);
        }
Beispiel #5
0
        // LOAD LIST
        public List <Account> LoadListAccount()
        {
            CMART0Entities db  = new CMART0Entities();
            List <Account> lst = db.Accounts.ToList();

            return(lst);
        }
Beispiel #6
0
        public List <usp_BranchOfficeDetailSearch_Result> searchDetail(String BranchID, String input)
        {
            CMART0Entities DataAccess = new CMART0Entities();
            List <usp_BranchOfficeDetailSearch_Result> lst = DataAccess.usp_BranchOfficeDetailSearch(BranchID, input).ToList();

            return(lst);
        }
Beispiel #7
0
        public List <sp_BranchOfficeSearch_Result> search(String input)
        {
            CMART0Entities DataAccess = new CMART0Entities();
            List <sp_BranchOfficeSearch_Result> lst = DataAccess.sp_BranchOfficeSearch(input).ToList();

            return(lst);
        }
Beispiel #8
0
        public float countmoney(string id, int number)
        {
            CMART0Entities db = new CMART0Entities();

            try
            {
                Price add = db.Prices.Single(st => st.ProductID == id);
                try
                {
                    Promotion addpro = db.Promotions.Single(st => st.ProductID == id);
                    if (add.EffectiveDay < addpro.StartDate)
                    {
                        return((float)addpro.PromotionPrice * number);
                    }
                    else
                    {
                        return((float)add.Price1 * number);
                    }
                }
                catch (Exception)
                {
                    return((float)add.Price1 * number);
                }
            }
            catch
            {
                float vogia = -1;
                return(vogia);
            }
        }
Beispiel #9
0
        // LOAD LIST
        public List <Supplier> LoadListSupplier()
        {
            CMART0Entities  db  = new CMART0Entities();
            List <Supplier> lst = db.Suppliers.ToList();

            return(lst);
        }
        // LOAD LIST
        public List <ProposeReceiptDetail> LoadListProposedDetail(string proposedID)
        {
            CMART0Entities db = new CMART0Entities();
            List <ProposeReceiptDetail> lst = db.ProposeReceiptDetails.Where(x => x.ProposeID == proposedID).ToList();

            return(lst);
        }
Beispiel #11
0
        public List <BranchOfficeReceipt> loadList()
        {
            CMART0Entities             DataAccess = new CMART0Entities();
            List <BranchOfficeReceipt> lst        = DataAccess.BranchOfficeReceipts.ToList();

            return(lst);
        }
Beispiel #12
0
        public List <SP_LOAD_BRANCHRECEIPTDETAIL_Result> loadListBranchDetail(String BranchID)
        {
            CMART0Entities DataAccess = new CMART0Entities();
            List <SP_LOAD_BRANCHRECEIPTDETAIL_Result> lst = DataAccess.SP_LOAD_BRANCHRECEIPTDETAIL(BranchID).ToList();

            return(lst);
        }
        public List <HeadquaterReceipt> loadList()
        {
            CMART0Entities           DataAccess = new CMART0Entities();
            List <HeadquaterReceipt> lst        = DataAccess.HeadquaterReceipts.ToList();

            return(lst);
        }
Beispiel #14
0
        public Authority Find(string id)
        {
            CMART0Entities db  = new CMART0Entities();
            Authority      aut = new Authority();

            return(db.Authorities.FirstOrDefault(x => x.AccountID == id));
        }
Beispiel #15
0
        public List <Authority> SelectAuthority()
        {
            CMART0Entities db  = new CMART0Entities();
            Account        acc = new Account();
            var            lst = db.Authorities.ToList();

            return(lst);
        }
Beispiel #16
0
        public void loadBRANCHOFFICERECEIPTDETAIL(String ID, String ProductID, TextBox txtQuantity, ComboBox cbbStatus)
        {
            CMART0Entities            DataAccess   = new CMART0Entities();
            BranchOfficeReceiptDetail BranchDetail = new BranchOfficeReceiptDetail();

            BranchDetail     = DataAccess.BranchOfficeReceiptDetails.Single(st => st.BranchOfficeID == ID && st.ProductID == ProductID);
            txtQuantity.Text = BranchDetail.Quantity.ToString();
            cbbStatus.Text   = BranchDetail.Status;
        }
Beispiel #17
0
        public void loadBRANCHOFFICERECEIPT(String id, TextBox txtbranchID, ComboBox cbbHeadQuater, ComboBox cbbBranch)
        {
            CMART0Entities      DataAccess = new CMART0Entities();
            BranchOfficeReceipt Branch     = new BranchOfficeReceipt();

            Branch                      = DataAccess.BranchOfficeReceipts.Single(st => st.BranchOfficeID == id);
            txtbranchID.Text            = Branch.BranchOfficeID.ToString();
            cbbHeadQuater.SelectedValue = Branch.HeadquaterID;
            cbbBranch.Text              = Branch.Branch;
        }
Beispiel #18
0
        private void GUI_PRICE_Load()
        {
            CMART0Entities DataAccess = new CMART0Entities();

            lstReceipt.DataSource = bus.loadList();
            lstReceipt.Columns["Product"].Visible = false;
            cbbProductID.DataSource    = DataAccess.Products.ToList();
            cbbProductID.ValueMember   = "ProductID";
            cbbProductID.DisplayMember = "Name";
        }
Beispiel #19
0
        private void clickSaveButton(object sender, EventArgs e)
        {
            CMART0Entities db  = new CMART0Entities();
            string         sum = sumExtension();

            if (txtid.Text != "")
            {
                if (sum == "")
                {
                    //Save Bill Detail
                    bus.updateBillDetail(lstbilldetail, txtid);

                    //Save Bill
                    if (checkNullData())
                    {
                        Bill update = new Bill();
                        update.BillID        = txtid.Text;
                        update.SaleDate      = dtpsaleday.Value;
                        update.POS           = int.Parse(txtpos.Text);
                        update.TotalAmount   = float.Parse(txtamount.Text);
                        update.TotalQuantity = int.Parse(txtsl.Text);
                        update.InputMoney    = float.Parse(txtinmoney.Text);
                        update.OutputMoney   = float.Parse(txtoutmoney.Text);
                        update.AccountID     = (string)cboaccount.SelectedValue;
                        if (bus.updateBill(update))
                        {
                            MessageBox.Show("Update bill successfully");
                            lstbilldetail.Rows.Clear();
                            txtsl.Text       = "0";
                            txtamount.Text   = "0";
                            txtoutmoney.Text = "0";
                            txtinmoney.Text  = "";
                            txtproduct.Text  = "";
                            txtpos.Text      = "";
                            cboaccount.Text  = "";
                            txtid.Text       = "";
                            dtpsaleday.Value = DateTime.Today;
                        }
                        else
                        {
                            MessageBox.Show("Update bill unsuccessfully");
                        }
                        showform();
                    }
                }
                else
                {
                    MessageBox.Show(sum);
                }
            }
            else
            {
                MessageBox.Show("Select a bill to update");
            }
        }
Beispiel #20
0
        private void GUI_Promote_Load(object sender, EventArgs e)
        {
            CMART0Entities db    = new CMART0Entities();
            Price          price = new Price();

            lstPromotion.DataSource = Bus_Promotion.loadListPromotion().ToList();
            lstPromotion.Columns["Product"].Visible = false;
            cboProduct.DataSource    = db.Products.ToList();
            cboProduct.ValueMember   = "ProductID";
            cboProduct.DisplayMember = "Name";
        }
Beispiel #21
0
        public void loadInfoBRANCHOFFICERECEIPTDETAIL(String ID, Label lblIDHeadID, Label lblBranchID, Label lblDate, Label lblBranch, Label lblCreator)
        {
            CMART0Entities      DataAccess = new CMART0Entities();
            Account             account    = new Account();
            BranchOfficeReceipt Branch     = new BranchOfficeReceipt();

            Branch           = DataAccess.BranchOfficeReceipts.Single(st => st.BranchOfficeID == ID);
            account          = DataAccess.Accounts.Single(st => st.AccountID == Branch.AccountID);
            lblBranchID.Text = ID;
            lblBranch.Text   = Branch.Branch;
            lblDate.Text     = Branch.Date.ToShortDateString();
            lblIDHeadID.Text = Branch.HeadquaterID;
            lblCreator.Text  = account.FullName;
        }
Beispiel #22
0
        public bool updateBill(Bill update)
        {
            CMART0Entities db = new CMART0Entities();

            try
            {
                db.usp_Bill_Update(update.BillID, update.SaleDate, update.POS, update.TotalAmount, update.TotalQuantity, update.InputMoney, update.OutputMoney, update.AccountID);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #23
0
        public bool checkexitProductid(string id)
        {
            CMART0Entities db = new CMART0Entities();

            try
            {
                Product add = db.Products.Single(st => st.ProductID == id);
                return(true);
            }
            catch
            {
                return(false);
            }
        }
Beispiel #24
0
        public void Load()
        {
            CMART0Entities DataAccess = new CMART0Entities();

            lstReceipt.DataSource = Bus.loadList();
            lstReceipt.Columns["Account"].Visible = false;
            lstReceipt.Columns["BranchOfficeReceiptDetails"].Visible = false;
            lstReceipt.Columns["HeadQuaterReceipt"].Visible          = false;
            cbbHeadquater.DataSource         = DataAccess.HeadquaterReceipts.ToList();
            cbbHeadquater.ValueMember        = "HeadquaterID";
            cbbHeadquater.DisplayMember      = "HeadquaterID";
            cbbHeadquater.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            cbbHeadquater.AutoCompleteSource = AutoCompleteSource.ListItems;
        }
Beispiel #25
0
        public void Load()
        {
            CMART0Entities DataAccess = new CMART0Entities();

            lstReceipt.DataSource = Bus.loadList();
            lstReceipt.Columns["Account"].Visible = false;
            lstReceipt.Columns["BranchOfficeReceiptDetails"].Visible = false;
            lstReceipt.Columns["HeadQuaterReceipt"].Visible          = false;
            lstReceipt.Columns[4].Visible = false;
            cbbHeadquater.DataSource      = DataAccess.HeadquaterReceipts.ToList();
            cbbHeadquater.ValueMember     = "HeadquaterID";
            cbbHeadquater.DisplayMember   = "HeadquaterID";
            txtAccount.Text         = getAccount;
            cbbBranch.SelectedIndex = 0;
        }
Beispiel #26
0
        private void lstCategories_DoubleClick(object sender, EventArgs e)
        {
            Category       category = new Category();
            CMART0Entities db       = new CMART0Entities();

            if (lstCategories.SelectedRows.Count == 1)
            {
                var    row        = lstCategories.SelectedRows[0];
                var    cell       = row.Cells["CategoryID"];
                string categoryID = (string)cell.Value;
                category     = db.Categories.Single(x => x.CategoryID == categoryID);
                txtID.Text   = category.CategoryID;
                txtName.Text = category.Name;
            }
        }
        public bool updataHEAQUATERRECEIPT(String headquaterID, String ProposeID, double TotalAmount, String account, String productID, int Quantity, double price, DateTime day, String Status)
        {
            bool           flag       = false;
            CMART0Entities DataAccess = new CMART0Entities();

            try
            {
                DataAccess.SP_UPDATE_HEADQUATERRECEIPT(headquaterID, ProposeID, TotalAmount, account, productID, Quantity, price, day, Status);
                flag = true;
            }
            catch (Exception g)
            {
                flag = false;
            }
            return(flag);
        }
Beispiel #28
0
        public bool updateBRANCHOFFICERECEIPTDETAIL(String BranchOfficeID, String ProductID, int Quantity, String Status)
        {
            bool           flag       = false;
            CMART0Entities DataAccess = new CMART0Entities();

            try
            {
                DataAccess.SP_UPDATE_BRANCHRECEIPTDETAIL(BranchOfficeID, ProductID, Quantity, Status);
                flag = true;
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }
Beispiel #29
0
        public bool updateBRANCHOFFICERECEIPT(String BranchOfficeID, String HeadQuaterID, String Account)
        {
            bool           flag       = false;
            CMART0Entities DataAccess = new CMART0Entities();

            try
            {
                DataAccess.SP_UPDATE_BRANCHRECEIPT(BranchOfficeID, HeadQuaterID, Account);
                flag = true;
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }
Beispiel #30
0
        public bool insertBRANCHOFFICERECEIPT(String HeadQuaterID, String Branch, String Account)
        {
            bool           flag       = false;
            CMART0Entities DataAccess = new CMART0Entities();

            try
            {
                DataAccess.SP_INSERT_BRANCHRECEIPT(HeadQuaterID, Branch, Account);
                flag = true;
            }
            catch
            {
                flag = false;
            }
            return(flag);
        }