private bool CanUpdateContactTitle(User contact, string title) { bool canUpdate = false; bool wasUpdatedByUser = false; ActionLogs actionLogs = new ActionLogs(LoginUser); actionLogs.LoadByUserID(contact.UserID); ActionLog lastActionLog = actionLogs.OrderByDescending(p => p.DateCreated) .Where(p => p.RefType == ReferenceType.Users && p.Description.ToLower().Contains("set contact title")) .FirstOrDefault(); //If the title has been updated before, we need to check if the user did it. If not then we can update. if (lastActionLog != null) { wasUpdatedByUser = lastActionLog.ModifierID > 0; if (!wasUpdatedByUser) { canUpdate = contact.Title != title; } } else if (string.IsNullOrEmpty(contact.Title)) { //The title has never changed. Update it if empty canUpdate = true; } return(canUpdate); }
protected void gridActionLogs_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { ActionLogs actionLogs = new ActionLogs(UserSession.LoginUser); if (_referenceType == ReferenceType.None) { actionLogs.LoadAll(); } else if (_referenceType == ReferenceType.Groups) { actionLogs.LoadByGroupID(_referenceID); } else if (_referenceType == ReferenceType.Users) { actionLogs.LoadByUserID(_referenceID); } else if (_referenceType == ReferenceType.Organizations) { actionLogs.LoadByOrganizationID(_referenceID); } else if (_referenceType == ReferenceType.Products) { actionLogs.LoadByProductID(_referenceID); } else if (_referenceType == ReferenceType.ProductVersions) { actionLogs.LoadByProductVersionID(_referenceID); } else if (_referenceType == ReferenceType.Tickets) { actionLogs.LoadByTicketID(_referenceID); } gridActionLogs.VirtualItemCount = actionLogs.Count; gridActionLogs.DataSource = actionLogs; }
protected void gridActionLogs_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { ActionLogs actionLogs = new ActionLogs(UserSession.LoginUser); switch (_refType) { case ReferenceType.None: actionLogs.LoadAll(); break; case ReferenceType.Actions: break; case ReferenceType.ActionTypes: break; case ReferenceType.Addresses: break; case ReferenceType.Attachments: break; case ReferenceType.CustomFields: break; case ReferenceType.CustomValues: break; case ReferenceType.Groups: actionLogs.LoadByGroupID(_refID); break; case ReferenceType.GroupUsers: break; case ReferenceType.OrganizationProducts: break; case ReferenceType.Organizations: actionLogs.LoadByOrganizationID(_refID); break; case ReferenceType.OrganizationTickets: break; case ReferenceType.PhoneNumbers: break; case ReferenceType.PhoneTypes: break; case ReferenceType.Products: actionLogs.LoadByProductID(_refID); break; case ReferenceType.ProductVersions: actionLogs.LoadByProductVersionID(_refID); break; case ReferenceType.ProductVersionStatuses: break; case ReferenceType.TechDocs: break; case ReferenceType.Tickets: actionLogs.LoadByTicketID(_refID); break; case ReferenceType.TicketSeverities: break; case ReferenceType.TicketStatuses: break; case ReferenceType.Subscriptions: break; case ReferenceType.TicketTypes: break; case ReferenceType.Users: actionLogs.LoadByUserID(_refID); break; case ReferenceType.ActionLogs: break; case ReferenceType.BillingInfo: break; case ReferenceType.ExceptionLogs: break; case ReferenceType.Invoices: break; case ReferenceType.SystemSettings: break; case ReferenceType.TicketNextStatuses: break; case ReferenceType.UserSettings: break; case ReferenceType.TicketQueue: break; case ReferenceType.CreditCards: break; case ReferenceType.Contacts: break; default: break; } gridActionLogs.VirtualItemCount = actionLogs.Count; gridActionLogs.DataSource = actionLogs; }