static public MenuEform[] getMenu(string oEmpcode, string oRoleId) { string sql = @"SELECT m.Menu_Code, m.Menu_Name, m.Menu_Parent, m.Menu_PageURL, m.Menu_Type, m.Menu_Order, m.Menu_Status, m.Menu_Seq, ro.Role_All, ru.Role_id FROM T_Role_User as ru INNER JOIN T_Role_Object as ro ON ru.Role_id = ro.Role_id INNER JOIN T_Menu_Mee as m ON ro.Search_header_id = m.Menu_Code where ru.Role_id in (" + oRoleId + ")" + " and ru.emp_code = '" + oEmpcode + "' and m.Menu_Status = 1 "; ConnectDatabase fn = new ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString); DataTable dtbMenu = fn.GetDataAdapter(sql); if (dtbMenu.Rows.Count > 0) { List <MenuEform> oMenu = new List <MenuEform>(); foreach (DataRow drv in dtbMenu.Rows) { MenuEform menu = new MenuEform(drv["Menu_Code"].ToString(), drv["Menu_Name"].ToString(), drv["Menu_PageURL"].ToString(), drv["Menu_Type"].ToString(), bool.Parse(drv["Menu_Status"].ToString()), int.Parse(drv["Menu_Parent"].ToString()), int.Parse(drv["Menu_Order"].ToString()), int.Parse(drv["Menu_Seq"].ToString())); oMenu.Add(menu); } return(oMenu.ToArray()); } return(null); }
static public bool checkRoleId(string oEmpCode) { string sql = @"SELECT * FROM T_Role_User WHERE emp_code = '" + oEmpCode + "' "; ConnectDatabase fn = new ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString); DataTable dtbRole = fn.GetDataAdapter(sql); if (dtbRole.Rows.Count == 0) { return(false); } return(true); }
static public DataTable getMenuDT(string oEmpcode, string oRoleId, string oTypeEform) { string sql = @"SELECT m.Menu_Code, m.Menu_Name, m.Menu_Parent, m.Menu_PageURL, m.Menu_Type, m.Menu_Order, m.Menu_Status, m.Menu_Seq, sum(Convert(int,ro.Role_All)) as Role_All FROM T_Role_User as ru INNER JOIN T_Role_Object as ro ON ru.Role_id = ro.Role_id INNER JOIN T_Menu as m ON ro.Search_header_id = m.Menu_Code where ru.Role_id in (" + oRoleId + ") and ro.type_eform='" + oTypeEform + "'" + " and ru.emp_code = '" + oEmpcode + "' and m.Menu_Status = 1 " + " group by m.Menu_Code, m.Menu_Name, m.Menu_Parent, m.Menu_PageURL, m.Menu_Type, " + " m.Menu_Order, m.Menu_Status, m.Menu_Seq " + " order by m.menu_seq, m.Menu_Order"; ConnectDatabase fn = new ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString); return(fn.GetDataAdapter(sql)); }
static public RoleUser[] getRoleId(string oEmpCode) { string sql = "SELECT * FROM T_Role_User WHERE emp_code='" + oEmpCode + "'"; ConnectDatabase fn = new ConnectDatabase(System.Configuration.ConfigurationManager.ConnectionStrings["Myconnect"].ConnectionString); DataTable dtbRole = fn.GetDataAdapter(sql); if (dtbRole.Rows.Count > 0) { List <RoleUser> oRoleUser = new List <RoleUser>(); foreach (DataRow drv in dtbRole.Rows) { RoleUser role = new RoleUser(drv["Role_id"].ToString()); oRoleUser.Add(role); } return(oRoleUser.ToArray()); } return(null); }