コード例 #1
0
ファイル: index.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            hashcode = Request.QueryString["txtweb-mobile"];

            Response.Write("Welcome to \"@txtforum\" where you can ask any type of technical/non-technical questions regarding txtweb.<br /><br />"
                          + "<a href='./login.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.login</a> : For login<br /><br />"
                          + "<a href='./new_que.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ask</a> : For ask new question<br /><br />"
                          + "<a href='./get_que_list.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que</a> : Get recent questions list<br /><br />"
                          + "<a href='./get_quelist_me.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.my.que</a> : Get questions asked by you<br /><br />"
                          + "<a href='./quelist_myans.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.my.ans</a> : Get questions list in which you gave the answers<br /><br />");
        }
        catch
        {
            //display error message
            Blogic ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #2
0
    //Handles finalize insert article
    public void Finalize_ArticleSubmission(Object s, EventArgs e)
    {
        //Instantiate the SQL command object
        Blogic FinalizeAddArticle = new Blogic();

        int ID = (int)Util.Val(Request.QueryString["aid"]);

        Caching.PurgeCacheItems("Newest_Articles");
        Caching.PurgeCacheItems("ArticleCategory_SideMenu");

        //Add the parameters to the SQL command
        int Err = FinalizeAddArticle.FinalizeAddArticle(ID);

        // If error occured, stop further processing and notify user.
        if (Err != 0)
        {
            JSLiteral.Text = Util.JSProcessingErrorAlert;
            return;
        }

        //Release allocated memory
        FinalizeAddArticle = null;

        //If success, redirect to article submission confirmation/thank you page.
        Util.PageRedirect(9);

        //Release allocated memory
        Util = null;
    }
コード例 #3
0
 private void GetAllGuitars()
 {
     foreach (var guitar in Blogic.GetAllGuitars())
     {
         Guitars.Add(new GuitarViewModel(guitar));
     }
 }
コード例 #4
0
ファイル: editing.aspx.cs プロジェクト: USWSNMBB/Trust-Con
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            GetDropdownCategoryID();

            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            //Instantiate database field
            RecipeDetails Recipe = new RecipeDetails();

            Recipe.ID = (int)Util.Val(Request.QueryString["id"]);

            strRecipeImage = GetRecipeImage.GetImage(Recipe.ID);

            Recipe.WhatPageID = constant.intRecipeAdminEditing; //Parameter 3 = we are pulling database field for Admin/editing.aspx

            //Fill up database fields
            Recipe.fillup();

            Name.Text         = Recipe.RecipeName;
            Author.Text       = Recipe.Author;
            Hits.Text         = Recipe.Hits.ToString();
            Ingredients.Text  = Recipe.Ingredients;
            Instructions.Text = Recipe.Instructions;

            //Release allocated memory
            Recipe = null;
            myBL   = null;
        }
    }
コード例 #5
0
    //Data bind
    private void BindList()
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        Recipe.CatID = (int)Util.Val(Request.QueryString["catid"]);

        IDataReader dr = FetchData.GetCatName(Recipe.CatID);

        try
        {
            dr.Read();

            Recipe.Category = dr["CAT_TYPE"].ToString();
            lbcatname.Text  = Recipe.Category.ToString();
            lbcatname2.Text = Recipe.Category.ToString();

            //Assing value to hidden HTML text field.
            Category.Value = Recipe.Category.ToString();
            CAT_ID.Value   = Recipe.CatID.ToString();

            dr.Close();
        }
        catch
        {
            //If no record, redirect to page not found.
            Util.PageRedirect(1);
        }

        //Release allocated memory
        FetchData = null;
    }
コード例 #6
0
    protected void Page_Load(object Sender, EventArgs E)
    {
        //Validate admin session username and password by comparing them to the admin user database record.
        UserNameVal.ValidateAdminUserNameandPass();

        //Get total article count
        ArticleCount = FetchData.ArticleCountAll;

        //Assign selected value to lastviewed dropdown menu
        int lv = (int)Util.Val(Request.QueryString["lv"]);

        GetLastViewedSelectedValue(lv);

        if (!IsPostBack)
        {
            //Populate year in the dropdwonlist - starting from 2000 to the current year.
            int tempDT = DateTime.Now.Year;
            for (int i = tempDT; (tempDT - i) < 9; i--)
            {
                ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString()));
            }

            MonthSearch();
            GetLastViewedDDLSelectedIndex();
            GetShowHideCommentDDLSelectedIndex();
            GetEmailandSMTPInfo();

            //Populate dropdown category list
            GetDropdownCategoryList();

            //Display A-Z alhpabet letter recipe name
            lblalphaletter.Text = Utility.DisplayAZAlphabetLink(constant.AdminBackEnd);

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername + "<br>Login session will expire in " + Session.Timeout + " mins.";

            lblletterlegend.Text          = "Recipe A-Z:";
            lblunapproved2.Visible        = false;
            lblmangermainpage.Text        = "Default View";
            lblmangermainpagelink.ToolTip = "Back to Default View";
            lbCountRecipe.Text            = "Total Approved Recipes:&nbsp;" + string.Format("{0:#,###}", FetchData.GetHomepageTotalRecipeCount);
            lbCountCat.Text             = "Total Category:&nbsp;" + FetchData.GetHomepageTotalCategoryCount;
            lbCountComments.Text        = "Total Comments: " + FetchData.AdminRecipeManagerGetTotalComments;
            lblunapproved.Text          = "Waiting For Approval:&nbsp;" + FetchData.AdminRecipeManagerGetWaitingforApprovalCount;
            lblrecordperpage.Text       = "Default 40 records per page";
            lblrecordperpageFooter.Text = "Showing default 40 records per page";
            lblrecordperpageTop.Text    = "- 40 records per page";
            approvallink.ToolTip        = "There are (" + FetchData.AdminRecipeManagerGetWaitingforApprovalCount + ") recipes waiting for your approval. Click this link to approve the recipe";

            //Set the default pagesize.
            dgrd_recipe.PageSize = 40;

            //Data binding
            BindData();

            //Release allocated memory
            FetchData = null;
            Util      = null;
        }
    }
