Esempio n. 1
0
        private string GenerateTransactionIDIfNotExists()
        {
            //retrieve sale ID
            string tranId = Session["SaleID"] as string;

            //if no sale ID is not found...create one
            tranId = tranId ?? SharedCommons.GenerateUniqueId("SALE-");

            return(tranId);
        }
Esempio n. 2
0
        public void RegisterSaleItemsTest_ValidInput_ExpectSuccess()
        {
            SaleItem item = new SaleItem
            {
                ItemId = SharedCommons.GenerateUniqueId("ITEM-"),
                SaleId = SharedCommons.GenerateUniqueId("SALE-")
            };
            TcmpCore core   = new TcmpCore();
            Result   result = core.RegisterSaleItems(item);

            Assert.AreEqual(result.StatusDesc, SharedCommonsGlobals.SUCCESS_STATUS_TEXT);
        }
Esempio n. 3
0
        public void RegisterSaleTest_ValidInput_ExpectSuccess()
        {
            Sale sale = new Sale
            {
                SaleID     = SharedCommons.GenerateUniqueId("SALE-"),
                CustomerId = "Nsubugak",
                TotalCost  = 0,
                Tax        = 0
            };
            TcmpCore core   = new TcmpCore();
            Result   result = core.RegisterSale(sale);

            Assert.AreEqual(result.StatusDesc, SharedCommonsGlobals.SUCCESS_STATUS_TEXT);
        }
Esempio n. 4
0
        public void RegisterItemTest_ValidInput_ExpectSuccess()
        {
            Item item = new Item
            {
                ItemCode   = SharedCommons.GenerateUniqueId("ITEM-"),
                CreatedBy  = "admin",
                ItemCount  = 10,
                ItemName   = "Shoes",
                ItemPrice  = 2000,
                ModifiedBy = "admin"
            };

            TcmpCore core   = new TcmpCore();
            Result   result = core.RegisterItem(item);

            Assert.AreEqual(result.StatusDesc, SharedCommonsGlobals.SUCCESS_STATUS_TEXT);
        }
Esempio n. 5
0
        protected void btnRegisterItem_Click(object sender, EventArgs e)
        {
            try
            {
                SystemUser user = Session["User"] as SystemUser;

                //create item
                Item item = new Item
                {
                    CreatedBy = user.Username,
                    ItemCode  = Request.QueryString["ItemId"] == null?SharedCommons.GenerateUniqueId("ITEM-") : Request.QueryString["ItemId"],
                                    ItemCount  = SharedCommons.GetIntFromStringDefaultsToZero(txtItemCount.Text),
                                    ItemImage  = GetBase64StringOfImageUploaded(),
                                    ItemName   = txtItemName.Text,
                                    ItemPrice  = SharedCommons.GetIntFromStringDefaultsToZero(txtPrice.Text),
                                    ModifiedBy = user.Username,
                };

                Result result = SharedLogic.TcmpTestCore.RegisterItem(item);

                //failed to save
                if (result.StatusCode != SharedCommonsGlobals.SUCCESS_STATUS_CODE)
                {
                    lblInfoMsg.Text = result.StatusDesc;
                    return;
                }

                //success
                lblInfoMsg.Text = "Item Registered Successfully";

                //reload items from database
                ItemsAvailableForSale = LoadItems();
            }
            catch (Exception ex)
            {
                ShowErrorMsg(SharedLogic.INTERNAL_ERROR_MSG);

                //log error
                SharedLogic.TcmpTestCore.LogError($"EXCEPTION:{ex.Message}", $"{this.GetType().Name}-{SharedLogic.GetCurrentMethod()}", "N/A");
            }
        }