private void OkAction() { try { RefreshValidator(); if (!this.messagePop.HasError()) { if (this.isEdit) { this.currentRole.MAKER_ID = CurrentSystemLogin.CurrentUser.TLNANME; this.preAuthStatus = this.currentRole.AUTH_STATUS; this.currentRole.AUTH_STATUS = "U"; ObservableCollection <TL_SYSROLEDETAIL> lstRoleDetailUpdate = new ObservableCollection <TL_SYSROLEDETAIL>(); ObservableCollection <TL_SYSROLEDETAIL> lstRoleDetailInsert = new ObservableCollection <TL_SYSROLEDETAIL>(); ActionMenuRole actionRole; TL_SYSROLEDETAIL newItemRoleDetail; bool? isNull = true; foreach (var key in this.dicCheckBoxItem.Keys) { isNull = this.dicCheckBoxItem[key].IsChecked; if (isNull == null || isNull.Value) { actionRole = this.dicMenuRole[key]; newItemRoleDetail = new TL_SYSROLEDETAIL() { ISAPPROVE = actionRole.Approve, ISCLOSE = actionRole.Close, ISDELETE = actionRole.Delete, ISEDIT = actionRole.Edit, ISINSERT = actionRole.Insert, ISSEARCH = actionRole.Search, ISUPDATE = actionRole.Update, ISVIEW = actionRole.View, MENU_ID = key, ROLE_ID = this.currentRole.ROLE_ID, ISCHECKNULL = (isNull == null ? true : false) }; if (this.lstInsertRoleDetail.Contains(key)) { lstRoleDetailInsert.Add(newItemRoleDetail); } else { lstRoleDetailUpdate.Add(newItemRoleDetail); } } } MyHelper.IsBusy(); this.roleClient.UpdateTLSYSROLEAsync(this.currentRole, lstRoleDetailUpdate, lstRoleDetailInsert, lstDeleteRoleDetail); } else { ObservableCollection <TL_SYSROLEDETAIL> lstRoleDetail = new ObservableCollection <TL_SYSROLEDETAIL>(); ActionMenuRole actionRole; bool? isNull = true; foreach (var key in this.dicCheckBoxItem.Keys) { isNull = this.dicCheckBoxItem[key].IsChecked; if (isNull == null || isNull.Value) { actionRole = this.dicMenuRole[key]; lstRoleDetail.Add(new TL_SYSROLEDETAIL() { ISAPPROVE = actionRole.Approve, ISCLOSE = actionRole.Close, ISDELETE = actionRole.Delete, ISEDIT = actionRole.Edit, ISINSERT = actionRole.Insert, ISSEARCH = actionRole.Search, ISUPDATE = actionRole.Update, ISVIEW = actionRole.View, MENU_ID = key, ROLE_ID = this.currentRole.ROLE_ID, ISCHECKNULL = (isNull == null ? true : false) }); } } MyHelper.IsBusy(); this.roleClient.InsertTLSYSROLEAsync(this.currentRole, lstRoleDetail); } // this.roleClient.InsertTLSYSROLEAsync(this.currentRole); } } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }
private void OkAction() { try { RefreshValidator(); if (!this.messagePop.HasError()) { if (this.isEdit) { this.currentRole.MAKER_ID = CurrentSystemLogin.CurrentUser.TLNANME; this.preAuthStatus = this.currentRole.AUTH_STATUS; this.currentRole.AUTH_STATUS = "U"; ObservableCollection<TL_SYSROLEDETAIL> lstRoleDetailUpdate = new ObservableCollection<TL_SYSROLEDETAIL>(); ObservableCollection<TL_SYSROLEDETAIL> lstRoleDetailInsert = new ObservableCollection<TL_SYSROLEDETAIL>(); ActionMenuRole actionRole; TL_SYSROLEDETAIL newItemRoleDetail; bool? isNull = true; foreach (var key in this.dicCheckBoxItem.Keys) { isNull = this.dicCheckBoxItem[key].IsChecked; if (isNull == null || isNull.Value) { actionRole = this.dicMenuRole[key]; newItemRoleDetail = new TL_SYSROLEDETAIL() { ISAPPROVE = actionRole.Approve, ISCLOSE = actionRole.Close, ISDELETE = actionRole.Delete, ISEDIT = actionRole.Edit, ISINSERT = actionRole.Insert, ISSEARCH = actionRole.Search, ISUPDATE = actionRole.Update, ISVIEW = actionRole.View, MENU_ID = key, ROLE_ID = this.currentRole.ROLE_ID, ISCHECKNULL = (isNull == null ? true : false) }; if (this.lstInsertRoleDetail.Contains(key)) lstRoleDetailInsert.Add(newItemRoleDetail); else lstRoleDetailUpdate.Add(newItemRoleDetail); } } MyHelper.IsBusy(); this.roleClient.UpdateTLSYSROLEAsync(this.currentRole, lstRoleDetailUpdate, lstRoleDetailInsert, lstDeleteRoleDetail); } else { ObservableCollection<TL_SYSROLEDETAIL> lstRoleDetail = new ObservableCollection<TL_SYSROLEDETAIL>(); ActionMenuRole actionRole; bool? isNull = true; foreach (var key in this.dicCheckBoxItem.Keys) { isNull = this.dicCheckBoxItem[key].IsChecked; if (isNull == null || isNull.Value) { actionRole = this.dicMenuRole[key]; lstRoleDetail.Add(new TL_SYSROLEDETAIL() { ISAPPROVE = actionRole.Approve, ISCLOSE = actionRole.Close, ISDELETE = actionRole.Delete, ISEDIT = actionRole.Edit, ISINSERT = actionRole.Insert, ISSEARCH = actionRole.Search, ISUPDATE = actionRole.Update, ISVIEW = actionRole.View, MENU_ID = key, ROLE_ID = this.currentRole.ROLE_ID, ISCHECKNULL = (isNull == null ? true : false) }); } } MyHelper.IsBusy(); this.roleClient.InsertTLSYSROLEAsync(this.currentRole, lstRoleDetail); } // this.roleClient.InsertTLSYSROLEAsync(this.currentRole); } } catch (Exception ex) { this.messagePop.SetSingleError(ex.Message); } }