protected void btnSave_Click(object sender, EventArgs e)
 {
     Blog objAddNewBlog = new Blog();
     try
     {
         if (string.IsNullOrWhiteSpace(txtBlogName.Text))
         {
             lblError.Visible = true;
             lblError.InnerHtml = "Please enter Blog Name";
         }
         else if (string.IsNullOrWhiteSpace(txtDescribeFor.Text))
         {
             lblError.Visible = true;
             lblError.InnerHtml = "Please enter Describe For";
         }
         else if (string.IsNullOrWhiteSpace(txtDescription.Text))
         {
             lblError.Visible = true;
             lblError.InnerHtml = "Please enter Description";
         }
         else
         {
             if (Request.QueryString["guid"] == null)
             {
                 objAddNewBlog.BLOGNAME= txtBlogName.Text;
                 objAddNewBlog.DESCRIBEFOR = txtDescribeFor.Text;
                 objAddNewBlog.DESCRIPTION = txtDescription.Text;
                 objAddNewBlog.CREATEDBY = new Guid(HttpContext.Current.Session["User"].ToString());
                 objAddNewBlog.saveBlog();
                 lblError.Visible = true;
                 lblError.InnerHtml = "Blog created successfully";
             }
             else
             {
                 objAddNewBlog.ID = new Guid(Request.QueryString["guid"].ToString());
                 objAddNewBlog.BLOGNAME = txtBlogName.Text;
                 objAddNewBlog.DESCRIBEFOR = txtDescribeFor.Text;
                 objAddNewBlog.DESCRIPTION = txtDescription.Text;
                 objAddNewBlog.updateBlog();
                 lblError.Visible = true;
                 lblError.InnerHtml = "Blog updated successfully";
             }
         }
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.InnerHtml = ex.Message;
     }
     finally
     {
         objAddNewBlog = null;
     }
 }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Blog objAddNewBlog = new Blog();
            Featured objFeature = new Featured();
            try
            {
                if (string.IsNullOrWhiteSpace(txtBlogName.Text))
                {
                    lblError.Visible = true;
                    lblError.InnerHtml = "Please enter Blog Name";
                }
                else if (string.IsNullOrWhiteSpace(txtDescribeFor.Text))
                {
                    lblError.Visible = true;
                    lblError.InnerHtml = "Please enter Describe For";
                }
                else if (string.IsNullOrWhiteSpace(txtDescription.Text))
                {
                    lblError.Visible = true;
                    lblError.InnerHtml = "Please enter Description";
                }
                else
                {
                    if (fileUplImage.HasFile)
                    {
                        string virtualFolderName = ConfigurationManager.AppSettings["ImageFolderName"];
                        string rootPath = Server.MapPath("~/" + virtualFolderName);
                        string newFolder =  Guid.NewGuid().ToString();
                        string filename = Path.GetFileName(fileUplImage.FileName);
                        string relativeFilePath = string.Format(@"{0}\{1}", newFolder, filename);

                        Response.Write(string.Format(@"{0}\{1}", rootPath, relativeFilePath));
                        Directory.CreateDirectory(string.Format(@"{0}\{1}", rootPath,newFolder));
                        fileUplImage.SaveAs(string.Format(@"{0}\{1}", rootPath, relativeFilePath));
                        objAddNewBlog.ImagePath = relativeFilePath;
                    }

                    if (Request.QueryString["guid"] == null)
                    {
                        objAddNewBlog.BLOGNAME= txtBlogName.Text;
                        objAddNewBlog.DESCRIBEFOR = txtDescribeFor.Text;
                        objAddNewBlog.DESCRIPTION = txtDescription.Text;
                        objAddNewBlog.CREATEDBY = new Guid(HttpContext.Current.Session["User"].ToString());

                        objAddNewBlog.saveBlog();
                        lblError.Visible = true;
                        lblError.InnerHtml = "Blog created successfully";
                    }
                    else
                    {
                        objAddNewBlog.ID = new Guid(Request.QueryString["guid"].ToString());
                        objAddNewBlog.BLOGNAME = txtBlogName.Text;
                        objAddNewBlog.DESCRIBEFOR = txtDescribeFor.Text;
                        objAddNewBlog.DESCRIPTION = txtDescription.Text;
                        objAddNewBlog.updateBlog();
                        lblError.Visible = true;
                        lblError.InnerHtml = "Blog updated successfully";
                    }
                    if (chkIsFeatured.Checked == true) {
                        objFeature.DESCRIPTION = txtFeature.Text;
                        objFeature.ID = objAddNewBlog.ID;
                        objFeature.saveFeatured();
                    }

                }
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.InnerHtml = ex.Message;
            }
            finally
            {
                objAddNewBlog = null;
            }
        }