コード例 #7
0
        /// <summary>
        /// Get data
        /// </summary>
        public override void fillup()
        {
            try
            {
                //Instantiate Action Stored Procedure object
                Blogic FetchData = new Blogic();

                //Get email and SMTP configuration
                IDataReader dr = FetchData.GetConfiguration;

                dr.Read();

                if (dr["Email"] != DBNull.Value)
                {
                    this._FromAdminEmail = (string)dr["Email"];
                }
                if (dr["SmtpServer"] != DBNull.Value)
                {
                    this._ToAdminEmail = (string)dr["SmtpServer"]; //This use to be the STMP server, but now changed to ToAdminEmail
                }

                dr.Close();
                dr = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        /// <summary>
        /// Create a hashtable for Article Category dropdownlist
        /// </summary>
        private static void createCategoryListArticle()
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            IDataReader dr = FetchData.GetArticleCategoryList;

            try
            {
                Hashtable ht = new Hashtable();
                while (dr.Read())
                {
                    ht.Add(dr["CAT_ID"].ToString(), dr["CAT_NAME"].ToString());

                    _CategoryListArticle = ht;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            //Release allocated memory
            dr.Close();

            FetchData = null;
        }
コード例 #9
0
ファイル: index.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            hashcode = Request.QueryString["txtweb-mobile"];

            Response.Write("Welcome to \"@txtforum\" where you can ask any type of technical/non-technical questions regarding txtweb.<br /><br />"
                           + "<a href='./login.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.login</a> : For login<br /><br />"
                           + "<a href='./new_que.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ask</a> : For ask new question<br /><br />"
                           + "<a href='./get_que_list.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que</a> : Get recent questions list<br /><br />"
                           + "<a href='./get_quelist_me.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.my.que</a> : Get questions asked by you<br /><br />"
                           + "<a href='./quelist_myans.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.my.ans</a> : Get questions list in which you gave the answers<br /><br />");
        }
        catch
        {
            //display error message
            Blogic ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Instantiate sql params object
            Blogic myBL = new Blogic();

            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            lbCountRecipe.Text = "There are " + string.Format("{0:#,###}", myBL.GetHomepageTotalRecipeCount) + " Approved Recipe";

            lbCountCat.Text = "Total Category: " + myBL.GetHomepageTotalCategoryCount;

            //Hide comment editing form
            Panel1.Visible         = false;
            catmanagerlink.Enabled = false;

            BindData();

            myBL = null;
        }
        else
        {
            //Show comment editing form
            Panel1.Visible         = true;
            catmanagerlink.Enabled = true;
        }
    }
コード例 #11
0
    //Handles finalize insert article
    public void Finalize_ArticleSubmission(Object s, EventArgs e)
    {
        //Instantiate the SQL command object
        Blogic FinalizeAddArticle = new Blogic();

        int ID = (int)Util.Val(Request.QueryString["aid"]);

        Caching.PurgeCacheItems("Newest_Articles");
        Caching.PurgeCacheItems("ArticleCategory_SideMenu");

        //Add the parameters to the SQL command
        int Err = FinalizeAddArticle.FinalizeAddArticle(ID);

        // If error occured, stop further processing and notify user.
        if (Err != 0)
        {
            JSLiteral.Text = Util.JSProcessingErrorAlert;
            return;
        }

        //Release allocated memory
        FinalizeAddArticle = null;

        //If success, redirect to article submission confirmation/thank you page.
        Util.PageRedirect(9);

        //Release allocated memory
        Util = null;
    }
コード例 #12
0
        /// <summary>
        /// Get recipe name, author, date, hits, rating, ingredients, instructions and other field from the DB matching the Recipe ID provided.
        /// </summary>
        /// <param name="ID">Recipe ID</param>
        public override void fillup()
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetHomepageRecipeoftheDay;

                dr.Read();

                if (dr["ID"] != DBNull.Value)
                {
                    this._ID = (int)dr["ID"];
                }
                if (dr["Name"] != DBNull.Value)
                {
                    this._RecipeName = (string)dr["Name"];
                }
                if (dr["CAT_ID"] != DBNull.Value)
                {
                    this._CatID = (int)dr["CAT_ID"];
                }
                if (dr["NO_RATES"] != DBNull.Value)
                {
                    this._NoRates = dr["NO_RATES"].ToString();
                }
                if (dr["HITS"] != DBNull.Value)
                {
                    this._Hits = (int)dr["HITS"];
                }
                if (dr["Rates"] != DBNull.Value)
                {
                    this._Rating = dr["Rates"].ToString();
                }
                if (dr["Category"] != DBNull.Value)
                {
                    this._Category = (string)dr["Category"];
                }
                if (dr["Ingredients"] != DBNull.Value)
                {
                    this._Ingredients = (string)dr["Ingredients"];
                }
                if (dr["Instructions"] != DBNull.Value)
                {
                    this._Instructions = (string)dr["Instructions"];
                }

                //Release allocated memory
                dr.Close();
                dr = null;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            FetchData = null;
        }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate object
        Blogic myBL = new Blogic();

        //Instantiate object
        Utility Util = new Utility();

        int CatId = (int)Util.Val(Request.QueryString["catid"]);

        //Display random recipe
        GetRandomrecipe(CatId);

        //Get the newest 10 recipes. Change the value to 5 if you want to display only 5 newest recipes.
        int TopNewest = 10;

        //Get the 15 popular recipes. Change the value to 5 or 10 if you want to display only 5/10 most popular recipes.
        int TopPopular = 15;

        NewestRecipeSideMenuProvider GetNewestRecipe = new NewestRecipeSideMenuProvider(CatId, TopNewest);
        PopularRecipeSideMenuProvider GetPopularRecipe = new PopularRecipeSideMenuProvider(CatId, TopPopular);

        string CategoryName = GetNewestRecipe.Category;

        if (!string.IsNullOrEmpty(this.Request.QueryString["catid"]))
        {
            lblcatname.Text = CategoryName.ToString() + "&nbsp;";
            lblcatnamepop.Text = CategoryName.ToString() + "&nbsp;";
            lblrancatname.Text = CategoryName.ToString() + "&nbsp;";
            lbTopCnt.Text = TopNewest.ToString();
        }
        else
        {
            lblcatname.Text = "";
            lbTopCnt.Text = TopNewest.ToString();
        }

        RecipeNew.DataSource = GetNewestRecipe.GetNewestRecipe();
        RecipeNew.DataBind();

        TopRecipe.DataSource = GetPopularRecipe.GetPopularRecipe();
        TopRecipe.DataBind();

        if (!string.IsNullOrEmpty(this.Request.QueryString["catid"]))
        {
            lblpopcounter.Text = "Top Recipes";
        }
        else
        {
            lblpopcounter.Text = "Top 15 Recipes";
        }

        //Release allocated memory
        GetNewestRecipe = null;
        GetPopularRecipe = null;
        Util = null;
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate object
        Blogic myBL = new Blogic();

        //Instantiate object
        Utility Util = new Utility();

        int CatId = (int)Util.Val(Request.QueryString["catid"]);

        //Display random recipe
        GetRandomrecipe(CatId);

        //Get the newest 10 recipes. Change the value to 5 if you want to display only 5 newest recipes.
        int TopNewest = 10;

        //Get the 15 popular recipes. Change the value to 5 or 10 if you want to display only 5/10 most popular recipes.
        int TopPopular = 15;

        NewestRecipeSideMenuProvider  GetNewestRecipe  = new NewestRecipeSideMenuProvider(CatId, TopNewest);
        PopularRecipeSideMenuProvider GetPopularRecipe = new PopularRecipeSideMenuProvider(CatId, TopPopular);

        string CategoryName = GetNewestRecipe.Category;

        if (!string.IsNullOrEmpty(this.Request.QueryString["catid"]))
        {
            lblcatname.Text    = CategoryName.ToString() + "&nbsp;";
            lblcatnamepop.Text = CategoryName.ToString() + "&nbsp;";
            lblrancatname.Text = CategoryName.ToString() + "&nbsp;";
            lbTopCnt.Text      = TopNewest.ToString();
        }
        else
        {
            lblcatname.Text = "";
            lbTopCnt.Text   = TopNewest.ToString();
        }

        RecipeNew.DataSource = GetNewestRecipe.GetNewestRecipe();
        RecipeNew.DataBind();

        TopRecipe.DataSource = GetPopularRecipe.GetPopularRecipe();
        TopRecipe.DataBind();

        if (!string.IsNullOrEmpty(this.Request.QueryString["catid"]))
        {
            lblpopcounter.Text = "Top Recipes";
        }
        else
        {
            lblpopcounter.Text = "Top 15 Recipes";
        }

        //Release allocated memory
        GetNewestRecipe  = null;
        GetPopularRecipe = null;
        Util             = null;
    }
コード例 #15
0
        public static void OtodikMenupont()
        {
            foreach (var item in Blogic.GetDriversPoints())
            {
                Console.WriteLine(item.DriverName + " " + item.Points);
            }

            Console.ReadLine();
        }
コード例 #16
0
    //Handle the delete button click event
    public void Delete_Recipes(object sender, DataGridCommandEventArgs e)
    {
        if ((e.CommandName == "Delete"))
        {
            TableCell iIdNumber2   = e.Item.Cells[0];
            TableCell iIRecipename = e.Item.Cells[1];

            #region Delete Recipe Image
            //Delete the recipe image if the recipe has an image.

            //Instantiate sql params object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetRecipeImageFileNameForUpdate(int.Parse(iIdNumber2.Text));

                dr.Read();

                if (dr["RecipeImage"] != DBNull.Value)
                {
                    System.IO.File.Delete(Server.MapPath(GetRecipeImage.ImagePath + dr["RecipeImage"].ToString()));
                }

                dr.Close();
            }
            catch
            {
            }

            FetchData = null;
            #endregion

            //Refresh cached data
            Caching.PurgeCacheItems("MainCourse_RecipeCategory");
            Caching.PurgeCacheItems("Ethnic_RecipeCategory");
            Caching.PurgeCacheItems("RecipeCategory_SideMenu");
            Caching.PurgeCacheItems("Newest_RecipesSideMenu_");

            //Instantiate delete recipe object
            RecipeInfo DelRecipe = new RecipeInfo();

            DelRecipe.ID = int.Parse(iIdNumber2.Text);

            //Perform delete recipe
            DelRecipe.Delete();

            DelRecipe = null;

            //Redirect to confirm delete page
            strURLRedirect = "confirmdel.aspx?catname=" + iIRecipename.Text + "&mode=del";
            Server.Transfer(strURLRedirect);
        }
    }
