public async Task CallMod(string callModId, string modSearchId, string fieldNameEdit, string parram, string pedit) { //Dongpv:look updata //OrderID = parram; dialogService.Close(parram); //Dongpv:look updata HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var mod = await homeBus.GetModule(callModId); if (mod != null && mod.ModulesInfo.Any()) { if (mod.ModulesInfo.First().UIType == EUITYPE.P.ToString()) { ModalParameters parameters = new ModalParameters(); //{modId}/{modSearchId} parameters.Add("modId", callModId); parameters.Add("modSearchId", modSearchId); parameters.Add("fieldNameEdit", fieldNameEdit); parameters.Add("parram", parram); parameters.Add("pedit", pedit); Modal.Show <Pages.Edit>(moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo), parameters); } else { NavManager.NavigateTo(String.Format("/Edit/{0}/{1}/{2}/{3}/{4}", callModId, modSearchId, fieldNameEdit, parram, pedit)); } } }
public async Task GoToMod(string modId, string fieldName, string parr = "", string key = "") { HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var dataMod = await homeBus.GetModule(modId); if (!dataMod.ModulesInfo.Any()) { //return RedirectToAction("Login", "Home"); } var module = homeBus.ConvertFromViewModel(dataMod); var btnParram = new List <ButtonParamInfo>(); btnParram.Add(new ButtonParamInfo { FieldName = fieldName, Value = parr, ModuleID = modId }); if (module.ModulesInfo.ModuleTypeName == EModuleType.MAINTAIN.ToString()) { //return RedirectToAction("Edit", new { modId = modId, parram = JsonConvert.SerializeObject(btnParram) }); } else { //return RedirectToAction("Search", new { modId = modId, parramMods = JsonConvert.SerializeObject(btnParram) }); } //return View(); }
public async Task Delete(string modId, List <ButtonParamInfo> keyDels) { HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var modInfo = await homeBus.GetModule(modId); var fieldDels = CommonFunction.GetModuleFields(modInfo.FieldsInfo, modId, FLDGROUP.PARAMETER); homeBus.AssignParamField(keyDels, fieldDels); var dataExcute = await homeBus.LoadExcuteModule(modId); if (dataExcute != null) { //Dongpv: //var excute = (await moduleService.DeleteModule(dataExcute.ExecuteStore, fieldDels)); var excute = (await moduleService.DeleteData(modId, dataExcute.ExecuteStore, "", keyDels)); //Dongpv: if (excute.Data != "success") { var err = excute.Data.GetError(); var errText = await homeBus.GetErrText(err); var textMsg = await homeBus.GetTextLang(errText); JSRuntime.InvokeAsync <string>("bb_alert", textMsg, DotNetObjectReference.Create(this), "AlertCallBack"); } else { await BtnSearch(""); } } }
public async Task CallMod(string callModId, string modSearchId, List <ButtonParamInfo> parram) { HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var mod = await homeBus.GetModule(callModId); var checkCheckBoxChecked = CheckBoxModels.Where(x => x.Value); if (checkCheckBoxChecked.Count() != 1) { //JSRuntime.InvokeAsync return; } foreach (var item in parram) { var value = checkCheckBoxChecked.First().KeyValue; var dataRows = ((Newtonsoft.Json.Linq.JContainer)value); foreach (var column in dataRows) { var columnName = ((Newtonsoft.Json.Linq.JProperty)column).Name; if (columnName.ToUpper() == item.FieldName.ToUpper()) { item.Value = (((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)column).Value).Value ?? "").ToString(); } } } if (mod != null && mod.ModulesInfo.Any()) { if (mod.ModulesInfo.First().UIType == EUITYPE.P.ToString()) { ModalParameters parameters = new ModalParameters(); //{modId}/{modSearchId} parameters.Add("modId", callModId); parameters.Add("modSearchId", modSearchId); parameters.Add("fieldNameEdit", ""); parameters.Add("parram", JsonConvert.SerializeObject(parram)); parameters.Add("pedit", "1"); Modal.Show <Pages.Edit>(moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo), parameters); } else { NavManager.NavigateTo(String.Format("/Edit/{0}/{1}/{2}/{3}/{4}", callModId, modSearchId, "", JsonConvert.SerializeObject(parram), "1")); } } }
protected override async Task OnInitializedAsync() { if (!string.IsNullOrEmpty(ModId)) { ModuleInfo = await moduleService.GetModule(ModId); HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var tree = await homeBus.GetModTreeviewById(ModId); if (tree != null) { var query = new ParramModuleQuery { Store = tree.ExecuteTreestore }; TreeView = await moduleService.GetDataTreeviewInfo(query); //RawTreeView = CreateTreeView(); } } }
public async Task CallMod(string callModId, string modSearchId) { HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var mod = await homeBus.GetModule(callModId); if (mod != null && mod.ModulesInfo.Any()) { if (mod.ModulesInfo.First().UIType == EUITYPE.P.ToString()) { ModalParameters parameters = new ModalParameters(); //{modId}/{modSearchId} parameters.Add("modId", callModId); parameters.Add("modSearchId", modSearchId); Modal.Show <Pages.Edit>(moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo), parameters); } else { NavManager.NavigateTo(String.Format("/Edit/{0}/{1}", callModId, modSearchId)); } } }
public async Task SearchModuleFieldInfoOnchange(ChangeEventArgs e) { HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); #region Load DropdownList ĐK search. các phép And Or var field = moduleFieldInfo.Where(x => x.FieldID == e.Value.ToString()); if (field != null && field.Any()) { var conditionDefCode = await homeBus.LoadAllDefCode("SCDTYPE", field.First().ConditionType.ToString()); if (conditionDefCode != null && conditionDefCode.Any()) { var conditionValues = await homeBus.LoadAllDefCode(conditionDefCode.First().CodeValueName); if (conditionValues != null && conditionValues.Any()) { Conditions = conditionValues.ToList(); } } } #endregion }
public async Task ControlOnchange(ChangeEventArgs e) { field.Value = (e.Value ?? "").ToString(); HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var codeInfoParrams = new List <CodeInfoParram>(); if (!string.IsNullOrEmpty(field.Callback)) { var codeInfoParram = new CodeInfoParram { Name = field.FieldName, CtrlType = field.ControlType, ListSource = field.Callback, Parrams = (e.Value ?? "").ToString() }; codeInfoParrams.Add(codeInfoParram); var loadCallBacks = await homeBus.LoadDataListSourceControl(codeInfoParrams); foreach (var item in loadCallBacks) { if (!String.IsNullOrEmpty(item.DataCallBack)) { var dataCallBackControls = JsonConvert.DeserializeObject <List <dynamic> >(item.DataCallBack); foreach (var controlCallBack in dataCallBackControls) { var name = ((Newtonsoft.Json.Linq.JProperty)((Newtonsoft.Json.Linq.JContainer)controlCallBack).First).Name; var value = ((Newtonsoft.Json.Linq.JProperty)((Newtonsoft.Json.Linq.JContainer)controlCallBack).First).Value; var arr = new string[2]; arr[0] = name; arr[1] = value == null ? "" : value.ToString(); await JSRuntime.InvokeVoidAsync("SetValueControl", arr); } } } } }
protected override void OnInitialized() { try { editContext = new EditContext(moduleFieldInfoValidate); HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); edit = pEdit == "1" ? true : false; var data = Task.Run(() => homeBus.LoadViewBagEdit(modId, modSearchId, "", fieldNameEdit, parram, true, success)).Result; if (data != null) { moduleInfoModel = data.ModuleInfo == null ? new ModuleInfoModel() : data.ModuleInfo; moduleInfo = data.ModuleInfo == null ? new ModuleInfo() : data.ModuleInfo.ModulesInfo; } else { moduleInfoModel = new ModuleInfoModel(); moduleInfo = new ModuleInfo(); } //ViewBag.Title = moduleInfoModel.ModulesInfo == null ? "" : moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo); moduleFieldInfo = moduleInfoModel.FieldsInfo.Where(x => x.FieldGroup == FLDGROUP.COMMON.ToString()).Where(x => x.HideWeb != "Y").OrderBy(x => x.Order).ToList(); if (moduleFieldInfo == null) { moduleFieldInfo = new List <ModuleFieldInfo>(); } codeInfos = data.DataCombobox; dataControl = data.DataControl; //Set title var arr = new string[1]; arr[0] = moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo);; Task.Run(() => JSRuntime.InvokeVoidAsync("SetTitle", arr)); //Hết SetTitle foreach (var field in moduleFieldInfo) { if (dataControl != null) { foreach (var item in dataControl) { var dataRows = ((Newtonsoft.Json.Linq.JContainer)item); foreach (var column in dataRows) { var columnName = ((Newtonsoft.Json.Linq.JProperty)column).Name; if (columnName.ToUpper() == field.FieldName.ToUpper()) { if (((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)column).Value).Value != null) { field.Value += (((Newtonsoft.Json.Linq.JValue)((Newtonsoft.Json.Linq.JProperty)column).Value).Value).ToString().Trim() + ","; } } } } } if (field.Value != null) { field.Value = field.Value.Trim(','); } } var lstSources = moduleFieldInfo.Where(x => !String.IsNullOrEmpty(x.ListSource) && x.ListSource.IndexOf("(") > 0 && x.ListSource.IndexOf("()") < 0).ToList();//Lấy các list source dạng store có truyền vào tên field var fieldChild = moduleFieldInfo.Where(x => x.FieldChilds != null).Select(x => x.FieldChilds); if (fieldChild.Any()) { foreach (var child in fieldChild) { var sourceChild = child.Where(x => !String.IsNullOrEmpty(x.ListSource) && x.ListSource.IndexOf("(") > 0 && x.ListSource.IndexOf("()") < 0); if (sourceChild.Any()) { lstSources.AddRange(sourceChild.ToList()); } } } foreach (var item in lstSources) { var sourceParr = item.ListSource.Substring(item.ListSource.IndexOf("(") + 1, item.ListSource.IndexOf(")") - item.ListSource.IndexOf("(") - 1).Split(","); foreach (var source in sourceParr) { var checkItems = moduleFieldInfo.Where(x => ":" + x.FieldID.ToUpper() == source.ToUpper()); if (checkItems.Any()) { item.ListSource = item.ListSource.Replace(source, checkItems.First().Value); } } } keyEdit = data.KeyEdit; //if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName"))) //{ // return RedirectToAction("Login", "Home"); //} //await LoadViewBagEdit(modId, modSearchId, subModId, fieldNameEdit, parram, edit, success); //codeInfos = DataCombobox; } catch (Exception e) { } }
public async Task Save() { //Dongpv:FIX TO RUN //ErrorValidate = new List<string>(); //foreach (var item in moduleFieldInfo) //{ // var validator = new Common.FluentValidation(); // var rsErr = validator.Validate(item); // if (!rsErr.IsValid) // { // ErrorValidate.AddRange(rsErr.Errors.Select(x => x.ErrorMessage)); // } //} //if (ErrorValidate.Any()) //{ // return; //} //Dongpv:FIX TO RUN HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); string validate = ""; var modMaintain = await homeBus.LoadMaintainModuleInfo(modId); var store = ""; //Dongpv: var excute = new RestOutput <string>(); if (string.IsNullOrEmpty(keyEdit)) { store = modMaintain.AddInsertStore; //Dongpv: excute = (await moduleService.SaveData(modId, store, keyEdit, moduleFieldInfo)); } else { store = modMaintain.EditUpdateStore; //Dongpv: excute = (await moduleService.UpdateData(modId, store, keyEdit, moduleFieldInfo)); } //var excute = (await moduleService.SaveEditModule(modId, store, keyEdit, fieldEdits)); //Dongpv: //var excute = (await moduleService.SaveEditModule(modId, store, keyEdit, moduleFieldInfo)); //Dongpv: if (excute.Data != "success" && excute.ResultCode != 1) { var err = excute.Data.GetError(); var redrectToSearch = string.IsNullOrEmpty(parram) ? modMaintain.AddRepeatInput : modMaintain.EditRepeatInput; JSRuntime.InvokeAsync <string>("bb_alert", excute.Data, DotNetObjectReference.Create(this), "AlertCallBack", redrectToSearch); } else { if (modMaintain.ShowSuccess == "Y" || excute.ResultCode == 1) { var title = "Lưu dữ liệu thành công"; JSRuntime.InvokeAsync <string>("bb_alert", title, DotNetObjectReference.Create(this), "AlertCallBack"); //Modal.Show<Pages.Edit>(moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo), parameters); } } }
public async Task BtnSearch(string export = "") { //if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName"))) //{ // return RedirectToAction("Login", "Home"); //} HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var data = await homeBus.GetModule(modId); var module = homeBus.ConvertFromViewModel(data); ModuleInfo = module; var cb = module.FieldsInfo.Where(x => !String.IsNullOrEmpty(x.ListSource)); if (cb.Any()) { var sources = cb.Select(x => x.ListSource).Distinct().ToList(); var codeInfoParram = cb.Select(x => new CodeInfoParram { CtrlType = x.ControlType, Name = x.FieldName, ListSource = x.ListSource }); //var para = string.Join("", sources); var dataCB = (await moduleService.GetCombobox(codeInfoParram.ToList())); DataCombobox = dataCB.Data; } modSearch = await homeBus.LoadModSearchByModId(modId); if (modSearch != null) { var fieldEdits = CommonFunction.GetModuleFields(moduleFieldInfo, modId, FLDGROUP.SEARCH_CONDITION); List <string> parrams = new List <string>(); foreach (var field in fieldEdits) { if ((field.FieldType == EFieldType.DEC.ToString()) || (field.FieldType == EFieldType.INT.ToString())) { parrams.Add(string.Format("{0}={1}", field.FieldName, (field.Value ?? "").Trim())); } else { parrams.Add(string.Format("{0} LIKE N'%{1}%'", field.FieldName, (field.Value ?? "").Trim())); } var valid = field.ValidateFieldInfo(); if (!string.IsNullOrEmpty(valid)) {//Nếu validate trường dữ liệu có lỗi. var invalidArr = valid.ToStringArray('.'); var fieldName = field.FieldName; string.Join(",", invalidArr.Select(x => fieldName + " " + x)); } } var query = ""; if (modSearch.QueryFormat.IndexOf("{1}") > 0) { if (modSearch.QueryFormat.IndexOf("{2}") > 0) { var paging = String.Format(" Limit {0} offset {1}", (currPage - 1) * CommonMethod.PageSize, (currPage - 1) * CommonMethod.PageSize + CommonMethod.PageSize); query = string.Format(modSearch.QueryFormat, Schema, parrams.Any() ? String.Join(" AND ", parrams) : " 1=1 ", paging); } else { query = string.Format(modSearch.QueryFormat, Schema, parrams.Any() ? String.Join(" AND ", parrams) : " 1=1 "); } } else { query = String.Format(modSearch.QueryFormat, Schema); } //CurrPage = currPage; //FieldSubmited = fieldEdits; //Dongpv: //var dataGrid = await moduleService.LoadQueryModule(new ParramModuleQuery { Store = query }); ////var dataGrid = await moduleService.LoadQueryModule(new ParramModuleQueryDynamicQuery { LogicConditionModels= SearchConditionInstances,SearchModuleInfo= modSearch }); ////if (!string.IsNullOrEmpty(export)) ////{ //// string pathSaveAs = Path.Combine(_hostingEnvironment.WebRootPath, String.Format("FileTemplate/TemplateExport_{0}.xls", DateTime.Now.ToString("dd-MM-yyyy"))); //// Data2ExcelFile(dataGrid, module.FieldsInfo, module, pathSaveAs); //// return DownloadFile(pathSaveAs); ////} //DataSearch = dataGrid; ////int userId = int.Parse("0" + HttpContext.Session.GetString("UserId")); ////var groupModUser = await moduleService.GetGroupModByUserId(userId); ////ViewBag.RoleUser = groupModUser; var moduleFields = module.FieldsInfo.FirstOrDefault(); if (modSearch.GroupModule == "004") { string strCondition = " WHERE 1=1 "; foreach (string parm in parrams) { if (parm.IndexOf("N'%%'") == -1) { strCondition += " AND " + parm; } } Message msg = new Message(); msg.ObjectName = Constants.OBJ_SEARCH; msg.MsgType = Constants.MSG_MISC_TYPE; msg.MsgAction = Constants.MSG_SEARCH; msg.ModId = modId; msg.Body.Add("SearchObject"); msg.Body.Add(moduleFields.Entity); msg.Body.Add("Condition"); msg.Body.Add(strCondition); msg.Body.Add("Page"); msg.Body.Add(0); var dataGrid = await moduleService.getQuery(msg); DataSearch = dataGrid; } else { var dataGrid = await moduleService.LoadQueryModule(new ParramModuleQuery { Store = query }); DataSearch = dataGrid; } //Dongpv: } //return View("Search", modId); }
protected override async Task OnInitializedAsync() { try { //if (string.IsNullOrEmpty(HttpContext.Session.GetString("UserName")) && modId.ToLower() != ConstMod.ModListHomo.ToLower()) //{ // return RedirectToAction("Login", "Home"); // NavigationManager.NavigateTo("PageToRedirect"); //} //Dongpv:look updata if (!string.IsNullOrEmpty(modId) && !string.IsNullOrEmpty(OrderID)) { ArrayList arrDetail = new ArrayList(); SysUtils.String2ArrayList(ref arrDetail, OrderID, "@", "="); modId = SysUtils.getValue(arrDetail, "MODID").ToString(); //Fix //modId = "03" + modId.Substring(2, 3); } //Dongpv:look updata CheckBoxModels = new List <CheckBoxModel>(); lstControl = new List <ModuleFieldInfo>(); moduleFieldInfo = new List <ModuleFieldInfo>(); HomeBus homeBus = new HomeBus(moduleService, iConfiguration, distributedCache); var data = await homeBus.GetModule(modId); int userId = int.Parse("0" + "" /*HttpContext.Session.GetString("UserId")*/); var groupModUser = await moduleService.GetGroupModByUserId(userId); RoleUser = groupModUser; moduleInfoModel = homeBus.ConvertFromViewModel(data); //Set title var arr = new string[1]; arr[0] = moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(moduleInfoModel.LanguageInfo); await JSRuntime.InvokeVoidAsync("SetTitle", arr); //Hết SetTitle Title = moduleInfoModel.ModulesInfo.ModuleName.GetLanguageTitle(await homeBus.LoadAllBtnLanguage()); var cb = moduleInfoModel.FieldsInfo.Where(x => !String.IsNullOrEmpty(x.ListSource)); var scdType = moduleInfoModel.FieldsInfo.Select(x => x.ConditionType); if (cb.Any()) { var codeInfoParram = cb.Select(x => new CodeInfoParram { CtrlType = x.ControlType, Name = x.FieldName, ListSource = x.ListSource }); //var para = string.Join("", sources); var sourceCodeInfo = cb.Where(x => x.ListSource.Contains(":"));//Lấy những thông tin các ListSource từ DefCode var codeInfoModels = new List <CodeInfoModel>(); if (sourceCodeInfo != null && sourceCodeInfo.Any()) { var defCodeAll = await homeBus.LoadAllDefCode(); var lstSource = sourceCodeInfo.Select(x => x.ListSource).ToList(); var cbDefCode = defCodeAll.Where(x => lstSource.Contains(":" + x.CodeType + "." + x.CodeName)); foreach (var item in sourceCodeInfo) { codeInfoModels.Add(new CodeInfoModel { Name = item.FieldName, CodeInfos = cbDefCode.Where(x => ":" + x.CodeType + "." + x.CodeName == item.ListSource).ToList() }); } } var dataCB = (await moduleService.GetCombobox(codeInfoParram.Where(x => !x.ListSource.Contains(":")).ToList()));//Lấy thông tin các Combobox theo Store codeInfoModels.AddRange(dataCB.Data); DataCombobox = codeInfoModels; } modSearch = await homeBus.LoadModSearchByModId(modId); if (modSearch != null) { var parrams = new List <string>(); if (!string.IsNullOrEmpty(parramMods)) { var btnParramInfo = (List <ButtonParamInfo>)JsonConvert.DeserializeObject <List <ButtonParamInfo> >(parramMods); var temp = btnParramInfo.Select(x => x.FieldName + " = '" + x.Value + "'"); parrams.AddRange(temp); } var query = ""; if (modSearch.QueryFormat.IndexOf("{0}") > 0) { if (modSearch.QueryFormat.IndexOf("{1}") > 0) { var currPage = 1; var paging = String.Format(" Limit {1} offset {0}", (currPage - 1) * CommonMethod.PageSize, (currPage - 1) * CommonMethod.PageSize + CommonMethod.PageSize); query = string.Format(modSearch.QueryFormat, Schema, parrams.Any() ? String.Join(" AND ", parrams) : " 1=1 ", paging); } else { query = string.Format(modSearch.QueryFormat, Schema, parrams.Any() ? String.Join(" AND ", parrams) : " 1=1 "); } } else { query = String.Format(modSearch.QueryFormat, Schema); } //Dongpv: //var dataGrid = await moduleService.LoadQueryModule(new ParramModuleQuery { Store = query }); var moduleFields = moduleInfoModel.FieldsInfo.FirstOrDefault(); if (modSearch.GroupModule == "004") { Message msg = new Message(); msg.MsgType = Constants.MSG_MISC_TYPE; //MESSAGE TYPE: INQ, MAINTAIN, TXN, REPORT msg.ObjectName = Constants.OBJ_SEARCH; msg.MsgAction = Constants.MSG_SEARCH; msg.Body.Add("SearchObject"); msg.Body.Add(moduleFields.Entity); msg.Body.Add("Condition"); msg.Body.Add(" WHERE 1=1"); msg.Body.Add("Page"); msg.Body.Add(0); var dataGrid = await moduleService.getQuery(msg); DataSearch = dataGrid; } else { var dataGrid = await moduleService.LoadQueryModule(new ParramModuleQuery { Store = query }); DataSearch = dataGrid; } //Dongpv: //var dataGrid = await _moduleService.LoadQueryModule(new ParramModuleQuery { Store = modSearch.QueryFormat }); ////Dongpv: //DataSearch = dataGrid; btnInfos = moduleInfoModel.ButtonsInfo == null ? new List <ButtonInfo>() : moduleInfoModel.ButtonsInfo; var moduleInfo = moduleInfoModel.ModulesInfo == null ? new ModuleInfo() : moduleInfoModel.ModulesInfo; moduleFieldInfo = moduleInfoModel.FieldsInfo == null ? new List <ModuleFieldInfo>() : moduleInfoModel.FieldsInfo; var parrs = moduleInfoModel.ButtonParamsInfo == null ? new List <ButtonParamInfo>() : moduleInfoModel.ButtonParamsInfo; codeInfos = DataCombobox; checkColAction = btnInfos.Where(x => x.ShowOnToolbar == "N").ToList(); checkBtnViews = btnInfos.Where(x => x.ButtonName.ToUpper() == EDefModBtn.BTN_VIEW.ToString().ToUpper()).ToList(); checkBtnEdits = btnInfos.Where(x => x.ButtonName.ToUpper() == EDefModBtn.BTN_EDIT.ToString().ToUpper()).ToList(); checkBtnDels = btnInfos.Where(x => x.ButtonName.ToUpper() == EDefModBtn.BTN_DELETE.ToString().ToUpper()).ToList(); checkBtnAssRole = btnInfos.Where(x => x.ButtonName.ToUpper() == EDefModBtn.BTN_ASSIGN_ROLE.ToString().ToUpper()).ToList(); checkBtnAssUsers = btnInfos.Where(x => x.ButtonName.ToUpper() == EDefModBtn.BTN_ASSIGN_USER.ToString().ToUpper()).ToList(); if (groupMods == null || groupMods.Count == 0) { groupMods = new List <GroupMod>(); groupMods.Add(new GroupMod { GroupId = "1", ModId = moduleInfoModel.ModulesInfo.ModuleID }); if (checkBtnEdits.Any()) { groupMods.Add(new GroupMod { GroupId = "1", ModId = checkBtnEdits.First().CallModuleID }); } if (checkBtnDels.Any()) { groupMods.Add(new GroupMod { GroupId = "1", ModId = checkBtnDels.First().CallModuleID }); } } checkBtnDel = checkBtnDels.Any(); checkBtnView = checkBtnViews.Any(); checkBtnEdit = checkBtnEdits.Any(); checkBtnAssignRole = checkBtnAssRole.Any(); checkBtnAssignUser = checkBtnAssUsers.Any(); parramEdit = new List <ButtonParamInfo>(); parramView = new List <ButtonParamInfo>(); parramDel = new List <ButtonParamInfo>(); parramAssignUser = new List <ButtonParamInfo>(); if (checkBtnView) { var parramViews = parrs.Where(x => x.ButtonName == EDefModBtn.BTN_VIEW.ToString()); if (parramViews.Any()) { parramView = parramViews.ToList(); } } if (checkBtnEdit) { var parramEdits = parrs.Where(x => x.ButtonName == EDefModBtn.BTN_EDIT.ToString()); if (parramEdits.Any()) { parramEdit = parramEdits.ToList(); } } if (checkBtnDel) { var parramDels = parrs.Where(x => x.ButtonName == EDefModBtn.BTN_DELETE.ToString()); if (parramDels.Any()) { parramDel = parramDels.ToList(); } } if (checkBtnAssignUser) { var parramAssignUsers = parrs.Where(x => x.ButtonName == EDefModBtn.BTN_ASSIGN_USER.ToString()); if (parramAssignUsers.Any()) { parramAssignUser = parramAssignUsers.ToList(); } } } //return View("Search", modId); } catch (Exception ex) { //return View("Search", modId); } }