Beispiel #1
0
 private void SetTicketSeverity(Ticket ticket, TicketSeverity severity, bool batch = false)
 {
     TicketSingle(ticket, batch, t => {
         t.Severity = severity;
         return(t);
     });
 }
        public string TranslateTicketSeverity(TicketSeverity ticketSeverity)
        {
            switch (ticketSeverity)
            {
            case TicketSeverity.Blocker:
                return(Resources.String_Blocker);

            case TicketSeverity.Critical:
                return(Resources.String_Critical);

            case TicketSeverity.Major:
                return(Resources.String_Major);

            case TicketSeverity.Normal:
                return(Resources.String_Normal);

            case TicketSeverity.Minor:
                return(Resources.String_Minor);

            case TicketSeverity.Trivial:
                return(Resources.String_Trivial);

            default:
                return(ticketSeverity.ToString());
            }
        }
Beispiel #3
0
        public static string GetTicketSeverity(RestCommand command, int ticketSeverityID)
        {
            TicketSeverity ticketSeverity = TicketSeverities.GetTicketSeverity(command.LoginUser, ticketSeverityID);

            if (ticketSeverity.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(ticketSeverity.GetXml("TicketSeverity", true));
        }
Beispiel #4
0
        internal Ticket(PeygirDatabaseDataSet.TicketsRow row)
        {
            if (row == null)
            {
                throw new ArgumentNullException("row");
            }

            ID = row.ID;
            milestoneID = row.MilestoneID;
            ticketNumber = row.TicketNumber;
            summary = row.Summary;
            reportedBy = row.ReportedBy;
            type = (TicketType)row.Type;
            severity = (TicketSeverity)row.Severity;
            state = (TicketState)row.State;
            assignedTo = row.AssignedTo;
            priority = (TicketPriority)row.Priority;
            description = row.Description;
        }
Beispiel #5
0
        private void LoadCustomProperty()
        {
            switch (_refType)
            {
            case ReferenceType.ActionTypes:
                ActionType actionType = (ActionType)ActionTypes.GetActionType(LoginSession.LoginUser, _id);
                textDescription.Text = actionType.Description;
                textName.Text        = actionType.Name;
                break;

            case ReferenceType.PhoneTypes:
                PhoneType phoneType = (PhoneType)PhoneTypes.GetPhoneType(LoginSession.LoginUser, _id);
                textDescription.Text = phoneType.Description;
                textName.Text        = phoneType.Name;
                break;

            case ReferenceType.ProductVersionStatuses:
                ProductVersionStatus productVersionStatus = (ProductVersionStatus)ProductVersionStatuses.GetProductVersionStatus(LoginSession.LoginUser, _id);
                textDescription.Text   = productVersionStatus.Description;
                textName.Text          = productVersionStatus.Name;
                cbDiscontinued.Checked = productVersionStatus.IsDiscontinued;
                cbShipping.Checked     = productVersionStatus.IsShipping;
                break;

            case ReferenceType.TicketSeverities:
                TicketSeverity ticketSeverity = (TicketSeverity)TicketSeverities.GetTicketSeverity(LoginSession.LoginUser, _id);
                textDescription.Text = ticketSeverity.Description;
                textName.Text        = ticketSeverity.Name;
                break;

            case ReferenceType.TicketStatuses:
                TicketStatus ticketStatus = (TicketStatus)TicketStatuses.GetTicketStatus(LoginSession.LoginUser, _id);
                textDescription.Text = ticketStatus.Description;
                textName.Text        = ticketStatus.Name;
                cbClosed.Checked     = ticketStatus.IsClosed;
                break;

            default:
                break;
            }
        }
    private void LoadSeverities()
    {
        TicketSeverities severities = new TicketSeverities(UserSession.LoginUser);

        severities.LoadNotSlaTriggers(UserSession.LoginUser.OrganizationID, _slaLevelID, _ticketTypeID);
        cmbSeverities.Items.Clear();
        if (_trigger != null)
        {
            TicketSeverity selected = TicketSeverities.GetTicketSeverity(UserSession.LoginUser, _trigger.TicketSeverityID);
            cmbSeverities.Items.Add(new RadComboBoxItem(selected.Name, selected.TicketSeverityID.ToString()));
        }

        foreach (TicketSeverity severity in severities)
        {
            cmbSeverities.Items.Add(new RadComboBoxItem(severity.Name, severity.TicketSeverityID.ToString()));
        }

        if (cmbSeverities.Items.Count > 0)
        {
            cmbSeverities.SelectedIndex = 0;
        }
    }
Beispiel #7
0
        public Ticket(int projectID, int milestoneID)
        {
            if (projectID == InvalidID)
            {
                string message = Resources.String_InvalidProjectID;
                throw new ArgumentException(message, "projectID");
            }
            if (milestoneID == InvalidID)
            {
                string message = Resources.String_InvalidMilestoneID;
                throw new ArgumentException(message, "milestoneID");
            }

            this.milestoneID = milestoneID;
            ticketNumber = 0;
            summary = string.Empty;
            reportedBy = string.Empty;
            type = (TicketType)(-1);
            severity = (TicketSeverity)(-1);
            state = (TicketState)(-1);
            assignedTo = string.Empty;
            priority = (TicketPriority)(-1);
            description = string.Empty;

            // Find max ticket number.
            TicketsTableAdapter tableAdapter = Database.TicketsTableAdapter;
            int? maxTicketNumber = tableAdapter.GetMaxTicketNumber(projectID);
            if (maxTicketNumber.HasValue)
            {
                ticketNumber = maxTicketNumber.Value + 1;
            }
            else
            {
                ticketNumber = 1;
            }
        }
Beispiel #8
0
        private void RecoverTickets(int orgID, LoginUser loginUser)
        {
            Tickets    badTickets = new Tickets(GetCorrupteLoginUser());
            SqlCommand command    = new SqlCommand();

            command.CommandText = @"
        SELECT 
          * 
        FROM 
          Tickets 
        WHERE 
          OrganizationID = @OrganizationID
          AND DateCreated > '2015-09-17 05:56:00'
          AND TicketSource != 'EMail'
          AND IgnoreMe = 0
      ";
            command.CommandType = CommandType.Text;
            command.Parameters.AddWithValue("@OrganizationID", orgID);
            badTickets.Fill(command, "");

            Organizations existingCompanies = new Organizations(loginUser);

            existingCompanies.LoadByParentID(orgID, false);

            foreach (Ticket badTicket in badTickets)
            {
                try
                {
                    //Copy Ticket
                    Ticket goodTicket = (new Tickets(loginUser)).AddNewTicket();
                    goodTicket.CopyRowData(badTicket);
                    //Product
                    if (badTicket.ProductID != null)
                    {
                        Product goodProduct = _goodProducts.FindByProductID((int)badTicket.ProductID);
                        if (goodProduct == null)
                        {
                            Product badProduct = _badProducts.FindByProductID((int)badTicket.ProductID);
                            goodProduct = _goodProducts.FindByName(badProduct.Name);
                            if (goodProduct != null)
                            {
                                goodTicket.ProductID = goodProduct.ProductID;
                            }
                            else
                            {
                                goodTicket.ProductID = null;
                            }
                        }
                    }
                    //Version
                    if (goodTicket.ProductID != null && badTicket.ReportedVersionID != null)
                    {
                        ProductVersion goodProductVersion = _goodProductVersions.FindByProductVersionID((int)badTicket.ReportedVersionID);
                        if (goodProductVersion == null)
                        {
                            ProductVersion badProductVersion = _badProductVersions.FindByProductVersionID((int)badTicket.ReportedVersionID);
                            goodProductVersion = _goodProductVersions.FindByVersionNumber(badProductVersion.VersionNumber, (int)goodTicket.ProductID);
                            if (goodProductVersion != null)
                            {
                                goodTicket.ReportedVersionID = goodProductVersion.ProductVersionID;
                            }
                            else
                            {
                                goodTicket.ReportedVersionID = null;
                            }
                        }
                    }
                    //Solved Version
                    if (goodTicket.ProductID != null && badTicket.SolvedVersionID != null)
                    {
                        ProductVersion goodProductVersion = _goodProductVersions.FindByProductVersionID((int)badTicket.SolvedVersionID);
                        if (goodProductVersion == null)
                        {
                            ProductVersion badProductVersion = _badProductVersions.FindByProductVersionID((int)badTicket.SolvedVersionID);
                            goodProductVersion = _goodProductVersions.FindByVersionNumber(badProductVersion.VersionNumber, (int)goodTicket.ProductID);
                            if (goodProductVersion != null)
                            {
                                goodTicket.SolvedVersionID = goodProductVersion.ProductVersionID;
                            }
                            else
                            {
                                goodTicket.SolvedVersionID = null;
                            }
                        }
                    }
                    //Group
                    if (badTicket.GroupID != null)
                    {
                        Group goodGroup = _goodGroups.FindByGroupID((int)badTicket.GroupID);
                        if (goodGroup == null)
                        {
                            Group badGroup = _badGroups.FindByGroupID((int)badTicket.GroupID);
                            goodGroup = _goodGroups.FindByName(badGroup.Name);
                            if (goodGroup != null)
                            {
                                goodTicket.GroupID = goodGroup.GroupID;
                            }
                            else
                            {
                                goodTicket.GroupID = null;
                            }
                        }
                    }
                    //Assigned User
                    if (badTicket.UserID != null)
                    {
                        User goodUser = _goodUsers.FindByUserID((int)badTicket.UserID);
                        if (goodUser == null)
                        {
                            User badUser = _badUsers.FindByUserID((int)badTicket.UserID);
                            goodUser = _goodUsers.FindByEmail(badUser.Email);
                            if (goodUser != null)
                            {
                                goodTicket.UserID = goodUser.UserID;
                            }
                            else
                            {
                                goodTicket.UserID = null;
                            }
                        }
                    }
                    //Type
                    TicketType goodTicketType = _goodTicketTypes.FindByTicketTypeID(badTicket.TicketTypeID);
                    if (goodTicketType == null)
                    {
                        TicketType badTicketType = _badTicketTypes.FindByTicketTypeID(badTicket.TicketTypeID);
                        goodTicketType = _goodTicketTypes.FindByName(badTicketType.Name);
                        if (goodTicketType != null)
                        {
                            goodTicket.TicketTypeID = goodTicketType.TicketTypeID;
                        }
                        else
                        {
                            goodTicket.TicketTypeID = _goodTicketTypes[0].TicketTypeID;
                        }
                    }

                    //Status
                    TicketStatus goodTicketStatus = _goodTicketStatuses.FindByTicketStatusID(badTicket.TicketStatusID);
                    if (goodTicketStatus == null)
                    {
                        TicketStatus badTicketStatus = _badTicketStatuses.FindByTicketStatusID(badTicket.TicketStatusID);
                        goodTicketStatus = _goodTicketStatuses.FindByName(badTicketStatus.Name, goodTicket.TicketTypeID);
                        if (goodTicketStatus != null)
                        {
                            goodTicket.TicketStatusID = goodTicketStatus.TicketStatusID;
                        }
                        else
                        {
                            goodTicketStatus          = _goodTicketStatuses.FindTopOne(goodTicket.TicketTypeID);
                            goodTicket.TicketStatusID = goodTicketStatus.TicketStatusID;
                        }
                    }


                    //Severity
                    TicketSeverity goodTicketSeverity = _goodTicketSeverities.FindByTicketSeverityID(badTicket.TicketSeverityID);
                    if (goodTicketSeverity == null)
                    {
                        TicketSeverity badTicketSeverity = _badTicketSeverities.FindByTicketSeverityID(badTicket.TicketSeverityID);
                        goodTicketSeverity = _goodTicketSeverities.FindByName(badTicketSeverity.Name);
                        if (goodTicketSeverity != null)
                        {
                            goodTicket.TicketSeverityID = goodTicketSeverity.TicketSeverityID;
                        }
                        else
                        {
                            goodTicket.TicketSeverityID = _goodTicketSeverities[0].TicketSeverityID;
                        }
                    }

                    //Knowledgebase Cat
                    if (badTicket.KnowledgeBaseCategoryID != null)
                    {
                        KnowledgeBaseCategory goodKBCategory = _goodTicketKBCategories.FindByCategoryID((int)badTicket.KnowledgeBaseCategoryID);
                        if (goodKBCategory == null)
                        {
                            KnowledgeBaseCategory badKBCategory = _badTicketKBCategories.FindByCategoryID((int)badTicket.KnowledgeBaseCategoryID);
                            goodKBCategory = _goodTicketKBCategories.FindByName(badKBCategory.CategoryName);
                            if (goodKBCategory != null)
                            {
                                goodTicket.KnowledgeBaseCategoryID = goodKBCategory.CategoryID;
                            }
                            else
                            {
                                goodTicket.KnowledgeBaseCategoryID = null;
                            }
                        }
                    }

                    //Parent Ticket (NOTE from MT:  we decided as a team to null out this field to ensure no bad relationships can happen since we don't know the ticketID is a preserved field for every ticket.
                    goodTicket.ParentID = null;

                    //Closing User
                    if (badTicket.CloserID != null)
                    {
                        User goodUser = _goodUsers.FindByUserID((int)badTicket.CloserID);
                        if (goodUser == null)
                        {
                            User badUser = _badUsers.FindByUserID((int)badTicket.CloserID);
                            goodUser = _goodUsers.FindByEmail(badUser.Email);
                            if (goodUser != null)
                            {
                                goodTicket.CloserID = goodUser.UserID;
                            }
                            else
                            {
                                goodTicket.CloserID = null;
                            }
                        }
                    }


                    //Reset ticket dates
                    goodTicket.DateCreated  = badTicket.DateCreatedUtc;
                    goodTicket.DateModified = badTicket.DateModifiedUtc;
                    goodTicket.ParentID     = null;
                    goodTicket.ImportID     = _importID;
                    if (badTicket.CreatorID > 0)
                    {
                        User creator = _usersAndContacts.FindByUserID(badTicket.CreatorID);
                        if (creator != null)
                        {
                            goodTicket.CreatorID = creator.UserID;
                        }
                        else
                        {
                            goodTicket.CreatorID = -5;
                        }
                    }
                    else
                    {
                        goodTicket.CreatorID = badTicket.CreatorID;
                    }

                    if (badTicket.ModifierID > 0)
                    {
                        User modifier = _usersAndContacts.FindByUserID(badTicket.ModifierID);
                        if (modifier != null)
                        {
                            goodTicket.ModifierID = modifier.UserID;
                        }
                        else
                        {
                            goodTicket.ModifierID = -5;
                        }
                    }
                    else
                    {
                        goodTicket.ModifierID = badTicket.ModifierID;
                    }
                    goodTicket.TicketNumber = 0;
                    goodTicket.Collection.Save();
                    EmailPosts.DeleteImportEmails(loginUser);

                    Actions badActions = new Actions(GetCorrupteLoginUser());
                    badActions.LoadByTicketID(badTicket.TicketID);

                    foreach (TeamSupport.Data.Action badAction in badActions)
                    {
                        TeamSupport.Data.Action goodAction = new Actions(loginUser).AddNewAction();
                        goodAction.CopyRowData(badAction);
                        goodAction.DateCreated  = badAction.DateCreatedUtc;
                        goodAction.DateModified = badAction.DateCreatedUtc;
                        goodAction.TicketID     = goodTicket.TicketID;
                        goodAction.ImportID     = _importID;
                        if (badAction.CreatorID > 0)
                        {
                            User creator = _usersAndContacts.FindByUserID(badAction.CreatorID);
                            if (creator != null)
                            {
                                goodAction.CreatorID = creator.UserID;
                            }
                            else
                            {
                                goodAction.CreatorID = -5;
                            }
                        }
                        else
                        {
                            goodAction.CreatorID = badAction.CreatorID;
                        }

                        if (badAction.ModifierID > 0)
                        {
                            User modifier = _usersAndContacts.FindByUserID(badAction.ModifierID);
                            if (modifier != null)
                            {
                                goodAction.ModifierID = modifier.UserID;
                            }
                            else
                            {
                                goodAction.ModifierID = -5;
                            }
                        }
                        else
                        {
                            goodAction.ModifierID = badAction.ModifierID;
                        }
                        goodAction.Collection.Save();
                        EmailPosts.DeleteImportEmails(loginUser);
                    }


                    Organizations orgs = new Organizations(GetCorrupteLoginUser());
                    orgs.LoadBTicketID(badTicket.TicketID);

                    foreach (Organization org in orgs)
                    {
                        Organization goodCompany = existingCompanies.FindByName(org.Name);
                        if (org.ParentID == orgID && goodCompany != null)
                        {
                            goodTicket.Collection.AddOrganization(goodCompany.OrganizationID, goodTicket.TicketID);
                            EmailPosts.DeleteImportEmails(loginUser);
                        }
                    }

                    RecoverTicketCustomValues(orgID, badTicket.TicketID, goodTicket.TicketID);
                    EmailPosts.DeleteImportEmails(loginUser);
                }
                catch (Exception ex)
                {
                    _exceptionOcurred = true;
                    ExceptionLogs.LogException(GetCorrupteLoginUser(), ex, "recover");
                }
            }
        }
    public static string UpdateType(SelectedType type,
                                    string arg,
                                    int?id,
                                    string name,
                                    string description,
                                    bool isTimed,
                                    bool isClosed,
                                    bool isClosedEmail,
                                    bool isEmailResponse,
                                    bool pauseSla,
                                    bool isShipping,
                                    bool isDiscontinued,
                                    string productFamilyID,
                                    string iconUrl,
                                    bool isVisibleOnPortal,
                                    bool isActive,
                                    bool ExcludeFromCDI)
    {
        if (!UserSession.CurrentUser.IsSystemAdmin)
        {
            return("");
        }
        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionType actionType = id == null ? (new ActionTypes(UserSession.LoginUser)).AddNewActionType() : ActionTypes.GetActionType(UserSession.LoginUser, (int)id);
            actionType.IsTimed     = isTimed;
            actionType.Name        = name;
            actionType.Description = description;
            if (id == null)
            {
                actionType.Position = actionType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                actionType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            actionType.Collection.Save();
            actionType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.PhoneTypes:
            PhoneType phoneType = id == null ? (new PhoneTypes(UserSession.LoginUser)).AddNewPhoneType() : PhoneTypes.GetPhoneType(UserSession.LoginUser, (int)id);
            phoneType.Name        = name;
            phoneType.Description = description;
            if (id == null)
            {
                phoneType.Position = phoneType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                phoneType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            phoneType.Collection.Save();
            phoneType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatus productVersionStatus = id == null ? (new ProductVersionStatuses(UserSession.LoginUser)).AddNewProductVersionStatus() : ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, (int)id);
            productVersionStatus.IsDiscontinued = isDiscontinued;
            productVersionStatus.IsShipping     = isShipping;
            productVersionStatus.Name           = name;
            productVersionStatus.Description    = description;
            if (id == null)
            {
                productVersionStatus.Position = productVersionStatus.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                productVersionStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            productVersionStatus.Collection.Save();
            productVersionStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketSeverities:
            TicketSeverity ticketSeverity = id == null ? (new TicketSeverities(UserSession.LoginUser)).AddNewTicketSeverity() : TicketSeverities.GetTicketSeverity(UserSession.LoginUser, (int)id);
            ticketSeverity.Name        = name;
            ticketSeverity.Description = description;
            if (id == null)
            {
                ticketSeverity.Position = ticketSeverity.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketSeverity.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            ticketSeverity.VisibleOnPortal = isVisibleOnPortal;
            ticketSeverity.Collection.Save();
            ticketSeverity.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketStatuses:
            if (isEmailResponse == true)
            {
                TicketStatuses statuses = new TicketStatuses(UserSession.LoginUser);
                statuses.LoadByTicketTypeID(int.Parse(arg));
                foreach (TicketStatus status in statuses)
                {
                    status.IsEmailResponse = false;
                }
                statuses.Save();
            }

            TicketStatus ticketStatus = id == null ? (new TicketStatuses(UserSession.LoginUser)).AddNewTicketStatus() : TicketStatuses.GetTicketStatus(UserSession.LoginUser, (int)id);
            ticketStatus.TicketTypeID    = int.Parse(arg);
            ticketStatus.IsClosed        = isClosed;
            ticketStatus.IsClosedEmail   = isClosedEmail;
            ticketStatus.IsEmailResponse = isEmailResponse;
            ticketStatus.PauseSLA        = pauseSla;
            ticketStatus.Name            = name;
            ticketStatus.Description     = description;
            if (id == null)
            {
                ticketStatus.Position = ticketStatus.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            ticketStatus.Collection.Save();
            ticketStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        case SelectedType.TicketTypes:
            TicketType ticketType = id == null ? (new TicketTypes(UserSession.LoginUser)).AddNewTicketType() : TicketTypes.GetTicketType(UserSession.LoginUser, (int)id);
            ticketType.Name              = name;
            ticketType.Description       = description;
            ticketType.IconUrl           = iconUrl;
            ticketType.IsVisibleOnPortal = isVisibleOnPortal;
            ticketType.IsActive          = isActive;
            ticketType.ExcludeFromCDI    = ExcludeFromCDI;
            if (id == null)
            {
                ticketType.Position = ticketType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                ticketType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            if (productFamilyID == "-1")
            {
                ticketType.ProductFamilyID = null;
            }
            else
            {
                ticketType.ProductFamilyID = Convert.ToInt32(productFamilyID);
            }

            ticketType.Collection.Save();
            ticketType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            if (id == null)
            {
                try
                {
                    System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand();
                    command.CommandText = "UPDATE Users SET MenuItems = MenuItems + ',mniTicketType_" + ticketType.TicketTypeID.ToString() + "' WHERE UserID IN (SELECT UserID WHERE OrganizationID = @OrganizationID)";
                    command.Parameters.AddWithValue("OrganizationID", UserSession.LoginUser.OrganizationID);
                    SqlExecutor.ExecuteNonQuery(UserSession.LoginUser, command);
                }
                catch (Exception ex)
                {
                    ExceptionLogs.LogException(UserSession.LoginUser, ex, "Ticket Type Creation - menu item");
                }

                TicketStatuses ticketStatuses = new TicketStatuses(UserSession.LoginUser);
                ticketStatus                = ticketStatuses.AddNewTicketStatus();
                ticketStatus.Name           = "New";
                ticketStatus.Description    = "New";
                ticketStatus.Position       = 0;
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
                ticketStatus.TicketTypeID   = ticketType.TicketTypeID;
                ticketStatus.IsClosed       = false;
                ticketStatus.IsClosedEmail  = false;

                ticketStatus                = ticketStatuses.AddNewTicketStatus();
                ticketStatus.Name           = "Closed";
                ticketStatus.Description    = "Closed";
                ticketStatus.Position       = 30;
                ticketStatus.OrganizationID = UserSession.LoginUser.OrganizationID;
                ticketStatus.TicketTypeID   = ticketType.TicketTypeID;
                ticketStatus.IsClosed       = true;
                ticketStatus.IsClosedEmail  = false;
                ticketStatus.Collection.Save();
                ticketStatus.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);


/*          TicketNextStatuses ticketNextStatuses = new TicketNextStatuses(UserSession.LoginUser);
 *        ticketNextStatuses.AddNextStatus(ticketStatuses[0], ticketStatuses[1], 0);
 *        ticketNextStatuses.AddNextStatus(ticketStatuses[1], ticketStatuses[0], 1);
 *        ticketNextStatuses.Save();*/
            }

            break;

        case SelectedType.ActivityTypes:
            ActivityType activityType = id == null ? (new ActivityTypes(UserSession.LoginUser)).AddNewActivityType() : ActivityTypes.GetActivityType(UserSession.LoginUser, (int)id);
            activityType.Name        = name;
            activityType.Description = description;
            if (id == null)
            {
                activityType.Position = activityType.Collection.GetMaxPosition(UserSession.LoginUser.OrganizationID) + 1;
            }
            if (id == null)
            {
                activityType.OrganizationID = UserSession.LoginUser.OrganizationID;
            }
            activityType.Collection.Save();
            activityType.Collection.ValidatePositions(UserSession.LoginUser.OrganizationID);
            break;

        default:
            break;
        }


        return(GetTypesHtml(type, arg));
    }
    public static TypeObject GetTypeObject(SelectedType type, int id)
    {
        TypeObject result = new TypeObject();

        switch (type)
        {
        case SelectedType.ActionTypes:
            ActionType actionType = ActionTypes.GetActionType(UserSession.LoginUser, id);
            result.ID          = actionType.ActionTypeID;
            result.Name        = actionType.Name;
            result.Description = actionType.Description;
            result.IsTimed     = actionType.IsTimed;
            break;

        case SelectedType.PhoneTypes:
            PhoneType phoneType = PhoneTypes.GetPhoneType(UserSession.LoginUser, id);
            result.ID          = phoneType.PhoneTypeID;
            result.Name        = phoneType.Name;
            result.Description = phoneType.Description;
            break;

        case SelectedType.ProductVersionStatuses:
            ProductVersionStatus productVersionStatus = ProductVersionStatuses.GetProductVersionStatus(UserSession.LoginUser, id);
            result.ID             = productVersionStatus.ProductVersionStatusID;
            result.Name           = productVersionStatus.Name;
            result.Description    = productVersionStatus.Description;
            result.IsShipping     = productVersionStatus.IsShipping;
            result.IsDiscontinued = productVersionStatus.IsDiscontinued;
            break;

        case SelectedType.TicketSeverities:
            TicketSeverity ticketSeverity = TicketSeverities.GetTicketSeverity(UserSession.LoginUser, id);
            result.ID                = ticketSeverity.TicketSeverityID;
            result.Name              = ticketSeverity.Name;
            result.Description       = ticketSeverity.Description;
            result.IsVisibleOnPortal = ticketSeverity.VisibleOnPortal;
            break;

        case SelectedType.TicketStatuses:
            TicketStatus ticketStatus = TicketStatuses.GetTicketStatus(UserSession.LoginUser, id);
            result.ID              = ticketStatus.TicketStatusID;
            result.Name            = ticketStatus.Name;
            result.Description     = ticketStatus.Description;
            result.IsClosed        = ticketStatus.IsClosed;
            result.IsClosedEmail   = ticketStatus.IsClosedEmail;
            result.IsEmailResponse = ticketStatus.IsEmailResponse;
            result.PauseSla        = ticketStatus.PauseSLA;
            break;

        case SelectedType.TicketTypes:
            TicketType ticketType = TicketTypes.GetTicketType(UserSession.LoginUser, id);
            result.ID                = ticketType.TicketTypeID;
            result.Name              = ticketType.Name;
            result.Description       = ticketType.Description;
            result.IsVisibleOnPortal = ticketType.IsVisibleOnPortal;
            result.IconUrl           = ticketType.IconUrl;
            result.IsActive          = ticketType.IsActive;
            result.ExcludeFromCDI    = ticketType.ExcludeFromCDI;

            if (ticketType.ProductFamilyID == null)
            {
                result.ProductFamilyID = -1;
            }
            else
            {
                result.ProductFamilyID = (int)ticketType.ProductFamilyID;
            }

            break;

        case SelectedType.ActivityTypes:
            ActivityType activityType = ActivityTypes.GetActivityType(UserSession.LoginUser, id);
            result.ID          = activityType.ActivityTypeID;
            result.Name        = activityType.Name;
            result.Description = activityType.Description;
            break;

        default:
            break;
        }

        return(result);
    }
Beispiel #11
0
 private void SetTicketSeverity(TicketSeverity severity)
 {
     TicketBatch(SetTicketSeverity, severity);
 }
Beispiel #12
0
        private string TranslateTicketSeverity(TicketSeverity ticketSeverity)
        {
            switch (ticketSeverity)
            {
                case TicketSeverity.Blocker:
                    return Resources.String_Blocker;

                case TicketSeverity.Critical:
                    return Resources.String_Critical;

                case TicketSeverity.Major:
                    return Resources.String_Major;

                case TicketSeverity.Normal:
                    return Resources.String_Normal;

                case TicketSeverity.Minor:
                    return Resources.String_Minor;

                case TicketSeverity.Trivial:
                    return Resources.String_Trivial;

                default:
                    return ticketSeverity.ToString();
            }
        }
Beispiel #13
0
 public string Severity(TicketSeverity old, TicketSeverity @new)
 {
     return(string.Format(Resources.String_SeverityChangesFromXToY,
                          TranslateTicketSeverity(old),
                          TranslateTicketSeverity(@new)));
 }