コード例 #17
0
    //Handle edit databound
    public void Edit_Handle(object sender, DataGridCommandEventArgs e)
    {
        if ((e.CommandName == "edit"))
        {
            TableCell iIdNumber = e.Item.Cells[0];
            TableCell iCatName  = e.Item.Cells[1];

            Panel1.Visible       = true;
            Panel3.Visible       = false;
            AddNewCat.Visible    = false;
            lblnamedis2.Text     = "Category Name:";
            updatebutton.Visible = true;
            DelCategory.Visible  = false;
            GroupID.Visible      = false;
            CategoryID.Visible   = true;
            lblheaderform.Text   = "Updating Recipe Category #:&nbsp;" + iIdNumber.Text;

            e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#F0E68C");

            //This will be the value to be populated into the textboxes
            string CatName = iCatName.Text;
            CategoryName.Text = CatName.Substring(0, CatName.IndexOf("(")).Trim(); //Strip off recipe count
            CategoryID.Value  = iIdNumber.Text;
        }
        else if ((e.CommandName == "delete"))
        {
            TableCell iIdNumber = e.Item.Cells[0];
            TableCell iCatName  = e.Item.Cells[1];

            Panel1.Visible       = true;
            Panel3.Visible       = true;
            AddNewCat.Visible    = false;
            lblnamedis2.Text     = "Category Name:";
            updatebutton.Visible = false;
            CategoryID.Visible   = true;
            DelCategory.Visible  = true;
            GroupID.Visible      = false;
            CategoryID.Value     = iIdNumber.Text;
            lblheaderform.Text   = "Deleting Recipe Category #:&nbsp;" + iIdNumber.Text;

            e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#F0E68C");

            //This will be the value to be populated into the textboxes
            string CatNamedel = iCatName.Text;
            CategoryName.Text = CatNamedel.Substring(0, CatNamedel.IndexOf("(")).Trim(); //Strip off recipe count

            //Instantiate sql params object
            Blogic myBL = new Blogic();

            lblrcdcount2.Text = "The number of recipes belong to&nbsp;" + CategoryName.Text + "&nbsp;category:&nbsp; " + myBL.CategoryCount(int.Parse(iIdNumber.Text));

            myBL = null;
        }
    }
コード例 #18
0
ファイル: Users.cs プロジェクト: makmen/WinForms
 public Users(Dashboard parent_)
 {
     InitializeComponent();
     parent = parent_;
     logic  = new Blogic();
     UpdateListUsers();
     if (parent.Group == 1)
     {
         button1.Show();
         button2.Show();
     }
 }
コード例 #19
0
        public static void HetedikElsMenupont()
        {
            Console.WriteLine("Versenyhétvége száma: ");
            int raceNumber = int.Parse(Console.ReadLine());

            foreach (var item in Blogic.GetResultWithEngineNames(raceNumber))
            {
                Console.WriteLine(item.ToString());
            }

            Console.ReadLine();
        }
コード例 #20
0
        /// <summary>
        /// Return GetData
        /// </summary>
        /// <returns></returns>
        private static IDataReader GetData(int CatId)
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            //Get data
            IDataReader dr = FetchData.GetRelatedRecipe(CatId);

            return(dr);

            FetchData = null;
        }
コード例 #21
0
ファイル: login2.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            string query, hashcode, name;
            hashcode = Request.QueryString["hashcode"];
            name = Request.QueryString["txtweb-message"];

            if (Request.QueryString["type"] == "firstTime")   //for first time user....
            {
                query = string.Format("insert into user_info (hashcode,name) values (@hashcode,@name)");
                Blogic ob = new Blogic();
                SqlCommand cmd = ob.getCMD(query);
                cmd.Parameters.AddWithValue("@hashcode", hashcode);
                cmd.Parameters.AddWithValue("@name", name);
                cmd.ExecuteNonQuery();
                Response.Write("Congratulation, you are successfully logged in...");

            }
            else   // if user is already exist, so update his/her name
            {
                query = string.Format("update user_info set name=@name where hashcode=@hashcode");
                Blogic ob = new Blogic();
                SqlCommand cmd = ob.getCMD(query);
                cmd.Parameters.AddWithValue("@name", name);
                cmd.Parameters.AddWithValue("@hashcode", hashcode);
                cmd.ExecuteNonQuery();
                Response.Write("Your name is successfully updated...");

            }

            //provide links for different pages.....
            Response.Write("<br /><br />Enjoy @txtforum....<br />"
                      + "<a href='./login.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.login</a> : For login<br />"
                      + "<a href='./new_que.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ask</a> : For ask new question<br />"
                      + "<a href='./get_que_list.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que</a> : Get recent questions list<br />"
                      + "<a href='./get_quelist_me.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que.me</a> : Get questions asked by you<br />"
                      + "<a href='./quelist_myans.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ans.me</a> : Get questions list in which you gave the answers<br /><br />");

        }

        catch
        {
            Blogic ob = new Blogic();
            Response.Write(ob.error_msg());  //error message...
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #22
0
        /// <summary>
        /// Return Newest Recipe Side Panel
        /// </summary>
        public static ExtendedCollection <Article> GetArticle(int Top)
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            ExtendedCollection <Article> GetArticles = new ExtendedCollection <Article>();

            string Key = "Newest_Articles";

            if (Caching.Cache[Key] != null)
            {
                GetArticles = (ExtendedCollection <Article>)Caching.Cache[Key];
            }
            else
            {
                IDataReader dr = FetchData.GetNewestArticleSidePanel(Top);

                while (dr.Read())
                {
                    Article item = new Article();

                    item.ID = (int)dr["ID"];

                    if (dr["Title"] != DBNull.Value)
                    {
                        item.Title = (string)dr["Title"];
                    }
                    if (dr["CAT_NAME"] != DBNull.Value)
                    {
                        item.Category = (string)dr["CAT_NAME"];
                    }
                    if (dr["Post_Date"] != DBNull.Value)
                    {
                        item.Date = (DateTime)(dr["Post_Date"]);
                    }
                    if (dr["HITS"] != DBNull.Value)
                    {
                        item.Hits = (int)dr["HITS"];
                    }

                    GetArticles.Add(item);

                    Caching.CahceData(Key, GetArticles);
                }

                dr.Close();
            }

            return(GetArticles);

            FetchData = null;
        }
コード例 #23
0
        public GuitarListViewModel()
        {
            GetAllGuitars();

            _editedGuitar   = new GuitarViewModel(Blogic.NewGuitar());
            _selectedGuitar = new GuitarViewModel(Blogic.NewGuitar());
            _addedGuitar    = new GuitarViewModel(Blogic.NewGuitar());
            _addedGuitar.Validate();
            _view = (ListCollectionView)CollectionViewSource.GetDefaultView(Guitars);
            _addNewGuiatCommand  = new RelayCommand(param => this.AddNewGuitar(), param => this.CanAddNewGuitar());
            _deleteGuitarCommand = new RelayCommand(param => this.DeleteGuitar());
            _editGuitarCommand   = new RelayCommand(param => this.EditGuitar(), param => this.CanEditGuitar());
        }
