Example #1
0
        public void SetPay()
        {
            DialogResult dialogResult = MessageBox.Show("Are you sure to process transaction?", "", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                Update_UnitLeft update_unitLeft = new Update_UnitLeft(
                    ItemsModel,
                    StockModel
                    );
                update_unitLeft.UpdateChecker();
                ItemsModel.ClearCart();
                EmptyProductInfo();
                GetStocksModelAndStoreToAutoComplete();
            }
        }
        public void AppendCredit()
        {
            //Update unit left in DB
            Update_UnitLeft update_unitLeft = new Update_UnitLeft(
                ItemsModel,
                StockModel
                );

            update_unitLeft.UpdateChecker();
            POS_DB pos_db = new POS_DB();

            for (int count = 0; count < ItemsModel.getItemName().Count; count++)
            {
                pos_db.AddToCredit(
                    CB_CustomerList.Text.Split('/')[1],
                    ItemsModel.getItemName()[count].ToString(),
                    ItemsModel.getCode()[count].ToString(),
                    ItemsModel.getPrice()[count].ToString(),
                    DateTime.Now.ToString(),
                    ItemsModel.getUnit()[count].ToString(),
                    "Unpaid",
                    dh.getUsername() + "/" + dh.getUserFullName(),
                    RTB_Description.Text);
            }
            MessageBox.Show("Successfuly added " + ItemsModel.getItemName().Count + " items to" + CB_CustomerList.Text.Split('/')[0] + " as credit!");
            ItemsModel.ClearCart();
            pos.AddItemsData();
        }