public ReportItem GetReport(int reportID) { Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID, TSAuthentication.UserID); report.MigrateToNewReport(); Reports.UpdateReportView(TSAuthentication.GetLoginUser(), reportID); return(new ReportItem(report, true)); }
public TaskLogProxy[] LoadHistory(int taskID, int start) { TaskLogs taskLogs = new TaskLogs(TSAuthentication.GetLoginUser()); taskLogs.LoadByTaskID(taskID, start); return(taskLogs.GetTaskLogProxies()); }
public TasksViewItemProxy[] LoadSubtasks(int taskID) { TasksView subtasks = new TasksView(TSAuthentication.GetLoginUser()); subtasks.LoadByParentID(taskID); return(subtasks.GetTasksViewItemProxies()); }
public WatercoolerLikProxy[] GetLikes(int msgid) { WatercoolerLikes likes = new WatercoolerLikes(TSAuthentication.GetLoginUser()); likes.LoadByMessageID(msgid); return(likes.GetWatercoolerLikProxies()); }
public string LoadCustomControls(ReferenceType refType) { CustomFields fields = new CustomFields(TSAuthentication.GetLoginUser()); fields.LoadByReferenceType(TSAuthentication.OrganizationID, refType, -1); int count = 0; StringBuilder htmltest = new StringBuilder(""); htmltest.Append("<div class='form-group'>"); foreach (CustomField field in fields) { if (count == 0) { htmltest.Append("<div class='row'>"); count++; } htmltest.AppendFormat("<div class='col-xs-4'><label for='{0}' class='col-xs-4 control-label'>{1}</label>", field.CustomFieldID, field.Name); switch (field.FieldType) { case CustomFieldType.Text: htmltest.AppendLine(CreateTextControl(field)); break; case CustomFieldType.Number: htmltest.AppendLine(CreateNumberControl(field)); break; case CustomFieldType.Time: htmltest.AppendLine(CreateTimeControl(field)); break; case CustomFieldType.Date: htmltest.AppendLine(CreateDateControl(field)); break; case CustomFieldType.DateTime: htmltest.AppendLine(CreateDateTimeControl(field)); break; case CustomFieldType.Boolean: htmltest.AppendLine(CreateBooleanControl(field)); break; case CustomFieldType.PickList: htmltest.AppendLine(CreatePickListControl(field)); break; default: break; } htmltest.Append("</div>"); count++; if (count % 4 == 0) { htmltest.Append("</div>"); //end row count = 0; } } if (count != 0) { count = 0; htmltest.Append("</div>"); // end row if not closed } htmltest.Append("</div>"); //end form-group count = 0; return(htmltest.ToString()); }
public List <TaskDTO> GetCustomerTasks(int from, int count, int organizationID) { List <TaskDTO> result = new List <TaskDTO>(); LoginUser loginUser = TSAuthentication.GetLoginUser(); Tasks taskHelper = new Tasks(loginUser); result = taskHelper.LoadByCompany(from, count, organizationID); return(convertToClientTasksList(result, loginUser)); }
public TsMenuItem GetNewTicketViewMenuItem(int reportID) { LoginUser loginUser = TSAuthentication.GetLoginUser(); Report report = Reports.GetReport(loginUser, reportID, loginUser.UserID); string data = @"{{""ContentUrl"":""{0}"",""PaneInfoUrl"":""{1}""}}"; return(new TsMenuItem("tickettype", "mniTicketView_" + report.ReportID.ToString(), report.Name, "vcr/1_9_0/images/nav/20/tickets.png", string.Format(data, "vcr/1_9_0/Pages/TicketView.html?ReportID=" + report.ReportID.ToString(), "vcr/1_9_0/PaneInfo/Reports.html"))); }
public ReminderProxy GetReminder(int reminderID) { Reminder reminder = Reminders.GetReminder(TSAuthentication.GetLoginUser(), (int)reminderID); if (reminder.OrganizationID != TSAuthentication.OrganizationID) { return(null); } return(reminder.GetProxy()); }
public AssetsViewItemProxy GetAsset(int assetID) { AssetsViewItem asset = AssetsView.GetAssetsViewItem(TSAuthentication.GetLoginUser(), assetID); if (asset.OrganizationID != TSAuthentication.OrganizationID) { return(null); } return(asset.GetProxy()); }
public WikiHistoryProxy GetWikiRevision(int historyID) { WikiHistory article = WikiHistoryCollection.GetWikiHistory(TSAuthentication.GetLoginUser(), historyID); if (article != null) { return(article.GetProxy()); } return(null); }
public List <TaskDTO> GetUserTasks(int from, int count, int userID) { List <TaskDTO> result = new List <TaskDTO>(); LoginUser loginUser = TSAuthentication.GetLoginUser(); Tasks taskHelper = new Tasks(loginUser); result = taskHelper.LoadByUser(from, count, userID); return(convertToClientTasksList(result, loginUser)); }
public WikiArticleProxy GetWiki(int wikiID) { WikiArticle article = WikiArticles.GetWikiArticle(TSAuthentication.GetLoginUser(), wikiID); if (article != null) { return(article.GetProxy()); } return(null); }
public TasksViewItemProxy GetTask(int taskID) { TasksViewItem task = TasksView.GetTasksViewItem(TSAuthentication.GetLoginUser(), taskID); if (task.OrganizationID != TSAuthentication.OrganizationID) { return(null); } return(task.GetProxy()); }
public int?AdminCloneReport(int reportID, string name) { if (TSAuthentication.UserID != 34 && TSAuthentication.UserID != 47 && TSAuthentication.UserID != 1839999) { return(null); } Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID); return(report.CloneReport(name)); }
public ReportProxy AdminGetReport(int reportID) { if (TSAuthentication.OrganizationID != 1078) { return(null); } Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID); return(report.GetProxy()); }
public ReportItem SaveReport(int?reportID, string name, int reportType, string data, bool isStock, bool isPrivate = false) { Report report = null; if (reportID == null) { report = (new Reports(TSAuthentication.GetLoginUser())).AddNewReport(); } else { report = Reports.GetReport(TSAuthentication.GetLoginUser(), (int)reportID); if (!TSAuthentication.IsSystemAdmin && report.CreatorID != TSAuthentication.UserID) { return(null); } } if (isStock) { if (TSAuthentication.UserID != 34 && TSAuthentication.UserID != 43 && TSAuthentication.UserID != 47 && TSAuthentication.UserID != 1839999) { return(null); } report.OrganizationID = null; } else { report.OrganizationID = TSAuthentication.OrganizationID; } report.Name = name; report.ReportDef = data; report.EditorID = TSAuthentication.UserID; report.DateEdited = DateTime.UtcNow; report.IsPrivate = isPrivate; switch (reportType) { case 0: report.ReportDefType = ReportType.Table; break; case 1: report.ReportDefType = ReportType.Chart; break; case 2: report.ReportDefType = ReportType.External; break; case 4: report.ReportDefType = ReportType.Summary; break; case 5: report.ReportDefType = ReportType.TicketView; break; default: break; } report.Collection.Save(); return(new ReportItem(report, true)); }
public void AdminUpdateQuery(int reportID, string query) { if (TSAuthentication.UserID != 34 && TSAuthentication.UserID != 47 && TSAuthentication.UserID != 4759191) { return; } Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID); report.Query = query; report.Collection.Save(); }
public void AdminChangeOrg(int reportID, string orgID) { if (TSAuthentication.UserID != 34 && TSAuthentication.UserID != 47 && TSAuthentication.UserID != 1839999) { return; } Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID); report.OrganizationID = orgID.ToUpper() == "ALL" ? null : (int?)int.Parse(orgID); report.Collection.Save(); }
public void AdminRenameReport(int reportID, string name) { if (TSAuthentication.UserID != 34 && TSAuthentication.UserID != 47 && TSAuthentication.UserID != 1839999) { return; } Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID); report.Name = name; report.Collection.Save(); }
public void CreateNewException() { try { throw new Exception("This is a test exception."); } catch (Exception ex) { ExceptionLogs.LogException(TSAuthentication.GetLoginUser(), ex, "TSSystem", "Extra Info"); } }
public DispatchService() { options.Encrypted = true; string pusherKey = SystemSettings.GetPusherKey(); string pusherAppId = SystemSettings.GetPusherAppId(); string pusherSecret = SystemSettings.GetPusherSecret(); pusher = new Pusher(pusherAppId, pusherKey, pusherSecret, options); loginUser = TSAuthentication.GetLoginUser(); }
public void ClearExceptionLogs(bool onlyCrmApi) { if (onlyCrmApi) { SqlExecutor.ExecuteNonQuery(TSAuthentication.GetLoginUser(), "DELETE FROM ExceptionLogs WHERE URL = 'CRM Processor' OR URL = 'API'"); } else { SqlExecutor.ExecuteNonQuery(TSAuthentication.GetLoginUser(), "TRUNCATE TABLE ExceptionLogs"); } }
public ServiceProxy[] GetServices() { if (TSAuthentication.OrganizationID != 1078) { return(null); } Services services = new Services(TSAuthentication.GetLoginUser()); services.LoadAll(); return(services.GetServiceProxies()); }
public List <TaskDTO> GetTasksByTicketID(int ticketID) { List <TaskDTO> result = new List <TaskDTO>(); LoginUser loginUser = TSAuthentication.GetLoginUser(); List <string> resultItems = new List <string>(); Tasks taskHelper = new Tasks(loginUser); result = taskHelper.LoadByTicketID(ticketID); return(convertToClientTasksList(result, loginUser)); }
public void DeleteWiki(int wikiID) { LoginUser loggedInUser = TSAuthentication.GetLoginUser(); WikiArticle wiki = WikiArticles.GetWikiArticle(loggedInUser, wikiID); wiki.IsDeleted = true; wiki.ModifiedDate = DateTime.UtcNow; wiki.ModifiedBy = loggedInUser.UserID; wiki.Collection.Save(); ReparentArticles(wikiID); }
public ChatUserSettingProxy GetCurrentUserChatSettings() { LoginUser loginUser = TSAuthentication.GetLoginUser(); ChatUserSetting setting = ChatUserSettings.GetChatUserSetting(loginUser, TSAuthentication.UserID); if (setting == null) { setting = (new ChatUserSettings(loginUser)).AddNewChatUserSetting(); setting.UserID = TSAuthentication.UserID; } return(setting.GetProxy()); }
public override bool Save() { if (IsValid()) { if (_isCloning) { //Clone SLA here LoginUser loginUser = TSAuthentication.GetLoginUser(); int clonedSlaLevelId = 0; try { SlaLevel originalSlaLevel = SlaLevels.GetSlaLevel(loginUser, _slaLevelID); SlaLevel clonedSlaLevel = originalSlaLevel.Clone(textName.Text.Trim()); clonedSlaLevelId = clonedSlaLevel.SlaLevelID; } catch (Exception ex) { ExceptionLogs.LogException(loginUser, ex, "Cloning Sla", "SlaLevel.aspx.cs.Save"); } } else { SlaLevel level; SlaLevels levels = new SlaLevels(UserSession.LoginUser); if (_slaLevelID < 0) { level = levels.AddNewSlaLevel(); level.OrganizationID = UserSession.LoginUser.OrganizationID; } else { level = SlaLevels.GetSlaLevel(UserSession.LoginUser, _slaLevelID); if (level == null) { return(false); } } level.Name = textName.Text; level.Collection.Save(); DialogResult = level.SlaLevelID.ToString(); } } else { return(false); } return(true); }
public AssetAssignmentsViewItemProxy[] GetAssetAssignments(int assetID) { AssetAssignmentsView assetAssignments = new AssetAssignmentsView(TSAuthentication.GetLoginUser()); assetAssignments.LoadByAssetID(assetID); List <AssetAssignmentsViewItemProxy> result = new List <AssetAssignmentsViewItemProxy>(); foreach (AssetAssignmentsViewItem assetAssignment in assetAssignments) { result.Add(assetAssignment.GetProxy()); } return(result.ToArray()); }
public string SetAssetNotes(int assetID, string value) { LoginUser loginUser = TSAuthentication.GetLoginUser(); Asset o = Assets.GetAsset(loginUser, assetID); string description = String.Format("Changed Notes from \"{0}\" to \"{1}\".", o.Notes, value); o.Notes = value; o.DateModified = DateTime.UtcNow; o.ModifierID = loginUser.UserID; o.Collection.Save(); ActionLogs.AddActionLog(loginUser, ActionLogType.Update, ReferenceType.Assets, assetID, description); return(value != "" ? value : "Empty"); }
public string GetAllReports() { List <ReportItem> result = new List <ReportItem>(); Reports reports = new Reports(TSAuthentication.GetLoginUser()); reports.LoadAll(TSAuthentication.OrganizationID, TSAuthentication.UserID); foreach (Report report in reports) { result.Add(new ReportItem(report, false)); } return(JsonConvert.SerializeObject(result)); }