コード例 #24
0
    //Handles update last viewed hours
    public void AdminUpdateLastViewedHours_Click(object sender, EventArgs e)
    {
        int GetMinutes;

        GetMinutes = int.Parse(ddllastviewedhours.SelectedValue);

        FetchData.AdminUpdateLastViewedHours(GetMinutes);

        FetchData = null;

        strURLRedirect = "recipemanager.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #25
0
    //Handles show hide comment configuration
    public void AdminShowHideComment_Click(object sender, EventArgs e)
    {
        int showhide;

        showhide = int.Parse(ddlshowhide.SelectedValue);

        FetchData.AdminUpdateShowHideComment(showhide);

        FetchData = null;

        strURLRedirect = "recipemanager.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #26
0
ファイル: vote_spam.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            que_id     = int.Parse(Request.QueryString["que_id"]);
            hashcode   = Request.QueryString["hashcode"];
            type       = Request.QueryString["type"];                    // vote/spam
            query_type = Request.QueryString["query_type"];              // insert/update

            switch (query_type)
            {
            //execute query according to the condition....
            case "insert":
                query = string.Format("insert into vote_spam (que_id,hashcode,{0}) values ({1},'{2}','{3}')", type, que_id, hashcode, "True");
                break;

            case "update":
                query = string.Format("update vote_spam set {0}='True' where que_id={1} and hashcode='{2}'", type, que_id, hashcode);
                break;
            }

            ob  = new Blogic();
            cmd = ob.getCMD(query);
            cmd.ExecuteNonQuery();


            //increase vote/spam by 1, in que_list table in db....
            query = string.Format("update que_list set {0}={0}+1 where que_id={1}", type, que_id);
            cmd   = ob.getCMD(query);
            cmd.ExecuteNonQuery();

            if (type == "vote")
            {
                Response.Write("Thank you, your vote is successfully submitted.... :)");
            }
            else
            {
                Response.Write("Thank you, your spam is considered....");
            }
        }
        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #27
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        int i = 0;

        //Note: You need to change the domain name "myasp-net.com and ex-designz.net" to your site domain
        Response.Clear();
        Response.ContentType = "text/xml";
        XmlTextWriter objX = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);

        objX.WriteStartDocument();
        objX.WriteStartElement("rss");
        objX.WriteAttributeString("version", "2.0");
        objX.WriteStartElement("channel");
        objX.WriteElementString("title", "Ex-designz.net Newest Recipe RSS Feed");
        objX.WriteElementString("link", "http://www.myasp-net.com");
        objX.WriteElementString("description", "Recipe database from around the world");
        objX.WriteElementString("copyright", "(c) 2005, Myasp-net.com and Ex-designz.net. All rights reserved.");
        objX.WriteElementString("ttl", "10");

        //Get data
        IDataReader dr = FetchData.GetRSSNewestRecipe;

        //loop through all record, and write XML for each item.
        for (i = 0; i <= 20 - 1; i++)
        {
            dr.Read();
            objX.WriteStartElement("item");
            objX.WriteElementString("title", dr["Name"].ToString());
            objX.WriteElementString("link", "http://www.ex-designz.net/recipedisplay.asp?rid=" + (int)dr["ID"]);
            objX.WriteElementString("pubDate", Convert.ToDateTime(dr["Date"]).ToShortDateString());
            objX.WriteEndElement();
        }

        dr.Close();

        //End of XML file
        objX.WriteEndElement();
        objX.WriteEndElement();
        objX.WriteEndDocument();

        //Close the XmlTextWriter object
        objX.Flush();
        objX.Close();
        Response.End();

        FetchData = null;
    }
コード例 #28
0
ファイル: vote_spam.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            que_id = int.Parse(Request.QueryString["que_id"]);
            hashcode = Request.QueryString["hashcode"];
            type = Request.QueryString["type"];                          // vote/spam
            query_type = Request.QueryString["query_type"];              // insert/update

            switch (query_type)
            {
                //execute query according to the condition....
                case "insert":
                    query = string.Format("insert into vote_spam (que_id,hashcode,{0}) values ({1},'{2}','{3}')", type, que_id, hashcode, "True");
                    break;
                case "update":
                    query = string.Format("update vote_spam set {0}='True' where que_id={1} and hashcode='{2}'", type, que_id, hashcode);
                    break;
            }

            ob = new Blogic();
            cmd = ob.getCMD(query);
            cmd.ExecuteNonQuery();

            //increase vote/spam by 1, in que_list table in db....
            query = string.Format("update que_list set {0}={0}+1 where que_id={1}", type, que_id);
            cmd = ob.getCMD(query);
            cmd.ExecuteNonQuery();

            if (type == "vote")
            {
                Response.Write("Thank you, your vote is successfully submitted.... :)");
            }
            else
            {
                Response.Write("Thank you, your spam is considered....");
            }

        }
        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ArticleUpdateSection = constant.intArticleAdminUpdate;

        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            //Instantiate SQL params object
            Blogic myBL = new Blogic();

            lbCountArticle.Text = "Total Approved Article: " + myBL.ArticleCountAll;

            //Return Update Category List
            AdminUpdateArtCatList.DataSource = myBL.GetArticleCategoryList;
            AdminUpdateArtCatList.DataBind();

            //Return Add New Category List
            ArtCategoryList.DataSource = myBL.GetArticleCategoryList;
            ArtCategoryList.DataBind();

            ShowEditArticleListing();

            //Hide comment editing form
            Panel2.Visible = false;

            if (Request.QueryString["editcatid"] != null)
            {
                CategoryName.Text  = Request.QueryString["catname"];
                CategoryID.Value   = Request.QueryString["editcatid"];
                Panel2.Visible     = true;
                Panel3.Visible     = false;
                AddNewCat.Visible  = false;
                lblheaderform.Text = "Updating Article Category ID# " + Request.QueryString["editcatid"];
            }

            //Release allocated memory
            myBL = null;
        }
        else
        {
            //Show comment editing form
            Panel2.Visible = true;
        }
    }
コード例 #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        int i = 0;

        //Note: You need to change the domain name "myasp-net.com and ex-designz.net" to your site domain
        Response.Clear();
        Response.ContentType = "text/xml";
        XmlTextWriter objX = new XmlTextWriter(Response.OutputStream, Encoding.UTF8);
        objX.WriteStartDocument();
        objX.WriteStartElement("rss");
        objX.WriteAttributeString("version", "2.0");
        objX.WriteStartElement("channel");
        objX.WriteElementString("title", "Ex-designz.net Most Popular Recipe RSS Feed");
        objX.WriteElementString("link", "http://www.myasp-net.com");
        objX.WriteElementString("description", "Recipe database from around the world");
        objX.WriteElementString("copyright", "(c) 2005, Myasp-net.com and Ex-designz.net. All rights reserved.");
        objX.WriteElementString("ttl", "10");

        //Get datatable
        IDataReader dr = FetchData.GetRSSMostPopularRecipe;

        //loop through all record, and write XML for each item.
        for (i = 0; i <= 20 - 1; i++)
        {
            dr.Read();
            objX.WriteStartElement("item");
            objX.WriteElementString("title", dr["Name"].ToString());
            objX.WriteElementString("link", "http://www.ex-designz.net/recipedisplay.asp?rid=" + (int)dr["ID"]);
            objX.WriteElementString("pubDate", Convert.ToDateTime(dr["Date"]).ToShortDateString());
            objX.WriteEndElement();
        }

        dr.Close();

        //End of XML file
        objX.WriteEndElement();
        objX.WriteEndElement();
        objX.WriteEndDocument();

        //Close the XmlTextWriter object
        objX.Flush();
        objX.Close();
        Response.End();

        FetchData = null;
    }
