/// <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)); } }