Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        private void BindDropDownRoles()
        {
            RoleModulesDto objRoleModulesDto = new RoleModulesDto();
            List <RoleDto> lstRoleDto        = _roleModulesService.Selectlist();
            SelectList     Slsroles          = new SelectList(lstRoleDto, "RoleId", "RoleName");

            ViewBag.Roles = Slsroles;
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        public ResultDto Update(RoleModulesDto RoleModule)
        {
            ResultDto resultDto = new ResultDto();

            return(InsertRoleModules(RoleModule));
        }
Esempio n. 6
0
 public ResultDto Insert(RoleModulesDto RoleModule)
 {
     return(InsertRoleModules(RoleModule));
 }