示例#1
0
    private void LoadEAICombos()
    {
        RadComboBox combo  = wndAltEmail.ContentContainer.FindControl("cmbEAIGroup") as RadComboBox;
        Groups      groups = new Groups(UserSession.LoginUser);

        groups.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (Group group in groups)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(group.Name, group.GroupID.ToString()));
        }
        combo.SelectedIndex = 0;

        combo = wndAltEmail.ContentContainer.FindControl("cmbEAITicket") as RadComboBox;
        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (TicketType ticketType in ticketTypes)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(ticketType.Name, ticketType.TicketTypeID.ToString()));
        }
        combo.SelectedIndex = 0;

        combo = wndAltEmail.ContentContainer.FindControl("cmbEAIProduct") as RadComboBox;
        Products products = new Products(UserSession.LoginUser);

        products.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
        combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem("Unassigned", "-1"));
        foreach (Product product in products)
        {
            combo.Items.Add(new Telerik.Web.UI.RadComboBoxItem(product.Name, product.ProductID.ToString()));
        }
        combo.SelectedIndex = 0;
    }
        public string GetData()
        {
            TicketsView tickets     = new TicketsView(_command.LoginUser);
            TicketTypes ticketTypes = new TicketTypes(_command.LoginUser);

            ticketTypes.LoadAllPositions(_command.Organization.OrganizationID);
            TicketType   ticketType = null;
            CustomFields customFields;
            string       elementName = "Ticket";

            switch (_restTicketType)
            {
            case RestTicketType.Bug:
                elementName = "Bug";
                ticketType  = ticketTypes.FindByName("Bugs");
                break;

            case RestTicketType.Feature:
                elementName = "Feature";
                ticketType  = ticketTypes.FindByName("Features");
                break;

            case RestTicketType.Task:
                elementName = "Task";
                ticketType  = ticketTypes.FindByName("Tasks");
                break;

            case RestTicketType.Issue:
                elementName = "Issue";
                ticketType  = ticketTypes.FindByName("Issues");
                break;

            default:
                break;
            }

            if (ticketType == null)
            {
                tickets.LoadByOrganizationID(_command.Organization.OrganizationID);
                customFields = null;
            }
            else
            {
                tickets.LoadByTicketTypeID(ticketType.TicketTypeID);
                customFields = new CustomFields(_command.LoginUser);
                customFields.LoadByTicketTypeID(_command.Organization.OrganizationID, ticketType.TicketTypeID);
            }

            RestXmlWriter writer = new RestXmlWriter(elementName + "s");

            foreach (TicketsViewItem ticket in tickets)
            {
                writer.XmlWriter.WriteStartElement(elementName);
                RestTicketsViewItem.WriteTicketsViewItemXml(_command, writer.XmlWriter, ticket, customFields);
                writer.XmlWriter.WriteEndElement();
            }
            return(writer.GetXml());
        }
        private static void ConfirmBaseData(LoginUser loginUser)
        {
            Organization organization = (Organization)Organizations.GetOrganization(loginUser, loginUser.OrganizationID);
            TicketTypes  types        = new TicketTypes(loginUser);

            types.LoadAllPositions(loginUser.OrganizationID);

            if (types.IsEmpty)
            {
                Organizations.CreateStandardData(loginUser, organization, true, true);
            }
        }
    public static RadComboBoxItemData[] GetTypesCombo()
    {
        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);

        List <RadComboBoxItemData> data = new List <RadComboBoxItemData>();

        foreach (TicketType ticketType in ticketTypes)
        {
            RadComboBoxItemData item = new RadComboBoxItemData();
            item.Text  = ticketType.Name;
            item.Value = ticketType.TicketTypeID.ToString();
            data.Add(item);
        }
        return(data.ToArray());
    }