コード例 #31
0
ファイル: login2.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            string query, hashcode, name;
            hashcode = Request.QueryString["hashcode"];
            name     = Request.QueryString["txtweb-message"];

            if (Request.QueryString["type"] == "firstTime")   //for first time user....
            {
                query = string.Format("insert into user_info (hashcode,name) values (@hashcode,@name)");
                Blogic     ob  = new Blogic();
                SqlCommand cmd = ob.getCMD(query);
                cmd.Parameters.AddWithValue("@hashcode", hashcode);
                cmd.Parameters.AddWithValue("@name", name);
                cmd.ExecuteNonQuery();
                Response.Write("Congratulation, you are successfully logged in...");
            }
            else   // if user is already exist, so update his/her name
            {
                query = string.Format("update user_info set name=@name where hashcode=@hashcode");
                Blogic     ob  = new Blogic();
                SqlCommand cmd = ob.getCMD(query);
                cmd.Parameters.AddWithValue("@name", name);
                cmd.Parameters.AddWithValue("@hashcode", hashcode);
                cmd.ExecuteNonQuery();
                Response.Write("Your name is successfully updated...");
            }

            //provide links for different pages.....
            Response.Write("<br /><br />Enjoy @txtforum....<br />"
                           + "<a href='./login.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.login</a> : For login<br />"
                           + "<a href='./new_que.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ask</a> : For ask new question<br />"
                           + "<a href='./get_que_list.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que</a> : Get recent questions list<br />"
                           + "<a href='./get_quelist_me.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.que.me</a> : Get questions asked by you<br />"
                           + "<a href='./quelist_myans.aspx?txtweb-mobile=" + hashcode + "'>@txtforum.ans.me</a> : Get questions list in which you gave the answers<br /><br />");
        }

        catch
        {
            Blogic ob = new Blogic();
            Response.Write(ob.error_msg());  //error message...
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #32
0
    //Handles update admin email and SMTP server address
    public void AdminUpdateEmailAndSMTPAddress_Click(object sender, EventArgs e)
    {
        string AdminEmail;
        string SMTPServer;

        AdminEmail = Request.Form["emailadd"];
        SMTPServer = Request.Form["smtpadd"];

        FetchData.AdminUpdateEmailAndSMTPAddress(AdminEmail, SMTPServer);

        FetchData = null;

        strURLRedirect = "confirmemailupdate.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #33
0
        /// <summary>
        /// Returns Most Popular Recipes Side Menu
        /// </summary>
        public ExtendedCollection <Recipe> GetPopularRecipe()
        {
            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            ExtendedCollection <Recipe> GetRecipe = new ExtendedCollection <Recipe>();

            string Key = "MostPopular_RecipesSideMenu_" + CatID.ToString();

            if (Caching.Cache[Key] != null)
            {
                GetRecipe = (ExtendedCollection <Recipe>)Caching.Cache[Key];
            }
            else
            {
                IDataReader dr = FetchData.GetMostpopularRecipesSideMenu(CatID, Top);

                while (dr.Read())
                {
                    Recipe item = new Recipe();

                    item.ID = (int)dr["ID"];

                    if (dr["Name"] != DBNull.Value)
                    {
                        item.RecipeName = (string)dr["Name"];
                    }
                    if (dr["Category"] != DBNull.Value)
                    {
                        item.Category = (string)dr["Category"];
                    }
                    if (dr["HITS"] != DBNull.Value)
                    {
                        item.Hits = (int)dr["HITS"];
                    }

                    GetRecipe.Add(item);

                    Caching.CahceData(Key, GetRecipe);
                }

                dr.Close();
            }

            return(GetRecipe);

            FetchData = null;
        }
コード例 #34
0
    //Data binding
    private void BindData()
    {
        //Return datatable.
        DataTable dt = myBL.AdminGetRecipeComments;

        //Assign dt to new DataView object
        DataView dv = new DataView(dt);

        lbCountComments.Text = "Total Comments: " + dv.Count.ToString();

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

        //Release allocated memory
        myBL = null;
    }
コード例 #35
0
ファイル: login.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            string hashcode = Request.QueryString["txtweb-mobile"];
            query = string.Format("select name from user_info where hashcode=@hashcode");
            Blogic ob = new Blogic();
            SqlCommand cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@hashcode", hashcode);
            SqlDataReader dr = cmd.ExecuteReader();

            if (!dr.Read())  //first time user
            {
                Response.Write("Create your account.....<br /><br />"
                               +"<form action='./login2.aspx' class='txtweb-form' method='get'>"
                               + "<input type='hidden' name='type' value='firstTime' />"
                               + "<input type='hidden' name='hashcode' value='" + hashcode + "' />"
                               + "Your name<input type='text' name='txtweb-message' />"
                               + "<input type='submit' value='submit' /></form><br /><br />"
                               +"Note: Your mobile hashcode is considered as password, so you don't need any password.");

            }

            else            //if user is already register, so update his/her name....
            {
                Response.Write("Welcome " + dr.GetValue(0).ToString() + ",<br /><br />"
                               + "For change your name<br /><br />"
                               + " <form action='./login2.aspx' class='txtweb-form' method='get'>"
                               + "<input type='hidden' name='hashcode' value='" + hashcode + "' />"
                               + "Your name<input type='text' name='txtweb-message' />"
                               + "<input type='submit' value='submit' /></form> ");

            }
        }

        catch
        {

            Blogic ob = new Blogic();
            Response.Write(ob.error_msg());     //print error_message...
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #36
0
        /// <summary>
        /// Show or hide recipe comment
        /// </summary>
        public override void fillup()
        {
            //Find control
            Panel     Panel1      = (Panel)(placeholder.FindControl("Panel1"));
            Image     CommentImg  = (Image)(placeholder.FindControl("CommentImg"));
            HyperLink CommentLink = (HyperLink)(placeholder.FindControl("CommentLink"));

            //Instantiate Action Stored Procedure object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetConfiguration;

                dr.Read();

                //Show hide comment
                if (dr["HideShowComment"] != DBNull.Value)
                {
                    this._ShowHideComment = (int)dr["HideShowComment"];
                }

                dr.Close();
                dr = null;

                if (IsShowHideComment)
                {
                    //If true, display recipe comments, else hide.
                    //Get datasourse
                    RepeaterName.DataSource = RecipeCommentProvider.GetComments(ID);
                    RepeaterName.DataBind();
                    Panel1.Visible = true;
                }
                else
                {
                    Panel1.Visible      = false;
                    CommentImg.Visible  = false;
                    CommentLink.Visible = false;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            FetchData = null;
        }
コード例 #37
0
    protected void Page_Load(Object sender, EventArgs e)
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        GetMetaKeywords();

        lbltotalRecipe.Text = "There are " + string.Format("{0:#,###}",
        FetchData.GetHomepageTotalRecipeCount) + " recipes in " + FetchData.GetHomepageTotalCategoryCount + " categories";

        BindList();

        //Display random image
        Myranimage.ImageUrl = Utility.GetRandomImage;

        FetchData = null;
    }
コード例 #38
0
    protected void Page_Load(Object sender, EventArgs e)
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        GetMetaKeywords();

        lbltotalRecipe.Text = "There are " + string.Format("{0:#,###}",
                                                           FetchData.GetHomepageTotalRecipeCount) + " recipes in " + FetchData.GetHomepageTotalCategoryCount + " categories";

        BindList();

        //Display random image
        Myranimage.ImageUrl = Utility.GetRandomImage;

        FetchData = null;
    }
コード例 #39
0
ファイル: new_que.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            string hashcode = Request.QueryString["txtweb-mobile"];

            //query for check user is exist or not..
            query = string.Format("select name from user_info where hashcode=@hashcode");

            ob = new Blogic();
            SqlCommand cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@hashcode", hashcode);
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())    //if user is exist in database then proceed him/her to ask a question
            {
                Response.Write("Ask a new question....<br /><br />"
                          + "Type, #t \"your que title\" #d \"your que description\"<br />"     //<your que title> print ni ho rha h
                          + "Use, #e For line break or enter<br />"
                          + "Note: #t and #d both are very important, you can't submit question without it.<br /><br />");

                Response.Write("For asking a new question....<br /><br />"
                                  + "<form action='./new_que2.aspx' method='get' class='txtweb-form'>"
                                  + "<input type='hidden' name='hashcode' value='" + hashcode + "' />"
                                  + "Title and Description<input type='text' name='txtweb-message' />"
                                  + "<input type='submit' value='Submit' />");

            }
            else    //if user is not exist in database, then redirect him/her to login.aspx
            {
                Response.Redirect("./login.aspx?txtweb-mobile=" + hashcode);

            }
        }
        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #40
0
    //Handles approve recipe
    public void Approve_Recipe(object sender, EventArgs e)
    {
        ID = (int)Util.Val(Request.QueryString["id"]);

        Caching.PurgeCacheItems("MainCourse_RecipeCategory");
        Caching.PurgeCacheItems("Ethnic_RecipeCategory");
        Caching.PurgeCacheItems("RecipeCategory_SideMenu");
        Caching.PurgeCacheItems("Newest_RecipesSideMenu_");

        // myBL.AdminApproveRecipe(ID);

        //Release allocated memory.
        myBL = null;

        //If success, redirect to recipe approval confirmation page.
        Util.PageRedirect(8);

        Util = null;
    }
コード例 #41
0
    //Handles final login process with validation
    private void ProcessLoginCheck(string Username, string UserPwd)
    {
        //Instantiate validation
        Utility Util = new Utility();

        //Instantiate stored procedure logic
        Blogic myBL = new Blogic();

        //Check whether admin username and password exist in the admin user database.
        if (!myBL.AdminUserNameExist(Username))
        {
            lblerror.Text = "Username does not exist";
            JSLiteral.Text = Util.JSAlert("Username does not exist");
            return;
        }
        else if (!myBL.AdminPasswordExist(UserPwd))
        {
            lblerror.Text = "Invalid Password";
            JSLiteral.Text = Util.JSAlert("Invalid Password");
            return;
        }
        else
        {
            //Assign variable for username and password to use for the session.
            string Getadminusername;
            string Getadminpassword;
            Getadminusername = myBL.GetAdminUserNameSession(Username);
            Getadminpassword = myBL.GetAdminPasswordSession(UserPwd);

            myBL = null;

            //Store admin username and password construct in session state
            Session.Add("adminuserid", Getadminusername);
            Session.Add("adminpassword", Getadminpassword);

            //If everything is okay, then redirect to the Admin Recipe Manager page.
            //5 = recipemanager
            Util.PageRedirect(5);
        }
    }
コード例 #42
0
ファイル: que_desc2.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            //get answer from que_desc.aspx...
            ans = Request.QueryString["txtweb-message"];
            ans = ans.Replace("#E", "#e");
            ans = ans.Replace("#e", "<br />");

            que_id = int.Parse(Request.QueryString["que_id"]);
            hashcode = Request.QueryString["hashcode"];

            //get date & time, according to India..
            TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tzi);

            //query for insert answer in our database..
            query = string.Format("insert into ans_list (que_id,ans_desc,sub_by,date) values ({0},@answer,'{1}','{2}')", que_id, hashcode, dt);

            ob = new Blogic();
            SqlCommand cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@answer", ans);
            cmd.ExecuteNonQuery();
            Response.Redirect("que_desc.aspx?que_id=" + que_id + "&hashcode=" + hashcode);
            ob.CloseConnection();
        }
        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #43
