Beispiel #1
0
 private void initVariables()
 {
     try
     {
         ComboFIll.fillStaticCombos();
         ////connString = Login.connString;
         ////userLoggedIn = Login.userLoggedIn;
         ////userLoggedInName = Login.userLoggedInName;
         ////empLoggedIn = Login.empLoggedIn;
         currentFY         = FinancialYearDB.getCurrentFinancialYear();
         documentDirectory = CatalogueValueDB.getParamValue("SysParam", "DocumentDirectory");
         showTime();
         lblEmployeeName.Text = Login.userLoggedInName;
         MenuPrivilegeDB mpDB     = new MenuPrivilegeDB();
         MenuItemDB      dbrecord = new MenuItemDB();
         menuhdritems = MenuItemDB.getMenuItemsHeader();
         foreach (menuitem menu in menuhdritems)
         {
             dictMainHeader.Add(menu.menugrp, 0);
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Main() : Error 2");
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            checkRestaurant(); //to check with the restaurant information details
        }
        //show the restaurant information
        if (Session["emailR"] != null)
        {
            Restaurant a = (Restaurant)Session["emailR"];
            tbxRestaurantName.Text = a.Name;
            tbxEmail.Text          = a.OrgEmail;
            tbxRegID.Text          = a.RegID;
            tbxAddress.Text        = a.Address;
            tbxPcode.Text          = a.PostalCode;
            tbxCity.Text           = a.City;
            tbxCountry.Text        = a.Country;
            tbxPassword.Text       = a.Password;
            tbxContact.Text        = a.ContactNo;
            tbxLicense.Text        = a.License;
            tbxDesc.Text           = a.Description;
            tbxHours.Text          = a.OpeningHours;
            imgRestaurant.ImageUrl = "../images/" + a.Photo;
            tbxSrating.Text        = Convert.ToString(a.StarRating);
        }
        //get menu items
        List <MenuItem> menuItems = MenuItemDB.getMenuItemByCountry(Session["countryName"].ToString(), Session["restaurant"].ToString());

        gvMenu.DataSource = menuItems;
        gvMenu.DataBind();
    }
Beispiel #3
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        //retrieve the restaurant session
        Restaurant r         = (Restaurant)Session["userRestaurant"];
        string     imagefile = "notavailable"; //initialize an imagefile into notavailable

        if (FileUpload1.HasFile)               //check if the file has the photo
        {
            imagefile = FileUpload1.FileName;
            FileUpload1.SaveAs(Server.MapPath("../images/" + imagefile)); //store the file in the images folder
        }
        Random rnd = new Random();                                        //declare a random number generator
        int    rId = rnd.Next(0, 100);                                    //initialize the random number generator for restaurantID

        MenuItem m = new MenuItem()
        {
            MenuItemID  = "M" + rId,
            Name        = tbxName.Text,
            Description = tbxDesc.Text,
            Price       = Convert.ToDouble(tbxPrice.Text),
            Photo       = imagefile,
            Restaurant  = r
        };
        int id = MenuItemDB.insertMenuItem(m); //insert the menuitem into database

        lblOutput.Text = "Successfully added!";
        tbxName.Text   = "";
        tbxDesc.Text   = "";
        tbxPrice.Text  = "";
        imagefile      = "notavailable";
        gvBind();
    }
Beispiel #4
0
 private void initVariables()
 {
     try
     {
         fillDocumentStatusCombo(cmbDocumentStatus);
         EmployeeDB.fillEmpListCombo(cmbEmployee);
         MenuItemDB.fillMenuItemComboNew(cmbDocument);
     }
     catch (Exception)
     {
     }
 }
Beispiel #5
0
    bool verification = true; //initialize the bool verfication into true.
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //show menuitem into listview
            List <MenuItem> menuItems = MenuItemDB.getMenuByRestaurant(Convert.ToInt32(Session["restaurant"]));
            lvMenu.DataSource = menuItems;
            lvMenu.DataBind(); //bind the data

            //get the restaurant name, address from the database
            Restaurant r = RestaurantDB.getRestaurant(Convert.ToInt32(Session["restaurant"]));
            lblRname.Text   = r.Name;
            lblAddress.Text = r.Address;
            lblName.Text    = r.Name;

            tbxDate.Attributes["min"] = DateTime.Now.ToString("yyyy-MM-dd"); //user cannot set the past date.
        }
    }
Beispiel #6
0
 private void initVariables()
 {
     try
     {
         menuitemTypeValues = new string[1, 2]
         {
             { "1", "Normal" }
         };
         fillMenuItemStatusCombo(cmbMenuItemStatus);
         fillMenuItemTypeCombo(cmbMenuItemType);
         MenuItemDB.fillMenuItemComboNew(cmbDocument);
         MenuItemDB.fillMenuGroupCombo(cmbMenuGroup);
         txtDocumentName.Visible = false;
         cmbDocument.Visible     = false;
     }
     catch (Exception)
     {
     }
 }
