private void LoadVersionNodes(RadTreeNode node, int selectedVersionID) { if (node == null) { return; } node.Nodes.Clear(); using (ProductVersions versions = new ProductVersions(UserSession.LoginUser)) { versions.LoadByProductID(GetProductID(node)); if (!versions.IsEmpty) { foreach (ProductVersion version in versions) { RadTreeNode vnode = new RadTreeNode(); vnode.Text = version.VersionNumber; vnode.Value = version.ProductVersionID.ToString(); vnode.ExpandMode = TreeNodeExpandMode.WebService; node.Nodes.Add(vnode); if (selectedVersionID == version.ProductVersionID) { vnode.Selected = true; SetNode(vnode); } } } } }
public static string GetOrganizationProductVersionItems(RestCommand command, int organizationID, int productID, int productVersionID) { Organization item = Organizations.GetOrganization(command.LoginUser, organizationID); if (item == null || item.ParentID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } Product product = Products.GetProduct(command.LoginUser, productID); if (product == null || product.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.NotFound); } ProductVersion productVersion = ProductVersions.GetProductVersion(command.LoginUser, productVersionID); if (productVersion == null || productVersion.ProductID != product.ProductID) { throw new RestException(HttpStatusCode.NotFound); } OrganizationProductsView organizationProductsView = new OrganizationProductsView(command.LoginUser); organizationProductsView.LoadByOrganizationProductAndVersionIDs(organizationID, productID, productVersionID); return(organizationProductsView.GetXml("OrganizationProducts", "OrganizationProduct", true, command.Filters)); }
public Options(string dockerfileVersion, string[] productVersion, string versionSourceName, string email, string password, string user, bool computeShas) { DockerfileVersion = dockerfileVersion; ProductVersions = productVersion .Select(pair => pair.Split(new char[] { '=' }, 2)) .ToDictionary(split => split[0].ToLower(), split => split[1]); VersionSourceName = versionSourceName; GitHubEmail = email; GitHubPassword = password; GitHubUser = user; ComputeChecksums = computeShas; // Special case for handling the lzma NuGet package cache. if (ProductVersions.ContainsKey("sdk") && DockerfileVersion == "2.1") { ProductVersions["lzma"] = ProductVersions["sdk"]; } // Special case for handling the shared dotnet product version variables. if (ProductVersions.ContainsKey("runtime")) { ProductVersions["dotnet"] = ProductVersions["runtime"]; } else if (ProductVersions.ContainsKey("aspnet")) { ProductVersions["dotnet"] = ProductVersions["aspnet"]; } }
public Options(string dockerfileVersion, string[] productVersion, string channelName, string versionSourceName, string email, string password, string user, bool computeShas, bool stableBranding) { DockerfileVersion = dockerfileVersion; ProductVersions = productVersion .Select(pair => pair.Split(new char[] { '=' }, 2)) .ToDictionary(split => split[0].ToLower(), split => split.Skip(1).FirstOrDefault()); ChannelName = channelName; VersionSourceName = versionSourceName; GitHubEmail = email; GitHubPassword = password; GitHubUser = user; ComputeChecksums = computeShas; UseStableBranding = stableBranding; // Special case for handling the shared dotnet product version variables. if (ProductVersions.ContainsKey("runtime")) { ProductVersions["dotnet"] = ProductVersions["runtime"]; } else if (ProductVersions.ContainsKey("aspnet")) { ProductVersions["dotnet"] = ProductVersions["aspnet"]; } }
public static string GetProductVersion(RestCommand command, int productVersionID) { ProductVersion productVersion = ProductVersions.GetProductVersion(command.LoginUser, productVersionID); if (productVersion.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(productVersion.GetXml("ProductVersion", true)); }
public bool CheckIfProductIsActive() { if (ProductVersions.Count != 0) { return(ProductVersions.Last().IsActive); } else { return(false); } }
protected void gridVersions_NeedDataSource(object source, GridNeedDataSourceEventArgs e) { ProductVersions versions = new ProductVersions(UserSession.LoginUser); versions.LoadForGrid(_productID); /* foreach (DataRow row in versions.Table.Rows) { row["ReleaseDate"] = row["ReleaseDate"] != DBNull.Value ? DataUtils.DateToLocal(UserSession.LoginUser, (DateTime?)row["ReleaseDate"]) : row["ReleaseDate"]; //ReportResults.aspx.cs(487): }*/ gridVersions.DataSource = versions.Table; }
private void LoadVersions(int productID) { cmbVersions.Items.Clear(); cmbVersions.Items.Add(new RadComboBoxItem("Unassigned", "-1")); ProductVersions productVersions = new ProductVersions(UserSession.LoginUser); productVersions.LoadByProductID(productID); foreach (ProductVersion version in productVersions) { cmbVersions.Items.Add(new RadComboBoxItem(version.VersionNumber, version.ProductVersionID.ToString())); } cmbVersions.SelectedIndex = 0; }
public IQueryable <ProductVersion> GetProductVersions(ProductLocator locator, DateTime date) { var productVersions = ProductVersions.Where(m => m.IsLive == locator.IsLive && m.Language == locator.Language && m.Format == locator.Format && m.Version == locator.Version && m.Modification <= date ); return((string.IsNullOrEmpty(locator.Slug)) ? productVersions.Where(m => String.IsNullOrEmpty(m.Slug)) : productVersions.Where(m => m.Slug == locator.Slug)); }
public void DeleteVersion(int versionID) { if (!UserSession.CurrentUser.IsSystemAdmin) { return; } try { ProductVersions.DeleteProductVersion(UserSession.LoginUser, versionID); } catch (Exception ex) { DataUtils.LogException(UserSession.LoginUser, ex); } }
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)); }
public static string GetProductVersions(RestCommand command) { ProductVersions productVersions = new ProductVersions(command.LoginUser); productVersions.LoadByOrganizationID(command.Organization.OrganizationID); if (command.Format == RestFormat.XML) { return(productVersions.GetXml("ProductVersions", "ProductVersion", true, command.Filters)); } else { throw new RestException(HttpStatusCode.BadRequest, "Invalid data format"); } }
public override bool Save() { if (textVersionNumber.Text.Trim() == "") { _manager.Alert("Please enter a version number."); return(false); } ProductVersion version; ProductVersions versions = new ProductVersions(UserSession.LoginUser);; if (_versionID < 0) { version = versions.AddNewProductVersion(); } else { versions.LoadByProductVersionID(_versionID); if (versions.IsEmpty) { return(false); } version = versions[0]; } version.VersionNumber = textVersionNumber.Text; version.ProductVersionStatusID = int.Parse(cmbStatus.SelectedValue); version.ProductID = int.Parse(cmbProduct.SelectedValue); version.Description = editorDescription.Content; version.IsReleased = cbReleased.Checked; if (dpRelease.SelectedDate == null) { version.ReleaseDate = null; } else { DateTime date = new DateTime(((DateTime)dpRelease.SelectedDate).Ticks); version.ReleaseDate = DataUtils.DateToUtc(UserSession.LoginUser, date); } version.Collection.Save(); (new OrganizationProducts(UserSession.LoginUser)).UpdateVersionProduct(version.ProductVersionID, version.ProductID); _fieldControls.RefID = version.ProductVersionID; _fieldControls.SaveCustomFields(); return(true); }
public IEnumerable GetVersionNodes(RadTreeNodeData node, IDictionary context) { ProductVersions versions = new ProductVersions(UserSession.LoginUser); versions.LoadByProductID(int.Parse(node.Value)); List <RadTreeNodeData> list = new List <RadTreeNodeData>(); foreach (ProductVersion version in versions) { RadTreeNodeData newNode = new RadTreeNodeData(); newNode.Text = version.VersionNumber; newNode.Value = version.ProductVersionID.ToString(); list.Add(newNode); } return(list); }
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 DeleteVersion(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); } string result = item.GetXml("Version", true); ProductVersions productVersions = new ProductVersions(command.LoginUser); using (SqlCommand dbCommand = new SqlCommand()) { dbCommand.CommandText = "DELETE FROM OrganizationProducts WHERE (ProductVersionID = @ProductVersionID)"; dbCommand.CommandType = CommandType.Text; dbCommand.Parameters.Clear(); dbCommand.Parameters.AddWithValue("@ProductVersionID", id); productVersions.ExecuteNonQuery(dbCommand, "OrganizationProducts"); dbCommand.CommandText = "UPDATE Tickets SET SolvedVersionID = null WHERE (SolvedVersionID = @ProductVersionID)"; dbCommand.CommandType = CommandType.Text; dbCommand.Parameters.Clear(); dbCommand.Parameters.AddWithValue("@ProductVersionID", id); productVersions.ExecuteNonQuery(dbCommand, "Tickets"); dbCommand.CommandText = "UPDATE Tickets SET ReportedVersionID = null WHERE (ReportedVersionID = @ProductVersionID)"; dbCommand.CommandType = CommandType.Text; dbCommand.Parameters.Clear(); dbCommand.Parameters.AddWithValue("@ProductVersionID", id); productVersions.ExecuteNonQuery(dbCommand, "Tickets"); } item.Delete(); item.Collection.Save(); return(result); }
public void RemoveProductUnit(Unit unitToRemove) { ProductVersion newVersion, previousVersion; previousVersion = ProductVersions.Last(); if (previousVersion.Units.Contains(unitToRemove)) { //Copying data from previous to new newVersion = DublicateProductVersion(previousVersion); //Adding the change newVersion.Units.Remove(unitToRemove); this.ProductVersions.Add(newVersion); repository.UpdateProductVersionList(this); } else { throw new UnitAlreadyRemovedException(); } }
public void AddProductUnit(Unit unitToAdd) { ProductVersion newVersion, previousVersion; previousVersion = ProductVersions.Last(); if (!previousVersion.Units.Contains(unitToAdd)) { //Copying data from previous to new newVersion = DublicateProductVersion(previousVersion); //Adding the change newVersion.Units.Add(unitToAdd); this.ProductVersions.Add(newVersion); repository.UpdateProductVersionList(this); } else { throw new ProductAlreadyHaveUnitException(); } }
public void ActivateProduct() { ProductVersion newVersion, previousVersion; previousVersion = ProductVersions.Last(); if (previousVersion.IsActive == false) { //Copying data from previous to new newVersion = DublicateProductVersion(previousVersion); //Adding the change newVersion.IsActive = true; this.ProductVersions.Add(newVersion); repository.UpdateProductVersionList(this); } else { throw new ProductAlreadyActivatedException(); } }
private void LoadVersion(int versionID) { ProductVersions versions = new ProductVersions(UserSession.LoginUser); versions.LoadByProductVersionID(versionID); if (!versions.IsEmpty) { Product product = Products.GetProduct(UserSession.LoginUser, versions[0].ProductID); if (product.OrganizationID != UserSession.LoginUser.OrganizationID) { Response.Write("Invalid Request"); Response.End(); return; } textVersionNumber.Text = versions[0].VersionNumber; cmbProduct.SelectedValue = versions[0].ProductID.ToString(); cmbStatus.SelectedValue = versions[0].ProductVersionStatusID.ToString(); editorDescription.Content = versions[0].Description; cbReleased.Checked = versions[0].IsReleased; dpRelease.SelectedDate = versions[0].ReleaseDate; } else { textVersionNumber.Text = ""; if (_productID < 0) { cmbProduct.SelectedIndex = 0; } else { cmbProduct.SelectedValue = _productID.ToString(); } cmbStatus.SelectedIndex = 0; cbReleased.Checked = false; dpRelease.SelectedDate = DateTime.Today; } }
public void ChangeProductSupplier(string supplier) { ProductVersion newVersion, previousVersion; previousVersion = ProductVersions.Last(); //Copying data from previous to new if (previousVersion.Supplier != supplier) { //Copying data from previous to new newVersion = DublicateProductVersion(previousVersion); //Adding the change newVersion.Supplier = supplier; this.ProductVersions.Add(newVersion); repository.UpdateProductVersionList(this); } else { throw new AlreadyExistingSupplierException(supplier); } }
private new void PopulateComboBox(bool isResidential, bool isHouseboat) { if (isResidential) { mNewLotType = LotType.Residential; mCombo.ValueList.Clear(); List <KeyValuePair <ResidentialLotSubType, string> > list = new List <KeyValuePair <ResidentialLotSubType, string> >(Responder.Instance.EditTownModel.ResidentialSubTypes); list.Sort(OnSort); foreach (KeyValuePair <ResidentialLotSubType, string> pair in list) { if (pair.Key == mCurrentResidentialSubType) { mCombo.ValueList.Add(pair.Value, pair.Key); mCombo.CurrentSelection = (uint)(mCombo.ValueList.Count - 1); } else if (pair.Key != ResidentialLotSubType.kEP10_PrivateLot) { mCombo.ValueList.Add(pair.Value, pair.Key); } } mOkButton.Enabled = true; } else { mNewLotType = LotType.Commercial; mCombo.ValueList.Clear(); if (mCurrentCommercialSubType == CommercialLotSubType.kCommercialUndefined) { mCombo.ValueList.Add(Responder.Instance.LocalizationModel.LocalizeString("Ui/Caption/EditTown/ChangeLotType:ChooseLotType", new object[0]), CommercialLotSubType.kCommercialUndefined); mCombo.CurrentSelection = (uint)(mCombo.ValueList.Count - 1); mOkButton.Enabled = false; } List <KeyValuePair <CommercialLotSubType, string> > list = new List <KeyValuePair <CommercialLotSubType, string> >(Responder.Instance.EditTownModel.GetCommercialSubTypes(false, isHouseboat)); list.Sort(OnSort); foreach (KeyValuePair <CommercialLotSubType, string> pair in list) { mCombo.ValueList.Add((pair.Key == CommercialLotSubType.kEP11_BaseCampFuture ? pair.Value + " (" + ProductVersions.GetLocalizedName(ProductVersion.EP11) + ")" : pair.Value), pair.Key); if (pair.Key == mCurrentCommercialSubType) { mCombo.CurrentSelection = (uint)(mCombo.ValueList.Count - 1); mOkButton.Enabled = true; } } } mCombo.CurrentSelection = mCombo.CurrentSelection; mCombo.Invalidate(); mCombo.Enabled = mCombo.ValueList.Count > 1; }
private void ImportOrg(int orgID, LoginUser loginUser) { string existingImportID = GetImportID(orgID); if (!string.IsNullOrWhiteSpace(existingImportID)) { MessageBox.Show("This company has already been imported"); return; } try { _importID = orgID.ToString() + "-" + Guid.NewGuid().ToString(); _logs = new Logs(orgID.ToString() + " - Org.txt"); _usersAndContacts = new Users(loginUser); _usersAndContacts.LoadContactsAndUsers(orgID, false); _badProducts = new Products(GetCorrupteLoginUser()); _badProductVersions = new ProductVersions(GetCorrupteLoginUser()); _badGroups = new Groups(GetCorrupteLoginUser()); _badUsers = new Users(GetCorrupteLoginUser()); _badTicketTypes = new TicketTypes(GetCorrupteLoginUser()); _badTicketStatuses = new TicketStatuses(GetCorrupteLoginUser()); _badTicketSeverities = new TicketSeverities(GetCorrupteLoginUser()); _badTicketKBCategories = new KnowledgeBaseCategories(GetCorrupteLoginUser()); _badProducts.LoadByOrganizationID(orgID); _badProductVersions.LoadByParentOrganizationID(orgID); _badGroups.LoadByOrganizationID(orgID); _badUsers.LoadByOrganizationID(orgID, false); _badTicketTypes.LoadByOrganizationID(orgID); _badTicketStatuses.LoadByOrganizationID(orgID); _badTicketSeverities.LoadByOrganizationID(orgID); _badTicketKBCategories.LoadCategories(orgID); _goodProducts = new Products(loginUser); _goodProductVersions = new ProductVersions(loginUser); _goodGroups = new Groups(loginUser); _goodUsers = new Users(loginUser); _goodTicketTypes = new TicketTypes(loginUser); _goodTicketStatuses = new TicketStatuses(loginUser); _goodTicketSeverities = new TicketSeverities(loginUser); _goodTicketKBCategories = new KnowledgeBaseCategories(loginUser); _goodProducts.LoadByOrganizationID(orgID); _goodProductVersions.LoadByParentOrganizationID(orgID); _goodGroups.LoadByOrganizationID(orgID); _goodUsers.LoadByOrganizationID(orgID, false); _goodTicketTypes.LoadByOrganizationID(orgID); _goodTicketStatuses.LoadByOrganizationID(orgID); _goodTicketSeverities.LoadByOrganizationID(orgID); _goodTicketKBCategories.LoadCategories(orgID); _exceptionOcurred = false; if (cbCompanies.Checked) { RecoverCompanies(orgID, loginUser); } //RecoverContacts(orgID); if (cbProducts.Checked) { RecoverProducts(orgID, loginUser); } // RecoverAssets(orgID); if (cbOldActions.Checked) { RecoverActionsFromOldTickets(orgID, loginUser); } if (cbTickets.Checked) { RecoverTickets(orgID, loginUser); } if (_exceptionOcurred) { SaveOrgResults(orgID, "Finished with exceptions", _importID); } else { SaveOrgResults(orgID, "Success", _importID); } SqlExecutor.ExecuteNonQuery(loginUser, "update organizations set LastIndexRebuilt='1/1/2000' where OrganizationID=" + orgID.ToString()); MessageBox.Show("Import Complete"); } catch (Exception ex) { SaveOrgResults(orgID, "Failure: " + ex.Message, _importID); ExceptionLogs.LogException(GetCorrupteLoginUser(), ex, "recover"); } }
public override string GetLocalizedValue(ProductVersion value) { return(ProductVersions.GetLocalizedName(value)); }