コード例 #1
0
        public XmlDocument GetPrefixedEntries(string prefix)
        {
            DateTime       t1          = DateTime.Now;
            CollectionView vContainers = GetContainers();

            vContainers.ApplyFilter("Tag", prefix, CollectionView.FilterOperand.StartsWith);
            System.Xml.XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.AppendChild(xmlDoc.CreateElement("entries"));
            if (prefix != null)
            {
                int nbRows = 0;
                try
                {
                    for (int i = 0; i < vContainers.Count; i++)
                    {
                        Container c         = (Container)vContainers[i];
                        XmlNode   entryNode = xmlDoc.CreateElement("entry");
                        AjaxUtils.addAttribute(ref entryNode, "key", c.Tag);
                        AjaxUtils.addAttribute(ref entryNode, "value", c.Name);
                        xmlDoc.DocumentElement.AppendChild(entryNode);
                        nbRows++;
                        if (nbRows == MAXSUGGEST)
                        {
                            break;
                        }
                    }
                }
                catch
                {
                    HttpRuntime.Cache.Remove(CACHEENTRYNAME);
                }
            }
            return(xmlDoc);
        } // GetPrefixedEntries
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        CultureList    dsCultures = SessionState.User.Cultures;
        CollectionView Master     = new CollectionView(dsCultures);

        Master.ApplyFilter("Type", CultureType.Master, CollectionView.FilterOperand.Equals);
        if (Master.Count > 0)
        {
            webTab.Tabs.FromKey("EOM").Visible = true;
        }
        else
        {
            webTab.Tabs.FromKey("EOM").Visible = false;
        }
        CollectionView Region = new CollectionView(dsCultures);

        Region.ApplyFilter("Type", CultureType.Regionale, CollectionView.FilterOperand.Equals);
        if (Region.Count > 0)
        {
            webTab.Tabs.FromKey("EOV").Visible = true;
        }
        else
        {
            webTab.Tabs.FromKey("EOV").Visible = false;
        }
        if ((Master.Count == 0) && (Region.Count == 0))
        {
            UITools.DenyAccess(DenyMode.Standard);
        }
    }
コード例 #3
0
    public void dg_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e)
    {
        /******** QC#723 (rowDel is true if row got deleted )****************/
        bool rowDel = false;

        Infragistics.WebUI.UltraWebGrid.UltraGridRow r = e.Row;
        vPLUsers.ApplyFilter("Id", r.Cells.FromKey("UserId").Value, CollectionView.FilterOperand.Equals);
        if (vPLUsers.Count > 0)
        {
            TemplatedColumn col = (TemplatedColumn)r.Cells.FromKey("Select").Column;
            CheckBox        cb  = (CheckBox)((CellItem)col.CellItems[e.Row.Index]).FindControl("g_sd");
            cb.Checked = true;
        }
        if (!cbFilterAllUsers.Checked)
        {
            TemplatedColumn col = (TemplatedColumn)r.Cells.FromKey("Select").Column;
            CheckBox        cb  = (CheckBox)((CellItem)col.CellItems[e.Row.Index]).FindControl("g_sd");
            /******** QC#723 (setting rowDel to true)****************/
            if (!cb.Checked)
            {
                dg.Rows.Remove(r); rowDel = true;
            }
        }
        #region filter
        /******** QC#723 (No need to search in deleted rows.)****************/
        if (txtFilter.Text.Length > 0 && !rowDel)
        {
            string filter   = txtFilter.Text.Trim().ToLower();
            string userName = r.Cells.FromKey("UserName").Value.ToString().ToLower();
            string orgName  = r.Cells.FromKey("OrgName").Value.ToString().ToLower();
            string roleName = r.Cells.FromKey("RoleName").Value.ToString().ToLower();

            if ((userName.Length == 0 || userName.IndexOf(filter) < 0) &&
                (orgName.Length == 0 || orgName.IndexOf(filter) < 0) &&
                (roleName.Length == 0 || roleName.IndexOf(filter) < 0))
            {
                dg.Rows.Remove(r);
            }
            else
            {
                UITools.HiglightGridRowFilter(ref r, txtFilter.Text);
            }
        }
        #endregion
    }
