Exemple #1
0
        public List <usermenuprivilege> getUserMenuPrivilegeforall()
        {
            usermenuprivilege        usr;
            List <usermenuprivilege> usrlist = new List <usermenuprivilege>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select b.EmployeeID,b.Name,a.MenuItemString from " +
                                      " MenuPrivilege a,ViewUserEmployeeList b where a.UserID=b.UserID ";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    usr                = new usermenuprivilege();
                    usr.EmpID          = reader.GetString(0);
                    usr.EmpName        = reader.GetString(1);
                    usr.menuItemString = reader.GetString(2);
                    usrlist.Add(usr);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.ToString() + "-" + System.Reflection.MethodBase.GetCurrentMethod().Name + "() : Error");
            }
            return(usrlist);
        }
Exemple #2
0
        public Boolean insertUserMenuPrivilege(usermenuprivilege mp)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into MenuPrivilege (UserID,MenuItemString,CreateTime,CreateUser)" +
                                     " values (" +
                                     "'" + mp.userID + "'," +
                                     "'" + mp.menuItemString + "'," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "MenuPrivilege", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception ex)
            {
                status = false;
            }
            return(status);
        }
Exemple #3
0
        public Boolean validateUser(usermenuprivilege mp)
        {
            Boolean status = true;

            try
            {
                if (mp.userID.Trim().Length == 0 || mp.userID == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
            }
            return(status);
        }
Exemple #4
0
        public Boolean updateUserMenuPrivilege(usermenuprivilege mp)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update MenuPrivilege set MenuItemString='" + mp.menuItemString +
                                   "' where UserID='" + mp.userID + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "MenuPrivilege", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }