Ejemplo n.º 1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                ERPUserDB   userDB = new ERPUserDB();
                MenuGroupDB MGDB   = new MenuGroupDB();
                menugroup   mg     = new menugroup();
                mg.rowid     = prev.rowid;
                mg.MenuGroup = txtUserID.Text;
                mg.status    = userDB.getUserStatusCode(cmbUserStatus.SelectedItem.ToString());
                System.Windows.Forms.Button btn = sender as System.Windows.Forms.Button;
                string btnText = btnSave.Text;

                if (btnText.Equals("Update"))
                {
                    if (MGDB.updateMenuGroup(mg))
                    {
                        MessageBox.Show("MenuGroup Status updated");
                        closeAllPanels();
                        ListUser();
                    }
                    else
                    {
                        MessageBox.Show("Failed to update MenuGroup Status");
                    }
                }
                else if (btnText.Equals("Save"))
                {
                    if (MGDB.validateMenuGroup(mg))
                    {
                        if (MGDB.insertMenuGroup(mg))
                        {
                            MessageBox.Show("MenuGroup data Added");
                            closeAllPanels();
                            ListUser();
                        }
                        else
                        {
                            MessageBox.Show("Failed to Insert MenuGroup Data");
                        }
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Failed Adding / Editing User Data");
            }
        }
Ejemplo n.º 2
0
 private void ListUser()
 {
     try
     {
         grdList.Rows.Clear();
         txtSearch.Text = "";
         MenuGroupDB      dbrecord = new MenuGroupDB();
         List <menugroup> mngrp    = dbrecord.getMenuGroup();
         foreach (menugroup mnr in mngrp)
         {
             grdList.Rows.Add(mnr.rowid, mnr.MenuGroup,
                              ComboFIll.getStatusString(mnr.status));
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
     }
     enableBottomButtons();
     pnlUserList.Visible = true;
 }