protected void grdData_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            _rpoObj = new SocialLinkRepository();
            switch (e.CommandName)
            {

                case "restoreitem":
                    if (_rpoObj.Restore(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
                    { grdData.DataBind(); }
                    break;
                case "deleteitem":
                    if (_rpoObj.Delete(e.CommandArgument.ToString(), Request.Cookies["CooLoginUserId"].Value))
                    { grdData.DataBind(); }
                    break;
            }
        }
        void GetInfo()
        {
            if (!string.IsNullOrEmpty(SocialLinkId))
            {
                _rpoObj = new SocialLinkRepository();
                SocialLink SocialLinkEnt = _rpoObj.LoadById(SocialLinkId);
                if (SocialLinkEnt != null)
                {
                    txtTitle.Text = SocialLinkEnt.SocialLinkTitle;
                    txtURL.Text = SocialLinkEnt.SocialLinkUrl;

                    try
                    {
                        ddlSocialLinkType.SelectedValue = SocialLinkEnt.SocialLinkTypeId.ToString();
                    }
                    catch
                    {
                        ddlSocialLinkType.SelectedIndex = -1;
                    }
                }
            }
        }
 private void LoadBySocialLinkTypeID()
 {
     _rpoObj = new SocialLinkRepository();
     grdData.DataSource = _rpoObj.LoadBySocialLinkType(ddlSocialLinkType.SelectedValue.ToString());
     grdData.DataBind();
 }
        void Save()
        {
            string ImageFile = string.Empty;
            _rpoObj = new SocialLinkRepository();
            #region Manage Item
            //string FileName = string.Empty;
            _rpoObj._Obj.SocialLinkTypeId = new Guid(ddlSocialLinkType.SelectedValue.ToString());
            _rpoObj._Obj.SocialLinkTitle = txtTitle.Text;
            _rpoObj._Obj.SocialLinkUrl = txtURL.Text;

            //isdefault here

            if (string.IsNullOrEmpty(SocialLinkId))
            {
                _rpoObj._Obj.CreatedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                //if (fpld.PostedFile.FileName != "")
                //{
                //    FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName);
                //    string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName;
                //    fpld.SaveAs(PathUrl);
                //    // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section");
                //    _PageSectionManagement._pageSection.ImageFile = FileName;
                //}
                SocialLinkId = _rpoObj.Add().ToString();
                //if (!string.IsNullOrEmpty(PageSectionId))
                //{
                //    BackendMessages(101);
                //}
                //else
                //{
                //    BackendMessages(201);
                //}
            }
            else
            {
                _rpoObj._Obj = _rpoObj.LoadById(SocialLinkId);
                _rpoObj._Obj.SocialLinkTypeId = new Guid(ddlSocialLinkType.SelectedValue.ToString());
                _rpoObj._Obj.SocialLinkTitle = txtTitle.Text;
                _rpoObj._Obj.SocialLinkUrl = txtURL.Text;

                //if (fpld.PostedFile.FileName != "")
                //{
                //    if (_PageSectionManagement._pageSection.ImageFile != null)
                //    {
                //        DirectoryInfo di = new DirectoryInfo(Server.MapPath(ConfigurationManager.AppSettings["Pages"]));
                //        foreach (FileInfo fi in di.GetFiles())
                //        {
                //            if (_PageSectionManagement._pageSection.ImageFile == fi.Name)
                //            {
                //                File.Delete(fi.Name);
                //            }
                //        }
                //    }
                //    FileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(fpld.PostedFile.FileName);
                //    string PathUrl = Server.MapPath(ConfigurationManager.AppSettings["Pages"].ToString()) + FileName;
                //    fpld.SaveAs(PathUrl);
                //    // DAL.ImagesFact.ResizeWithCropResizeImage("", FileName, "Section");
                //    _PageSectionManagement._pageSection.ImageFile = FileName;
                //}

                _rpoObj._Obj.ModifiedBy = new Guid(Request.Cookies["CooLoginUserId"].Value);
                if (_rpoObj.Edit())
                {
                    //lblMessge.Text = "Done, changes has been saved successfully!";
                    //msg.Attributes["class"] = "msg-success";
                }
                else
                {
                    //lblMessge.Text = "Error, Please try again later!";
                    //msg.Attributes["class"] = "msg-error";
                }
            }
            #endregion
        }