public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
        {
            if (e.Sender == "Ingredient" && e.Target == "WidgetSimilarIngredients")
            {
                List<object> ingredientDataList = (List<object>)e.Value;

                string ingredientName = (string)ingredientDataList[0];
                int ingredientID = (int)ingredientDataList[1];
                int categoryID = (int)ingredientDataList[2];
                DataTable linkedEntitiesTable = (DataTable)ingredientDataList[6];

                DataTable dtSimilar = Content.GetSimilarIngredientsDataTable((int)ingredientDataList[1],
                                                                             (int)ingredientDataList[2],
                                                                             (int)ingredientDataList[3],
                                                                             (int)ingredientDataList[4],
                                                                             (int)ingredientDataList[5]);

                HtmlGenericControl chartDiv = Content.GetIngredientChartDiv(ingredientID);
                if (chartDiv != null) _widgetFlavorProfileChart.Controls.Add(chartDiv);

                _widgetDrinksThatUseThisIngredient.Controls.Add(new LiteralControl(Content.GetSimilarIngredientsHtml(dtSimilar, categoryID, ingredientName, true, false, false, false)));
                _widgetIngredientsWithSameCategtory.Controls.Add(new LiteralControl(Content.GetSimilarIngredientsHtml(dtSimilar, categoryID, ingredientName, false, true, false, false)));
                _widgetIngredientsWithSameBrand.Controls.Add(new LiteralControl(Content.GetSimilarIngredientsHtml(dtSimilar, categoryID, ingredientName, false, false, true, false)));
                _widgetIngredientsWithSimilarFlavors.Controls.Add(new LiteralControl(Content.GetSimilarIngredientsHtml(dtSimilar, categoryID, ingredientName, false, false, false, true)));

                _widgetLinkedEntitiesDiv.Controls.Add(new LiteralControl(Content.GetLinkBoxHtml(linkedEntitiesTable)));

                if (ConfigurationManager.AppSettings["ShowGoogleAds"] == "1")
                {
                    _widgetAs.Controls.Add(new LiteralControl(AdRotator.GetAdsenseCode("adsense.ingredient.200x90.linkunit")));
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            DataView dv = CacheManager.GetItem(CacheManager.Cache_GetDrinkCategoriesInUse,
                                              "GetDrinkCategoriesInUse",
                                              "ListItem_pk",
                                               null);

            _repeater.DataSource = dv;
            _repeater.DataBind();

            ModuleConfiguration.ModuleTitle = "Drink Categories";

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
        public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
        {
            if (e.Target == "Widget")
            {
                List<string> widgetContentList = (List<string>)e.Value;

                foreach (string widgetContent in widgetContentList)
                {
                    if (widgetContent != string.Empty)
                    {
                        HtmlGenericControl widgetDiv = new HtmlGenericControl("div");
                        widgetDiv.Attributes.Add("class", "WidgetDiv");

                        if (widgetContent.Contains("google_ad_client"))
                        {// This is an Adsense widget--add some css

                            widgetDiv.Attributes.Add("style", "width: 100%; margin-bottom: 10px");
                        }

                        widgetDiv.InnerHtml = widgetContent;
                        this.Controls.Add(widgetDiv);
                    }
                }
            }
        }
        public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
        {
            if (e.Sender == "Drink" && e.Target == "WidgetSimilarDrinks")
            {
                List<object> drinkDataList = (List<object>)e.Value;

                int drinkID = (int)drinkDataList[0];
                DataTable linkedEntitiesTable = (DataTable)drinkDataList[3];

                // pk, structure id, glass id
                DataTable _dtSimilar = Content.GetSimilarDrinksDataTable((int)drinkDataList[0],
                                                                         (int)drinkDataList[1],
                                                                         (int)drinkDataList[2]);

                HtmlGenericControl chartDiv = Content.GetDrinkChartDiv(drinkID);
                if (chartDiv != null) _widgetIngredientProfileChart.Controls.Add(chartDiv);

                _widgetDrinksInSameCategory.Controls.Add(new LiteralControl(Content.GetSimilarDrinksHtml(_dtSimilar, true, false)));
                //_widgetDrinksWithSimilarFlavors.Controls.Add(new LiteralControl(Content.GetSimilarDrinksHtml(_dtSimilar, false, true, false)));
                _widgetDrinksWithSameGlass.Controls.Add(new LiteralControl(Content.GetSimilarDrinksHtml(_dtSimilar, false, true)));

                _widgetLinkedEntitiesDiv.Controls.Add(new LiteralControl(Content.GetLinkBoxHtml(linkedEntitiesTable)));

                if (ConfigurationManager.AppSettings["ShowGoogleAds"] == "1")
                {
                    _widgetAs.Controls.Add(new LiteralControl(AdRotator.GetAdsenseCode("adsense.drink.200x90.linkunit")));
                }

            }
        }
 public void OnModuleCommunication(object s, ModuleCommunicationEventArgs e)
 {
     if (e.Target == "WidgetLinkedEntities")
     {// Target is this widget
         
         DataTable dt = (DataTable)e.Value;
         
         _widgetDiv.Controls.Add(new LiteralControl(Content.GetLinkBoxHtml(dt)));
     }
 }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            DataView dv = CacheManager.GetItem(CacheManager.Cache_GetFlavors,
                                              "GetListItems",
                                              "ListItem_pk",
                                               new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(Constant.List.Flavor)) });

            if (Request.QueryString["target"] == "ingredient")
            {// Eventual target will be a list of ingredients--bind the ingredient repeater

                _repeaterIngredient.DataSource = dv;
                _repeaterIngredient.DataBind();

                ModuleConfiguration.ModuleTitle = "Browse Liquor/Mixers - By Flavor";
            }
            else
            {// Eventual target will be a list of drinks--bind the drink repeater

                _repeaterDrink.DataSource = dv;
                _repeaterDrink.DataBind();

                ModuleConfiguration.ModuleTitle = "Browse Drinks - By Flavor";
            }

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            // Log page
            AppUtility.Utility.LogPage();

            // Social buttons
            if (ConfigurationManager.AppSettings["ShowSocialButtons"] == "1") _socialButtons.Text = AppUI.Content.GetSocialSharingButtons();

            DoSEO();
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int rowCount = 0;

            // Log page
            AppUtility.Utility.LogPage();

            if (Request.QueryString["desc"] != null)
            {// This is not a generic search--it is a browse filter--figure out page title

                if (Request.QueryString["filter"] == "search")
                {// Doing a one parameter search to impersonate a browse

                    if (Request.QueryString["tag"] != null)
                        ModuleConfiguration.ModuleTitle = "Drinks - Tag - " + WebUtility.TitleCase(CharlesThompson.LiquorAndDrink.AppUtility.Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["ingred"] != null)
                    {
                        ModuleConfiguration.ModuleTitle = WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"])) + " Drinks";
                        _metaDescription = "A delicious list of drinks that use " +  WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"])) + ".";
                    }
                    else if (Request.QueryString["brand"] != null)
                        ModuleConfiguration.ModuleTitle = "Drinks - Ingredient Brand - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["flavor"] != null)
                        ModuleConfiguration.ModuleTitle = "Drinks - Flavor - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));
                }
                else
                {// Doing an actual browse

                    if (Request.QueryString["filter"] == "cat")
                        ModuleConfiguration.ModuleTitle = "Drinks - Category - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["filter"] == "family")
                        ModuleConfiguration.ModuleTitle = "Drinks - Family - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["filter"] == "struct")
                        ModuleConfiguration.ModuleTitle = "Drinks - Structure - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["filter"] == "glass")
                        ModuleConfiguration.ModuleTitle = "Drinks - Glass - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["filter"] == "temp")
                        ModuleConfiguration.ModuleTitle = "Drinks - Temperature - " + WebUtility.TitleCase(Utility.UrlDecode(Request.QueryString["desc"]));
                }
            }
            else
            {// These don't use a desc

                if (Request.QueryString["filter"] == "proof")
                {
                    if (Request.QueryString["value2"] == "0")
                        ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Proof - No Alcohol";
                    else
                        ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Proof - " + Request.QueryString["value1"] + " to " + Request.QueryString["value2"] + " Proof";
                }

                else if (Request.QueryString["filter"] == "strength")
                {
                    switch (Request.QueryString["value2"])
                    {
                        case "0": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - No Alcohol"; break;
                        case "0.5": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - Weak"; break;
                        case "1.5": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - Single"; break;
                        case "2.5": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - Double"; break;
                        case "3.5": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - Triple"; break;
                        case "4.5": ModuleConfiguration.ModuleTitle = "Drinks - Alcohol Strength - Quadruple"; break;
                    }
                }

                else if (Request.QueryString["filter"] == "name")
                    ModuleConfiguration.ModuleTitle = "Drinks - By Name";

                else
                {// Must be a genuine search

                    ModuleConfiguration.ModuleTitle = "Drinks - Search Results";
                }
            }

            SqlParameter[] sqlParameters = new SqlParameter[19];

            // First, fill out blank parameters.  If a parameter is going to be used, it will be filled out below.
            // SqlParemeterCollection can't have nulls in it.
            sqlParameters[0] = new SqlParameter("Name", null);
            sqlParameters[1] = new SqlParameter("InstructionsAndNotes", null);
            sqlParameters[2] = new SqlParameter("CategoryID", null);
            sqlParameters[3] = new SqlParameter("FamilyID", null);
            sqlParameters[4] = new SqlParameter("StructureID", null);
            sqlParameters[5] = new SqlParameter("AttributeID", null);
            sqlParameters[6] = new SqlParameter("IngredientID", null);
            sqlParameters[7] = new SqlParameter("IngredientBrandID", null);
            sqlParameters[8] = new SqlParameter("AlcoholProof1", null);
            sqlParameters[9] = new SqlParameter("AlcoholProof2", null);
            sqlParameters[10] = new SqlParameter("AlcoholStrength1", null);
            sqlParameters[11] = new SqlParameter("AlcoholStrength2", null);
            sqlParameters[12] = new SqlParameter("FlavorID", null);
            sqlParameters[13] = new SqlParameter("GlassID", null);
            sqlParameters[14] = new SqlParameter("TempID", null);
            sqlParameters[15] = new SqlParameter("PageNum", 1);
            sqlParameters[16] = new SqlParameter("PageSize", 5000);

            if (Request.QueryString["name"] != null)
            {
                sqlParameters[0] = new SqlParameter("Name", SqlDbType.VarChar, 100, ParameterDirection.Input, true, 0, 0, "Name", DataRowVersion.Current, Request.QueryString["name"]);
            }

            if (Request.QueryString["in"] != null)
            {
                sqlParameters[1] = new SqlParameter("InstructionsAndNotes", SqlDbType.VarChar, 100, ParameterDirection.Input, true, 0, 0, "InstructionsAndNotes", DataRowVersion.Current, Request.QueryString["in"]);
            }

            // Retired...category now really hits the structures
            //if (Request.QueryString["cat"] != null)
            //{
            //    sqlParameters[2] = new SqlParameter("CategoryID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "CategoryID", DataRowVersion.Current, Request.QueryString["cat"]);
            //}

            if (Request.QueryString["fam"] != null)
            {
                sqlParameters[3] = new SqlParameter("FamilyID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "FamilyID", DataRowVersion.Current, Request.QueryString["fam"]);
            }

            // Category is now driven by structures
            if (Request.QueryString["cat"] != null)
            {
                sqlParameters[4] = new SqlParameter("StructureID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "StructureID", DataRowVersion.Current, Request.QueryString["cat"]);
            }

            // Attributes now called Tags
            if (Request.QueryString["tag"] != null)
            {
                sqlParameters[5] = new SqlParameter("AttributeID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "AttributeID", DataRowVersion.Current, Request.QueryString["tag"]);
            }

            if (Request.QueryString["ingred"] != null)
            {
                sqlParameters[6] = new SqlParameter("IngredientID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "PrincipalIngredientID", DataRowVersion.Current, Request.QueryString["ingred"]);
            }

            if (Request.QueryString["brand"] != null)
            {
                sqlParameters[7] = new SqlParameter("IngredientBrandID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "PrincipalIngredientBrandID", DataRowVersion.Current, Request.QueryString["brand"]);
            }

            if (Request.QueryString["proof1"] != null)
            {
                sqlParameters[8] = new SqlParameter("AlcoholProof1", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "AlcoholProof1", DataRowVersion.Current, Request.QueryString["proof1"]);
            }

            if (Request.QueryString["proof2"] != null)
            {
                sqlParameters[9] = new SqlParameter("AlcoholProof2", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "AlcoholProof2", DataRowVersion.Current, Request.QueryString["proof2"]);
            }

            if (Request.QueryString["strength1"] != null)
            {
                sqlParameters[10] = new SqlParameter("AlcoholStrength1", SqlDbType.Decimal, 0, ParameterDirection.Input, true, 5, 1, "AlcoholStrength1", DataRowVersion.Current, Request.QueryString["strength1"]);
            }

            if (Request.QueryString["strength2"] != null)
            {
                sqlParameters[11] = new SqlParameter("AlcoholStrength2", SqlDbType.Decimal, 0, ParameterDirection.Input, true, 5, 1, "AlcoholStrength2", DataRowVersion.Current, Request.QueryString["strength2"]);
            }

            if (Request.QueryString["flavor"] != null)
            {
                sqlParameters[12] = new SqlParameter("FlavorID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "FlavorID", DataRowVersion.Current, Request.QueryString["flavor"]);
            }

            if (Request.QueryString["glass"] != null)
            {
                sqlParameters[13] = new SqlParameter("GlassID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "GlassID", DataRowVersion.Current, Request.QueryString["glass"]);
            }

            if (Request.QueryString["temp"] != null)
            {
                sqlParameters[14] = new SqlParameter("TempID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "TempID", DataRowVersion.Current, Request.QueryString["temp"]);
            }

            // Add output parameters
            sqlParameters[17] = new SqlParameter("TotalPages", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalPages", DataRowVersion.Current, 0);
            sqlParameters[18] = new SqlParameter("TotalRows", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalRows", DataRowVersion.Current, 0);

            SimpleData simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            if (Request.QueryString["filter"] == "search")
            {// Full search requested--crank the search stored procedure

                _repeater.DataSource = simpleData.FetchSP("SearchDrinks", sqlParameters);
                rowCount = ((DataTable)_repeater.DataSource).Rows.Count;
            }
            else
            {// Browse requested--filter on one column (hopefully from the cache)

                DataView dataView = null;

                switch (Request.QueryString["filter"])
                {
                    case "name":
                    // Filter by name (just show all)

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = String.Empty;
                        _repeater.DataSource = dataView;

                        break;

                    case "cat":
                    // Filter by category

                        // Category now driven by the structure list
                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "StructureID = " + Request.QueryString["value"];
                        _repeater.DataSource = dataView;

                        //dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                        //                               "GetDrinks",
                        //                               "Drink_pk",
                        //                                null);

                        //dataView.RowFilter = "CategoryID = " + Request.QueryString["value"];
                        //_repeater.DataSource = dataView;

                        break;

                    case "family":
                    // Filter by family

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "FamilyID = " + Request.QueryString["value"];
                        _repeater.DataSource = dataView;

                        break;

                    case "struct":
                    // Filter by structure

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "StructureID = " + Request.QueryString["value"];
                        _repeater.DataSource = dataView;

                        break;

                    case "proof":
                    // Filter by alcohol proof

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "FinalProof >= " + Request.QueryString["value1"] + " AND FinalProof <= " + Request.QueryString["value2"];
                        _repeater.DataSource = dataView;

                        break;

                    case "strength":
                    // Filter by alcohol strength

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "Strength >= " + Request.QueryString["value1"] + " AND Strength <= " + Request.QueryString["value2"];
                        _repeater.DataSource = dataView;

                        break;

                    case "glass":
                    // Filter by glass

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "GlassID = " + Request.QueryString["value"];
                        _repeater.DataSource = dataView;

                        break;

                    case "temp":
                    // Filter by temperature

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                       "GetDrinks",
                                                       "Drink_pk",
                                                        null);

                        dataView.RowFilter = "TempID = " + Request.QueryString["value"];
                        _repeater.DataSource = dataView;

                        break;
                }

                rowCount = dataView.Count;
             }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "family" && Request.QueryString["value"] != null)
            {// A browse request was made for a list of drinks that belong to a particular family.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "glass")
            {// A browse request was made for a list of drinks by glass.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "proof")
            {// A browse request was made for a list of drinks that are in a certain proof range.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["brand"] != null)
            {// A browse request was made for a list of drinks that use a particular ingredient brand.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["flavor"] != null)
            {// A browse request was made for a list of drinks that have a particular flavor.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "strength")
            {// A browse request was made for a list of drinks that are a certain strength.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "struct" && Request.QueryString["value"] != null)
            {// A browse request was made for a list of drinks that belong to a particular structure.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "temp")
            {// A browse request was made for a list of drinks that are a certain temperature.  We do not do
             // this kind of browsing anymore so throw a 404 instead.

                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (rowCount == 0 && Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "cat" && Request.QueryString["value"] != null)
            {// A browse request was made for a list of drinks that belong to a particular category.  We have consolidated
             // drink categories.  If the request is for one of the categories that no longer exists, the
             // page would just show a blank list.  This is not good for SEO so we need to throw a 404 instead.
             // We know that the drink category requested does not exist because we only show in use categories
             // in the browse list.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (rowCount == 0 && Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["tag"] != null)
            {// A browse request was made for a list of drinks that belong to a particular tag.  We have consolidated
             // drink tags.  If the request is for one of the tags that no longer exists, the
             // page would just show a blank list.  This is not good for SEO so we need to throw a 404 instead.
             // We know that the drink tag requested does not exist because we only show in use tags
             // in the browse list.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            if (rowCount == 0 && Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["ingred"] != null)
            {// A browse request was made for a list of drinks that use a particular ingredient.  We have cleaned
             // out a long of ingredients.  If the request is for one of the ingredients that no longer exists, the
             // page would just show a blank list.  This is not good for SEO so we need to throw a 404 instead.
             // We know that the drink ingredient requested does not exist because we only show in use ingredients
             // in the browse list.

                    HttpContext.Current.Response.StatusCode = 404;
                    HttpContext.Current.Response.End();
            }

            _repeater.DataBind();

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            SimpleData simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            SqlParameter[] sqlParameters = new SqlParameter[16];

            // First, fill out blank parameters.  If a parameter is going to be used, it will be filled out below.
            // SqlParemeterCollection can't have nulls in it.
            sqlParameters[0] = new SqlParameter("Name", null);
            sqlParameters[1] = new SqlParameter("DescriptionAndNotes", null);
            sqlParameters[2] = new SqlParameter("CategoryID", null);
            sqlParameters[3] = new SqlParameter("FlavorID", null);
            sqlParameters[4] = new SqlParameter("CountryID", null);
            sqlParameters[5] = new SqlParameter("BrandID", null);
            sqlParameters[6] = new SqlParameter("AlcoholProof1", null);
            sqlParameters[7] = new SqlParameter("AlcoholProof2", null);
            sqlParameters[8] = new SqlParameter("LADRating1", null);
            sqlParameters[9] = new SqlParameter("LADRating2", null);
            sqlParameters[10] = new SqlParameter("COMRating1", null);
            sqlParameters[11] = new SqlParameter("COMRating2", null);
            sqlParameters[12] = new SqlParameter("PageNum", 1);
            sqlParameters[13] = new SqlParameter("PageSize", 5000);

            // We just want ingredients that have a review.  So look for ingredients that have a review rating between 0 and 100
            sqlParameters[8] = new SqlParameter("LADRating1", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "LADRating1", DataRowVersion.Current, 0);
            sqlParameters[9] = new SqlParameter("LADRating2", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "LADRating2", DataRowVersion.Current, 100);

            // Add output parameters
            sqlParameters[14] = new SqlParameter("TotalPages", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalPages", DataRowVersion.Current, 0);
            sqlParameters[15] = new SqlParameter("TotalRows", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalRows", DataRowVersion.Current, 0);

            // Get the list
            _repeaterIngredient.DataSource = simpleData.FetchSP("SearchIngredients", sqlParameters);

            // Light up the ingredients to ingredient repeater
            _repeaterIngredient.DataBind();

            // Module title
            ModuleConfiguration.ModuleTitle = "Liquor/Mixer Reviews";

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
Exemplo n.º 10
0
        public void OnModuleCommunication(object sender, ModuleCommunicationEventArgs e)
        {
            if (e.Target.Equals(IMC.ProcessFlowTarget))
            {
                List<string> lstRevokeProID = GetRevokeAllProcessID();
                // Revoke Process
                if (lstRevokeProID != null)
                {
                    if (lstRevokeProID.Contains(ProID))
                    {
                        // Return is must
                        ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                        mcArgs.Sender = this.IMC_Sender;
                        mcArgs.Target = e.Sender;
                        mcArgs.Type = "";
                        mcArgs.Value = "";
                        mcArgs.Text = "";
                        ModuleCommunication(this, mcArgs);

                        return;
                    }
                }

                InitialObject(Info, RequestModuleID);

                //Done(true, BranchInfo.BranchType.NONE);
                if (PM == PageMode.Mode.REVISE)
                {
                    Done(true, BranchInfo.BranchType.ITERATION);
                }
                else
                {
                    Done(true, BranchInfo.BranchType.NONE);
                }

                if (ProcessFlowReturn.Equals("True"))
                {
                    switch (PM)
                    {
                        case PageMode.Mode.CREATE:
                            ProcessFlow(true, true, string.Empty, e.Sender);
                            break;

                        case PageMode.Mode.VIEW:
                            if (IsDraft)
                                ProcessFlow(true, true, TaskID, e.Sender);
                            break;

                        case PageMode.Mode.TASK:
                            ProcessFlow(false, true, TaskID, e.Sender);
                            break;

                    }
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "AfterCreateProcess", "window.parent.$('#'+window.parent.$('body').find('.ui-jqgrid-bdiv').find('table')[0].id).trigger('reloadGrid');\nlocation.href='./';\n", true);
                }
            }
            else if (e.Target.Equals(IMC.SaveDraftTarget))
            {
                InitialObject(Info, RequestModuleID);

                Done(true, BranchInfo.BranchType.NONE);

                Hashtable htTaskData = new Hashtable();
                htTaskData.Add("PROJECTID", Info.AlarmRuleSetID);

                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = e.Sender;
                mcArgs.Text = "SaveAsDraft";
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = htTaskData;
                ModuleCommunication(this, mcArgs);
            }
            else if (e.Target.Equals(IMC.GetModuleInfoTarget))
            {
                if (e.Text.Equals(Constants.ComponentName))
                {
                    Hashtable ht = (Hashtable)e.Value;
                    ht.Add("ModuleID", this.ModuleId);
                    ht.Add("AssemblyName", _ctrl.GetType().FullName + ", " + _ctrl.GetType().Assembly.GetName().Name);
                }
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // The CommentsPlus module from SunBlogNuke should take care of this
            //// See if we need to set the Disqus comments into development mode
            //if (ConfigurationManager.AppSettings["disqus_developer"] == "1")
            //{// Yes, set to development mode so the comments will work under localhost

            //    Page.ClientScript.RegisterStartupScript(this.GetType(), "Disqus_Developer", @"var disqus_developer = 1; // developer mode is on;", true);
            //}

            // Log page
            AppUtility.Utility.LogPage();

            SimpleData simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            // Get drink data from cache
            DataView dv = CacheManager.GetItem(CacheManager.Cache_GetDrinks,
                                                    "GetDrinks",
                                                    "Drink_pk",
                                                     null);

            _drDrink = dv.Table.Rows.Find(Convert.ToInt32(Request.QueryString["pk"]));

            if (_drDrink == null)
            {// We did not find the drink using it's pk--it has probably been culled as a low quality page--send a 404

                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.StatusCode = 404;
                HttpContext.Current.Response.End();

                //HttpContext.Current.Response.Clear();
                //HttpContext.Current.Response.StatusCode = 404;
                //HttpContext.Current.Items.Remove("ClientDependencyLoader");
                //Server.Transfer("liquoranddrink_dotnetnuke6/http-404", false);
                //DotNetNuke.Common.Globals.NavigateURL(136);
            }
            else
            {// Found the drink--continue

                string calledUrl = ConfigurationManager.AppSettings["SiteDomain"] + HttpContext.Current.Request.RawUrl;
                string correctUrl = CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetUrl((int)_drDrink["Drink_pk"], (string)_drDrink["Slug"]);

                if (calledUrl != correctUrl)
                {// The url used to get to this page is different than the correct url for this page.  This is usually because the slug is different (the text after
                 // the pk).  The slug may have changed for SEO reasons.  Anyway, we want Google (and anyone else) to use the current, correct url for this page so
                 // we need to 301 to the correct url.

                    Response.RedirectPermanent(correctUrl, true);
                }

                // Thumbnail microdata
                if (CharlesThompson.LiquorAndDrink.AppUtility.Drink.HasThumbnailFilename((int)_drDrink["Drink_pk"]))
                {// We have a thumbnail image for this drink--stick it in the microdata

                    _thumbnailImageMetaLiteral.Text = @"<meta itemprop=""thumbnailUrl"" content=""" +
                                                      CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetThumbnailFilenameUrl((int)_drDrink["Drink_pk"]) +
                                                      @""" />";
                }

                // Do page title
                Control h1 = this.FindControl("_H1");

                if (h1 != null)
                {// H1 heading found--set it to the page title

                    ((HtmlGenericControl)h1).InnerText = (string)_drDrink["Keywords"];
                }

                _prepTimeLiteral.Text = CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetPrepTimeAsMicrodataTag((int)_drDrink["Drink_pk"]) + CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetPrepTimeAsString((int)_drDrink["Drink_pk"]);

                _servingsLiteral.Text = ((Decimal)_drDrink["Servings"]).ToString("###.#");

                // Category (structure under the covers)
                _structureLink.Text = (string)_drDrink["StructureName"];
                if (_structureLink.Text.Trim().Length > 0) _structureLink.NavigateUrl = ConfigurationManager.AppSettings["SiteUrl"] + @"drinks/browse/category/" + Convert.ToString(_drDrink["StructureID"]) + "-" + CharlesThompson.LiquorAndDrink.AppUtility.Utility.UrlEncode((string)_drDrink["StructureName"]);

                // Tags are down below

                _proofLiteral.Text = ((Decimal)_drDrink["FinalProof"]).ToString("###.#");

                _strengthLiteral.Text = ((Decimal)_drDrink["Strength"]).ToString("###.#");

                // Flavors are down below

                _glassLiteral.Text = (string)_drDrink["GlassName"];

                _tempLiteral.Text = (string)_drDrink["TempName"];

                //// Sources ###############################################
                //// Get source data from cache
                //DataView sourceView = CacheManager.GetItem(CacheManager.Cache_GetDrinkSourcesAll,
                //                                           "GetDrinkSourcesAll",
                //                                           "DrinkID,SourceID",
                //                                           null);
                //DataRow[] sourceRows = sourceView.Table.Select("DrinkID = " + Request.QueryString["pk"], "SourceName ASC");
                //StringBuilder sourceList = new StringBuilder();

                //foreach (DataRow row in sourceRows)
                //{
                //    if ((int)row["SourceID"] != 1)  // Hide if Charles is the source
                //    {
                //        sourceView.RowFilter = "Source_pk = " + Convert.ToString(row["SourceID"]);

                //        sourceList.Append(@"<a href=""");
                //        sourceList.Append(ConfigurationManager.AppSettings["SiteUrl"]);
                //        sourceList.Append(@"/resources/");
                //        sourceList.Append(Convert.ToString(row["SourceID"]));
                //        sourceList.Append("-");
                //        sourceList.Append(CharlesThompson.LiquorAndDrink.AppUtility.Utility.UrlEncode(Convert.ToString(sourceView[0]["SourceName"])));
                //        sourceList.Append(@""">");
                //        sourceList.Append(Convert.ToString(sourceView[0]["SourceName"]));
                //        sourceList.Append(@"</a>, ");
                //    }
                //}

                //// Chop off trailing comma
                //if (sourceList.Length > 0) sourceList.Remove(sourceList.Length - 2, 2);

                //if (sourceList.Length > 0) _sourceLiteral.Text = sourceList.ToString();
                //else _sourceRow.Visible = false;                                            // no sources so hide this field

                // Instructions #############################################
                if (((string)_drDrink["Instructions"]).Trim() != string.Empty && ! ((string)_drDrink["Instructions"]).Contains("<p>"))
                {// Description is present and does not have any html in it.  This is an older description that needs to have
                 // html formatting added

                    _instructionsLiteral.Text = Utility.ReplaceTokens(WebUtility.ConvertDBDescriptionToHTML((string)_drDrink["Instructions"]));
                }
                else if (((string)_drDrink["Instructions"]).Trim() != string.Empty && ((string)_drDrink["Instructions"]).Contains("<p>"))
                {// Description is present and has html in it.  This is a newer description where we store the html in it.

                    _instructionsLiteral.Text = Utility.ReplaceTokens((string)_drDrink["Instructions"]);
                }
                //_instructionsLiteral.Text = WebUtility.ConvertDBDescriptionToHTML((string)_drDrink["Instructions"]);

                // Ratings ##################################################
                // Get rating data from cache
                DataView ratingsView = CacheManager.GetItem(CacheManager.Cache_GetDrinkRatingsAll,
                                                           "GetDrinkRatingsAll",
                                                           "Rating_pk",
                                                           null);

                ratingsView.RowFilter = "DrinkID = " + Request.QueryString["pk"];
                ratingsView.Sort = "SourceID ASC";

                if (ratingsView.Count > 0)
                {
                    _repeaterRatings.DataSource = ratingsView;
                    _repeaterRatings.DataBind();
                }
                else _reviewDiv.Visible = false;

                // Notes
                string notes = CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetNotesWithAdsAndImages((int)_drDrink["Drink_pk"]);

                if (notes.Length > 0) _notesDiv.InnerHtml = notes;
                else _notesDiv.Visible = false;

                // Get ingredients
                // Get ingredient data from cache
                _ingredientsView = CacheManager.GetItem(CacheManager.Cache_GetDrinkIngredientsAll,
                                                               "GetDrinkIngredientsAll",
                                                               "Drink_pk,Ingredient_pk",
                                                                null);

                _ingredientsView.RowFilter = "Drink_pk = " + Request.QueryString["pk"];
                _ingredientsView.Sort = "Sort ASC";

                _ingredients.DataSource = _ingredientsView;
                _ingredients.DataBind();

                // Tags (attributes under the covers) ################################################
                // Get tag data from cache
                DataView tagsView = CacheManager.GetItem(CacheManager.Cache_GetDrinkTagsAll,
                                                           "GetDrinkTagsAll",
                                                           "Drink_pk,ListItem_pk",
                                                           null);

                tagsView.RowFilter = "Drink_pk = " + Request.QueryString["pk"];
                tagsView.Sort = "TagName ASC";

                StringBuilder tags = new StringBuilder();
                foreach (DataRowView row in tagsView)
                {
                    tags.Append(@"<a href=""");
                    tags.Append(ConfigurationManager.AppSettings["SiteUrl"]);
                    tags.Append(@"drinks/browse/tag/");
                    tags.Append(Convert.ToString(row["ListItem_pk"]));
                    tags.Append("-");
                    tags.Append(CharlesThompson.LiquorAndDrink.AppUtility.Utility.UrlEncode(Convert.ToString(row["TagName"])));
                    tags.Append(@""">");
                    tags.Append(Convert.ToString(row["TagName"]));
                    tags.Append(@"</a>, ");
                }

                // Chop off trailing comma
                if (tags.Length > 0) tags.Remove(tags.Length - 2, 2);

                _tagsLiteral.Text = tags.ToString();

                // ##############################
                // Do right column widgets content for this drink
                // ##############################
                // Get drink links in right column
                DataTable dtDrinkLinks = simpleData.FetchSP("GetDrinkLinks", new SqlParameter[] { new SqlParameter("DrinkID", Request.QueryString["pk"]) });

                // Send a message to any widget modules that are listening.  This message contains data about the drink being shown on the page.
                ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
                args.Sender = "Drink";
                args.Target = "WidgetSimilarDrinks";
                args.Value = new List<object>() {Convert.ToInt32(Request.QueryString["pk"]),
                                                    _drDrink["StructureID"],
                                                    _drDrink["GlassID"],
                                                    dtDrinkLinks};

                if (ModuleCommunication != null)
                {
                    ModuleCommunication(this, args);
                }

                // Log this drink
                // No don't do this.  We are trying not to hit the db for performance reasons and the LogPage table gives us this info anyway
                //LogDrink(Convert.ToInt32(Request.QueryString["pk"]));

                // Microdata
                _microdataUrlMeta.Attributes.Add("content", CharlesThompson.LiquorAndDrink.AppUtility.Drink.GetUrl(Convert.ToInt32(Request.QueryString["pk"]), (string)_drDrink["Slug"]));

                // Social buttons
                if (ConfigurationManager.AppSettings["ShowSocialButtons"] == "1") _socialButtons.Text = AppUI.Content.GetSocialSharingButtons();

                DoSEO();
            }
        }
Exemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int rowCount = 0;

            // Log page
            AppUtility.Utility.LogPage();

            if (Request.QueryString["desc"] != null)
            {// This is not a generic search--it is a browse filter--figure out page title

                if (Request.QueryString["filter"] == "search")
                {// Doing a one parameter search to impersonate a browse

                    if (Request.QueryString["cat"] != null)
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Category - " + WebUtility.TitleCase(AppUtility.Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["flavor"] != null)
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Flavor - " + WebUtility.TitleCase(AppUtility.Utility.UrlDecode(Request.QueryString["desc"]));
                }
                else
                {// Doing an actual browse

                    if (Request.QueryString["filter"] == "brand")
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Brand - " + WebUtility.TitleCase(AppUtility.Utility.UrlDecode(Request.QueryString["desc"]));

                    else if (Request.QueryString["filter"] == "country")
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Country of Origin - " + WebUtility.TitleCase(AppUtility.Utility.UrlDecode(Request.QueryString["desc"]));
                }
            }
            else
            {// These don't use a desc

                if (Request.QueryString["filter"] == "proof")
                {
                    if (Request.QueryString["value2"] == "0")
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Alcohol Proof - No Alcohol";
                    else
                        ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Alcohol Proof - " + Request.QueryString["value1"] + " to " + Request.QueryString["value2"] + " Proof";
                }

                else if (Request.QueryString["filter"] == "name")
                {
                    ModuleConfiguration.ModuleTitle = "Cocktail Ingredients";
                    _metaDescription = "A huge list of cocktail ingredients.";
                }
                else if (Request.QueryString["filter"] == "inusebydrinks")
                {// drinks/browse/ingredient, browse drinks by ingredient, showing all ingredients in use in drinks

                    ModuleConfiguration.ModuleTitle = "Cocktail Ingredients";
                    _metaDescription = "A huge list of cocktail ingredients.";
                    _subheadParagraph.InnerText = "Click on a cocktail ingredient to see which drink recipes use it.";
                }
                else
                {// Must be a genuine search

                    ModuleConfiguration.ModuleTitle = "Liquor/Mixers - Search Results";
                }
            }

            SimpleData simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            SqlParameter[] sqlParameters = new SqlParameter[16];

            // First, fill out blank parameters.  If a parameter is going to be used, it will be filled out below.
            // SqlParemeterCollection can't have nulls in it.
            sqlParameters[0] = new SqlParameter("Name", null);
            sqlParameters[1] = new SqlParameter("DescriptionAndNotes", null);
            sqlParameters[2] = new SqlParameter("CategoryID", null);
            sqlParameters[3] = new SqlParameter("FlavorID", null);
            sqlParameters[4] = new SqlParameter("CountryID", null);
            sqlParameters[5] = new SqlParameter("BrandID", null);
            sqlParameters[6] = new SqlParameter("AlcoholProof1", null);
            sqlParameters[7] = new SqlParameter("AlcoholProof2", null);
            sqlParameters[8] = new SqlParameter("LADRating1", null);
            sqlParameters[9] = new SqlParameter("LADRating2", null);
            sqlParameters[10] = new SqlParameter("COMRating1", null);
            sqlParameters[11] = new SqlParameter("COMRating2", null);
            sqlParameters[12] = new SqlParameter("PageNum", 1);
            sqlParameters[13] = new SqlParameter("PageSize", 5000);

            if (Request.QueryString["name"] != null)
            {
                sqlParameters[0] = new SqlParameter("Name", SqlDbType.VarChar, 100, ParameterDirection.Input, true, 0, 0, "Name", DataRowVersion.Current, Request.QueryString["name"]);
            }

            if (Request.QueryString["dn"] != null)
            {
                sqlParameters[1] = new SqlParameter("DescriptionAndNotes", SqlDbType.VarChar, 100, ParameterDirection.Input, true, 0, 0, "DescriptionAndNotes", DataRowVersion.Current, Request.QueryString["dn"]);
            }

            if (Request.QueryString["cat"] != null)
            {
            //                DataTable dtCategory = simpleData.FetchSP("GetListItemsTreeAllChildren",
            //                                                           new SqlParameter[] { new SqlParameter("ListItemID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "ListItemID", DataRowVersion.Current, Request.QueryString["cat"]) });

                sqlParameters[2] = new SqlParameter("CategoryID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "CategoryID", DataRowVersion.Current, Request.QueryString["cat"]);
            }

            if (Request.QueryString["flavor"] != null)
            {
                sqlParameters[3] = new SqlParameter("FlavorID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "FlavorID", DataRowVersion.Current, Request.QueryString["flavor"]);
            }

            if (Request.QueryString["country"] != null)
            {
                sqlParameters[4] = new SqlParameter("CountryID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "CountryID", DataRowVersion.Current, Request.QueryString["country"]);
            }

            if (Request.QueryString["brand"] != null)
            {
                sqlParameters[5] = new SqlParameter("BrandID", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "BrandID", DataRowVersion.Current, Request.QueryString["brand"]);
            }

            if (Request.QueryString["proof1"] != null)
            {
                sqlParameters[6] = new SqlParameter("AlcoholProof1", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "AlcoholProof1", DataRowVersion.Current, Request.QueryString["proof1"]);
            }

            if (Request.QueryString["proof2"] != null)
            {
                sqlParameters[7] = new SqlParameter("AlcoholProof2", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "AlcoholProof2", DataRowVersion.Current, Request.QueryString["proof2"]);
            }

            if (Request.QueryString["ladrating1"] != null)
            {
                sqlParameters[8] = new SqlParameter("LADRating1", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "LADRating1", DataRowVersion.Current, Request.QueryString["ladrating1"]);
            }

            if (Request.QueryString["ladrating2"] != null)
            {
                sqlParameters[9] = new SqlParameter("LADRating2", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "LADRating2", DataRowVersion.Current, Request.QueryString["ladrating2"]);
            }

            if (Request.QueryString["comrating1"] != null)
            {
                sqlParameters[10] = new SqlParameter("COMRating1", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "COMRating1", DataRowVersion.Current, Request.QueryString["comrating1"]);
            }

            if (Request.QueryString["comrating2"] != null)
            {
                sqlParameters[11] = new SqlParameter("COMRating2", SqlDbType.Int, 0, ParameterDirection.Input, true, 0, 0, "COMRating2", DataRowVersion.Current, Request.QueryString["comrating2"]);
            }

            // Add output parameters
            sqlParameters[14] = new SqlParameter("TotalPages", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalPages", DataRowVersion.Current, 0);
            sqlParameters[15] = new SqlParameter("TotalRows", SqlDbType.Int, 0, ParameterDirection.Output, true, 0, 0, "TotalRows", DataRowVersion.Current, 0);

            if (Request.QueryString["filter"] == "search")
            {// Full search requested--crank the search stored procedure

                _repeaterIngredient.DataSource = simpleData.FetchSP("SearchIngredients", sqlParameters);
                rowCount = ((DataTable)_repeaterIngredient.DataSource).Rows.Count;
            }
            else
            {// Browse requested--filter on one column (hopefully from the cache)

                DataView dataView = null;

                switch (Request.QueryString["filter"])
                {
                    case "name":
                    // Filter by name--just show all

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsWithDetailPage,
                                                       "GetIngredientsWithDetailPage",
                                                       "Ingredient_pk",
                                                        null);

                        dataView.RowFilter = String.Empty;
                        _repeaterIngredient.DataSource = dataView;
                        break;

                    case "cat":
                    // Filter by category--this is actually done as a one parameter search above
                        break;

                    case "country":
                    // Filter by country

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsWithDetailPage,
                                                       "GetIngredientsWithDetailPage",
                                                       "Ingredient_pk",
                                                        null);

                        dataView.RowFilter = "CountryID = " + Request.QueryString["value"];
                        _repeaterIngredient.DataSource = dataView;
                        break;

                    case "brand":
                    // Filter by brand

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsWithDetailPage,
                                                       "GetIngredientsWithDetailPage",
                                                       "Ingredient_pk",
                                                        null);

                        dataView.RowFilter = "BrandID = " + Request.QueryString["value"];
                        _repeaterIngredient.DataSource = dataView;
                        break;

                    case "proof":
                    // Filter by alcohol proof

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsWithDetailPage,
                                                       "GetIngredientsWithDetailPage",
                                                       "Ingredient_pk",
                                                        null);

                        dataView.RowFilter = "Proof >= " + Request.QueryString["value1"] + " AND Proof <= " + Request.QueryString["value2"];
                        _repeaterIngredient.DataSource = dataView;
                        break;

                    case "inusebydrinks":
                    // Filter by ingredients in use in drinks

                        dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsInUseByDrinks,
                                                       "GetIngredientsInUseByDrinks",
                                                       "Ingredient_pk",
                                                        null);

                        _repeaterDrink.DataSource = dataView;
                        break;
                }

                rowCount = dataView.Count;
            }

            if (Request.QueryString["filter"] == "inusebydrinks")
            {// Browse drinks by ingredient

                // Light up the ingredient/brand to drink repeater
                _repeaterDrink.DataBind();
            }
            else
            {// Browse ingredients by filter passed in

                if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "brand")
                {// A browse request was made for a list of ingredients that belong to a particular brand.  We do not do
                 // this kind of browsing anymore so throw a 404 instead.

                        HttpContext.Current.Response.StatusCode = 404;
                        HttpContext.Current.Response.End();
                }

                if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "country")
                {// A browse request was made for a list of ingredients from a particular country.  We do not do
                 // this kind of browsing anymore so throw a 404 instead.

                        HttpContext.Current.Response.StatusCode = 404;
                        HttpContext.Current.Response.End();
                }

                if (rowCount == 0)
                {// No records returned

                    if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["cat"] != null)
                    {// A request was made for a list of ingredients for a particlar ingredient category.  We have cleaned
                     // out a long of categories.  If the request is for one of the categories that no longer exists, the
                     // page would just show a blank list.  This is not good for SEO so we need to throw a 404 instead.

                        HttpContext.Current.Response.StatusCode = 404;
                        HttpContext.Current.Response.End();
                    }

                    if (Request.QueryString["type"] == "browse" && Request.QueryString["filter"] == "search" && Request.QueryString["flavor"] != null)
                    {// A request was made for a list of ingredients with a particular flavor.  We have cleaned
                     // out a lot of flavors.  If the request is for one of the categories that no longer exists, the
                     // page would just show a blank list.  This is not good for SEO so we need to throw a 404 instead.

                        HttpContext.Current.Response.StatusCode = 404;
                        HttpContext.Current.Response.End();
                    }
                }

                // Light up the ingredients to ingredient repeater
                _repeaterIngredient.DataBind();
            }

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            // Log page
            AppUtility.Utility.LogPage();

            DoSEO();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            DataView dv = CacheManager.GetItem(CacheManager.Cache_GetIngredientCategories,
                                              "GetIngredientCategories",
                                              "ListItem_pk",
                                               null);

            //_repeater.DataSource = dv;
            //_repeater.DataBind();

            ModuleConfiguration.ModuleTitle = "Browse Liquor/Mixers - By Category";

            int currentLevel = 0;
            int counter = 0;
            StringBuilder sb = new StringBuilder();

            foreach (DataRow dr in dv.Table.Rows)
            {
                if ((int)dr["Level"] > currentLevel)
                {// Level increased

                    sb.Append(@"<ul>");
                }
                else if ((int)dr["Level"] < currentLevel)
                {// Level decreased

                    if (currentLevel - (int)dr["Level"] == 1)
                        sb.Append(@"</li></ul></li>");
                    else if (currentLevel - (int)dr["Level"] == 2)
                        sb.Append(@"</li></ul></li></ul><li>");
                    else if (currentLevel - (int)dr["Level"] == 3)
                        sb.Append(@"</li></ul></li></ul><li></ul><li>");
                }
                else
                {// No level change

                    if (counter > 0)
                    {// Close previous li

                        sb.Append(@"</li>");
                    }
                }

                sb.Append(@"<li><a href=""");
                sb.Append(ConfigurationManager.AppSettings["SiteUrl"]);
                sb.Append(@"ingredients/browse/category/");
                sb.Append(Convert.ToString(dr["ListItem_pk"]));
                sb.Append(@"-");
                sb.Append(CharlesThompson.LiquorAndDrink.AppUtility.Utility.UrlEncode((string)dr["Name"]));
                sb.Append(@""">");
                sb.Append((string)dr["Name"]);
                sb.Append(@"</a>");

                counter++;
                currentLevel = (int)dr["Level"];
            }

            // Add final closing tag
            sb.Append(@"</li>");

            _categoriesLiteral.Text = sb.ToString();

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
Exemplo n.º 14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Remove this if we can go full cache (not yet)...
            SimpleData simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            // Log page
            AppUtility.Utility.LogPage();

            // Get ingredient data from cache
            DataView dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredients,
                                                    "GetIngredients",
                                                    "Ingredient_pk",
                                                     null);

            _dataRow = dataView.Table.Rows.Find(Convert.ToInt32(Request.QueryString["pk"]));

            if (_dataRow == null || ! (bool)_dataRow["HasDetailPage"])
            {// Either we did not find the ingredient using it's pk (it has probably been culled as a low quality page) or we found it and it is set to not have a detail page--send a 404

                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.StatusCode = 404;
                HttpContext.Current.Response.End();
            }
            else
            {// Found the ingredient--continue

                string calledUrl = ConfigurationManager.AppSettings["SiteDomain"] + HttpContext.Current.Request.RawUrl;
                string correctUrl = CharlesThompson.LiquorAndDrink.AppUtility.Ingredient.GetUrl((int)_dataRow["Ingredient_pk"], (string)_dataRow["Slug"]);

                if (calledUrl != correctUrl)
                {// The url used to get to this page is different than the correct url for this page.  This is usually because the slug is different (the text after
                 // the pk).  The slug may have changed for SEO reasons.  Anyway, we want Google (and anyone else) to use the current, correct url for this page so
                 // we need to 301 to the correct url.

                    Response.RedirectPermanent(correctUrl, true);
                }

                // Thumbnail microdata
                if (CharlesThompson.LiquorAndDrink.AppUtility.Ingredient.HasThumbnailFilename((int)_dataRow["Ingredient_pk"]))
                {// We have a thumbnail image for this ingredient--stick it in the microdata

                    _thumbnailImageMetaLiteral.Text = @"<meta itemprop=""thumbnailUrl"" content=""" +
                                                      CharlesThompson.LiquorAndDrink.AppUtility.Ingredient.GetThumbnailFilenameUrl((int)_dataRow["Ingredient_pk"]) +
                                                      @""" />";
                }

                // Do page title
                Control h1 = this.FindControl("_H1");

                if (h1 != null)
                {// H1 heading found--set it to the page title

                    ((HtmlGenericControl)h1).InnerText = (string)_dataRow["Keywords"];
                }

                // Categories
                // Get all parents of this category.  We will display the parents as a hierarchy.
                // Use the IngredientCategoriesInUse cache object so we don't hit the db
                DataView categoriesView = CacheManager.GetItem(CacheManager.Cache_GetIngredientCategories,
                                                              "GetIngredientCategories",
                                                              "ListItem_pk",
                                                               null);

                DataRow categoryRow = categoriesView.Table.Rows.Find((int)_dataRow["CategoryID"]);
                List<int> categoryIdList = new List<int>();
                List<string> categoryNameList = new List<string>();
                StringBuilder sb = new StringBuilder();
                int counter = 0;

                while (categoryRow != null)
                {
                    categoryIdList.Insert(0, (int)categoryRow["ListItem_pk"]);
                    categoryNameList.Insert(0, (string)categoryRow["Name"]);

                    if (categoryRow["ParentID"] == DBNull.Value) break;
                    else categoryRow = categoriesView.Table.Rows.Find((int)categoryRow["ParentID"]);
                }

                sb.Append(@"<p style=""line-height: 1.25em"">");

                foreach (int listItemID in categoryIdList)
                {
                    for (int x = 0; x < counter * 2; x++)
                    {
                        sb.Append("&nbsp;");
                    }

                    sb.Append(@"<a href=""");
                    sb.Append(ConfigurationManager.AppSettings["SiteUrl"]);
                    sb.Append("ingredients/browse/category/");
                    sb.Append(Convert.ToString(listItemID));
                    sb.Append("-");
                    sb.Append(AppUtility.Utility.UrlEncode(categoryNameList[counter]));
                    sb.Append(@""">");
                    sb.Append(categoryNameList[counter]);
                    sb.Append(@"</a><br/>");

                    counter++;
                }

                sb.Append(@"</p>");

                _categoryLiteral.Text = sb.ToString();

                // Ingredient name
                if ((int)_dataRow["BrandID"] != 0)
                {
                    _brandLiteral.Text = (string)_dataRow["BrandName"];
                }
                else
                {// No brand--don't show the field

                    _brandRow.Visible = false;
                }

                if ((int)_dataRow["CountryID"] != 0)
                {
                    //_countryLink.NavigateUrl = ConfigurationManager.AppSettings["SiteUrl"] + "ingredients/browse/country/" + Convert.ToString(_dataRow["CountryID"]) + "-" + AppUtility.Utility.UrlEncode((string)_dataRow["CountryName"]);
                    _countryLiteral.Text = (string)_dataRow["CountryName"];
                }
                else
                {// No country--don't show the field

                    _countryRow.Visible = false;
                }

                //_proofLink.NavigateUrl = ConfigurationManager.AppSettings["SiteUrl"] + "ingredients/browse/proof/" + String.Format("{0:##0}", _dataRow["Proof"]) + "-" + String.Format("{0:##0}", (decimal)_dataRow["Proof"] + 1);
                _proofLiteral.Text = String.Format("{0:##0.##}", _dataRow["Proof"]) + " (" + String.Format("{0:##0.##%}", (decimal)_dataRow["Proof"] * (decimal).5 / 100) +")";

                // Not displaying more information links to external brand website or ingredient web page.  We were using the ingredient's
                // name in the anchor text which links juice for the term we are trying to rank for on this page.
                //// More information
                //sb = new StringBuilder();
                //bool moreInformationAvailable = false;

                //if (_dataRow["IngredientURL"] != DBNull.Value && (string)_dataRow["IngredientURL"] != String.Empty)
                //{// We have an ingredient URL--use it

                //    sb.Append(@"<a target=""_blank"" href=""");
                //    sb.Append(AppUtility.Utility.ExternalUrlEncode((string)_dataRow["IngredientURL"]));
                //    sb.Append(@""">");
                //    sb.Append((string)_dataRow["IngredientName"]);
                //    sb.Append(@"</a>");
                //    moreInformationAvailable = true;
                //}

                //if (_dataRow["BrandURL"] != DBNull.Value && (string)_dataRow["BrandURL"] != String.Empty)
                //{// We have an brand URL--use it

                //    if (sb.Length > 0) sb.Append("<br/>");
                //    sb.Append(@"<a target=""_blank"" href=""");
                //    sb.Append(AppUtility.Utility.ExternalUrlEncode((string)_dataRow["BrandURL"]));
                //    sb.Append(@""">");
                //    sb.Append((string)_dataRow["BrandName"]);
                //    sb.Append(@"</a>");
                //    moreInformationAvailable = true;
                //}

                //if (moreInformationAvailable)
                //    _moreInformationLiteral.Text = sb.ToString();
                //else
                //{// More information not available--hide the field

                //    _moreInformationRow.Visible = false;
                //}

                // Flavors ##########################################################################
                DataView flavorsView = CacheManager.GetItem(CacheManager.Cache_GetIngredientFlavorsAll,
                                                           "GetIngredientFlavorsAll",
                                                           "ListItem_pk,Ingredient_pk",
                                                            null);

                DataRow[] flavorRows = flavorsView.Table.Select("Ingredient_pk = " + Request.QueryString["pk"], "Name ASC");

                StringBuilder flavors = new StringBuilder();
                foreach (DataRow row in flavorRows)
                {
                    flavors.Append(@"<a href=""");
                    flavors.Append(ConfigurationManager.AppSettings["SiteUrl"]);
                    flavors.Append(@"ingredients/browse/flavor/");
                    flavors.Append(Convert.ToString(row["ListItem_pk"]));
                    flavors.Append("-");
                    flavors.Append(AppUtility.Utility.UrlEncode(Convert.ToString(row["Name"])));
                    flavors.Append(@""">");
                    flavors.Append(Convert.ToString(row["Name"]));
                    flavors.Append(@"</a>, ");
                }

                // Chop off trailing comma
                if (flavors.Length > 0) flavors.Remove(flavors.Length - 2, 2);

                if (flavorRows.Length > 0)
                {
                    _flavorsLiteral.Text = flavors.ToString();
                }
                else
                {// No flavors--don't show the field

                    _flavorsRow.Visible = false;
                }

                // Price #######################################################
                if (_dataRow["Price"] != DBNull.Value)
                {
                    StringBuilder price = new StringBuilder();
                    price.Append(String.Format("{0:$##0.##}", _dataRow["Price"]));
                    price.Append(" / ");
                    price.Append(String.Format("{0:##0.##}", _dataRow["PriceQuantity"]));
                    price.Append(" ");
                    price.Append((Decimal)_dataRow["PriceQuantity"] > 1 ? (string)_dataRow["UnitAbbreviationPlural"] : (string)_dataRow["UnitAbbreviation"]);
                    _priceLiteral.Text = price.ToString();
                }
                else
                {// No price--don't show the field

                    _priceRow.Visible = false;
                }

                // Ratings ##################################################
                DataView ratingsView = CacheManager.GetItem(CacheManager.Cache_GetIngredientRatingsAll,
                                                           "GetIngredientRatingsAll",
                                                           "Rating_pk,IngredientID",
                                                            null);

                //DataRow[] ratingRows = ratingsView.Table.Select("IngredientID = " + Request.QueryString["pk"]);
                ratingsView.RowFilter = "IngredientID = " + Request.QueryString["pk"];

                if (ratingsView.Count > 0)
                {
                    _repeaterRatings.DataSource = ratingsView;
                    _repeaterRatings.DataBind();
                }
                else _reviewDiv.Visible = false;

                ratingsView.RowFilter = string.Empty;

                // Description ##############################################
                string description = CharlesThompson.LiquorAndDrink.AppUtility.Ingredient.GetNotesWithAdsAndImages((int)_dataRow["Ingredient_pk"]);

                if (description.Length > 0) _descriptionLiteral.Text = description;
                else _descriptionLiteral.Visible = false;

                //// Not used anymore
                //// Notes ####################################################
                //if (((string)_dataRow["Notes"]).Trim() != string.Empty)
                //    _notesLiteral.Text = WebUtility.ConvertDBDescriptionToHTML((string)_dataRow["Notes"]);
                //else
                //    _notesDiv.Visible = false;

                // Flavor Profile ########################################################
                DataTable dtFlavorProfile = new DataTable();
                dtFlavorProfile.Columns.Add("Body", typeof(decimal));
                dtFlavorProfile.Columns.Add("Sweet", typeof(decimal));
                dtFlavorProfile.Columns.Add("Acidity", typeof(decimal));
                dtFlavorProfile.Columns.Add("Fresh Fruit", typeof(decimal));
                dtFlavorProfile.Columns.Add("Dried Fruit", typeof(decimal));
                dtFlavorProfile.Columns.Add("Spice", typeof(decimal));
                dtFlavorProfile.Columns.Add("Heat", typeof(decimal));
                dtFlavorProfile.Columns.Add("Wood", typeof(decimal));

                dtFlavorProfile.Rows.Add(new object[] { });

                // ##############################
                // Do ingredient right column widgets content for this ingredient
                // ##############################
                int flavor1ID = -1;
                int flavor2ID = -1;
                if (flavorRows.Length > 0) flavor1ID = (int)flavorRows[0]["ListItem_pk"];
                if (flavorRows.Length > 1) flavor2ID = (int)flavorRows[1]["ListItem_pk"];

                // Get linked entities
                DataTable dtIngredientLinks = simpleData.FetchSP("GetIngredientLinks", new SqlParameter[] { new SqlParameter("IngredientID", Request.QueryString["pk"]) });

                // Send a message to any widget modules that are listening.  This message contains data about the ingredient being shown on the page.
                ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
                args.Sender = "Ingredient";
                args.Target = "WidgetSimilarIngredients";
                args.Value = new List<object>() {(string)_dataRow["IngredientName"],
                                                    Convert.ToInt32(Request.QueryString["pk"]),
                                                    (int)_dataRow["CategoryID"],
                                                    (int)_dataRow["BrandID"],
                                                    flavor1ID,
                                                    flavor2ID,
                                                    dtIngredientLinks};

                if (ModuleCommunication != null)
                {
                    ModuleCommunication(this, args);
                }

                // Log this ingredient
                // No don't do this.  We are trying not to hit the db for performance reasons and the LogPage table gives us this info anyway
                //LogIngredient(Convert.ToInt32(Request.QueryString["pk"]));

                // Microdata
                _microdataUrlMeta.Attributes.Add("content", CharlesThompson.LiquorAndDrink.AppUtility.Ingredient.GetUrl(Convert.ToInt32(Request.QueryString["pk"]), (string)_dataRow["Slug"]));

                // Social buttons
                if (ConfigurationManager.AppSettings["ShowSocialButtons"] == "1") _socialButtons.Text = AppUI.Content.GetSocialSharingButtons();

                DoSEO();
            }
        }
Exemplo n.º 15
0
        public void setApprovalHistory(Hashtable ht)
        {
            if (!ht.ContainsKey("RootTaskID"))
            {
                ht.Add("RootTaskID", Info.RootTaskID);
            }

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.InitialApprovalHistoryTarget;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find ApprovalHistory Init Listener"));
            }
        }
Exemplo n.º 16
0
 public void OnModuleCommunication(object s,
 ModuleCommunicationEventArgs e)
 {
     if (e.Target == "Ourspace_ThreadDetails")
     {
         if (e.Text == "updatePhaseDisplay")
         {
             rptr_ThreadInfo.DataBind();
         }
     }
     // throw new NotImplementedException();
 }
Exemplo n.º 17
0
        public void setSignature(Hashtable ht)
        {
            if (!ht.ContainsKey("TaskID"))
            {
                if (!string.IsNullOrEmpty(TaskID))
                    ht.Add("TaskID", TaskID);
                else
                    ht.Add("TaskID", "");
            }

            if (!ht.ContainsKey("ComponentAssemblyName"))
                ht.Add("ComponentAssemblyName", "Keywin.DNN.Modules.FMS.AlarmRuleSet.Components.AlarmRuleSetController, Keywin.DNN.Modules.FMS.AlarmRuleSet");

            if (!ht.ContainsKey("ComponentModuleID"))
                ht.Add("ComponentModuleID", this.ModuleId.ToString());

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.InitialSignatureTarget;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find Signature Init Listener"));
            }
        }
Exemplo n.º 18
0
        public bool ProcessFlow(bool isCreateProcess, bool completeTask, string taskID, string sender)
        {

            Hashtable htTaskData = new Hashtable();

            try
            {
                if (ModuleCommunication != null)
                {
                    // PLM_TODO Set process parameter

                    htTaskData.Add("PROJECTID", Info.AlarmRuleSetID);
                    htTaskData.Add("PROJECTCODE", Info.AlarmRuleSetID);
                    htTaskData.Add("FLOWNAME", "AlarmRuleSet");
                    htTaskData.Add("TASKURL", TabController.CurrentPage.TabPath.Replace("//", "/"));
                    htTaskData.Add("OWNER", UserInfo.Username);
                    htTaskData.Add("SUBJECT", Info.AlarmRuleSetID);

                    ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                    mcArgs.Sender = this.IMC_Sender;
                    mcArgs.Target = sender;

                    object obj;
                    if (isCreateProcess)
                    {
                        mcArgs.Text = "ProcessInfo";
                        obj = new ProcessInfo(InitialExecuteMemID());
                        ProcessInfo objProcess = (ProcessInfo)obj;
                        objProcess.Parameters = htTaskData;
                    }
                    else
                    {
                        mcArgs.Text = "TaskInfo";
                        obj = new TaskInfo(taskID);
                        TaskInfo objTask = (TaskInfo)obj;
                        objTask.Parameters = htTaskData;
                    }

                    mcArgs.Type = obj.GetType().ToString();
                    mcArgs.Value = obj;

                    if (ProcessFlowReturn.Equals("True"))
                        ModuleCommunication(this, mcArgs);
                }
                else
                {
                    this.Controls.Add(new System.Web.UI.LiteralControl("Can't find Signature IMC Listener"));
                }
            }
            catch (Exception exc)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc);
            }

            return false;
        }
Exemplo n.º 19
0
        public void setRevoke(Hashtable ht)
        {
            if (!ht.ContainsKey("DocID"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("DocID", AlarmRuleSetID);
                else
                    ht.Add("DocID", "");
            }

            if (!ht.ContainsKey("AssemblyName")) ht.Add("AssemblyName", _ctrl.GetType().FullName + ", " + _ctrl.GetType().Assembly.GetName().Name);
            if (!ht.ContainsKey("RootTaskID")) ht.Add("RootTaskID", Info.RootTaskID);
            if (!ht.ContainsKey("StatusCode")) ht.Add("StatusCode", Info.StatusCode);
            if (!ht.ContainsKey("RevokeID")) ht.Add("RevokeID", Info.RevokeID);

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.InitialRevokeTarget;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find Revoke Init Listener"));
            }
        }
Exemplo n.º 20
0
        public void setCoSign(Hashtable ht)
        {
            if (!ht.ContainsKey("DocID"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("DocID", AlarmRuleSetID);
                else
                    ht.Add("DocID", "");
            }

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.CoSign.InitData;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find CoSign Init Listener"));
            }
        }
Exemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            //_pathLiteral1.Text = ConfigurationManager.AppSettings["SiteUrl"];

            if (Request.QueryString["target"] == "ingredient")
            {// Eventual target will be a list of ingredients--show the ingredient div

                _tableIngredient.Visible = true;
                ModuleConfiguration.ModuleTitle = "Browse Liquor/Mixers - By Alcohol Proof";
            }
            else
            {// Eventual target will be a list of drinks--show the drink div

                _divDrink.Visible = true;
                ModuleConfiguration.ModuleTitle = "Browse Drinks - By Alcohol Proof";
            }

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
Exemplo n.º 22
0
        public void setProjectTracking(Hashtable ht)
        {
            if (!ht.ContainsKey("DocID"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("DocID", AlarmRuleSetID);
                else
                    ht.Add("DocID", "");
            }

            if (!ht.ContainsKey("ProjectCode"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("ProjectCode", AlarmRuleSetID);
                else
                    ht.Add("ProjectCode", "");
            }

            if (!ht.ContainsKey("ProjectName"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("ProjectName", AlarmRuleSetID);
                else
                    ht.Add("ProjectName", "");
            }

            if (!ht.ContainsKey("PageURL"))
            {
                ht.Add("PageURL", GetPageURL());

            }

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.InitialProjectTrackingTarget;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find ProjectTracking Init Listener"));
            }
        }
Exemplo n.º 23
0
        private void Done(bool saveLog, BranchInfo.BranchType branchType)
        {
            if (ProcessFlowReturn.Equals("False")) Info.StatusCode = "RELEASE";
            else
            {
                if (PageMode.Mode.CREATE.Equals(PM)) Info.StatusCode = "DRAFT";
            }

            // Start User Define Parameter For SaveData
            Info.RuleName = txtRuleName.Text;
            Info.AlarmType = ddlAlarmType.SelectedValue;
            //Info.AlarmType = hidAlarmType.Value;
            //Info.AlarmTypeName = hidAlarmTypeName.Value;
            Info.Severity = ddlSeverity.SelectedValue;
            Info.CustomCode = ""; //txtCustomCode.Text;
            Info.Notifier = "";
            foreach (ListItem itm in chklNotifier.Items)
            {
                if (itm.Selected)
                {
                    if (Info.Notifier != "") Info.Notifier = Info.Notifier + ",";
                    Info.Notifier = Info.Notifier + itm.Value;
                }
            }

            Info.State = ddlState.SelectedValue;
            Info.GenerateTask = rdlGenerateTask.SelectedValue;
            Info.Handler = rdlHandler.SelectedValue;
            Info.Rules = hidRules.Value;

            // End User Define Parameter For SaveData

            _ctrl.Save(Info, PM, saveLog, branchType);
            
            bool isTemperature = false;
            if(Info.AlarmType.CompareTo("611") == 0)
                isTemperature = true;

            //ApplyCar
            string[] ary = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(hidApplyCarList.Value);
            ApplyCarController applyCarController = new ApplyCarController();
            ApplyCarInfo applyCarInfo = null;
            applyCarController.DeleteByAlarmRuleSet(Info.AlarmRuleSetID);

            Dictionary<string, string> dic;
            if (isTemperature)
            {
                dic = new Dictionary<string, string>();
                for (int i = 0; i < ary.Length; i++)
                {
                    string[] splitArray = ary[i].Split(';');
                    string value;
                    if (dic.TryGetValue(splitArray[0], out value)) //相同carInfoId的資料合併
                    {
                        value = value + '|' + splitArray[1];
                    }
                    else
                    {
                        value = splitArray[1];
                    }
                    dic[splitArray[0]] = value;
                }
                foreach (KeyValuePair<string, string> kv in dic)
                {
                    applyCarInfo = new ApplyCarInfo();
                    InitialObject(applyCarInfo, RequestModuleID);
                    applyCarInfo.AlarmRuleSetID = Info.AlarmRuleSetID;
                    applyCarInfo.fleetSetting_CARInfoID = kv.Key;
                    applyCarInfo.PortNameInDB = kv.Value;
                    applyCarController.Save(applyCarInfo, PageMode.Mode.CREATE, saveLog, branchType);
                }
            }
            else
            {
                for (int i = 0; i < ary.Length; i++)
                {
                    applyCarInfo = new ApplyCarInfo();
                    InitialObject(applyCarInfo, RequestModuleID);
                    applyCarInfo.AlarmRuleSetID = Info.AlarmRuleSetID;
                    applyCarInfo.fleetSetting_CARInfoID = ary[i];
                    applyCarController.Save(applyCarInfo, PageMode.Mode.CREATE, saveLog, branchType);
                }
            }
            //ApplyContainer
            string[] ary2 = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(hidApplyContainerList.Value);
            ApplyContainerController applyContainerController = new ApplyContainerController();
            ApplyContainerInfo applyContainerInfo = null;
            applyContainerController.DeleteByAlarmRuleSet(Info.AlarmRuleSetID);

            if (isTemperature)
            {
                dic = new Dictionary<string, string>();
                for (int i = 0; i < ary2.Length; i++)
                {
                    string[] splitArray = ary2[i].Split(';');
                    string value;
                    if (dic.TryGetValue(splitArray[0], out value)) //相同carInfoId的資料合併
                    {
                        value = value + '|' + splitArray[1];
                    }
                    else
                    {
                        value = splitArray[1];
                    }
                    dic[splitArray[0]] = value;
                }
                foreach (KeyValuePair<string, string> kv in dic)
                {
                    applyContainerInfo = new ApplyContainerInfo();
                    InitialObject(applyContainerInfo, RequestModuleID);
                    applyContainerInfo.AlarmRuleSetID = Info.AlarmRuleSetID;
                    applyContainerInfo.fleetSetting_ContainerID = kv.Key;
                    applyContainerInfo.PortNameInDB = kv.Value;
                    applyContainerController.Save(applyContainerInfo, PageMode.Mode.CREATE, saveLog, branchType);
                }
            }
            else
            {
                for (int i = 0; i < ary2.Length; i++)
                {
                    applyContainerInfo = new ApplyContainerInfo();
                    InitialObject(applyContainerInfo, RequestModuleID);
                    applyContainerInfo.AlarmRuleSetID = Info.AlarmRuleSetID;
                    applyContainerInfo.fleetSetting_ContainerID = ary2[i];
                    applyContainerController.Save(applyContainerInfo, PageMode.Mode.CREATE, saveLog, branchType);
                }
            }          

            Hashtable ht = new Hashtable();
            ht.Add("ModID", this.ModuleId);
            ht.Add("DocID", Info.AlarmRuleSetID);

            ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
            mcArgs.Sender = this.IMC_Sender;
            mcArgs.Target = IMC.SaveSupportComponentTarget;
            mcArgs.Type = "System.Collections.Hashtable";
            mcArgs.Value = ht;
            mcArgs.Text = "";
            ModuleCommunication(this, mcArgs);

        }
Exemplo n.º 24
0
        public void setProjectTeam(Hashtable ht)
        {
            if (!ht.ContainsKey("ProID"))
            {
                if (!string.IsNullOrEmpty(ProID))
                    ht.Add("ProID", ProID);
                else
                    ht.Add("ProID", "");
            }

            if (!ht.ContainsKey("DocID"))
            {
                if (!string.IsNullOrEmpty(AlarmRuleSetID))
                    ht.Add("DocID", AlarmRuleSetID);
                else
                    ht.Add("DocID", "");
            }

            /*
            //Initial Project Team Data
            if (PM.Equals(PageMode.Mode.CREATE))
            {
                Hashtable initTeamMember = new Hashtable();
                initTeamMember.Add("APPLICANT", InitialExecuteMemID());

                ht.Add("InitTeamMember", initTeamMember);
            }
            */

            if (ModuleCommunication != null)
            {
                ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs();
                mcArgs.Sender = this.IMC_Sender;
                mcArgs.Target = IMC.InitialProjectTeamTarget;
                mcArgs.Type = "System.Collections.Hashtable";
                mcArgs.Value = ht;
                mcArgs.Text = "";
                ModuleCommunication(this, mcArgs);
            }
            else
            {
                this.Controls.Add(new System.Web.UI.LiteralControl("Can't find ProjectTeam Init Listener"));
            }
        }
Exemplo n.º 25
0
 public void OnModuleCommunication(object sender, ModuleCommunicationEventArgs e)
 {
     foreach (object obj in plhContent.Controls)
     {
         System.Reflection.MethodInfo minfo = obj.GetType().GetMethod("OnModuleCommunication");
         if (minfo != null)
         {
             minfo.Invoke(obj, new object[] { sender, e });
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            DataView dv;
            SimpleData simpleData;

            simpleData = new SimpleData();
            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            ModuleConfiguration.ModuleTitle = "Search Liquor and Mixers";

            // Get categories #####################################################################
            dv = CacheManager.GetItem(CacheManager.Cache_GetIngredientCategories,
                                     "GetIngredientCategories",
                                     "ListItem_pk",
                                      null);

            _category.DataSource = dv;
            _category.DataBind();

            _category.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set the category value to the value in the form

                _category.SelectedValue = Request.Form[_category.UniqueID];
            }
            else
            {// Not in postback--set the category to not specified

                _category.SelectedIndex = 0;
            }

            // Get flavors #####################################################################
            dv = CacheManager.GetItem(CacheManager.Cache_GetFlavors,
                                     "GetListItems",
                                     "ListItem_pk",
                                      new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(AppUtility.Constant.List.Flavor)) });

            _flavor.DataSource = dv;
            _flavor.DataBind();

            _flavor.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set the flavor value to the value in the form

                _flavor.SelectedValue = Request.Form[_flavor.UniqueID];
            }
            else
            {// Not in postback--set the flavor to not specified

                _flavor.SelectedIndex = 0;
            }

            //// Get countries #####################################################################
            //dv = CacheManager.GetItem(CacheManager.Cache_GetCountries,
            //                         "GetListItems",
            //                         "ListItem_pk",
            //                          new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(AppUtility.Constant.List.Country)) });

            //_country.DataSource = dv;
            //_country.DataBind();

            //_country.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            //if (Page.IsPostBack)
            //{// In postback--so set the country value to the value in the form

            //    _country.SelectedValue = Request.Form[_country.UniqueID];
            //}
            //else
            //{// Not in postback--set the country to not specified
            //    _country.SelectedIndex = 0;
            //}

            //// Get brands #####################################################################
            //dv = CacheManager.GetItem(CacheManager.Cache_GetBrands,
            //                         "GetBrands",
            //                         "Brand_pk",
            //                          null);

            //_brand.DataSource = dv;
            //_brand.DataBind();

            //_brand.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            //if (Page.IsPostBack)
            //{// In postback--so set the brand value to the value in the form

            //    _brand.SelectedValue = Request.Form[_brand.UniqueID];
            //}
            //else
            //{// Not in postback--set the brand to not specified

            //    _brand.SelectedIndex = 0;
            //}

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }
Exemplo n.º 27
0
        protected void lnkbtnPromoteToPhase3_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["threadId"] != null)
            {
                int threadId = Convert.ToInt32(Request.QueryString["threadId"].ToString());

                using (var sqlConn = new SqlConnection(CONNECTION_STRING))
                {
                    sqlConn.Open();
                    string sql = "UPDATE Ourspace_Forum_Thread_Info SET phaseId = 3 WHERE ThreadId = @ThreadId";
                    using (SqlCommand cmd = new SqlCommand(sql, sqlConn))
                    {
                        cmd.CommandType = CommandType.Text;
                        cmd.Parameters.Add(new SqlParameter("@ThreadId", threadId));
                        int rows = cmd.ExecuteNonQuery();
                    }
                    sqlConn.Close();

                }

                // Sending email notification
                Ourspace_Utilities.View util = new Ourspace_Utilities.View();
                util.SendEmailToThreadTrackersAboutMovingToPhase3(threadId, threadId, CultureInfo.CurrentCulture.ToString());

                // the IMC message data gets stored inside
                // a ModuleCommunicationEventArgs object
                ModuleCommunicationEventArgs mcArgs =
                    new ModuleCommunicationEventArgs();
                mcArgs.Sender = "Ourspace_ProposedSolutions";
                mcArgs.Target = "Ourspace_ThreadDetails";
                mcArgs.Text = "updatePhaseDisplay";
                mcArgs.Type = "Your custom type";
                //XmlDocument xmlDoc = new XmlDocument();
                //xmlDoc.Load("path/to/xml/doc.xml");
                mcArgs.Value = "notUsed";

                // if ModuleCommunication is null,
                // the cache settings for your module
                // might need to be set to 0 (turned off)
                if (ModuleCommunication != null)
                {
                    // calling your ModuleCommunication delegate event
                    // will cause the event to be raised
                    ModuleCommunication(this, mcArgs);
                }
                lnkbtnPromoteToPhase3.Visible = false;

                string[] parameters1 = new string[3];
                parameters1 = new string[3] { "threadid=" + threadId,"mode=featured", "language=" + CultureInfo.CurrentCulture.ToString()};
                string url = DotNetNuke.Common.Globals.NavigateURL(200, "", parameters1);

                //string language = CultureInfo.CurrentCulture.ToString();
              //string  url = "http://www.joinourspace.eu/tabid/196/result/" + threadId + "/language/" + language + "/Default.aspx";
                Response.Redirect(url);
            }
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Log page
            AppUtility.Utility.LogPage();

            DataView dataView;
            SimpleData simpleData = new SimpleData();

            ConnectionStringSettings connectionStringSettings = ConfigurationManager.ConnectionStrings["db"];
            simpleData.ConnectionString = connectionStringSettings.ConnectionString;

            // Get ingredients ################################################################
            dataView = CacheManager.GetItem(CacheManager.Cache_GetIngredientsInUseByDrinks,
                                           "GetIngredientsInUseByDrinks",
                                           "Ingredient_pk",
                                            null);

            _ingredient.DataSource = dataView;
            _ingredient.DataBind();

            _ingredient.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set the category value to the value in the form

                _ingredient.SelectedValue = Request.Form[_ingredient.UniqueID];
            }
            else
            {// Not in postback--set the category to not specified

                _ingredient.SelectedIndex = 0;
            }

            // Get categories ################################################################
            dataView = CacheManager.GetItem(CacheManager.Cache_GetStructures,
                                           "GetListItems",
                                           "ListItem_pk",
                                            new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(AppUtility.Constant.List.Structure)) });

            _structure.DataSource = dataView;
            _structure.DataBind();

            _structure.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set to the value in the form

                _structure.SelectedValue = Request.Form[_structure.UniqueID];
            }
            else
            {// Not in postback--set to not specified

                _structure.SelectedIndex = 0;
            }

            // Get tags ################################################################
            dataView = CacheManager.GetItem(CacheManager.Cache_GetAttributes,
                                           "GetListItems",
                                           "ListItem_pk",
                                            new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(AppUtility.Constant.List.Attribute)) });

            _attribute.DataSource = dataView;
            _attribute.DataBind();

            _attribute.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set to the value in the form

                _attribute.SelectedValue = Request.Form[_attribute.UniqueID];
            }
            else
            {// Not in postback--set to not specified

                _attribute.SelectedIndex = 0;
            }

            // Get glasses ################################################################
            dataView = CacheManager.GetItem(CacheManager.Cache_GetGlasses,
                                           "GetGlasses",
                                           "Glass_pk",
                                            null);

            _glass.DataSource = dataView;
            _glass.DataBind();

            _glass.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set to the value in the form

                _glass.SelectedValue = Request.Form[_glass.UniqueID];
            }
            else
            {// Not in postback--set to not specified

                _glass.SelectedIndex = 0;
            }

            // Get temperatures ################################################################
            dataView = CacheManager.GetItem(CacheManager.Cache_GetTemps,
                                           "GetListItems",
                                           "ListItem_pk",
                                            new SqlParameter[] { new SqlParameter("ListID", Convert.ToInt32(AppUtility.Constant.List.Temperature)) });

            _temp.DataSource = dataView;
            _temp.DataBind();

            _temp.Items.Insert(0, new ListItem(CharlesThompson.Web.Utility.Constant.NotSpecifiedDescription, Convert.ToString(CharlesThompson.Web.Utility.Constant.NotSpecifiedValue)));

            if (Page.IsPostBack)
            {// In postback--so set to the value in the form

                _temp.SelectedValue = Request.Form[_temp.UniqueID];
            }
            else
            {// Not in postback--set to not specified

                _temp.SelectedIndex = 0;
            }

            // Widgets
            // Send a message to any widget modules that are listening.
            ModuleCommunicationEventArgs args = new ModuleCommunicationEventArgs();
            args.Sender = "Headlines";
            args.Target = "Widget";
            args.Value = new List<string>() {AppUtility.AdRotator.GetAdsenseCode("adsense.list.200x90.linkunit")};

            if (ModuleCommunication != null)
            {
                ModuleCommunication(this, args);
            }

            DoSEO();
        }