Beispiel #7
0
 private void createMainHeaderButtons()
 {
     try
     {
         MenuPrivilegeDB mpDB     = new MenuPrivilegeDB();
         MenuItemDB      dbrecord = new MenuItemDB();
         menuitems = dbrecord.getMenuItems();
         MenuPrivilegeDB mpdb = new MenuPrivilegeDB();
         menuPrivString  = mpdb.getUserMenuPrivilege(Login.userLoggedIn);
         userOptionArray = menuPrivString.Split(';');
         intex           = 0;
         removpnlcontrols();
         foreach (menuitem menu in menuhdritems)
         {
             int             count = 0;
             List <menuitem> mnm   = menuitems.Where(x => x.menugrp == menu.menugrp).ToList();
             foreach (menuitem menuin in mnm)
             {
                 if (Utilities.checkMenuPrivilege(menuin.menuItemID, userOptionArray) >= 0)
                 {
                     if (menuin.menuitemStatus == 1)
                     {
                         count++;
                     }
                 }
             }
             if (count > 0)
             {
                 val = 0;
                 addButtonheader(menu.menugrp, intex, menu.menugrp);
                 intex++;
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Main() : Error 3");
     }
 }
Beispiel #8
0
 private void ListMenuItems()
 {
     try
     {
         grdUserPrivileges.Rows.Clear();
         MenuItemDB      dbrecord  = new MenuItemDB();
         List <menuitem> menuitems = dbrecord.getMenuItems();
         foreach (menuitem menu in menuitems)
         {
             if (menu.menuitemStatus == 1)
             {
                 grdUserPrivileges.Rows.Add(menu.menuItemID, menu.description);
             }
         }
         fillUserMenuPrivileges();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
     pnlMenuPrivilegeList.Visible = true;
 }
Beispiel #9
0
        ////private void Form1_Load(object sender, EventArgs e)
        ////{
        ////    ListMenuItems();

        ////}
        private void ListMenuItems()
        {
            try
            {
                grdList.Rows.Clear();
                MenuItemDB      dbrecord  = new MenuItemDB();
                List <menuitem> menuitems = dbrecord.getMenuItems();
                foreach (menuitem menu in menuitems)
                {
                    grdList.Rows.Add(menu.menuItemID, menu.description, menu.shortDescription,
                                     dbrecord.getMenuItemTypeString(menu.menuitemType),
                                     menu.documentID + "-" + menu.documentName,
                                     menu.pageLink, menu.versionrequired,
                                     menu.menugrp,
                                     ComboFIll.getStatusString(menu.menuitemStatus));
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            enableBottomButtons();
            pnlMenuList.Visible = true;
        }
Beispiel #10
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     try
     {
         menuitem   menu    = new menuitem();
         MenuItemDB menuDB  = new MenuItemDB();
         string     docName = "";
         string     docID   = "";
         try
         {
             ////////docID = cmbDocument.SelectedItem.ToString().Trim().Substring(0, cmbDocument.SelectedItem.ToString().Trim().IndexOf('-'));
             docID = ((Structures.ComboBoxItem)cmbDocument.SelectedItem).HiddenValue;
             ////////docName = cmbDocument.SelectedItem.ToString().Trim().Substring(cmbDocument.SelectedItem.ToString().Trim().IndexOf('-') + 1);
             docName = ((Structures.ComboBoxItem)cmbDocument.SelectedItem).ToString();
         }
         catch (Exception)
         {
             docName = "";
             docID   = "";
         }
         menu.menuItemID       = txtMenuItemID.Text;
         menu.description      = txtMenuItemDescription.Text;
         menu.shortDescription = txtMenuItemShortDescription.Text;
         menu.menuitemType     = menuDB.getMenuItemTypeCode(cmbMenuItemType.SelectedItem.ToString());
         menu.documentID       = docID;
         menu.documentName     = docName;
         menu.pageLink         = txtMenuItemUIName.Text;
         menu.menuitemStatus   = ComboFIll.getStatusCode(cmbMenuItemStatus.SelectedItem.ToString());
         menu.menugrp          = cmbMenuGroup.SelectedItem.ToString();
         menu.versionrequired  = txtVersionRequired.Text.Trim();
         System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
         string btnText = btn.Text;
         {
             if (btnText.Equals("Update"))
             {
                 if (menuDB.updateMenuItem(menu))
                 {
                     MessageBox.Show("Menu Item updated");
                     closeAllPanels();
                     ListMenuItems();
                 }
                 else
                 {
                     MessageBox.Show("Failed to update Mnu Item");
                 }
             }
             else if (btnText.Equals("Save"))
             {
                 if (menuDB.validateMenuItem(menu))
                 {
                     if (menuDB.insertMenuItem(menu))
                     {
                         MessageBox.Show("Menu Item data Added");
                         closeAllPanels();
                         ListMenuItems();
                     }
                     else
                     {
                         MessageBox.Show("Failed to Insert Menu Item Data");
                     }
                 }
                 else
                 {
                     MessageBox.Show("enu Item Data Validation failed");
                 }
             }
         }
     }
     catch (Exception)
     {
         MessageBox.Show("Failed Adding / Editing Menu Item Data");
     }
 }