Пример #1
0
        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));
        }
Пример #2
0
        public TaskLogProxy[] LoadHistory(int taskID, int start)
        {
            TaskLogs taskLogs = new TaskLogs(TSAuthentication.GetLoginUser());

            taskLogs.LoadByTaskID(taskID, start);

            return(taskLogs.GetTaskLogProxies());
        }
Пример #3
0
        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());
        }
Пример #5
0
        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());
        }
Пример #6
0
        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));
        }
Пример #7
0
        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")));
        }
Пример #8
0
        public ReminderProxy GetReminder(int reminderID)
        {
            Reminder reminder = Reminders.GetReminder(TSAuthentication.GetLoginUser(), (int)reminderID);

            if (reminder.OrganizationID != TSAuthentication.OrganizationID)
            {
                return(null);
            }
            return(reminder.GetProxy());
        }
Пример #9
0
        public AssetsViewItemProxy GetAsset(int assetID)
        {
            AssetsViewItem asset = AssetsView.GetAssetsViewItem(TSAuthentication.GetLoginUser(), assetID);

            if (asset.OrganizationID != TSAuthentication.OrganizationID)
            {
                return(null);
            }
            return(asset.GetProxy());
        }
Пример #10
0
        public WikiHistoryProxy GetWikiRevision(int historyID)
        {
            WikiHistory article = WikiHistoryCollection.GetWikiHistory(TSAuthentication.GetLoginUser(), historyID);

            if (article != null)
            {
                return(article.GetProxy());
            }
            return(null);
        }
Пример #11
0
        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));
        }
Пример #12
0
        public WikiArticleProxy GetWiki(int wikiID)
        {
            WikiArticle article = WikiArticles.GetWikiArticle(TSAuthentication.GetLoginUser(), wikiID);

            if (article != null)
            {
                return(article.GetProxy());
            }
            return(null);
        }
Пример #13
0
        public TasksViewItemProxy GetTask(int taskID)
        {
            TasksViewItem task = TasksView.GetTasksViewItem(TSAuthentication.GetLoginUser(), taskID);

            if (task.OrganizationID != TSAuthentication.OrganizationID)
            {
                return(null);
            }
            return(task.GetProxy());
        }
Пример #14
0
        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));
        }
Пример #15
0
        public ReportProxy AdminGetReport(int reportID)
        {
            if (TSAuthentication.OrganizationID != 1078)
            {
                return(null);
            }
            Report report = Reports.GetReport(TSAuthentication.GetLoginUser(), reportID);

            return(report.GetProxy());
        }
Пример #16
0
        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));
        }
Пример #17
0
        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();
        }
Пример #18
0
        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();
        }
Пример #19
0
        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();
        }
Пример #20
0
 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();
        }
Пример #22
0
 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");
     }
 }
Пример #23
0
        public ServiceProxy[] GetServices()
        {
            if (TSAuthentication.OrganizationID != 1078)
            {
                return(null);
            }
            Services services = new Services(TSAuthentication.GetLoginUser());

            services.LoadAll();
            return(services.GetServiceProxies());
        }
Пример #24
0
        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));
        }
Пример #25
0
        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);
        }
Пример #26
0
        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());
        }
Пример #27
0
    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);
    }
Пример #28
0
        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());
        }
Пример #29
0
        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");
        }
Пример #30
0
        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));
        }