0
ファイル: new_que2.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
            hashcode = Request.QueryString["hashcode"];

            full_msg = Request.QueryString["txtweb-message"];
            full_msg = full_msg.Replace("#T", "#t");
            full_msg = full_msg.Replace("#D", "#d");
            full_msg = full_msg.Replace("#E", "#e");

            //separate the question title from full_msg....
            title = full_msg.Substring(full_msg.IndexOf("#t") + 2, full_msg.IndexOf("#d") - (full_msg.IndexOf("#t") + 2));   //get title of the que.
            title = title.Replace("#e", " ");

            //separate the question description from full_msg....
            desc = full_msg.Substring(full_msg.IndexOf("#d") + 2);  // get description of the que.
            desc = desc.Replace("#e", "<br />");

            //insert current date & time according to India...
            TimeZoneInfo tji = TimeZoneInfo.FindSystemTimeZoneById("India Standard Time");
            DateTime dt = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, tji);

            //insert question in db.....
            query = string.Format("insert into que_list (title,que_desc,sub_by,sub_date) values (@title,@desc,@hashcode,'{0}')", dt);

            ob = new Blogic();
            cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@title", title);
            cmd.Parameters.AddWithValue("@desc", desc);
            cmd.Parameters.AddWithValue("@hashcode", hashcode);

            cmd.ExecuteNonQuery();
            ob.CloseConnection();

            //print the question description
            query = string.Format("select top 1 que_id from que_list where sub_by='{0}' order by sub_date desc", hashcode);   //query for select latest question
            ob = new Blogic();                                                                                                //asked by user....
            cmd = ob.getCMD(query);
            dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                Response.Redirect("./que_desc.aspx?que_id=" + dr.GetValue(0).ToString() + "&hashcode=" + hashcode);
            }

            ob.CloseConnection();

        }

        catch
        {
            //error message, if user doesn't ask question in a proper format...
            Response.Write("Please type in a proper format....<br /><br />"
                          + "Type, #t \"your que title\" #d \"your que description\"<br />"
                          + "Use, #e For line break or enter<br />"
                          + "Note: #t and #d both are very important, you can't submit question without it.<br /><br />");

            Response.Write("For asking a new question....<br /><br />"
                              + "<form action='./new_que2.aspx' method='get' class='txtweb-form'>"
                              + "<input type='hidden' name='hashcode' value='" + hashcode + "' />"
                              + "Title and Description<input type='text' name='txtweb-message' />"
                              + "<input type='submit' value='Submit' />");
        }

        Response.Write("</body></html>");
    }
コード例 #44
0
    //Handles show hide comment configuration
    public void AdminShowHideComment_Click(object sender, EventArgs e)
    {
        int showhide;
        showhide = int.Parse(ddlshowhide.SelectedValue);

        FetchData.AdminUpdateShowHideComment(showhide);

        FetchData = null;

        strURLRedirect = "recipemanager.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #45
0
    //Handles update admin email and SMTP server address
    public void AdminUpdateEmailAndSMTPAddress_Click(object sender, EventArgs e)
    {
        string AdminEmail;
        string SMTPServer;
        AdminEmail = Request.Form["emailadd"];
        SMTPServer = Request.Form["smtpadd"];

        FetchData.AdminUpdateEmailAndSMTPAddress(AdminEmail, SMTPServer);

        FetchData = null;

        strURLRedirect = "confirmemailupdate.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #46
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            GetArticleCategoryName();

            IDataReader dr = myBL.GetLastArticleID;

            dr.Read();

            Label1.Text = dr["Col"].ToString();

            dr.Close();

            //Release allocated memory
            myBL = null;
            Util = null;
        }
    }
コード例 #47
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {

            if (Request.QueryString["next_index"] == null)
            {
                hashcode = Request.QueryString["txtweb-mobile"];
            }
            else
            {
                hashcode = Request.QueryString["hashcode"];
            }

            //check either user is already exist or not, if he/she is not exist so redirect to him/her to login.aspx....
            query = string.Format("select name from user_info where hashcode=@hashcode");

            ob = new Blogic();
            cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@hashcode", hashcode);
            dr = cmd.ExecuteReader();

            if (dr.Read())   //if user is exist, display the que_list to him/her
            {
                if (Request.QueryString["next_index"] == null)
                {
                    hashcode = Request.QueryString["txtweb-mobile"];
                    index = 1;
                }
                else
                {
                    hashcode = Request.QueryString["hashcode"];
                    index = int.Parse(Request.QueryString["next_index"]);
                }

                //query for display recent questions in which user gave the answers.....
                query = string.Format("select * from (select row_number() over(order by ans_list.date desc) as row_num,ans_list.que_id,que_list.title,que_list.vote,que_list.spam from ans_list join que_list on ans_list.que_id=que_list.que_id where ans_list.sub_by='{0}') as list where row_num>={1} and row_num<={2}", hashcode, index, index + 4);

                ob = new Blogic();
                cmd = ob.getCMD(query);
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    Response.Write("<a href='./que_desc.aspx?que_id=" + dr.GetValue(1).ToString() + "&hashcode=" + hashcode + "' >"
                                  + dr.GetValue(2).ToString() + "</a><br />"                               //que_title
                                  + dr.GetValue(3).ToString() + " votes, "                                 //number of votes
                                  + dr.GetValue(4).ToString() + " spam<br /><br />");                      //number of spam

                }

                next_index = index + 5;

                Response.Write("<a href='./quelist_myans.aspx?next_index=" + next_index + "&hashcode=" + hashcode + "' class='txtweb-menu-for' accesskey='M''>More</a>");
            }
            else
            {
                Response.Redirect("./login.aspx?txtweb-mobile=" + hashcode);
            }
        }
        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());    //error msg...
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #48
0
    protected void Page_Load(object Sender, EventArgs E)
    {
        //Validate admin session username and password by comparing them to the admin user database record.
        UserNameVal.ValidateAdminUserNameandPass();

        //Get total article count
        ArticleCount = FetchData.ArticleCountAll;

        //Assign selected value to lastviewed dropdown menu
        int lv = (int)Util.Val(Request.QueryString["lv"]);
        GetLastViewedSelectedValue(lv);

        if (!IsPostBack)
        {
            //Populate year in the dropdwonlist - starting from 2000 to the current year.
            int tempDT = DateTime.Now.Year;
            for (int i = tempDT; (tempDT - i) < 9; i--)
                ddlyear.Items.Add(new ListItem(i.ToString(), i.ToString()));

            MonthSearch();
            GetLastViewedDDLSelectedIndex();
            GetShowHideCommentDDLSelectedIndex();
            GetEmailandSMTPInfo();

            //Populate dropdown category list
            GetDropdownCategoryList();

            //Display A-Z alhpabet letter recipe name
            lblalphaletter.Text = Utility.DisplayAZAlphabetLink(constant.AdminBackEnd);

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername + "<br>Login session will expire in " + Session.Timeout + " mins.";

            lblletterlegend.Text = "Recipe A-Z:";
            lblunapproved2.Visible = false;
            lblmangermainpage.Text = "Default View";
            lblmangermainpagelink.ToolTip = "Back to Default View";
            lbCountRecipe.Text = "Total Approved Recipes:&nbsp;" + string.Format("{0:#,###}", FetchData.GetHomepageTotalRecipeCount);
            lbCountCat.Text = "Total Category:&nbsp;" + FetchData.GetHomepageTotalCategoryCount;
            lbCountComments.Text = "Total Comments: " + FetchData.AdminRecipeManagerGetTotalComments;
            lblunapproved.Text = "Waiting For Approval:&nbsp;" + FetchData.AdminRecipeManagerGetWaitingforApprovalCount;
            lblrecordperpage.Text = "Default 40 records per page";
            lblrecordperpageFooter.Text = "Showing default 40 records per page";
            lblrecordperpageTop.Text = "- 40 records per page";
            approvallink.ToolTip = "There are (" + FetchData.AdminRecipeManagerGetWaitingforApprovalCount + ") recipes waiting for your approval. Click this link to approve the recipe";

            //Set the default pagesize.
            dgrd_recipe.PageSize = 40;

            //Data binding
            BindData();

            //Release allocated memory
            FetchData = null;
            Util = null;
        }
    }
