public override void Create(UserroleDataModel userrole) { if (HttpContext.Current.Session["userroleParentID"] != null) { userrole.RoleID = Convert.ToInt32(HttpContext.Current.Session["userroleParentID"]); } base.Create(userrole); }
public virtual void Update(UserroleDataModel userrole) { if (userrole.RoleID > 0 && userrole.UserID > 0) { UserroleDAL.Update(userrole); } else { throw new Exception("Page not found"); } }
public virtual void Update(UserroleDataModel userrole) { if (userrole.ID > 0) { UserroleDAL.Update(userrole); } else { throw new Exception("Page not found"); } }
public ActionResult Edit(UserroleDataModel userrole) { UserroleBO.GetInstance().Update(userrole); if (Session["userroleParentID"] != null) { return RedirectToAction("Index", new { id = Convert.ToInt32(Session["userroleParentID"]) }); } else { return RedirectToAction("Index"); } }
public ActionResult Create(UserroleDataModel userrole) { UserroleBO.GetInstance().Create(userrole); if (Session["userroleParentID"] != null) { return(RedirectToAction("Index", new { id = Convert.ToInt32(Session["userroleParentID"]) })); } else { return(RedirectToAction("Index")); } }
public static void Create(UserroleDataModel userrole) { MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_CreateUserrole", connection); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; MySqlParameter paramID = new MySqlParameter("pID",userrole.ID); paramID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramID); MySqlParameter paramUserID = new MySqlParameter("pUserID",userrole.UserID); paramUserID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramUserID); MySqlParameter paramRoleID = new MySqlParameter("pRoleID",userrole.RoleID); paramRoleID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramRoleID); DataTable results = new DataTable(); adapter.Fill(results); }
public static void Create(UserroleDataModel userrole) { MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_CreateUserrole", connection); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; MySqlParameter paramUserID = new MySqlParameter("pUserID", userrole.UserID); paramUserID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramUserID); MySqlParameter paramRoleID = new MySqlParameter("pRoleID", userrole.RoleID); paramRoleID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramRoleID); DataTable results = new DataTable(); adapter.Fill(results); }
public static UserroleDataModel Get(int id) { UserroleDataModel userrole = null; MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_GetUserroleByID", connection); MySqlParameter paramID = new MySqlParameter("pId", id); paramID.Direction = ParameterDirection.Input; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.Add(paramID); DataTable results = new DataTable(); adapter.Fill(results); if(results.Rows.Count > 0) { DataRow item = results.Rows[0]; userrole = new UserroleDataModel(); if (item["ID"].GetType() != typeof(DBNull)) { userrole.ID = Convert.ToInt32(item["ID"]); } if (item["UserID"].GetType() != typeof(DBNull)) { userrole.UserID = Convert.ToInt32(item["UserID"]); } if (item["RoleID"].GetType() != typeof(DBNull)) { userrole.RoleID = Convert.ToInt32(item["RoleID"]); } } return userrole; }
public virtual void Create(UserroleDataModel userrole) { UserroleDAL.Create(userrole); }
public static List<UserroleDataModel> GetAll() { List<UserroleDataModel> userroles = new List<UserroleDataModel>(); MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_GetUserroles", connection); DataTable results = new DataTable(); adapter.Fill(results); foreach (DataRow item in results.Rows) { UserroleDataModel userrole = new UserroleDataModel(); if (item["ID"].GetType() != typeof(DBNull)) { userrole.ID = Convert.ToInt32(item["ID"]); } if (item["UserID"].GetType() != typeof(DBNull)) { userrole.UserID = Convert.ToInt32(item["UserID"]); } if (item["RoleID"].GetType() != typeof(DBNull)) { userrole.RoleID = Convert.ToInt32(item["RoleID"]); } userroles.Add(userrole); } return userroles; }
public static List<UserroleDataModel> GetByRole(int id) { List<UserroleDataModel> userroles = new List<UserroleDataModel>(); MySqlConnection connection = new MySqlConnection(ConfigurationManager.AppSettings[BusinessUtilies.Const.Database.AppSetting]); MySqlDataAdapter adapter = new MySqlDataAdapter("Core_GetUserrolesByRole", connection); MySqlParameter paramID = new MySqlParameter("pID", id); paramID.Direction = ParameterDirection.Input; adapter.SelectCommand.Parameters.Add(paramID); adapter.SelectCommand.CommandType = CommandType.StoredProcedure; DataTable results = new DataTable(); adapter.Fill(results); foreach (DataRow item in results.Rows) { UserroleDataModel userrole = new UserroleDataModel(); if (item["ID"].GetType() != typeof(DBNull)) { userrole.ID = Convert.ToInt32(item["ID"]); } if (item["UserID"].GetType() != typeof(DBNull)) { userrole.UserID = Convert.ToInt32(item["UserID"]); } if (item["RoleID"].GetType() != typeof(DBNull)) { userrole.RoleID = Convert.ToInt32(item["RoleID"]); } userroles.Add(userrole); } return userroles; }