예제 #1
0
        public void loadKitchenItems()
        {
            //clear the card list
            kitchenItemcards.Clear();

            using (DBEntities db = new DBEntities())
            {
                kitchenItems = db.Items.ToList();

                foreach (Item Item in kitchenItems)
                {
                    //creating new card
                    itemcard                = new KitchenitemCard();
                    itemcard.itemID         = Item.itemID;
                    itemcard.itemName       = Item.name;
                    itemcard.itemImage      = Util.convertBinaryToImage(Item.image);
                    itemcard.purchacedPrice = Item.purchase_price.ToString();


                    //adding card to the list
                    kitchenItemcards.Add(itemcard);
                }
            }


            //adding cards to the flow panel
            foreach (KitchenitemCard card in kitchenItemcards)
            {
                flowItemPanel.Controls.Add(card);
            }
        }
예제 #2
0
        //method to load vehicles
        //method to load the categories
        public void loadvehicleCards()
        {
            //clear the card list
            vehiclecardList.Clear();

            using (DBEntities db = new DBEntities())
            {
                vehicleList = db.Vehicles.ToList();

                foreach (Vehicle Item in vehicleList)
                {
                    //creating new card
                    Vcard = new vehicleCard();

                    Vcard.vNumber    = Item.vehicleNo;
                    Vcard.vtype      = Item.type;
                    Vcard.rentPerDay = Item.RentPerDay.ToString();
                    Vcard.rentPerKM  = Item.RentPerkm.ToString();
                    Vcard.vimage     = Util.convertBinaryToImage(Item.VehicleImage);


                    //adding card to the list
                    vehiclecardList.Add(Vcard);
                }
            }


            //adding cards to the flow panel
            foreach (vehicleCard card in vehiclecardList)
            {
                flowRentVehiclePanel.Controls.Add(card);
            }
        }//
예제 #3
0
        //method to load food item cards to the panel
        public void loadFoodItemCards()
        {
            //clear the card list
            foodCardsList.Clear();


            using (DBEntities db = new DBEntities())
            {
                foodItemsList = db.Foods.ToList();

                foreach (Food Item in foodItemsList)
                {
                    //creating new card
                    foodcard = new FoodItemCard();

                    foodcard.cardId    = Item.foodCode;
                    foodcard.FoodName  = Item.name;
                    foodcard.price     = Item.sellingPrice.ToString();
                    foodcard.FoodImage = Util.convertBinaryToImage(Item.foodImage);
                    //adding card to the list
                    foodCardsList.Add(foodcard);
                }

                //adding cards to the flow panel
                foreach (FoodItemCard card in foodCardsList)
                {
                    flowPanelFoodList.Controls.Add(card);
                }
            }
        }//end of load food cards method
예제 #4
0
        }//end of the method

        //method to display filtered kitchenitem list
        public void filterFoodCards(String categoryID)
        {
            //clear the card list
            kitchenitemcardList.Clear();
            flowKitchenItems.Controls.Clear();

            using (DBEntities db = new DBEntities())
            {
                itemsList = db.Items.Where(x => x.categoryID == categoryID).ToList();;

                foreach (Item Item in itemsList)
                {
                    //creating new card
                    kicard = new POSKICard();

                    kicard.KItemName       = Item.name;
                    kicard.KItemCardID     = Item.itemID;
                    kicard.KItemPrice      = Item.purchase_price.ToString();
                    kicard.ItemImage       = Util.convertBinaryToImage(Item.image);
                    kicard.MeasurementUnit = Item.unitOfMeasurement;
                    //adding card to the list
                    kitchenitemcardList.Add(kicard);
                }
            }


            //adding cards to the flow panel
            foreach (POSKICard card in kitchenitemcardList)
            {
                flowKitchenItems.Controls.Add(card);
            }
        }//
        //load employee cards-----------------------------------------------------------------------------------------
        public void loadEmployees()
        {
            empCardList.Clear();

            using (DBEntities db = new DBEntities())
            {
                employeelist = db.Employees.ToList();
                //Employee Card
                foreach (Employee item in employeelist)
                {
                    empcard             = new employeecard();
                    empcard.cardid      = item.employeeId;
                    empcard.FirstName   = item.fname;
                    empcard.LastName    = item.lname;
                    empcard.NIC         = item.nic;
                    empcard.Destination = item.designation;
                    empcard.Basicsalary = item.basicsalary.ToString();
                    empcard.EmpImage    = Util.convertBinaryToImage(item.image);


                    //last line
                    empCardList.Add(empcard);
                }
            }//------------------------------------------------------------------------------------------------------------
            //all card item generater for loop
            foreach (employeecard card in empCardList)
            {
                flowEmployeesPanel.Controls.Add(card);
            }
        }