コード例 #4
0
ファイル: Preview.aspx.cs プロジェクト: GitJayanth/test3
    protected void UpdateDataView()
    {
        try
        {
            dlTemplates.Items.Clear();
            if (template != null || template.Count >= 0)
            {
                foreach (string t in template)
                {
                    dlTemplates.Items.Add(new ListItem(t, t));
                }
            }
            CultureList    culs  = SessionState.User.Cultures;
            CollectionView vCuls = new CollectionView(culs);
            if (SessionState.Culture.Code != HyperCatalog.Shared.SessionState.MasterCulture.Code)
            {
                vCuls.ApplyFilter("FallbackCode", SessionState.Culture.Code, CollectionView.FilterOperand.StartsWith);
                dlLocalizations.Items.Add(new ListItem(SessionState.Culture.Name, SessionState.Culture.Code));
            }
            foreach (Culture cul in vCuls)
            {
                string prefix = "";
                for (int i = 0; i < (int)cul.Type; i++)
                {
                    prefix += "_";
                }
                dlLocalizations.Items.Add(new ListItem(prefix + cul.Name, cul.Code));
            }
            if (SessionState.Culture != null)
            {
                dlLocalizations.SelectedValue = SessionState.Culture.Code;
            }
            else
            {
                dlLocalizations.SelectedValue = HyperCatalog.Shared.SessionState.MasterCulture.Code;
            }

            Publication pubWS = HyperCatalog.WebServices.WSInterface.Publication;
            colorParams = pubWS.GetParamSet("HP Colors");
            dlColors.Items.Add(new ListItem("Default", "default"));
            dlColors.Items.Add(new ListItem("Auto", "auto"));

            foreach (ParamSet param in colorParams)
            {
                dlColors.Items.Add(new ListItem(param.Name, param.Id.ToString()));
            }

            try
            {
                //FIX FOR 70901
                int paramVal = 0;
                //paramVal = pubWS.GetHotItemParam(item.Id.ToString(), dlTemplates.Text.ToString());
                paramVal = GetHotItemParam(item.Id.ToString(), dlTemplates.Text.ToString());
                //FIX FOR 70901

                if (paramVal > 0)
                {
                    if (paramVal < dlColors.Items.Count)
                    {
                        dlColors.SelectedValue = dlColors.Items[paramVal + 1].Value;
                    }
                }
            }
            catch (Exception ex)
            { }
        }
        catch (Exception e)
        {
            Response.Write(e.Message);
        }
    }
