public int Delete(string userid, int idx)
        {
            // Write your own Delete statement blocks.        

            string dir_path = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"]) + "/article_category_images";
            string file_name = GetImageByID(idx);
            if (file_name != null)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(file_name, dir_path);
            }

            SqlCommand cmd = new SqlCommand("[Articles].[sp_ArticleCategories_Delete]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout };
            cmd.Parameters.AddWithValue("@userid", userid);
            cmd.Parameters.AddWithValue("@ip", ip);
            cmd.Parameters.AddWithValue("@idx", idx);
            cmd.Parameters.Add(new SqlParameter("@o_return", SqlDbType.Int) { Direction = ParameterDirection.Output });
            con.Open();
            cmd.ExecuteNonQuery();
            int retunvalue = (int)cmd.Parameters["@o_return"].Value;
            con.Close();
            return retunvalue;
        }
        private int UpdateData()
        {
            string userid = Session["UserId"].ToString();
            int portalid = Convert.ToInt32(ddlPortalList.SelectedValue);
            int typeid = Convert.ToInt32(ddlMediaTypeList.SelectedValue);
            string title = txtTitle.Text;
            string description = txtDescription.Text;


            /*** UPLOAD *************************************************************************************************************/
            string dir_path = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_background_audio_dir"];
            HttpPostedFile icon_file = FileInput.PostedFile;
            string filename = "";
            if (icon_file != null)
            {
                if (icon_file.ContentLength > 0)
                {
                    ModuleClass module_obj = new ModuleClass();
                    module_obj.deleteFile(ViewState["filename"].ToString(), dir_path);

                    filename = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                    string savePath = Server.MapPath(dir_path + "/" + filename);
                    icon_file.SaveAs(savePath);
                }
                else
                {
                    filename = ViewState["filename"].ToString();
                }
            }            
            /************************************************************************************************************************/

            //MediaClass media_obj = new MediaClass();
            //int i = media_obj.Update(userid, _idx,portalid,typeid, filename, title, description);
            int i=0;
            return i;
        }
        private int UpdateData()
        {
            int PortalId = Convert.ToInt32(ddlPortalList.SelectedValue);
            string SkinType = ddlSkinTypeList.SelectedValue;
            string SkinName = txtSkinName.Text;
            string LastModifiedByUserId = Session["UserId"].ToString();
            
            /*** UPLOAD *************************************************************************************************************/
            string SkinIcon = string.Empty;
            string upload_image_physical_path = Server.MapPath(upload_image_dir);
            HttpPostedFile icon_file = FileInput.PostedFile;            
            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(ViewState["SkinIcon"].ToString(), upload_image_physical_path);

                SkinIcon = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));
                string savePath = System.IO.Path.Combine(upload_image_physical_path, SkinIcon);
                icon_file.SaveAs(savePath);
            }
            else
            {
                SkinIcon = ViewState["SkinIcon"].ToString();
            }
            /************************************************************************************************************************/

            SkinPackages skin_package_obj = new SkinPackages();
            int i = skin_package_obj.Update(_idx, PortalId, SkinName, SkinType, SkinIcon, LastModifiedByUserId);
            return i;
        }
        private int UpdateData()
        {
            int SkinPackage_ID = Convert.ToInt32(ddlPackageList.SelectedValue);
            string SkinBackground_Name = txtTitle.Text;
            string SkinBackground_Url = txtUrl.Text;
            bool bStatus = ChkBoxStatus.Checked;
            int SkinBackground_Discontinued = 0;
            if (bStatus == true)
            {
                SkinBackground_Discontinued = 1;
            }
            else
            {
                SkinBackground_Discontinued = 0;
            }


            /*** UPLOAD *************************************************************************************************************/
            string dir_path = "~/" + System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"] + "/background_images/";
            HttpPostedFile icon_file = FileInput.PostedFile;
            string SkinBackground_FileName = "";
            if (icon_file.ContentLength > 0)
            {
                ModuleClass module_obj = new ModuleClass();
                module_obj.deleteFile(txtFileName.Text, dir_path);
               
                SkinBackground_FileName = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName));                   
                string savePath = Server.MapPath(dir_path + SkinBackground_FileName);
                icon_file.SaveAs(savePath);
            }
            else
            {
                SkinBackground_FileName = txtFileName.Text;
            }
            /************************************************************************************************************************/

            SkinBackgrounds background_obj = new SkinBackgrounds();
            int i = background_obj.Update(_idx, SkinPackage_ID, SkinBackground_Name,SkinBackground_FileName, SkinBackground_Url, SkinBackground_Discontinued);            
            return i;
        }