示例#5
0
        public AutomationData GetData()
        {
            AutomationData result = new AutomationData();
            TicketAutomationPossibleActions actions = new TicketAutomationPossibleActions(UserSession.LoginUser);

            actions.LoadActive();
            result.Actions = actions.GetTicketAutomationPossibleActionProxies();


            List <AutoFieldItem> fieldItems = new List <AutoFieldItem>();
            ReportTableFields    fields     = new ReportTableFields(TSAuthentication.GetLoginUser());

            fields.LoadByReportTableID(10);

            CustomFields customs = new CustomFields(fields.LoginUser);

            customs.LoadByReferenceType(TSAuthentication.OrganizationID, ReferenceType.Tickets);

            CustomFields orgfields = new CustomFields(fields.LoginUser);

            orgfields.LoadByReferenceType(TSAuthentication.OrganizationID, ReferenceType.Organizations);
            List <string> orgCustomFields = new List <string>();

            foreach (CustomField c in orgfields)
            {
                orgCustomFields.Add(c.Name + ":" + c.CustomFieldID);
            }


            TicketTypes ticketTypes = new TicketTypes(fields.LoginUser);

            ticketTypes.LoadAllPositions(TSAuthentication.OrganizationID);

            foreach (ReportTableField field in fields)
            {
                fieldItems.Add(new AutoFieldItem(field));
            }

            List <AutoFieldItem> customFieldsItems = new List <AutoFieldItem>();

            foreach (CustomField custom in customs)
            {
                TicketType ticketType = ticketTypes.FindByTicketTypeID(custom.AuxID);
                if (ticketType == null)
                {
                    fieldItems.Add(new AutoFieldItem(custom));
                    customFieldsItems.Add(new AutoFieldItem(custom));
                }
                else
                {
                    fieldItems.Add(new AutoFieldItem(custom, string.Format("{0} ({1})", custom.Name, ticketType.Name)));
                    customFieldsItems.Add(new AutoFieldItem(custom, string.Format("{0} ({1})", custom.Name, ticketType.Name)));
                }
            }
            result.CustomFields = customFieldsItems.ToArray();

            ReportTableField actionsViewDescription = ReportTableFields.GetReportTableField(fields.LoginUser, 6);

            actionsViewDescription.Alias = "Action Text";
            fieldItems.Add(new AutoFieldItem(actionsViewDescription));

            ReportTableField actionsViewName = ReportTableFields.GetReportTableField(fields.LoginUser, 5);

            fieldItems.Add(new AutoFieldItem(actionsViewName));

            ReportTableField actionsViewType = ReportTableFields.GetReportTableField(fields.LoginUser, 18);

            fieldItems.Add(new AutoFieldItem(actionsViewType));

            AutoFieldItem afiDayOfWeekCreated = new AutoFieldItem();

            afiDayOfWeekCreated.Alias         = "Day of Week Created";
            afiDayOfWeekCreated.DataType      = "list";
            afiDayOfWeekCreated.FieldID       = 101001;
            afiDayOfWeekCreated.FieldName     = "Day of Week Created";
            afiDayOfWeekCreated.IsCustom      = false;
            afiDayOfWeekCreated.IsVisible     = true;
            afiDayOfWeekCreated.ListValues    = new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
            afiDayOfWeekCreated.LookupTableID = null;
            afiDayOfWeekCreated.Size          = 0;
            afiDayOfWeekCreated.Description   = "";
            afiDayOfWeekCreated.TableID       = -2;
            afiDayOfWeekCreated.RefType       = ReferenceType.Tickets;
            afiDayOfWeekCreated.AuxID         = null;
            afiDayOfWeekCreated.OtherTrigger  = "ticketsview.dayofweekcreated";
            fieldItems.Add(afiDayOfWeekCreated);

            AutoFieldItem afiHourOfDayCreated = new AutoFieldItem();

            afiHourOfDayCreated.Alias         = "Hour of Day Created";
            afiHourOfDayCreated.DataType      = "text";
            afiHourOfDayCreated.FieldID       = 101002;
            afiHourOfDayCreated.FieldName     = "Hour of Day Created";
            afiHourOfDayCreated.IsCustom      = false;
            afiHourOfDayCreated.IsVisible     = true;
            afiHourOfDayCreated.ListValues    = null;
            afiHourOfDayCreated.LookupTableID = null;
            afiHourOfDayCreated.Size          = 0;
            afiHourOfDayCreated.Description   = "";
            afiHourOfDayCreated.TableID       = -2;
            afiHourOfDayCreated.RefType       = ReferenceType.Tickets;
            afiHourOfDayCreated.AuxID         = null;
            afiHourOfDayCreated.OtherTrigger  = "ticketsview.hourofdaycreated";
            fieldItems.Add(afiHourOfDayCreated);

            AutoFieldItem afiMinSinceLastAction = new AutoFieldItem();

            afiMinSinceLastAction.Alias         = "Minutes Since last Action Added";
            afiMinSinceLastAction.DataType      = "text";
            afiMinSinceLastAction.FieldID       = 101003;
            afiMinSinceLastAction.FieldName     = "Minutes Since last Action Added";
            afiMinSinceLastAction.IsCustom      = false;
            afiMinSinceLastAction.IsVisible     = true;
            afiMinSinceLastAction.ListValues    = null;
            afiMinSinceLastAction.LookupTableID = null;
            afiMinSinceLastAction.Size          = 0;
            afiMinSinceLastAction.Description   = "";
            afiMinSinceLastAction.TableID       = -2;
            afiMinSinceLastAction.RefType       = ReferenceType.Tickets;
            afiMinSinceLastAction.AuxID         = null;
            afiMinSinceLastAction.OtherTrigger  = "ticketsview.minutessincelastactionadded";
            fieldItems.Add(afiMinSinceLastAction);

            AutoFieldItem afiHoursSinceAction = new AutoFieldItem();

            afiHoursSinceAction.Alias         = "Hours Since Last Action Added";
            afiHoursSinceAction.DataType      = "text";
            afiHoursSinceAction.FieldID       = 101004;
            afiHoursSinceAction.FieldName     = "Hours Since Last Action Added";
            afiHoursSinceAction.IsCustom      = false;
            afiHoursSinceAction.IsVisible     = true;
            afiHoursSinceAction.ListValues    = null;
            afiHoursSinceAction.LookupTableID = null;
            afiHoursSinceAction.Size          = 0;
            afiHoursSinceAction.Description   = "";
            afiHoursSinceAction.TableID       = -2;
            afiHoursSinceAction.RefType       = ReferenceType.Tickets;
            afiHoursSinceAction.AuxID         = null;
            afiHoursSinceAction.OtherTrigger  = "ticketsview.hourssincelastactionadded";
            fieldItems.Add(afiHoursSinceAction);

            AutoFieldItem afiCurrentDayOfWeek = new AutoFieldItem();

            afiCurrentDayOfWeek.Alias         = "Current Day of Week";
            afiCurrentDayOfWeek.DataType      = "list";
            afiCurrentDayOfWeek.FieldID       = 101005;
            afiCurrentDayOfWeek.FieldName     = "Current Day of Week";
            afiCurrentDayOfWeek.IsCustom      = false;
            afiCurrentDayOfWeek.IsVisible     = true;
            afiCurrentDayOfWeek.ListValues    = new string[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
            afiCurrentDayOfWeek.LookupTableID = null;
            afiCurrentDayOfWeek.Size          = 0;
            afiCurrentDayOfWeek.Description   = "";
            afiCurrentDayOfWeek.TableID       = -2;
            afiCurrentDayOfWeek.RefType       = ReferenceType.Tickets;
            afiCurrentDayOfWeek.AuxID         = null;
            afiCurrentDayOfWeek.OtherTrigger  = "ticketsview.currentdayofweek";
            fieldItems.Add(afiCurrentDayOfWeek);

            AutoFieldItem afiCurrentHourOfDay = new AutoFieldItem();

            afiCurrentHourOfDay.Alias         = "Current Hour of Day";
            afiCurrentHourOfDay.DataType      = "text";
            afiCurrentHourOfDay.FieldID       = 101006;
            afiCurrentHourOfDay.FieldName     = "Current Hour of Day";
            afiCurrentHourOfDay.IsCustom      = false;
            afiCurrentHourOfDay.IsVisible     = true;
            afiCurrentHourOfDay.ListValues    = null;
            afiCurrentHourOfDay.LookupTableID = null;
            afiCurrentHourOfDay.Size          = 0;
            afiCurrentHourOfDay.Description   = "";
            afiCurrentHourOfDay.TableID       = -2;
            afiCurrentHourOfDay.RefType       = ReferenceType.Tickets;
            afiCurrentHourOfDay.AuxID         = null;
            afiCurrentHourOfDay.OtherTrigger  = "ticketsview.currenthourofday";
            fieldItems.Add(afiCurrentHourOfDay);

            AutoFieldItem afiAssignedUserIsAvailable = new AutoFieldItem();

            afiAssignedUserIsAvailable.Alias         = "Assigned User Is Available";
            afiAssignedUserIsAvailable.DataType      = "bit";
            afiAssignedUserIsAvailable.FieldID       = 101007;
            afiAssignedUserIsAvailable.FieldName     = "Assigned User Is Available";
            afiAssignedUserIsAvailable.IsCustom      = false;
            afiAssignedUserIsAvailable.IsVisible     = true;
            afiAssignedUserIsAvailable.ListValues    = null;
            afiAssignedUserIsAvailable.LookupTableID = null;
            afiAssignedUserIsAvailable.Size          = 0;
            afiAssignedUserIsAvailable.Description   = "";
            afiAssignedUserIsAvailable.TableID       = -2;
            afiAssignedUserIsAvailable.RefType       = ReferenceType.Tickets;
            afiAssignedUserIsAvailable.AuxID         = null;
            afiAssignedUserIsAvailable.OtherTrigger  = "ticketsview.assigneduseravailable";
            fieldItems.Add(afiAssignedUserIsAvailable);

            AutoFieldItem afiAssignedUserIsBusy = new AutoFieldItem();

            afiAssignedUserIsBusy.Alias         = "Assigned User Is Busy";
            afiAssignedUserIsBusy.DataType      = "bit";
            afiAssignedUserIsBusy.FieldID       = 101008;
            afiAssignedUserIsBusy.FieldName     = "Assigned User Is Busy";
            afiAssignedUserIsBusy.IsCustom      = false;
            afiAssignedUserIsBusy.IsVisible     = true;
            afiAssignedUserIsBusy.ListValues    = null;
            afiAssignedUserIsBusy.LookupTableID = null;
            afiAssignedUserIsBusy.Size          = 0;
            afiAssignedUserIsBusy.Description   = "";
            afiAssignedUserIsBusy.TableID       = -2;
            afiAssignedUserIsBusy.RefType       = ReferenceType.Tickets;
            afiAssignedUserIsBusy.AuxID         = null;
            afiAssignedUserIsBusy.OtherTrigger  = "ticketsview.assignedusernotavailable";
            fieldItems.Add(afiAssignedUserIsBusy);

            AutoFieldItem afiAgentRatings = new AutoFieldItem();

            afiAgentRatings.Alias         = "Agent Rating";
            afiAgentRatings.DataType      = "list";
            afiAgentRatings.FieldID       = 101009;
            afiAgentRatings.FieldName     = "AgentRating";
            afiAgentRatings.IsCustom      = false;
            afiAgentRatings.IsVisible     = true;
            afiAgentRatings.ListValues    = new string[] { "Positive", "Negative", "Neutral" };
            afiAgentRatings.LookupTableID = null;
            afiAgentRatings.Size          = 0;
            afiAgentRatings.Description   = "";
            afiAgentRatings.TableID       = -2;
            afiAgentRatings.RefType       = ReferenceType.Tickets;
            afiAgentRatings.AuxID         = null;
            afiAgentRatings.OtherTrigger  = "ticketsview.AgentRating";
            fieldItems.Add(afiAgentRatings);

            AutoFieldItem afiCDIValue = new AutoFieldItem();

            afiCDIValue.Alias         = "Customer CDI Value";
            afiCDIValue.DataType      = "text";
            afiCDIValue.FieldID       = 101010;
            afiCDIValue.FieldName     = "Customer CDI Value";
            afiCDIValue.IsCustom      = false;
            afiCDIValue.IsVisible     = true;
            afiCDIValue.ListValues    = null;
            afiCDIValue.LookupTableID = null;
            afiCDIValue.Size          = 0;
            afiCDIValue.Description   = "";
            afiCDIValue.TableID       = -2;
            afiCDIValue.RefType       = ReferenceType.Tickets;
            afiCDIValue.AuxID         = null;
            afiCDIValue.OtherTrigger  = "organizations.cdivalue";
            fieldItems.Add(afiCDIValue);

            AutoFieldItem afiCDITrend = new AutoFieldItem();

            afiCDITrend.Alias         = "Customer CDI Trend";
            afiCDITrend.DataType      = "text";
            afiCDITrend.FieldID       = 101011;
            afiCDITrend.FieldName     = "Customer CDI Trend";
            afiCDITrend.IsCustom      = false;
            afiCDITrend.IsVisible     = true;
            afiCDITrend.ListValues    = new string[] { "1", "0", "-1" };;
            afiCDITrend.LookupTableID = null;
            afiCDITrend.Size          = 0;
            afiCDITrend.Description   = "";
            afiCDITrend.TableID       = -2;
            afiCDITrend.RefType       = ReferenceType.Tickets;
            afiCDITrend.AuxID         = null;
            afiCDITrend.OtherTrigger  = "organizations.cditrend";
            fieldItems.Add(afiCDITrend);

            AutoFieldItem afiServiceLevelName = new AutoFieldItem();

            afiServiceLevelName.Alias         = "Service Level Name";
            afiServiceLevelName.DataType      = "text";
            afiServiceLevelName.FieldID       = 101012;
            afiServiceLevelName.FieldName     = "Service Level Name";
            afiServiceLevelName.IsCustom      = false;
            afiServiceLevelName.IsVisible     = true;
            afiServiceLevelName.ListValues    = null;
            afiServiceLevelName.LookupTableID = null;
            afiServiceLevelName.Size          = 0;
            afiServiceLevelName.Description   = "";
            afiServiceLevelName.TableID       = -2;
            afiServiceLevelName.RefType       = ReferenceType.Tickets;
            afiServiceLevelName.AuxID         = null;
            afiServiceLevelName.OtherTrigger  = "organizations.SLAName";
            fieldItems.Add(afiServiceLevelName);

            AutoFieldItem afiServiceExpirationDate = new AutoFieldItem();

            afiServiceExpirationDate.Alias         = "Service Expiration Date";
            afiServiceExpirationDate.DataType      = "datetime";
            afiServiceExpirationDate.FieldID       = 101013;
            afiServiceExpirationDate.FieldName     = "Service Expiration Date";
            afiServiceExpirationDate.IsCustom      = false;
            afiServiceExpirationDate.IsVisible     = true;
            afiServiceExpirationDate.ListValues    = null;
            afiServiceExpirationDate.LookupTableID = null;
            afiServiceExpirationDate.Size          = 0;
            afiServiceExpirationDate.Description   = "";
            afiServiceExpirationDate.TableID       = -2;
            afiServiceExpirationDate.RefType       = ReferenceType.Tickets;
            afiServiceExpirationDate.AuxID         = null;
            afiServiceExpirationDate.OtherTrigger  = "organizations.serviceexpirationdate";
            fieldItems.Add(afiServiceExpirationDate);

            AutoFieldItem afiCustomerIsActive = new AutoFieldItem();

            afiCustomerIsActive.Alias         = "Customer Is Active";
            afiCustomerIsActive.DataType      = "bit";
            afiCustomerIsActive.FieldID       = 101014;
            afiCustomerIsActive.FieldName     = "Customer Is Active";
            afiCustomerIsActive.IsCustom      = false;
            afiCustomerIsActive.IsVisible     = true;
            afiCustomerIsActive.ListValues    = null;
            afiCustomerIsActive.LookupTableID = null;
            afiCustomerIsActive.Size          = 0;
            afiCustomerIsActive.Description   = "";
            afiCustomerIsActive.TableID       = -2;
            afiCustomerIsActive.RefType       = ReferenceType.Tickets;
            afiCustomerIsActive.AuxID         = null;
            afiCustomerIsActive.OtherTrigger  = "organizations.active";
            fieldItems.Add(afiCustomerIsActive);

            AutoFieldItem afiCustomerCustomValue = new AutoFieldItem();

            afiCustomerCustomValue.Alias         = "Customer Custom Value";
            afiCustomerCustomValue.DataType      = "text";
            afiCustomerCustomValue.FieldID       = -999;
            afiCustomerCustomValue.FieldName     = "Customer Custom Value";
            afiCustomerCustomValue.IsCustom      = false;
            afiCustomerCustomValue.IsVisible     = true;
            afiCustomerCustomValue.ListValues    = orgCustomFields.ToArray();
            afiCustomerCustomValue.LookupTableID = null;
            afiCustomerCustomValue.Size          = 0;
            afiCustomerCustomValue.Description   = "";
            afiCustomerCustomValue.TableID       = -2;
            afiCustomerCustomValue.RefType       = ReferenceType.Tickets;
            afiCustomerCustomValue.AuxID         = null;
            afiCustomerCustomValue.OtherTrigger  = "organizations.customvalue";
            fieldItems.Add(afiCustomerCustomValue);

            AutoFieldItem afiCustomerServiceExpired = new AutoFieldItem();

            afiCustomerServiceExpired.Alias         = "Customer Service Expired";
            afiCustomerServiceExpired.DataType      = "bit";
            afiCustomerServiceExpired.FieldID       = 101015;
            afiCustomerServiceExpired.FieldName     = "Customer Service Expired";
            afiCustomerServiceExpired.IsCustom      = false;
            afiCustomerServiceExpired.IsVisible     = true;
            afiCustomerServiceExpired.ListValues    = null;
            afiCustomerServiceExpired.LookupTableID = null;
            afiCustomerServiceExpired.Size          = 0;
            afiCustomerServiceExpired.Description   = "";
            afiCustomerServiceExpired.TableID       = -2;
            afiCustomerServiceExpired.RefType       = ReferenceType.Tickets;
            afiCustomerServiceExpired.AuxID         = null;
            afiCustomerServiceExpired.OtherTrigger  = "organizations.serviceexpired";
            fieldItems.Add(afiCustomerServiceExpired);

            result.Fields = fieldItems.ToArray();

            Users users = new Users(UserSession.LoginUser);

            users.LoadByOrganizationID(UserSession.LoginUser.OrganizationID, true);
            List <AutocompleteItem> userItems = new List <AutocompleteItem>();

            foreach (User user in users)
            {
                userItems.Add(new AutocompleteItem(user.DisplayName, user.UserID.ToString()));
            }
            result.Users = userItems.ToArray();

            Groups groups = new Groups(UserSession.LoginUser);

            groups.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
            List <AutocompleteItem> groupItems = new List <AutocompleteItem>();

            foreach (Group group in groups)
            {
                groupItems.Add(new AutocompleteItem(group.Name, group.GroupID.ToString()));
            }
            result.Groups = groupItems.ToArray();

            TicketSeverities severities = new TicketSeverities(UserSession.LoginUser);

            severities.LoadByOrganizationID(UserSession.LoginUser.OrganizationID);
            List <AutocompleteItem> severityItems = new List <AutocompleteItem>();

            foreach (TicketSeverity severity in severities)
            {
                severityItems.Add(new AutocompleteItem(severity.Name, severity.TicketSeverityID.ToString()));
            }
            result.Severities = severityItems.ToArray();

            List <AutocompleteItem> statusItems = new List <AutocompleteItem>();

            List <AutocompleteItem> ticketTypeItems = new List <AutocompleteItem>();

            foreach (TicketType ticketType in ticketTypes)
            {
                ticketTypeItems.Add(new AutocompleteItem(ticketType.Name, ticketType.TicketTypeID.ToString()));


                TicketStatuses statuses = new TicketStatuses(UserSession.LoginUser);
                statuses.LoadAllPositions(ticketType.TicketTypeID);

                foreach (TicketStatus status in statuses)
                {
                    statusItems.Add(new AutocompleteItem(ticketType.Name + " - " + status.Name, status.TicketStatusID.ToString()));
                }
            }
            result.Statuses    = statusItems.ToArray();
            result.TicketTypes = ticketTypeItems.ToArray();
            return(result);
        }
示例#6
0
        public ReportFieldItem[] GetFields(int reportSubCatID)
        {
            LoginUser loginUser                = TSAuthentication.GetLoginUser();
            List <ReportFieldItem> result      = new List <ReportFieldItem>();
            TicketTypes            ticketTypes = new TicketTypes(loginUser);

            ticketTypes.LoadAllPositions(loginUser.OrganizationID);

            ReportSubcategory subCat       = ReportSubcategories.GetReportSubcategory(loginUser, reportSubCatID);
            ReportTable       primaryTable = ReportTables.GetReportTable(loginUser, subCat.ReportCategoryTableID);

            ReportTableFields reportTableFields = new ReportTableFields(loginUser);

            reportTableFields.LoadByReportTableID(subCat.ReportCategoryTableID);

            CRMLinkTable crmLink = new CRMLinkTable(loginUser);

            crmLink.LoadByOrganizationID(loginUser.OrganizationID);
            bool          isJiraActive = crmLink.Where(p => p.CRMType.ToLower() == "jira" && p.Active).Any();
            List <string> jiraFields   = new List <string>()
            {
                "DateModifiedByJiraSync", "JiraID", "SyncWithJira", "JiraKey", "JiraLinkURL", "JiraStatus"
            };

            foreach (ReportTableField reportTableField in reportTableFields)
            {
                if ((isJiraActive && jiraFields.Where(p => p == reportTableField.FieldName).Any() ||
                     !jiraFields.Where(p => p == reportTableField.FieldName).Any()))
                {
                    result.Add(new ReportFieldItem(primaryTable.Alias, true, reportTableField));
                }
            }

            if (primaryTable.CustomFieldRefType != ReferenceType.None)
            {
                CustomFields customFields = new CustomFields(loginUser);
                customFields.LoadByReferenceType(loginUser.OrganizationID, primaryTable.CustomFieldRefType, null, "Name");

                foreach (CustomField customField in customFields)
                {
                    if (customField.RefType == ReferenceType.Tickets || customField.RefType == ReferenceType.Actions)
                    {
                        TicketType ticketType = ticketTypes.FindByTicketTypeID(customField.AuxID);
                        if (ticketType != null)
                        {
                            result.Add(new ReportFieldItem(primaryTable.Alias, true, customField, ticketType.Name));
                        }
                    }
                    else
                    {
                        result.Add(new ReportFieldItem(primaryTable.Alias, true, customField, ""));
                    }
                }
            }

            if (subCat.ReportTableID != null)
            {
                ReportTable subTable = ReportTables.GetReportTable(loginUser, (int)subCat.ReportTableID);
                reportTableFields = new ReportTableFields(loginUser);
                reportTableFields.LoadByReportTableID((int)subCat.ReportTableID);
                foreach (ReportTableField reportTableField in reportTableFields)
                {
                    result.Add(new ReportFieldItem(subTable.Alias, false, reportTableField));
                }


                if (subTable.CustomFieldRefType != ReferenceType.None)
                {
                    CustomFields customFields = new CustomFields(loginUser);
                    customFields.LoadByReferenceType(loginUser.OrganizationID, subTable.CustomFieldRefType, null, "Name");

                    foreach (CustomField customField in customFields)
                    {
                        if (customField.RefType == ReferenceType.Tickets || customField.RefType == ReferenceType.Actions)
                        {
                            TicketType ticketType = ticketTypes.FindByTicketTypeID(customField.AuxID);
                            if (ticketType != null)
                            {
                                result.Add(new ReportFieldItem(subTable.Alias, false, customField, ticketType.Name));
                            }
                        }
                        else
                        {
                            result.Add(new ReportFieldItem(subTable.Alias, false, customField, ""));
                        }
                    }
                }
            }
            return(result.ToArray());
        }
示例#7
0
    private void LoadFields(int subcategoryID)
    {
        cmbFields.Items.Clear();

        ReportSubcategory sub = (ReportSubcategory)ReportSubcategories.GetReportSubcategory(UserSession.LoginUser, subcategoryID);

        if (sub == null)
        {
            return;
        }

        int primaryTableID   = sub.ReportCategoryTableID;
        int secondaryTableID = sub.ReportTableID != null ? (int)sub.ReportTableID : -1;

        ReportTableFields fields = new ReportTableFields(UserSession.LoginUser);

        fields.LoadByReportTableID(primaryTableID);
        foreach (ReportTableField field in fields)
        {
            cmbFields.Items.Add(new RadComboBoxItem(field.Row["TableAlias"].ToString() + " :: " + field.Alias, "R" + field.ReportTableFieldID.ToString()));
        }

        TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);

        ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);

        ReportTable table = (ReportTable)ReportTables.GetReportTable(UserSession.LoginUser, primaryTableID);

        if (table.CustomFieldRefType != ReferenceType.None)
        {
            CustomFields customFields = new CustomFields(UserSession.LoginUser);
            customFields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, (ReferenceType)table.CustomFieldRefType);

            foreach (CustomField customField in customFields)
            {
                if (customField.RefType == ReferenceType.Tickets)
                {
                    TicketType ticketType = ticketTypes.FindByTicketTypeID(customField.AuxID);
                    if (ticketType != null)
                    {
                        cmbFields.Items.Add(new RadComboBoxItem(table.Alias + " :: " + customField.Name + " (" + ticketType.Name + ")", "C" + customField.CustomFieldID.ToString()));
                    }
                }
                else
                {
                    cmbFields.Items.Add(new RadComboBoxItem(table.Alias + " :: " + customField.Name, "C" + customField.CustomFieldID.ToString()));
                }
            }
        }

        if (secondaryTableID > -1)
        {
            fields = new ReportTableFields(UserSession.LoginUser);
            fields.LoadByReportTableID(secondaryTableID);
            foreach (ReportTableField field in fields)
            {
                cmbFields.Items.Add(new RadComboBoxItem(field.Row["TableAlias"].ToString() + " :: " + field.Alias, "R" + field.ReportTableFieldID.ToString()));
            }

            table = (ReportTable)ReportTables.GetReportTable(UserSession.LoginUser, secondaryTableID);
            if (table.CustomFieldRefType != ReferenceType.None)
            {
                CustomFields customFields = new CustomFields(UserSession.LoginUser);
                customFields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, (ReferenceType)table.CustomFieldRefType);

                foreach (CustomField customField in customFields)
                {
                    if (customField.RefType == ReferenceType.Tickets)
                    {
                        TicketType ticketType = ticketTypes.FindByTicketTypeID(customField.AuxID);
                        if (ticketType != null)
                        {
                            cmbFields.Items.Add(new RadComboBoxItem(table.Alias + " :: " + customField.Name + " (" + ticketType.Name + ")", "C" + customField.CustomFieldID.ToString()));
                        }
                    }
                    else
                    {
                        cmbFields.Items.Add(new RadComboBoxItem(table.Alias + " :: " + customField.Name, "C" + customField.CustomFieldID.ToString()));
                    }
                }
            }
        }
    }
    public static string GetTypesHtml(SelectedType type, string arg)
    {
        Organization organization = Organizations.GetOrganization(UserSession.LoginUser, UserSession.LoginUser.OrganizationID);
        DataTable    table        = new DataTable();

        table.Columns.Add("ID");
        table.Columns.Add("Name");
        table.Columns.Add("Description");
        string result = "";

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionTypes actionTypes = new ActionTypes(UserSession.LoginUser);
            actionTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            table.Columns.Add("Is Timed");
            foreach (ActionType actionType in actionTypes)
            {
                table.Rows.Add(new string[] { actionType.ActionTypeID.ToString(), actionType.Name, actionType.Description, actionType.IsTimed.ToString() });
            }
            break;

        case SelectedType.PhoneTypes:
            PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);
            phoneTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (PhoneType phoneType in phoneTypes)
            {
                table.Rows.Add(new string[] { phoneType.PhoneTypeID.ToString(), phoneType.Name, phoneType.Description });
            }
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(UserSession.LoginUser);
            productVersionStatuses.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            table.Columns.Add("Is Shipping");
            table.Columns.Add("Is Discontinued");
            foreach (ProductVersionStatus productVersionStatus in productVersionStatuses)
            {
                table.Rows.Add(new string[] { productVersionStatus.ProductVersionStatusID.ToString(), productVersionStatus.Name, productVersionStatus.Description, productVersionStatus.IsShipping.ToString(), productVersionStatus.IsDiscontinued.ToString() });
            }
            break;

        case SelectedType.TicketSeverities:
            table.Columns.Add("Visible on Portal");
            TicketSeverities ticketSeverities = new TicketSeverities(UserSession.LoginUser);
            ticketSeverities.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (TicketSeverity ticketSeverity in ticketSeverities)
            {
                table.Rows.Add(new string[] { ticketSeverity.TicketSeverityID.ToString(), ticketSeverity.Name, ticketSeverity.Description, ticketSeverity.VisibleOnPortal.ToString() });
            }
            break;

        case SelectedType.TicketStatuses:
            TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
            ticketStatuses.LoadAllPositions(int.Parse(arg));

            table.Columns.Add("Is Closed");
            table.Columns.Add("Closed Email");
            table.Columns.Add("Email Response");
            table.Columns.Add("Pause SLA");

            foreach (TicketStatus ticketStatus in ticketStatuses)
            {
                table.Rows.Add(new string[] { ticketStatus.TicketStatusID.ToString(), ticketStatus.Name, ticketStatus.Description, ticketStatus.IsClosed.ToString(), ticketStatus.IsClosedEmail.ToString(), ticketStatus.IsEmailResponse.ToString(), ticketStatus.PauseSLA.ToString() });
            }
            break;

        case SelectedType.TicketTypes:
            table.Columns.Add("Icon");
            table.Columns.Add("Visible on Portal");
            string icon = "<img src=\"../{0}\" />";
            if (organization.UseProductFamilies)
            {
                TicketTypesView ticketTypes = new TicketTypesView(UserSession.LoginUser);
                ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
                table.Columns.Add("Product Line");
                table.Columns.Add("Active");
                foreach (TicketTypesViewItem ticketType in ticketTypes)
                {
                    table.Rows.Add(new string[] { ticketType.TicketTypeID.ToString(), ticketType.Name, ticketType.Description, string.Format(icon, ticketType.IconUrl), ticketType.IsVisibleOnPortal.ToString(), ticketType.ProductFamilyName });
                }
            }
            else
            {
                TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);
                ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
                table.Columns.Add("Active");
                foreach (TicketType ticketType in ticketTypes)
                {
                    table.Rows.Add(new string[] { ticketType.TicketTypeID.ToString(), ticketType.Name, ticketType.Description, string.Format(icon, ticketType.IconUrl), ticketType.IsVisibleOnPortal.ToString() });
                }
            }
            break;

        case SelectedType.ActivityTypes:
            ActivityTypes activityTypes = new ActivityTypes(UserSession.LoginUser);
            activityTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            foreach (ActivityType activityType in activityTypes)
            {
                table.Rows.Add(new string[] { activityType.ActivityTypeID.ToString(), activityType.Name, activityType.Description });
            }
            break;

        default:
            break;
        }

        return(BuildTable(table));
    }
    public static RadComboBoxItemData[] GetReplaceTypeComboData(int id, SelectedType type, int ticketTypeID)
    {
        //IDictionary<string, object> contextDictionary = (IDictionary<string, object>)context;
        List <RadComboBoxItemData> list = new List <RadComboBoxItemData>();

        /*string[] s = context["FilterString"].ToString().Split(',');
         * SelectedType type = (SelectedType)int.Parse(s[0]);
         * int ticketTypeID = int.Parse(s[1]);
         * int id = int.Parse(s[2]);*/

        BaseCollection collection  = null;
        string         nameColName = "Name";
        string         idColName   = "ID";

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionTypes actionTypes = new ActionTypes(UserSession.LoginUser);
            actionTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = actionTypes;
            idColName  = "ActionTypeID";
            break;

        case SelectedType.PhoneTypes:
            PhoneTypes phoneTypes = new PhoneTypes(UserSession.LoginUser);
            phoneTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = phoneTypes;
            idColName  = "PhoneTypeID";
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatuses productVersionStatuses = new ProductVersionStatuses(UserSession.LoginUser);
            productVersionStatuses.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = productVersionStatuses;
            idColName  = "ProductVersionStatusID";
            break;

        case SelectedType.TicketSeverities:
            TicketSeverities ticketSeverities = new TicketSeverities(UserSession.LoginUser);
            ticketSeverities.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = ticketSeverities;
            idColName  = "TicketSeverityID";
            break;

        case SelectedType.TicketStatuses:
            TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
            TicketType     ticketType     = TicketTypes.GetTicketType(UserSession.LoginUser, ticketTypeID);
            if (ticketType.OrganizationID == UserSession.LoginUser.OrganizationID)
            {
                ticketStatuses.LoadAllPositions(ticketTypeID);
                collection = ticketStatuses;
                idColName  = "TicketStatusID";
            }
            break;

        case SelectedType.TicketTypes:
            TicketTypes ticketTypes = new TicketTypes(UserSession.LoginUser);
            ticketTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            collection = ticketTypes;
            idColName  = "TicketTypeID";
            break;

        case SelectedType.ActivityTypes:
            ActivityTypes activityTypes = new ActivityTypes(UserSession.LoginUser);
            activityTypes.LoadAllPositions(UserSession.LoginUser.OrganizationID);
            //Load base items
            //Get default activity types
            foreach (ActivityTypeEnum activity in Enum.GetValues(typeof(ActivityTypeEnum)))
            {
                var value = Enum.Parse(typeof(ActivityTypeEnum), activity.ToString());
                //results.Add(new ActivityTypesDropDown() { Name = activity.ToString(), Value = (int)value });
                RadComboBoxItemData itemData = new RadComboBoxItemData();
                itemData.Text  = activity.ToString();
                itemData.Value = ((int)value).ToString();
                list.Add(itemData);
            }

            collection = activityTypes;
            idColName  = "ActivityTypeID";
            break;

        default:
            break;
        }

        foreach (DataRow row in collection.Table.Rows)
        {
            int i = (int)row[idColName];
            if (id != i)
            {
                RadComboBoxItemData itemData = new RadComboBoxItemData();
                itemData.Text  = row[nameColName].ToString();
                itemData.Value = i.ToString();
                list.Add(itemData);
            }
        }

        if (list.Count < 1)
        {
            RadComboBoxItemData noData = new RadComboBoxItemData();
            noData.Text  = "[No types to display.]";
            noData.Value = "-1";
            list.Add(noData);
        }

        return(list.ToArray());
    }