예제 #1
0
        //2018-02-23
        public static List <menuitem> getMenuItemsHeader()
        {
            menuitem        menuitemhdr;
            List <menuitem> menuitems = new List <menuitem>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select distinct MenuGroup from MenuGroup where Status='1'";
                SqlCommand    cmd   = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    menuitemhdr         = new menuitem();
                    menuitemhdr.menugrp = reader.GetString(0);
                    menuitems.Add(menuitemhdr);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("getMenuItemsHeader() : Error");
            }
            return(menuitems);
        }
예제 #2
0
        public Boolean validateMenuItem(menuitem menu)
        {
            Boolean status = true;

            try
            {
                if (menu.menuItemID.Trim().Length == 0 || menu.menuItemID == null)
                {
                    return(false);
                }
                if (menu.description.Trim().Length == 0 || menu.description == null)
                {
                    return(false);
                }
                if (menu.shortDescription.Trim().Length == 0 || menu.shortDescription == null)
                {
                    return(false);
                }
                if (menu.menugrp.Trim().Length == 0 || menu.menugrp == null)
                {
                    return(false);
                }
            }
            catch (Exception)
            {
            }

            return(status);
        }
예제 #3
0
        public Boolean updateMenuItem(menuitem menu)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                string updateSQL = "update MenuItem set Description='" + menu.description + "'," +
                                   "ShortDescription='" + menu.shortDescription + "'," +
                                   "Type=" + menu.menuitemType + "," +
                                   "DocumentID='" + menu.documentID + "'," +
                                   "PageLink='" + menu.pageLink + "'," +
                                   "VersionRequired='" + menu.versionrequired + "'," +
                                   "MenuGroup='" + menu.menugrp + "'," +
                                   "Status=" + menu.menuitemStatus +
                                   " where MenuItemID='" + menu.menuItemID + "'";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("update", "MenuItem", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }
예제 #4
0
        public List <menuitem> getMenuItems()
        {
            menuitem        menuitemrec;
            List <menuitem> menuitems = new List <menuitem>();

            try
            {
                SqlConnection conn  = new SqlConnection(Login.connString);
                string        query = "select a.menuitemid,a.description,a.shortdescription,a.TYPE, " +
                                      "isnull(a.documentid,' '),isnull(b.documentName,' '), a.Pagelink,a.Status,a.CreateTime,a.CreateUser,isnull(a.VersionRequired,' ') VersionRequired ,a.MenuGroup " +
                                      "from menuitem a LEFT OUTER JOIN Document b on a.DocumentID = b.DocumentID  order by a.shortdescription";
                SqlCommand cmd = new SqlCommand(query, conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    menuitemrec                  = new menuitem();
                    menuitemrec.menuItemID       = reader.GetString(0);
                    menuitemrec.description      = reader.GetString(1);
                    menuitemrec.shortDescription = reader.GetString(2);
                    menuitemrec.menuitemType     = reader.GetInt32(3);
                    menuitemrec.documentID       = reader.GetString(4);
                    menuitemrec.documentName     = reader.GetString(5);
                    menuitemrec.pageLink         = reader.GetString(6);
                    menuitemrec.menuitemStatus   = reader.GetInt32(7);
                    menuitemrec.versionrequired  = reader.GetString(10);
                    menuitemrec.menugrp          = reader.IsDBNull(11)?"": reader.GetString(11);
                    menuitems.Add(menuitemrec);
                }
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("getMenuItems() : Error");
            }
            return(menuitems);
        }
예제 #5
0
        public Boolean insertMenuItem(menuitem menu)
        {
            Boolean status   = true;
            string  utString = "";

            try
            {
                DateTime cdt       = DateTime.Now;
                string   updateSQL = "insert into MenuItem (MenuItemID,Description,ShortDescription,Type,DocumentID,PageLink,VersionRequired,MenuGroup,Status,CreateTime,CreateUser)" +
                                     "values (" +
                                     "'" + menu.menuItemID + "'," +
                                     "'" + menu.description + "'," +
                                     "'" + menu.shortDescription + "'," +
                                     menu.menuitemType + "," +
                                     "'" + menu.documentID + "'," +
                                     "'" + menu.pageLink + "'," +
                                     "'" + menu.versionrequired + "'," +
                                     "'" + menu.menugrp + "'," +
                                     menu.menuitemStatus + "," +
                                     "GETDATE()" + "," +
                                     "'" + Login.userLoggedIn + "'" + ")";
                utString = utString + updateSQL + Main.QueryDelimiter;
                utString = utString +
                           ActivityLogDB.PrepareActivityLogQquerString("insert", "MenuItem", "", updateSQL) +
                           Main.QueryDelimiter;
                if (!UpdateTable.UT(utString))
                {
                    status = false;
                }
            }
            catch (Exception)
            {
                status = false;
            }
            return(status);
        }