コード例 #49
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ArticleUpdateSection = constant.intArticleAdminUpdate;

        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            //Instantiate SQL params object
            Blogic myBL = new Blogic();

            lbCountArticle.Text = "Total Approved Article: " + myBL.ArticleCountAll;

            //Return Update Category List
            AdminUpdateArtCatList.DataSource = myBL.GetArticleCategoryList;
            AdminUpdateArtCatList.DataBind();

            //Return Add New Category List
            ArtCategoryList.DataSource = myBL.GetArticleCategoryList;
            ArtCategoryList.DataBind();

            ShowEditArticleListing();

            //Hide comment editing form
            Panel2.Visible = false;

            if (Request.QueryString["editcatid"] != null)
            {
                CategoryName.Text = Request.QueryString["catname"];
                CategoryID.Value = Request.QueryString["editcatid"];
                Panel2.Visible = true;
                Panel3.Visible = false;
                AddNewCat.Visible = false;
                lblheaderform.Text = "Updating Article Category ID# " + Request.QueryString["editcatid"];
            }

            //Release allocated memory
            myBL = null;
        }
        else
        {
            //Show comment editing form
            Panel2.Visible = true;
        }
    }
コード例 #50
0
    //Data bind
    private void BindList()
    {
        //Instantiate Action Stored Procedure object
        Blogic FetchData = new Blogic();

        Recipe.CatID = (int)Util.Val(Request.QueryString["catid"]);

        IDataReader dr = FetchData.GetCatName(Recipe.CatID);

        try
        {
            dr.Read();

            Recipe.Category = dr["CAT_TYPE"].ToString();
            lbcatname.Text = Recipe.Category.ToString();
            lbcatname2.Text = Recipe.Category.ToString();

            //Assing value to hidden HTML text field.
            Category.Value = Recipe.Category.ToString();
            CAT_ID.Value = Recipe.CatID.ToString();

            dr.Close();
        }
        catch
        {
            //If no record, redirect to page not found.
            Util.PageRedirect(1);
        }

        //Release allocated memory
        FetchData = null;
    }
コード例 #51
0
ファイル: que_desc.aspx.cs プロジェクト: sagar022/txtforum
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {
        hashcode = Request.QueryString["hashcode"];
        que_id = int.Parse(Request.QueryString["que_id"]);

        /****  PART-1  ****/

        //query for que_description....
        query = string.Format("select que_list.title,que_list.que_desc,user_info.name from que_list join user_info on que_list.sub_by=user_info.hashcode where que_list.que_id={0}", que_id);

        ob = new Blogic();
        cmd = ob.getCMD(query);
        dr = cmd.ExecuteReader();

        if (dr.Read())
        {
            //print que_description...
            Response.Write("Title: " + dr.GetValue(0).ToString()
                          + "<br /><br />Description: " + dr.GetValue(1).ToString()
                          + "<br />By: " + dr.GetValue(2).ToString()+"<br /><br />");

        }

        /***********************/

        /****  PART-2  ****/

        //query for check vote/spam......
        query_for_vs = string.Format("select vote,spam from vote_spam where que_id={0} and hashcode='{1}'", que_id, hashcode);
        Blogic ob_vs = new Blogic();
        SqlCommand command = ob_vs.getCMD(query_for_vs);
        SqlDataReader reader = command.ExecuteReader();

        //print link for vote/spam.....
        if (reader.Read())
        {
            if (reader.GetValue(0).ToString() == "False")
            {
                Response.Write("<a href='./vote_spam.aspx?que_id=" + que_id + "&hashcode=" + hashcode + "&query_type=update&type=vote' >Vote up this question<br /></a>");
            }

            if (reader.GetValue(1).ToString() == "False")
            {
                Response.Write("<a href='./vote_spam.aspx?que_id=" + que_id + "&hashcode=" + hashcode + "&query_type=update&type=spam'>Spam this question</a>");

            }
        }
        else
        {
            Response.Write("<a href='./vote_spam.aspx?que_id="+que_id+"&hashcode="+hashcode+"&query_type=insert&type=vote'>Vote up this question<br /></a>");
            Response.Write("<a href='./vote_spam.aspx?que_id=" + que_id + "&hashcode=" + hashcode + "&query_type=insert&type=spam'>Spam this question</a>");
        }

        Response.Write("<br />*****");

        ob_vs.CloseConnection();
        ob.CloseConnection();

        /***********************/

        /****  PART-3  ****/

        //query for print answers.......
        query = string.Format("select ans_list.ans_desc,user_info.name from ans_list join user_info on ans_list.sub_by=user_info.hashcode where que_id={0} order by ans_list.date", que_id);
        cmd = ob.getCMD(query);
        dr = cmd.ExecuteReader();

        Response.Write("<br /><br />Answers....<br /><br />");

        while (dr.Read())
        {
            //print answers
            Response.Write(dr.GetValue(0).ToString()
                          +"<br />By: "+dr.GetValue(1).ToString()+"<br /><br />");
        }
        ob.CloseConnection();

        /***********************/

        /****  PART-4  ****/

        //Take input for answer....
        Response.Write("<br /><br />Give your answer....<br />(Use #e for line break or enter)<br />"
                       + "<form action='./que_desc2.aspx' class='txtweb-form' method='get'>"
                       + "Your answer<input type='text' name='txtweb-message' />"
                       + "<input type='hidden' name='hashcode' value='" + hashcode + "' />"
                       + "<input type='hidden' name='que_id' value='" + que_id + "' />"
                       + "<input type='submit' value='submit' /></form>");
        }

        /***********************/

        catch
        {
            ob = new Blogic();
            Response.Write(ob.error_msg());  //error msg....
            ob.CloseConnection();
        }

        Response.Write("</body></html>");
    }
コード例 #52
0
    //which define in Blogin.cs file
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write("<html><head><meta name=\"txtweb-appkey\" content=\"9cf923ac-53bd-4388-85fa-f75bd432ba68\" /></head><body>");

        try
        {

            if (Request.QueryString["next_index"] == null)
            {
                hashcode = Request.QueryString["txtweb-mobile"];
            }
            else   //execute when user click on "More" link..
            {
                hashcode = Request.QueryString["hashcode"];
            }

            //check either user is already exist or not, if he/she is not exist so redirect to him/her to login.aspx....
            query = string.Format("select name from user_info where hashcode=@hashcode");

            //initialize an object "ob" of Blogic class, which
            //we declare in Blogic.cs file
            ob = new Blogic();
            cmd = ob.getCMD(query);
            cmd.Parameters.AddWithValue("@hashcode", hashcode);
            dr = cmd.ExecuteReader();

            if (dr.Read())  //if user is exist, display the que_list to him/her
            {

                if (Request.QueryString["next_index"] == null)
                {
                    hashcode = Request.QueryString["txtweb-mobile"];
                    index = 1;
                }
                else
                {
                    hashcode = Request.QueryString["hashcode"];
                    index = int.Parse(Request.QueryString["next_index"]);
                }

                //query for select recent que_list.....
                query = string.Format("select * from (select row_number() over(order by sub_date desc) as row_num,que_id,title,vote,spam from que_list) as list where row_num>={0} and row_num<={1}", index, index + 4);

                ob = new Blogic();
                cmd = ob.getCMD(query);
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    Response.Write("<a href='./que_desc.aspx?que_id=" + dr.GetValue(1).ToString() + "&hashcode=" + hashcode + "' >"
                                  + dr.GetValue(2).ToString() + "</a><br />"                  //que. title
                                  + dr.GetValue(3).ToString() + " votes, "                    //number of votes
                                  + dr.GetValue(4).ToString() + " spam<br /><br />");         //number of spam

                }

                next_index = index + 5;
                Response.Write("<a href='./get_que_list.aspx?next_index=" + next_index + "&hashcode=" + hashcode + "' class='txtweb-menu-for' accesskey='M' '>More</a>");

            }
            else
            {
                Response.Redirect("./login.aspx?txtweb-mobile=" + hashcode);
            }

        }

        catch
        {
            //display error message...
            Response.Write(ob.error_msg());
        }

        //close the connection
        ob.CloseConnection();

        Response.Write("</body></html>");
    }
