private ResultDto InsertRoleModules(RoleModulesDto RoleModulesDto) { ResultDto resultDto = new ResultDto(); string objectName = "RoleModule"; try { int RoleModuleId = RoleModulesDto.RoleModuleId; int rowAffected = _RoleModulesDal.InsertRoleModules(RoleModulesDto); resultDto.ObjectId = RoleModuleId; if (resultDto.ObjectId > 0) { resultDto.Message = string.Format("{0} details saved successfully", objectName); } else { resultDto.Message = string.Format("Error occured while saving {0} details", objectName); } } catch (Exception) { resultDto.Message = string.Format("Service layer error occured while saving the {0} details", objectName); resultDto.ObjectId = -98; } return(resultDto); }
public int InsertRoleModules(RoleModulesDto RoleModulesDto) { int rowseffected = default(int); SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmdRoleModule = new SqlCommand(ProcNames.uspRoleModulesInsertUpdate, con); cmdRoleModule.CommandType = CommandType.StoredProcedure; cmdRoleModule.Parameters.AddWithValue("@RoleModuleCode", RoleModulesDto.RoleModuleCode); cmdRoleModule.Parameters.AddWithValue("@Roleid", RoleModulesDto.RoleId); cmdRoleModule.Parameters.AddWithValue("@ModuleId", RoleModulesDto.ModuleId); cmdRoleModule.Parameters.AddWithValue("@ModuleActionId", RoleModulesDto.ModuleActionId); // cmdRoleModule.Parameters.AddWithValue("@RoleModuleId", ParameterDirection.Output); SqlParameter param = new SqlParameter("@RoleModuleId", SqlDbType.Int); param.Direction = ParameterDirection.InputOutput; param.Value = RoleModulesDto.RoleModuleId; cmdRoleModule.Parameters.Add(param); con.Open(); rowseffected = cmdRoleModule.ExecuteNonQuery(); RoleModulesDto.RoleModuleId = Convert.ToInt32(cmdRoleModule.Parameters["@RoleModuleId"].Value); return(rowseffected); }
private void BindDropDownRoles() { RoleModulesDto objRoleModulesDto = new RoleModulesDto(); List <RoleDto> lstRoleDto = _roleModulesService.Selectlist(); SelectList Slsroles = new SelectList(lstRoleDto, "RoleId", "RoleName"); ViewBag.Roles = Slsroles; }
public List <RoleModulesDto> GetAllRoleModules() { List <RoleModulesDto> lstall = new List <RoleModulesDto>(); SqlConnection con = new SqlConnection(DBConstants.MFIS_CS); SqlCommand cmd = new SqlCommand(ProcNames.uspGetRoleModulesLookup, con); cmd.CommandType = CommandType.StoredProcedure; con.Open(); SqlDataReader dr = cmd.ExecuteReader(); RoleModulesDto objroles; while (dr.Read()) { objroles = new RoleModulesDto(); objroles.RoleModuleId = Convert.ToInt32(dr["RoleModuleId"]); objroles.RoleName = Convert.ToString(dr["RoleName"]); objroles.MainModule = Convert.ToString(dr["MainModule"]); objroles.SubModules = Convert.ToString(dr["SubModule"]); objroles.StatusCode = Convert.ToString(dr["StatusCode"]); lstall.Add(objroles); } return(lstall); }
public ResultDto Update(RoleModulesDto RoleModule) { ResultDto resultDto = new ResultDto(); return(InsertRoleModules(RoleModule)); }
public ResultDto Insert(RoleModulesDto RoleModule) { return(InsertRoleModules(RoleModule)); }