public int Delete(string userid, int idx, string photo, string thumbnail, string filename) { // Photo ============================================================================================================================================================= string photo_dir_path = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"]) + "/media_images/photo"; if (photo != string.Empty) { module_obj.deleteFile(photo, photo_dir_path); } // Thumbnail ======================================================================================================================================================== string thumbnail_dir_path = HttpContext.Current.Server.MapPath(System.Configuration.ConfigurationManager.AppSettings["upload_image_dir"]) + "/media_images/thumbnails"; if (thumbnail != string.Empty) { module_obj.deleteFile(thumbnail, thumbnail_dir_path); } //Media File ======================================================================================================================================================== string file_path = string.Empty; MediaFiles media_obj = new MediaFiles(); DataTable dt = media_obj.GetDetailById(idx); if (dt.Rows.Count > 0) { int TypeId = Convert.ToInt32(dt.Rows[0]["TypeId"].ToString()); MediaTypes media_type_obj = new MediaTypes(); string TypePath = media_type_obj.GetTypePathByTypeId(TypeId); file_path = HttpContext.Current.Server.MapPath("~/" + TypePath); } module_obj.deleteFile(filename, file_path); //=================================================================================================================================================================== SqlCommand cmd = new SqlCommand("[Media].[Files_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); }
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); }
public int Delete(int Category_Id, string ImgPath) { string dir_path = HttpContext.Current.Server.MapPath(ImgPath); if (System.IO.Directory.Exists(dir_path)) { string img_file = GetImageByID(Category_Id); if (img_file != null || img_file != string.Empty) { string file_path = dir_path + "/" + img_file; if (System.IO.File.Exists(file_path)) { module_obj.deleteFile(img_file, dir_path); } } } SqlCommand cmd = new SqlCommand("[Production].[Product_Categories_Delete]", con) { CommandType = CommandType.StoredProcedure, CommandTimeout = Settings.CommandTimeout }; cmd.Parameters.AddWithValue("@Category_Id", Category_Id); 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() { 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); }
public int Delete(string UserId, int Idx, string Dir_Path) { using (MediaEntities dbContext = new MediaEntities()) { dbContext.CommandTimeout = Settings.CommandTimeout; string filename = (from x in dbContext.Media_Topics where x.TopicId == Idx select x.Photo).SingleOrDefault(); if (filename != null && filename != string.Empty) { module_obj.deleteFile(filename, Dir_Path); } //Media_Topics topic_obj = (from x in dbContext.Media_Topics where x.TopicId == Idx select x).First(); Media_Topics topic_obj = dbContext.Media_Topics.Single(x => x.TopicId == Idx); dbContext.DeleteObject(topic_obj); int i = dbContext.SaveChanges(); return(i); } }
private int UpdateData() { int SkinPackage_ID = Convert.ToInt32(ddlPackageList.SelectedValue); string ControlKey = txtControlKey.Text; HttpPostedFile File_ControlSrc = FileInput.PostedFile; string ControlSrc = ""; if ((File_ControlSrc != null) && (File_ControlSrc.ContentLength > 0)) { ControlSrc = System.IO.Path.GetDirectoryName(File_ControlSrc.FileName); } else { ControlSrc = txtControlSrc.Text; } /*** UPLOAD *************************************************************************************************************/ string physical_path = Server.MapPath(skin_img_path); HttpPostedFile icon_file = FileInput.PostedFile; string IconFile = ""; if (icon_file.ContentLength > 0) { ModuleClass module_obj = new ModuleClass(); module_obj.deleteFile(ViewState["IconFile"].ToString(), physical_path); IconFile = module_obj.GetEncodeString(System.IO.Path.GetFileName(icon_file.FileName)); string savePath = Path.Combine(physical_path, IconFile); icon_file.SaveAs(savePath); } else { IconFile = ViewState["IconFile"].ToString(); } /************************************************************************************************************************/ SkinControl skin_control_obj = new SkinControl(); int i = skin_control_obj.Update(_idx, SkinPackage_ID, ControlKey, ControlSrc, IconFile); 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); }
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); }