コード例 #53
0
    private void Page_Init(Object sender, EventArgs e)
    {
        //Instantiate sql params object
        Blogic myBL = new Blogic();

        int ID = (int)Util.Val(Request.QueryString["id"]);
        string FileName = "";

        try
        {
            IDataReader dr = myBL.GetRecipeImageFileNameForUpdate(ID);

            dr.Read();

            if (dr["RecipeImage"] != DBNull.Value)
            {
                FileName = (string)dr["RecipeImage"];
            }

            dr.Close();
        }
        catch
        {
            //Redirect to image not found.
            //1 = pagenotfound.aspx
            Util.PageRedirect(1);
        }

        string Directory = Server.MapPath("~/RecipeImageUpload/");
        string path = Directory + FileName;

        int roundedDia = 30;

        using (System.Drawing.Image imgin = System.Drawing.Image.FromFile(path))
        {

            System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(imgin.Width, imgin.Height);
            Graphics g = Graphics.FromImage(bitmap);
            g.Clear(Color.White);
            Brush brush = new System.Drawing.TextureBrush(imgin);

            FillRoundedRectangle(g, new Rectangle(0, 0, imgin.Width, imgin.Height), roundedDia, brush);

            // done with drawing dispose graphics object.

            g.Dispose();

            // Stream Image to client.
            Response.Clear();

            Response.ContentType = "image/pjpeg";

            bitmap.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);

            Response.End();

            //dispose bitmap object.

            bitmap.Dispose();

            //Release allocated memory
            myBL = null;
            Util = null;

        }
    }
コード例 #54
0
    //Data binding
    private void BindData()
    {
        //Return datatable.
        DataTable dt = myBL.AdminGetRecipeComments;

        //Assign dt to new DataView object
        DataView dv = new DataView(dt);

        lbCountComments.Text = "Total Comments: " + dv.Count.ToString();

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

        //Release allocated memory
         myBL = null;
    }
コード例 #55
0
    //Handles show edit article listing
    private void ShowEditArticleListing()
    {
        //Instantiate sql params object
        Blogic myBL = new Blogic();

        //Instantiate validation
        Utility Util = new Utility();

        int CatId;
        CatId = (int)Util.Val(Request.QueryString["catid"]);

        if (string.IsNullOrEmpty(this.Request.QueryString["catid"]))
        {
            Panel1.Visible = false;
        }
        else
        {
            Panel1.Visible = true;

            try
            {
                IDataReader dr = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name.

                dr.Read();
                lbcatname.Text = dr["CAT_NAME"].ToString();
                dr.Close();

                ArticleCat.DataSource = myBL.GetArticleCategory(CatId, 3); //3 = Category OrderBy Name.
                ArticleCat.DataBind();
            }
            catch
            {
                Error.Text = "No Record Found.";
                return;
            }

            //Release allocated memory
            myBL = null;
            Util = null;
        }
    }
コード例 #56
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            //Get admin username from the sessioan variable and place it in the label.
            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            lbCountRecipe.Text = "There are " + string.Format("{0:#,###}", myBL.GetHomepageTotalRecipeCount) + " Approved Recipe";

            //Hide comment editing form
            Panel1.Visible = false;
            countcommentlink.Enabled = false;

            BindData();
        }
        else
        {
            //Show comment editing form
            Panel1.Visible = true;
            countcommentlink.Enabled = true;
        }

        myBL = null;
    }
コード例 #57
0
    //Handles update last viewed hours
    public void AdminUpdateLastViewedHours_Click(object sender, EventArgs e)
    {
        int GetMinutes;
        GetMinutes = int.Parse(ddllastviewedhours.SelectedValue);

        FetchData.AdminUpdateLastViewedHours(GetMinutes);

        FetchData = null;

        strURLRedirect = "recipemanager.aspx";
        Response.Redirect(strURLRedirect);
    }
コード例 #58
0
    //Handle edit databound
    public void Edit_Handle(object sender, DataGridCommandEventArgs e)
    {
        if ((e.CommandName == "edit"))
        {
            TableCell iIdNumber = e.Item.Cells[0];
            TableCell iCatName = e.Item.Cells[1];

            Panel1.Visible = true;
            Panel3.Visible = false;
            AddNewCat.Visible = false;
            lblnamedis2.Text = "Category Name:";
            updatebutton.Visible = true;
            DelCategory.Visible = false;
            GroupID.Visible = false;
            CategoryID.Visible = true;
            lblheaderform.Text = "Updating Recipe Category #:&nbsp;" + iIdNumber.Text;

            e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#F0E68C");

            //This will be the value to be populated into the textboxes
            string CatName = iCatName.Text;
            CategoryName.Text = CatName.Substring(0, CatName.IndexOf("(")).Trim(); //Strip off recipe count
            CategoryID.Value = iIdNumber.Text;
        }
        else if ((e.CommandName == "delete"))
        {
            TableCell iIdNumber = e.Item.Cells[0];
            TableCell iCatName = e.Item.Cells[1];

            Panel1.Visible = true;
            Panel3.Visible = true;
            AddNewCat.Visible = false;
            lblnamedis2.Text = "Category Name:";
            updatebutton.Visible = false;
            CategoryID.Visible = true;
            DelCategory.Visible = true;
            GroupID.Visible = false;
            CategoryID.Value = iIdNumber.Text;
            lblheaderform.Text = "Deleting Recipe Category #:&nbsp;" + iIdNumber.Text;

            e.Item.BackColor = System.Drawing.ColorTranslator.FromHtml("#F0E68C");

            //This will be the value to be populated into the textboxes
            string CatNamedel = iCatName.Text;
            CategoryName.Text = CatNamedel.Substring(0, CatNamedel.IndexOf("(")).Trim(); //Strip off recipe count

            //Instantiate sql params object
            Blogic myBL = new Blogic();

            lblrcdcount2.Text = "The number of recipes belong to&nbsp;" + CategoryName.Text + "&nbsp;category:&nbsp; " + myBL.CategoryCount(int.Parse(iIdNumber.Text));

            myBL = null;
        }
    }
コード例 #59
0
    //Handle the delete button click event
    public void Delete_Recipes(object sender, DataGridCommandEventArgs e)
    {
        if ((e.CommandName == "Delete"))
        {
            TableCell iIdNumber2 = e.Item.Cells[0];
            TableCell iIRecipename = e.Item.Cells[1];

            #region Delete Recipe Image
            //Delete the recipe image if the recipe has an image.

            //Instantiate sql params object
            Blogic FetchData = new Blogic();

            try
            {
                IDataReader dr = FetchData.GetRecipeImageFileNameForUpdate(int.Parse(iIdNumber2.Text));

                dr.Read();

                if (dr["RecipeImage"] != DBNull.Value)
                {
                    System.IO.File.Delete(Server.MapPath(GetRecipeImage.ImagePath + dr["RecipeImage"].ToString()));
                }

                dr.Close();
            }
            catch
            {
            }

            FetchData = null;
            #endregion

            //Refresh cached data
            Caching.PurgeCacheItems("MainCourse_RecipeCategory");
            Caching.PurgeCacheItems("Ethnic_RecipeCategory");
            Caching.PurgeCacheItems("RecipeCategory_SideMenu");
            Caching.PurgeCacheItems("Newest_RecipesSideMenu_");

            //Instantiate delete recipe object
            RecipeInfo DelRecipe = new RecipeInfo();

            DelRecipe.ID = int.Parse(iIdNumber2.Text);

            //Perform delete recipe
            DelRecipe.Delete();

            DelRecipe = null;

            //Redirect to confirm delete page
            strURLRedirect = "confirmdel.aspx?catname=" + iIRecipename.Text + "&mode=del";
            Server.Transfer(strURLRedirect);
        }
    }
コード例 #60
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //Validate admin session username and password by comparing them to the admin user database record.
            UserNameVal.ValidateAdminUserNameandPass();

            GetDropdownCategoryID();

            lblusername.Text = "Welcome Admin:&nbsp;" + UserNameVal.AdminUsername;

            //Instantiate database field
            RecipeDetails Recipe = new RecipeDetails();

            Recipe.ID = (int)Util.Val(Request.QueryString["id"]);

            strRecipeImage = GetRecipeImage.GetImage(Recipe.ID);

            Recipe.WhatPageID = constant.intRecipeAdminEditing; //Parameter 3 = we are pulling database field for Admin/editing.aspx

            //Fill up database fields
            Recipe.fillup();

            Name.Text = Recipe.RecipeName;
            Author.Text = Recipe.Author;
            Hits.Text = Recipe.Hits.ToString();
            Ingredients.Text = Recipe.Ingredients;
            Instructions.Text = Recipe.Instructions;

            //Release allocated memory
            Recipe = null;
            myBL = null;
        }
    }