예제 #6
0
        //method to filter the Items/Foods
        public void filterFoodCards(String categoryID)
        {
            //clear the card list
            posFoodCards.Clear();
            posProducrtCard.Clear();
            flowPanelFoods.Controls.Clear();

            using (DBEntities db = new DBEntities())
            {
                foodItems         = db.Foods.Where(x => x.categoryID == categoryID).ToList();
                readyMadeProducts = db.Items.Where(y => y.categoryID == categoryID).ToList();


                foreach (Food Item in foodItems)
                {
                    //creating new card
                    cardpos            = new POSFoodCard();
                    cardpos.foodName   = Item.name;
                    cardpos.foodCardID = Item.foodCode;
                    cardpos.foodPrice  = Item.sellingPrice.ToString();
                    cardpos.foodImage  = Util.convertBinaryToImage(Item.foodImage);
                    //adding card to the list
                    posFoodCards.Add(cardpos);
                }

                foreach (Item item in readyMadeProducts)
                {
                    cardProduct = new POSKICard();

                    cardProduct.KItemName   = item.name;
                    cardProduct.KItemCardID = item.itemID;
                    //getting the selling price ...
                    readyMAde = db.ReadyMadeProducts.Where(s => s.productID == item.itemID).FirstOrDefault();
                    cardProduct.KItemPrice = readyMAde.sellingPrice.ToString();

                    cardProduct.ItemImage = Util.convertBinaryToImage(item.image);

                    posProducrtCard.Add(cardProduct);
                }
            }


            //adding Food cards to the flow panel
            foreach (POSFoodCard card in posFoodCards)
            {
                flowPanelFoods.Controls.Add(card);
            }

            //adding Product cards to the flow panel
            foreach (POSKICard card in posProducrtCard)
            {
                flowPanelFoods.Controls.Add(card);
            }
        }//end of filtering method
예제 #7
0
        //method to edit food details
        public void editcategory(String id)
        {
            //retreiving selected row
            using (DBEntities db = new DBEntities())
            {
                //setting operation to update
                operation    = "update";
                btnSave.Text = "Update";

                itemRow = db.Items.Where(x => x.itemID == id).FirstOrDefault();


                //storing values to the textboxes
                txtItemID.Text        = itemRow.itemID;
                txtItemName.Text      = itemRow.name;
                txtLimit.Text         = itemRow.limitQuantity.ToString();
                txtPurchacePrice.Text = itemRow.purchase_price.ToString();
                comBoSupplier.Text    = itemRow.suppliedBy;
                picBocitempic.Image   = Util.convertBinaryToImage(itemRow.image);
            }
        }//end of edit Food details method
예제 #8
0
        } // --------------------------------------------------------------------------------------------

        //method to edit food details
        public void editcategory(String id)
        {
            //retreiving selected row
            using (DBEntities db = new DBEntities())
            {
                //setting operation to update
                operation            = "update";
                btnSaveFoodItem.Text = "Update";

                food = db.Foods.Where(x => x.foodCode == id).FirstOrDefault();
                MessageBox.Show(food.foodCode);

                //storing values to the textboxes
                txtID.Text           = food.foodCode;
                txtName.Text         = food.name;
                txtDescription.Text  = food.description;
                txtSellingPrice.Text = food.sellingPrice.ToString();
                txtDiscountRate.Text = food.disountRate.ToString();

                picBoxImage.Image = Util.convertBinaryToImage(food.foodImage);
            }
        }//end of edit Food details method
예제 #9
0
        //edit employees ==================================================
        public void editemployee(String id)
        {
            status       = "update";
            btnSave.Text = "Update";
            using (DBEntities db = new DBEntities())
            {
                employeeModel = db.Employees.Where(x => x.employeeId == id).FirstOrDefault();
                MessageBox.Show(employeeModel.employeeId, "Employee Access update");

                txtempid.Text         = employeeModel.employeeId;
                txtfname.Text         = employeeModel.fname;
                txtlname.Text         = employeeModel.lname;
                txtaddress.Text       = employeeModel.address;
                txtemail.Text         = employeeModel.email;
                txtdob.Value          = Convert.ToDateTime(employeeModel.dob.ToString());
                txtconatcno.Text      = employeeModel.contactno.ToString();
                txtbasicsal.Text      = employeeModel.basicsalary.ToString();
                txtnationality.Text   = employeeModel.nationality;
                txtmatrialststus.Text = employeeModel.matrialstatus;
                txtnic.Text           = employeeModel.nic;
                cmbgender.Text        = employeeModel.gender;
                if (id.StartsWith("D"))
                {
                    rbdriver.Text = employeeModel.designation;
                }


                picBoxEmp.Image = Util.convertBinaryToImage(employeeModel.image);

                if (id.StartsWith("D"))
                {
                    driverModel = db.Drivers.Where(x => x.driverid == id).FirstOrDefault();
                    MessageBox.Show(driverModel.driverid, "Driver Access update");
                    cmbDriverSerivice.Text = driverModel.service;
                    txtlicenceno.Text      = driverModel.licenceNo.ToString();
                    cmbdrivertype.Text     = driverModel.type;
                }
                else if (id.StartsWith("C"))
                {
                    cleanerModel = db.Cleaners.Where(x => x.cleanerid == id).FirstOrDefault();
                    MessageBox.Show(cleanerModel.cleanerid, "Cleaners Access update");
                    txtclenertype.Text = cleanerModel.ctype;
                }
                else if (id.StartsWith("hc"))
                {
                    HeadchefModel = db.HeadChefs.Where(x => x.headchefid == id).FirstOrDefault();
                    MessageBox.Show(HeadchefModel.headchefid, "HeadChefs Access update");
                    txtservice.Text = HeadchefModel.service;
                }
                else if (id.StartsWith("M"))
                {
                    ManagerModel = db.Managers.Where(x => x.Managerid == id).FirstOrDefault();
                    MessageBox.Show(ManagerModel.Managerid, "Managers Access update");
                    cmbexperiecnce.Text = ManagerModel.experience;
                }
                else if (id.StartsWith("Rc"))
                {
                    receptionModel = db.Receptions.Where(x => x.receptionid == id).FirstOrDefault();
                    MessageBox.Show(receptionModel.receptionid, "Receptions Access update");
                    cmblanguage.Text = receptionModel.language;
                }
            }
        }// end the edit details===================================================