Esempio n. 1
0
        private void BuildUIFromCustom2()
        {
            SqlDataReader dr = GetDatabase();

            sb = new StringBuilder();
            sb.Append("<table border=\"1\" cellpadding=\"1\" cellspacing=\"5\">");
            sb.Append("<tr>");
            sb.AppendFormat("<th>Row Number</th><th>{0}</th><th>{1}</th><th>{2}</th><th>{3}</th>", "DB NDC", "Item Path", "Current PI", "Modified To");

            sb.Append("</tr>");
            while (dr.Read())
            {
                String RowID = dr[0].ToString();
                String NDC   = dr[1].ToString();
                String NewPI = dr[3].ToString();

                String CurrentPI = String.Empty;
                Item   product   = null;
                Item   itm       = null;

                String query = "/sitecore/content/MylanInstitutionalProducts/Products//*[@@templateid='{692169E2-B461-41B4-95F9-235D652319A8}' and @ _NDC='" + NDC + "']";
                itm = masterDB.SelectSingleItem(query);
                try
                {
                    if (itm != null)
                    {
                        product = null;
                        product = getProductforNDC(itm);
                        if (product != null)
                        {
                            TextField tf = product.Fields["PrescribingInformationLink"];
                            if ((tf != null) && (!string.IsNullOrWhiteSpace(tf.Value)))
                            {
                                CurrentPI = tf.Value.ToString();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    product = null;
                }
                sb.Append(BuildDisplayStringCustom(RowID, NDC, itm, product, CurrentPI, NewPI));
            }
            sb.Append("</table>");
            lblRenamedItems.Text = sb.ToString();
        }
Esempio n. 2
0
        public List <Item> GetCampaignItems(string path)
        {
            Sitecore.Data.Database context = Sitecore.Configuration.Factory.GetDatabase("master");
            Item        item  = context.SelectSingleItem(path);
            List <Item> items = item.Axes.GetDescendants().Where(x => x.TemplateID.ToString() == "{94FD1606-139E-46EE-86FF-BC5BF3C79804}").ToList();

            return(items);
        }
Esempio n. 3
0
 public static Stream GetFileByPath(string Path, Sitecore.Data.Database database)
 {
     return(GetFileStream(database.SelectSingleItem(Path)));
 }
Esempio n. 4
0
 public static List <KeyValuePair <string, string> > GetItemValuesByPath(string Path, Sitecore.Data.Database database)
 {
     return(GetItemFieldValuesFromTemplate(database.SelectSingleItem(Path), database));
 }
Esempio n. 5
0
 public static Item GetItemByPath(string Path, Sitecore.Data.Database database)
 {
     return(database.SelectSingleItem(Path));
 }
Esempio n. 6
0
        private DataTable DisplayCookieData()
        {
            string[]  CookieArray = getValuesFromCookies(Request.Cookies["ProductCatalog"].Value.ToString());
            DataTable dt          = new DataTable();

            dt.Columns.Add("ProductID");
            dt.Columns.Add("ProductName");
            dt.Columns.Add("InfoPrescribingInformationLink");
            dt.Columns.Add("AttrWarnings");
            dt.Columns.Add("RowCount");
            int productCount           = 0;
            HashSet <string> prodNames = new HashSet <string>();

            foreach (string a in CookieArray)
            {
                string[] ProdArray = a.Split(new Char[] { '_' });
                if (ProdArray[0] == "ndc")
                {
                    Item[] productNDC = masterDB.SelectItems(String.Format("fast://*[@@name='{0}']", ProdArray[1]));
                    foreach (Item ndc in productNDC)
                    {
                        prodNames.Add(ndc.Parent.ID.ToString());
                    }
                }
            }
            foreach (string prod in prodNames)
            {
                DataRow dr = dt.NewRow();
                productCount++;
                bool itemInTable = false;

                Item fullProduct = masterDB.SelectSingleItem(String.Format("fast://*[@@id='{0}']", prod));
                if (fullProduct != null)
                {
                    dr["ProductID"] = fullProduct.ID;
                    if (fullProduct.Fields["PrescribingInformationLink"] != null)
                    {
                        dr["ProductName"] = fullProduct.Fields["Product Group Name"].Value.ToString();
                    }
                    if (fullProduct.Fields["PrescribingInformationLink"] != null)
                    {
                        dr["InfoPrescribingInformationLink"] = fullProduct.Fields["PrescribingInformationLink"].Value.ToString();
                    }

                    foreach (Item child in fullProduct.Children)
                    {
                        if (child.Fields["_xAttrWarnings"] != null)
                        {
                            dr["AttrWarnings"] = createWarningImages(child.Fields["_xAttrWarnings"].Value.ToString());
                        }
                    }
                    dr["RowCount"] = productCount;

                    for (int q = 0; q < dt.Rows.Count; q++)
                    {
                        if (dt.Rows[q]["ProductName"] == dr["ProductName"])
                        {
                            itemInTable = true;
                        }
                    }
                    if (!itemInTable)
                    {
                        dt.Rows.Add(dr);
                    }
                }
            }
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i]["RowCount"] = productCount;
            }

            return(dt);
        }