/// <summary> /// Gets All menuRights for every Menutags and set visibility to menustrip items /// </summary> public bool checkUserPermission(u_User User, string g_MenuId, string oparation) { u_UserRights objUserRight = new u_UserRights(); objUserRight.User = new u_User(); objUserRight.MenuTag = new u_MenuTag(); u_UserRights_BL objUserRghtsBL = new u_UserRights_BL(); objUserRight.User.strUserID = User.strUserID; objUserRight.MenuTag.strMenuID = g_MenuId; DataTable dtAllMenuItems = objUserRghtsBL.GetUserRights(objUserRight); if (dtAllMenuItems.Rows.Count != 0) { for (int i = 0; i < dtAllMenuItems.Rows.Count; i++) { switch (oparation) { case "process": if (Convert.ToBoolean(dtAllMenuItems.Rows[i]["dtPrint"].ToString()) == true) { return(true); } break; } } } return(false); }
/// <summary> /// Check whether there exist any Users to the entered EmployeeID in the u_User table /// Modified By Nilmini 2013/10/29 /// </summary> /// <param name="objUser">object of a u_User class in the smartOffice_Models which carried Employee ID</param> /// <returns>if user exist in the u_User table, returns user details, else null</returns> public u_User GetUserDetailsforEmployeeIDToEdit(u_User objUser) { try { u_User_DL objUserDL = new u_User_DL(); if (objUserDL.isEmpExist(objUser) == true) { if (objUserDL.isEmpUserExist(objUser) == true) { objUser = objUserDL.GetExistingUserToEmpID(objUser); objUser.strPassword = CreateCheckPassword(false, objUser.strPassword); return(objUser); } else { return(null); } } else { return(null); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Check whether there exist any employees to the entered EmployeeID /// Modified By Nilmini 2013/12/18 /// </summary> /// <param name="objUser">object of a u_User class in the smartOffice_Models which carried Employee ID</param> /// <returns>if employee exist in the employee table, returns true, else false</returns> public bool isEmpExist(u_User objUser) { try { u_User_DL objUserDL = new u_User_DL(); return(objUserDL.isEmpExist(objUser)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Edit existing User /// Modified By Nilmini 2013/12/18 /// </summary> /// <param name="objUser">Object of a u_User class carried Employee ID</param> /// <returns>if saved or updated successfully, returns true, else false</returns> public bool EditUser(u_User objUser) { try { u_User_DL objUserDL = new u_User_DL(); objUser.strPassword = CreateCheckPassword(true, objUser.strPassword); //if (objUserDL.isUserIDExistforEmployee(objUser) == true) //{ // return objUserDL.UpdateUser(objUser); //} return(objUserDL.UpdateUser(objUser)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Save new User or update existing User /// Modified By Nilmini 2013/10/28 /// </summary> /// <param name="objUser">Object of a u_User class carried Employee ID</param> /// <returns>if saved or updated successfully, returns true, else false</returns> public bool SaveUser(u_User objUser) { try { u_User_DL objUserDL = new u_User_DL(); objUser.strPassword = CreateCheckPassword(true, objUser.strPassword); if (objUserDL.isUserIDExistforEmployee(objUser) == true) { return(objUserDL.UpdateUser(objUser)); } else { return(objUserDL.saveUser(objUser)); } } catch (Exception ex) { throw ex; } }