コード例 #5
0
ファイル: Export.cs プロジェクト: GitJayanth/test3
        /// <summary>
        /// Export the containers List in Excel file
        /// </summary>
        /// <param name="page"></param>
        public static void ExportContainers(Page page)
        {
            using (CollectionView cv = new CollectionView(HyperCatalog.Business.Container.GetAll()))
            {
                cv.Sort("GroupId");

                using (CollectionView cvCG = new CollectionView(ContainerGroup.GetAll()))
                {
                    using (CollectionView cvCT = new CollectionView(ContainerType.GetAll()))
                    {
                        using (CollectionView cvDT = new CollectionView(DataType.GetAll()))
                        {
                            using (CollectionView cvU = new CollectionView(User.GetAll()))
                            {
                                using (CollectionView cvLG = new CollectionView(LookupGroup.GetAll()))
                                {
                                    using (CollectionView cvIM = new CollectionView(InheritanceMethod.GetAll()))
                                    {
                                        // string contains html code to export
                                        System.Text.StringBuilder sb = new System.Text.StringBuilder(string.Empty);

                                        sb.Append("<html><body>");
                                        sb.Append("<table border='1'>");
                                        /******** Writing the User info and Current date ***********/
                                        int ColCount = 28;
                                        sb.Append("<tr style='border: none' valign='top'><td style='font-weight:bold;font-size: 14;border: none; font-family:Arial Unicode MS' colspan=" + ColCount + ">" + "Container Report" + "</td></tr>");
                                        sb.Append("<tr style='border: none' valign='top'><td style='font-weight:bold;border: none; font-size: 14; font-family:Arial Unicode MS'>Generated By: </td><td style='border: none; font-size: 14; font-family:Arial Unicode MS' colspan=" + (ColCount - 1).ToString() + ">" + SessionState.User.FullName + "</td></tr>");
                                        sb.Append("<tr style='border: none' valign='top'><td style='font-weight:bold;border: none; font-size: 14;font-family:Arial Unicode MS'>Exported On: </td><td style='border: none ;font-size: 14; font-family:Arial Unicode MS' colspan=" + (ColCount - 1).ToString() + ">" + SessionState.User.FormatUtcDate(DateTime.UtcNow, true, "MM/dd/yyyy:HH:mm:ss") + "</td></tr>");



                                        #region "Header"

                                        sb.Append("<tr style='font-size: 14; font-weight: bold;font-family:Arial Unicode MS background-color: lightgrey' wordwrap='true'>");
                                        sb.Append("<td>Id</td>");
                                        sb.Append("<td>Container group</td>");
                                        sb.Append("<td>xmlname</td>");
                                        sb.Append("<td>Name</td>");
                                        sb.Append("<td>Label</td>");
                                        sb.Append("<td>Definition</td>");
                                        sb.Append("<td>Entry rule</td>");
                                        sb.Append("<td>Sample</td>");
                                        sb.Append("<td>Data type</td>");
                                        sb.Append("<td>Container type</td>");
                                        sb.Append("<td>Lookup</td>");
                                        sb.Append("<td>Input mask</td>");
                                        sb.Append("<td>Max length</td>");
                                        sb.Append("<td>Translatable</td>");
                                        sb.Append("<td>Regionalizable</td>");
                                        sb.Append("<td>Localizable</td>");
                                        sb.Append("<td>Publishable</td>");
                                        sb.Append("<td>Readonly</td>");
                                        sb.Append("<td>Keep if obsolete</td>");
                                        sb.Append("<td>Inheritance method</td>");
                                        sb.Append("<td>Sort</td>");
                                        sb.Append("<td>Segment</td>");
                                        sb.Append("<td>ValidationMask</td>");
                                        sb.Append("<td>WWXPath</td>");
                                        sb.Append("<td>Creator</td>");
                                        sb.Append("<td>Create date</td>");
                                        sb.Append("<td>Modifier</td>");
                                        sb.Append("<td>Modifier date</td>");
                                        sb.Append("</tr>");
                                        #endregion

                                        string cellColor = "#D0D0D0", defaultCellColor = "#D0D0D0";
                                        for (int i = 0; i < cv.Count; i++)
                                        {
                                            Container curContainer = ((Container)cv[i]);
                                            sb.Append("<tr valign='top' style='font-size: 14; font-family:Arial Unicode MS;background-color: " + cellColor + ";text-color: black;'>");
                                            sb.Append("<td>" + curContainer.Id + "</td>");
                                            //********************************************************************************************
                                            //GADSC Code Change for displaying the Goup/Subgroup path of the container group in the report
                                            //Ezilla Bug N0:68758
                                            //Modified By:Kanthi.J
                                            //********************************************************************************************
                                            cvCG.ApplyFilter("Id", curContainer.GroupId, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            sb.Append("<td>" + ((ContainerGroup)cvCG[0]).Path + ((ContainerGroup)cvCG[0]).Name + "</td>");
                                            sb.Append("<td>" + curContainer.Tag + "</td>");
                                            sb.Append("<td>" + curContainer.Name + "</td>");
                                            sb.Append("<td>" + curContainer.Label + "</td>");
                                            sb.Append("<td>" + curContainer.Definition + "</td>");
                                            sb.Append("<td>" + curContainer.EntryRule + "</td>");
                                            sb.Append("<td>" + curContainer.Sample + "</td>");
                                            cvDT.ApplyFilter("Code", curContainer.DataTypeCode, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            sb.Append("<td>" + ((DataType)cvDT[0]).Name + "</td>");
                                            cvCT.ApplyFilter("Code", curContainer.ContainerTypeCode, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            sb.Append("<td>" + ((ContainerType)cvCT[0]).Name + "</td>");
                                            if (curContainer.LookupId == -1)
                                            {
                                                sb.Append("<td></td>");
                                            }
                                            else
                                            {
                                                cvLG.ApplyFilter("Id", curContainer.LookupId, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                                sb.Append("<td>" + ((LookupGroup)cvLG[0]).Name + "</td>");
                                            }
                                            sb.Append("<td>" + curContainer.InputMask + "</td>");
                                            sb.Append("<td>" + curContainer.MaxLength + "</td>");
                                            sb.Append("<td>" + curContainer.Translatable + "</td>");
                                            sb.Append("<td>" + curContainer.Regionalizable + "</td>");
                                            sb.Append("<td>" + curContainer.Localizable + "</td>");
                                            sb.Append("<td>" + curContainer.Publishable + "</td>");
                                            sb.Append("<td>" + curContainer.ReadOnly + "</td>");
                                            sb.Append("<td>" + curContainer.KeepIfObsolete + "</td>");
                                            cvIM.ApplyFilter("Id", curContainer.InheritanceMethodId, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            sb.Append("<td>" + ((InheritanceMethod)cvIM[0]).Name + "</td>");
                                            sb.Append("<td>" + curContainer.Sort + "</td>");
                                            sb.Append("<td>" + curContainer.SegmentId + "</td>");
                                            sb.Append("<td>" + curContainer.ValidationMask + "</td>");
                                            sb.Append("<td>" + curContainer.WWXPath + "</td>");
                                            cvU.ApplyFilter("Id", curContainer.CreatorId, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            sb.Append("<td>" + ((User)cvU[0]).FullName + "</td>");
                                            sb.Append("<td>" + curContainer.CreateDate + "</td>");
                                            if (curContainer.ModifierId == -1)
                                            {
                                                sb.Append("<td></td>");
                                            }
                                            else
                                            {
                                                cvU.ApplyFilter("Id", curContainer.ModifierId, HyperCatalog.Business.CollectionView.FilterOperand.Equals);
                                            }
                                            sb.Append("<td>" + ((User)cvU[0]).FullName + "</td>");
                                            sb.Append("<td>" + curContainer.ModifyDate + "</td>");

                                            sb.Append("</tr>");
                                            if (cellColor == defaultCellColor)
                                            {
                                                cellColor = "white";
                                            }
                                            else
                                            {
                                                cellColor = defaultCellColor;
                                            }
                                        }

                                        sb.Append("</table>");
                                        sb.Append("</body></html>");

                                        string fileName = string.Empty;
                                        fileName += "Containers.xls";

                                        string exportContent = sb.ToString();
                                        page.Response.Clear();
                                        page.Response.ClearContent();
                                        page.Response.ClearHeaders();
                                        page.Response.Charset = string.Empty;
                                        page.Response.AddHeader("content-disposition", "attachment;filename=" + fileName);
                                        page.Response.ContentType = "application/vnd.ms-excel;";
                                        //Fix for CR 5109 - Prabhu R S
                                        page.Response.ContentEncoding = System.Text.Encoding.UTF8;
                                        page.EnableViewState          = false;
                                        page.Response.Write(exportContent);
                                        page.Response.End();
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["filter"] != null)
        {
            txtFilter.Text = Request["filter"].ToString();
        }
        lbMessage.Visible = false;
        #region Check Capabilities
        if ((SessionState.User.IsReadOnly) || (!SessionState.User.HasCapability(CapabilitiesEnum.LOCALIZE_PRODUCTS)))
        {
            uwToolbar.Items.FromKeyButton("Validate").Enabled = uwToolbar.Items.FromKeyButton("Exclude").Enabled = false;
        }
        if (SessionState.User.Cultures.Count == 0)
        {
            lbMessage.Text       = "Your profile is not correctly set. Contact an administrator to assign the correct culture to your profile.";
            lbMessage.CssClass   = "hc_error";
            lbMessage.Visible    = true;
            DDL_Cultures.Visible = false;
            return;
        }
        #endregion

        if (!Page.IsPostBack)
        {
            #region Load Cultures list
            /// Retrieve all Users Cultures, and keep only primary
            CultureList    dsCultures = SessionState.User.Cultures;
            CollectionView locales    = new CollectionView(dsCultures);
            locales.ApplyFilter("Type", CultureType.Locale, CollectionView.FilterOperand.Equals);
            locales.ApplySort("Name", System.ComponentModel.ListSortDirection.Ascending);
            if (locales.Count > 0)
            {
                DDL_Cultures.DataSource = locales;
                DDL_Cultures.DataBind();
                if (SessionState.Culture.Type != CultureType.Locale)
                {
                    SessionState.Culture = HyperCatalog.Business.Culture.GetByKey(DDL_Cultures.Items[0].Value);
                }
                else
                {
                    DDL_Cultures.Items.FindByValue(SessionState.Culture.Code).Selected = true;
                }
                DisplayData();
            }
            else
            {
                // User has no primary cultures in its scope
                lbMessage.Text       = "Your profile is not correctly set. Contact an administrator to assign the correct culture to your profile.";
                lbMessage.CssClass   = "hc_error";
                lbMessage.Visible    = true;
                DDL_Cultures.Visible = false;
                return;
            }
            #endregion
        }
        else
        {
            // action after changes in PLC edit window
            if (Request["action"] != null && Request["action"].ToString().ToLower() == "reload")
            {
                DisplayData();
            }
        }
        txtFilter.AutoPostBack = false;
        txtFilter.Attributes.Add("onKeyDown", "KeyHandler(this);"); Page.ClientScript.RegisterStartupScript(Page.GetType(), "filtering", "<script defer=true>var txtFilterField;txtFilterField = document.getElementById('" + txtFilter.ClientID + "');</script>");
        Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "initCulture", "<script>var curCulture = '" + SessionState.Culture.Code + "';</script>");
    }