/// <summary> /// Load country list /// </summary> private void loadCountries() { _countries = null; //empty country list countriesGrid.Rows.Clear(); foreach (HyperCatalog.Business.Country country in countries) { HyperCatalog.Business.Region region = country.Region; //build a new row for this country UltraGridRow newRow = new UltraGridRow(new object[] { country.Code, country.Name, region != null ? region.Code + (region.Name != null ? " - " + region.Name : "") : "" }); newRow.DataKey = country.Code; //add this row to the grid countriesGrid.Rows.Add(newRow); } }
private void AddCountrieRows(HyperCatalog.Business.CountryList countries, PLCList plcDates, int offSet) { if (countries == null) { return; } foreach (Country country in countries) { Trace.Write(" CountryCode = " + country.Code); UltraGridRow newRow; /*DateTime? blind=null, full=null, obsolete=null, announce=null, remove=null; * bool blindLocked = false, fullLocked = false, obsoleteLocked = false, announceLocked = false, removeLocked = false; * */ PLC p = new PLC(); p.CountryCode = country.Code; #region identify if country is in Item PLC list if (plcDates != null) { foreach (PLC plc in plcDates) { if (plc.CountryCode == country.Code) { p = plc; break; } } } #endregion newRow = new UltraGridRow(new object[] { "", country.Code + " - " + country.Name, "", p.BlindDate, p.FullDate, p.ObsoleteDate, p.AnnouncementDate, p.RemovalDate, "C", country.Code, country.RegionCode, offSet, "", p.BlindLocked, p.FullLocked, p.ObsoleteLocked, p.AnnouncementLocked, p.RemovalLocked, p.EndOfSupportLocked, p.DiscontinueLocked, p.EndOfLifeLocked, p.BlindDateType, p.FullDateType, p.ObsoleteDateType, p.AnnouncementDateType, p.RemovalDateType, p.EndOfSupportDateType, p.DiscontinueDateType, p.EndOfLifeDateType, p.Excluded, p.ExcludeModifierId, p.EndOfSupportDate, p.DiscontinueDate, p.EndOfLifeDate }); dg.Rows.Add(newRow); #region formatting dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Blind").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("PID").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("POD").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Announcement").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Removal").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("EndOfSupport").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("Discontinue").Column.Format = SessionState.User.FormatDate; dg.Rows[dg.Rows.Count - 1].Cells.FromKey("EndOfLife").Column.Format = SessionState.User.FormatDate; #endregion rowCount++; newRow.Cells.FromKey("Region").Text = "<img src='/hc_v4/img/flags/" + country.Code + ".gif' border=0 valign='middle'/> " + newRow.Cells.FromKey("Region").Text; newRow.Cells.FromKey("Region").Style.Padding.Left = Unit.Parse((offSet * 5).ToString() + "px"); newRow.Cells.FromKey("Region").Style.CustomRules = "class='hc_country'"; newRow.Cells.FromKey("ApplyChilds").Text = "<IMG title='Clear this line' src='/hc_v4/img/clear.gif' onclick='CC(\"" + dg.ClientID + "\", " + newRow.Index.ToString() + ");' BORDER=0 VALIGN=MIDDLE BORDER=0 STYLE='cursor:hand'></IMG>"; // Consider Locks coming from country level //Trace.Write(country.Code + " - " + country.Name, "FULL Locked = " + p.FullLocked.ToString()); //newRow.Cells.FromKey("Blind").AllowEditing = (p.BlindLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Blind").Style.CssClass = (p.BlindLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("PID").AllowEditing = (p.FullLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("PID").Style.CssClass = (p.FullLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("POD").AllowEditing = (p.ObsoleteLocked || p.IsMinimized) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("POD").Style.CssClass = (p.ObsoleteLocked || p.IsMinimized) ? "ro" : ""; //newRow.Cells.FromKey("Announcement").AllowEditing = (p.AnnouncementLocked || p.IsMinimized || p.IsFrozen) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Announcement").Style.CssClass = (p.AnnouncementLocked || p.IsMinimized || p.IsFrozen) ? "ro" : ""; //newRow.Cells.FromKey("Removal").AllowEditing = (p.RemovalLocked || p.IsMinimized) ? AllowEditing.No : AllowEditing.Yes; //newRow.Cells.FromKey("Removal").Style.CssClass = (p.RemovalLocked || p.IsMinimized) ? "ro" : ""; // Changes for CR 4516 - Prabhu Trace.Write(country.Code + " - " + country.Name, "FULL Locked = " + p.FullLocked.ToString()); newRow.Cells.FromKey("Blind").AllowEditing = (p.BlindLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Blind").Style.CssClass = (p.BlindLocked) ? "ro" : ""; newRow.Cells.FromKey("PID").AllowEditing = (p.FullLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("PID").Style.CssClass = (p.FullLocked) ? "ro" : ""; newRow.Cells.FromKey("POD").AllowEditing = (p.ObsoleteLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("POD").Style.CssClass = (p.ObsoleteLocked) ? "ro" : ""; newRow.Cells.FromKey("Announcement").AllowEditing = (p.AnnouncementLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Announcement").Style.CssClass = (p.AnnouncementLocked) ? "ro" : ""; newRow.Cells.FromKey("Removal").AllowEditing = (p.RemovalLocked) ? AllowEditing.No : AllowEditing.Yes; newRow.Cells.FromKey("Removal").Style.CssClass = (p.RemovalLocked) ? "ro" : ""; newRow.DataKey = country.Code; } }
/// <summary> /// Display the package selected /// </summary> private void ShowPackage(int package) { #region Load Region/country package listbox HyperCatalog.Business.CountryList cList = HyperCatalog.Business.Country.GetAllCountries(); ddlRegionPackage.Items.Add(new ListItem("GENERIC EMEA", "GENERIC EMEA")); ddlRegionPackage.Items.Add(new ListItem("APJ WIDE", "APJ WIDE")); foreach (Country c in cList) { ddlRegionPackage.Items.Add(new ListItem(c.Name, c.Code)); } #endregion lbTitle.Text = "Package properties"; propertiesMsgLbl.Visible = false; Package p = Package.GetByKey(package); txtPackageId.Text = package.ToString(); if (p != null) { cbActive.Checked = p.IsActive; txtName.Text = p.Name; txtFileName.Text = p.FileName; cbTimeStamp.Checked = p.IncludeTimeStamp; txtFTPURL.Text = p.FTPURL; txtFTPLogin.Text = p.FTPLogin; txtFTPPassword.Text = p.FTPPassword; txtUploadPath.Text = p.UploadPath; txtFTPPort.Text = p.FTPPort; ddlFTPMode.SelectedValue = p.FTPMode; txtEmail.Text = p.NotificationEmail; panelCreator.Visible = true; hlCreator.Text = p.User.FullName; lbOrganization.Text = p.User.Organization.Name; ddlRegionPackage.SelectedValue = (p.RegionPackage != string.Empty) ? p.RegionPackage : p.Countries[0].CountryCode; panelFilter.Visible = false; if (p.RegionPackage == string.Empty) { panelFilter.Visible = true; cboxFilter.Items[0].Selected = p.Countries[0].FilterPreReleased; cboxFilter.Items[1].Selected = p.Countries[0].FilterLive; cboxFilter.Items[2].Selected = p.Countries[0].FilterObsolete; cboxFilter.Items[3].Selected = p.Countries[0].ApplyFallbackEnglish; } } else { panelFilter.Visible = false; cbActive.Checked = false; txtPackageId.Text = package.ToString(); txtName.Text = String.Empty; txtFileName.Text = String.Empty; cbTimeStamp.Checked = false; ddlRegionPackage.SelectedIndex = 0; txtFTPURL.Text = string.Empty; txtFTPLogin.Text = string.Empty; txtFTPPassword.Text = string.Empty; txtUploadPath.Text = string.Empty; txtFTPPort.Text = string.Empty; ddlFTPMode.SelectedIndex = 0; txtEmail.Text = string.Empty; panelCreator.Visible = false; } }
private void UpdateDataEdit(string countryCode) { if (countryCode != string.Empty) { currentCountry = Business.Country.GetByKey(countryCode); } else { currentCountry = null; } txtRegionCodeValue.ClearSelection(); //using (ItemList classes = Item.GetAll("LevelId=1")) //{ // classes.Sort("Sort"); // dgPVGrid.DataSource = classes; using (HyperComponents.Data.dbAccess.Database dbObj = Utils.GetMainDB()) { //using (ds = dbObj.RunSQLReturnDataSet("SELECT * From CountryApprovalTrigger WHERE CountryCode = @CountryCode", HyperComponents.Data.dbAccess.Database.NewSqlParameter("@CountryCode", System.Data.SqlDbType.NVarChar, 50, countryCode))) //{ string sql = "select I.ItemId as ClassId, dbo.GetItemName(I.ItemId) as [PRODUCT TYPE NAME] from Items I where I.LevelId = 1 "; //sql += "SELECT * From CountryApprovalTrigger WHERE CountryCode = '" + countryCode + "'"; sql += "SELECT W.ItemId AS ClassId, W.PLCode AS PLCode, W.PLCode +' [' + BP.PLName + ']' AS ProductLine, CA.PassiveApprovalDay as [Trigger],CA.ActiveApproval as IsActive FROM Work_Item_ProductLines W "; sql += "INNER JOIN Items I ON I.ItemId = W.ItemId AND I.LevelId = 1 "; sql += "LEFT OUTER JOIN [CountryApprovalTrigger] CA ON CA.ClassId = W.ItemId AND CA.PLCode = W.PLCode AND CA.CountryCode = '" + countryCode + "' "; sql += "INNER JOIN BPL BP ON BP.PLCode = W.PLCode"; //using (ds = dbObj.RunSQLReturnDataSet(sql.ToString())) //{ //dbObj.CloseConnection(); ds = dbObj.RunSQLReturnDataSet(sql.ToString()); if (ds.Tables[0].Rows.Count > 0) { DataColumn parentColumn; DataColumn childColumn; DataRelation relation; parentColumn = ds.Tables[0].Columns["ClassId"]; childColumn = ds.Tables[1].Columns["ClassId"]; relation = new System.Data.DataRelation("ClassId", parentColumn, childColumn); ds.Relations.Add(relation); } } if (currentCountry != null) { Debug.Trace("<br>txtCountryNameValue.Text=" + currentCountry.Name + ", txtRegionCodeValue.SelectedValue = " + currentCountry.RegionCode, DebugSeverity.Low); txtCountryNameValue.Text = currentCountry.Name; txtCountryCodeValue.Text = currentCountry.Code; cbEditContent.Checked = currentCountry.CanLocalizeContent; cbEditCP.Checked = currentCountry.CanCreateProductInLocalLanguage; cbEditPLC.Checked = currentCountry.CanLocalizePLC; cbEditMS.Checked = currentCountry.CanLocalizeMarketSegments; cbEditCS.Checked = currentCountry.CanLocalizeCrossSells; cbEditPublishers.Checked = currentCountry.CanLocalizePublishers; cbTranslationPLC.Checked = currentCountry.PLCDrivenTranslation; cbIsActive.Checked = currentCountry.IsActive; cbPublishable.Checked = currentCountry.Publishable; cbFallBackToEnglish.Checked = currentCountry.FallBackToEnglish; txtRegionCodeValue.SelectedValue = currentCountry.RegionCode; _countries = Business.Region.GetByKey(currentCountry.RegionCode).Countries; txtCountryCodeValue.Enabled = false; UITools.ShowToolBarButton(propertiesToolBar, "Delete"); UITools.ShowToolBarSeparator(propertiesToolBar, "DeleteSep"); } else { cbIsActive.Checked = true; txtCountryNameValue.Text = null; txtCountryCodeValue.Text = null; UITools.HideToolBarButton(propertiesToolBar, "Delete"); UITools.HideToolBarSeparator(propertiesToolBar, "DeleteSep"); if (regionList.SelectedValue != string.Empty) { txtRegionCodeValue.SelectedValue = regionList.SelectedValue; } txtCountryCodeValue.Enabled = true; } dgPVGrid.DataSource = ds.Tables[0].DefaultView; //dgPVGrid.DataSource = ds; dgPVGrid.DataBind(); dgPVGrid.Height = Unit.Empty; dgPVGrid.Width = Unit.Empty; Utils.InitGridSort(ref dgPVGrid, false); foreach (UltraGridColumn use1 in dgPVGrid.Bands[1].Columns) { Response.Write(use1.Header.Title); } //} dgPVGrid.Bands[0].Columns[2].Hidden = true; dgPVGrid.Bands[1].Columns[5].Hidden = true; setPropertiesVisible(true); }