コード例 #1
0
        public List <BrandRawData> GetSystemBrands()
        {
            DataTable dataTable = queries.GetSystemBrands();

            if (dataTable == null)
            {
                return(null);
            }
            List <BrandRawData> brandsList = new List <BrandRawData>();

            foreach (DataRow row in dataTable.Rows)
            {
                String[] tpStr = new String[dataTable.Columns.Count];
                int      i     = 0;
                foreach (DataColumn col in dataTable.Columns)
                {
                    tpStr[i] = row[col].ToString();
                    i++;
                }
                BrandRawData tempData = new BrandRawData();
                tempData.Handler(tpStr);
                brandsList.Add(tempData);
            }

            return(brandsList);
        }
コード例 #2
0
ファイル: AdminPage.cs プロジェクト: AhmedNabih/OnlineStore
        private void BRemoveBrand_Click(object sender, EventArgs e)
        {
            List <BrandRawData> removeList = new List <BrandRawData>();

            for (int i = 0; i < BrandList.Items.Count; i++)
            {
                if (BrandList.GetItemChecked(i))
                {
                    BrandRawData tempData = new BrandRawData();
                    tempData.RefactorString(BrandList.Items[i].ToString());
                    removeList.Add(tempData);
                }
            }

            for (int i = 0; i < removeList.Count; i++)
            {
                bool DONE = controller.RemoveBrand(removeList[i].ID);
                if (DONE)
                {
                    MessageBox.Show(removeList[i].ToString() + " Removed");
                }
                else
                {
                    MessageBox.Show(removeList[i].ToString() + " Remove Failed");
                }
            }

            BRefreshBrandList_Click(sender, e);
        }
コード例 #3
0
 public StoreProduct(String storeProductID, String storeID, ProductRawData product, BrandRawData brand, double price, int amount)
 {
     this.storeProductID = storeProductID;
     this.storeID        = storeID;
     this.product        = product;
     this.brand          = brand;
     this.price          = price;
     this.amount         = amount;
 }
コード例 #4
0
 public StoreProduct()
 {
     this.storeProductID = null;
     this.storeID        = null;
     this.product        = new ProductRawData();
     this.brand          = new BrandRawData();
     this.price          = 0.0;
     this.amount         = 0;
 }
コード例 #5
0
        private void BAddStoreProduct_Click(object sender, EventArgs e)
        {
            if (SystemProductsList.SelectedItem == null || SystemBrandsList.SelectedItem == null)
            {
                MessageBox.Show("Please select brand and product");
                return;
            }

            String product = SystemProductsList.SelectedItem.ToString();
            String Brand   = SystemBrandsList.SelectedItem.ToString();

            ProductRawData productRawData = new ProductRawData();

            productRawData.RefactorString(product);

            BrandRawData brandRawData = new BrandRawData();

            brandRawData.RefactorString(Brand);

            InputData inputData = new InputData("price", "amount", "Submit Product");

            inputData.ShowDialog();

            StoreProduct        storeProduct = new StoreProduct("0", controllerStore.GetStoreID(), productRawData, brandRawData, price, amount);
            StoreCommandInvoker invoker      = new StoreCommandInvoker();

            IStoreCommand command     = new AddCommand();
            CommandData   commandData = new CommandData();

            commandData.UserIDCollab   = controllerSO.storeOwner.Data.ID;
            commandData.UsernameCollab = controllerSO.storeOwner.Data.userName;
            commandData.CmdType        = "Add";
            commandData.ProductID      = storeProduct.storeProductID;
            commandData.ProductName    = storeProduct.product.Name;
            commandData.PAmount        = storeProduct.amount;
            commandData.Price          = storeProduct.price;
            commandData.StoreID        = storeProduct.storeID;

            bool DONE = invoker.DoCommand(command, commandData, this.collMode, storeProduct);

            //controllerStoreProduct.AddStoreProduct(controllerStore.GetStoreID(), storeProduct);
            if (DONE)
            {
                MessageBox.Show("Product Added");
            }
            else
            {
                MessageBox.Show("Product Add failed");
            }

            BShowStoreProduct_Click(sender, e);
        }