/// <summary> /// Method To Populate the Record in Find User /// </summary> public void ViewUserData(object obj) { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); try { cmdName = Resources.msgview; VisibilityEditUserTab = true; FindUserDeligate.SetValueMethod(((AppWorks.UI.ViewModel.AdminUser.UserDetails)(obj)).UdUserCode); FindUserDeligate.SetValueMethodCmd(cmdName); SeletedTabFinduser = 1; } catch (Exception ex) { LogHelper.LogErrorToDb(ex); bool displayErrorOnUI = false; CommonSettings.logger.LogError(this.GetType(), ex); if (displayErrorOnUI) { throw; } } finally { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }
/// <summary> /// Function to Delete record for user. /// </summary> /// <param name="obj"></param> /// <returns>void</returns> /// <createdBy></createdBy> public void DeleteRecord(object obj) { try { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); MessageBoxResult messageBoxResult = MessageBox.Show(Resources.MsgDeleteConfirm, Resources.msgTitleMessageBoxDelete, MessageBoxButton.YesNo); if (messageBoxResult == MessageBoxResult.Yes) { string errMsg = string.Empty; FindUserProp objFindUserProp = new FindUserProp(); objFindUserProp.UserID = obj.GetType().GetProperty("UdUserID").GetValue(obj).ToString(); objFindUserProp.RecordStatus = "Inactive"; objFindUserProp.FirstName = obj.GetType().GetProperty("UdUserFirstName").GetValue(obj).ToString();; objFindUserProp.LastName = obj.GetType().GetProperty("UdUserLastName").GetValue(obj).ToString();; objFindUserProp.UserCode = obj.GetType().GetProperty("UdUserCode").GetValue(obj).ToString();; objFindUserProp.SelectedRole = SelectedRole; string currentUserName = Application.Current.Properties["LoggedInUserName"].ToString().ToUpper(); string deleteUserName = objFindUserProp.UserCode.ToUpper(); if (deleteUserName != currentUserName) { int value = _serviceInstance.RemoveUserDetails(objFindUserProp); if (SelectedStatus != null && !SelectedStatus.Equals("All")) { objFindUserProp.selectedStatusRole = SelectedStatus; } if (obj.GetType().GetProperty("UdUserStatus").GetValue(obj) != null && !obj.GetType().GetProperty("UdUserStatus").GetValue(obj).ToString().Equals("All")) { objFindUserProp.selectedStatusRole = obj.GetType().GetProperty("UdUserStatus").GetValue(obj).ToString();; } FindUserDeligate.SetValueMethodCmdReferesh(string.Empty); MessageBox.Show(Resources.msgDeleteSuccessfully); UsersRecordList(null); } else { MessageBox.Show(Resources.WarnDeleteCurrentUser); } } } catch (Exception ex) { LogHelper.LogErrorToDb(ex); bool displayErrorOnUI = false; CommonSettings.logger.LogError(this.GetType(), ex); if (displayErrorOnUI) { throw; } } finally { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }
/// <summary> /// Method To Populate the Record in Find User /// </summary> public void FillUserDataOnSelection(object obj) { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); try { Telerik.Windows.Controls.GridView.GridViewCell objSelectedUser = (Telerik.Windows.Controls.GridView.GridViewCell)obj; //AppWorks.UI.ViewModel.AdminUser.UserDetails selected = (AppWorks.UI.ViewModel.AdminUser.UserDetails) objSelectedUser; cmdName = Resources.btnView; VisibilityEditUserTab = true; FindUserDeligate.SetValueMethod(((AppWorks.UI.ViewModel.AdminUser.UserDetails)(objSelectedUser.Value)).UdUserCode); FindUserDeligate.SetValueMethodCmd(cmdName); SeletedTabFinduser = 1; //foreach (System.Windows.Window window in System.Windows.Application.Current.Windows) //{ // if (window.Title.Equals("Find User")) // { // window.Close(); // } //} } catch (Exception ex) { LogHelper.LogErrorToDb(ex); bool displayErrorOnUI = false; CommonSettings.logger.LogError(this.GetType(), ex); if (displayErrorOnUI) { throw; } } finally { CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name)); } }