Ejemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["VersionID"] == null)
        {
            EndResponse("Invalid Version");
        }

        int versionID = int.Parse(Request["VersionID"]);
        ProductVersionsViewItem version = ProductVersionsView.GetProductVersionsViewItem(TSAuthentication.GetLoginUser(), versionID);

        if (version == null)
        {
            EndResponse("Invalid Version");
        }

        if (version.OrganizationID != TSAuthentication.OrganizationID)
        {
            EndResponse("Invalid Version");
        }

        tipProduct.InnerText = version.ProductName;
        tipProduct.Attributes.Add("onclick", "top.Ts.MainPage.openNewProduct(" + version.ProductID.ToString() + "); return false;");
        tipVersion.InnerText = version.VersionNumber;
        tipVersion.Attributes.Add("onclick", "top.Ts.MainPage.openNewProductVersion(" + version.ProductVersionID.ToString() + "); return false;");
        tipStatus.InnerText   = version.VersionStatus;
        tipReleased.InnerText = version.IsReleased ? "Yes" : "No";
        tipDate.InnerText     = version.ReleaseDate == null ? "None" : ((DateTime)version.ReleaseDate).ToString("d");
        tipDesc.InnerHtml     = version.Description;
    }
Ejemplo n.º 2
0
        public static string GetProductVersionsViewItem(RestCommand command, int productVersionID)
        {
            ProductVersionsViewItem productVersionsViewItem = ProductVersionsView.GetProductVersionsViewItem(command.LoginUser, productVersionID);

            if (productVersionsViewItem.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            return(productVersionsViewItem.GetXml("ProductVersionsViewItem", true));
        }
Ejemplo n.º 3
0
        public static string CreateVersion(RestCommand command, int productID)
        {
            if (Products.GetProduct(command.LoginUser, productID).OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            ProductVersions items = new ProductVersions(command.LoginUser);
            ProductVersion  item  = items.AddNewProductVersion();

            item.ReadFromXml(command.Data, true);
            item.ProductID = productID;
            item.Collection.Save();
            item.UpdateCustomFieldsFromXml(command.Data);
            return(ProductVersionsView.GetProductVersionsViewItem(command.LoginUser, item.ProductVersionID).GetXml("Version", true));
        }
Ejemplo n.º 4
0
        public static string UpdateVersion(RestCommand command, int id)
        {
            ProductVersion item = ProductVersions.GetProductVersion(command.LoginUser, id);

            if (item == null)
            {
                throw new RestException(HttpStatusCode.BadRequest);
            }
            if (Products.GetProduct(command.LoginUser, item.ProductID).OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }

            item.ReadFromXml(command.Data, false);
            item.Collection.Save();
            item.UpdateCustomFieldsFromXml(command.Data);
            return(ProductVersionsView.GetProductVersionsViewItem(command.LoginUser, item.ProductVersionID).GetXml("Version", true));
        }
        public static string GetVersionOrganizations(RestCommand command, int versionID, bool orderByDateCreated = false)
        {
            ProductVersionsViewItem item = ProductVersionsView.GetProductVersionsViewItem(command.LoginUser, versionID);

            if (item == null || item.OrganizationID != command.Organization.OrganizationID)
            {
                throw new RestException(HttpStatusCode.Unauthorized);
            }
            OrganizationsView organizations = new OrganizationsView(command.LoginUser);

            if (orderByDateCreated)
            {
                organizations.LoadByVersionID(versionID, "op.DateCreated DESC");
            }
            else
            {
                organizations.LoadByVersionID(versionID);
            }
            return(organizations.GetXml("Customers", "Customer", true, command.Filters));
        }
        override protected void GetNextRecord()
        {
            ProductVersionsViewItem productVersion = ProductVersionsView.GetProductVersionsViewItem(_loginUser, _itemIDList[_rowIndex]);

            _lastItemID = productVersion.ProductVersionID;
            UpdatedItems.Add((int)_lastItemID);

            DocText = HtmlToText.ConvertHtml(productVersion.Description == null ? string.Empty : productVersion.Description);

            _docFields.Clear();
            foreach (DataColumn column in productVersion.Collection.Table.Columns)
            {
                object value = productVersion.Row[column];
                string s     = value == null || value == DBNull.Value ? "" : value.ToString();
                AddDocField(column.ColumnName, s);
            }

            ProductVersionsSearch productVersionsSearch = new ProductVersionsSearch(productVersion);
            Tickets tickets = new Tickets(_loginUser);

            productVersionsSearch.openTicketCount = tickets.GetProductVersionTicketCount(productVersion.ProductVersionID, 0, _organizationID);
            AddDocField("**JSON", JsonConvert.SerializeObject(productVersionsSearch));

            CustomValues customValues = new CustomValues(_loginUser);

            customValues.LoadByReferenceType(_organizationID, ReferenceType.ProductVersions, null, productVersion.ProductVersionID);

            foreach (CustomValue value in customValues)
            {
                object o = value.Row["CustomValue"];
                string s = o == null || o == DBNull.Value ? "" : o.ToString();
                AddDocField(value.Row["Name"].ToString(), s);
            }
            DocFields       = _docFields.ToString();
            DocIsFile       = false;
            DocName         = productVersion.ProductVersionID.ToString();
            DocCreatedDate  = productVersion.DateCreatedUtc;
            DocModifiedDate = DateTime.UtcNow;
        }