using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; public partial class Bulkmail_Template : System.Web.UI.Page { static int img; //static int count; static ArrayList al = new ArrayList(); // static FileUpload[] fu=new FileUpload[10]; Page p = new Page(); protected void Page_Load(object sender, EventArgs e) { if (Page.IsPostBack == false) { if (Session["Bulkmail"] == null) { Response.Redirect("BulkmailLogin.aspx"); } try { al.Clear(); p = this.Page; img = 0; //count = 0; //string str; //str = Server.MapPath("Upload"); //File.Create(str + "//test.eml"); //btnUpload.Attributes.Add("onclick", "return Test();"); } catch { } } lblMsg.Visible = false; } //protected void btnUpload_Click(object sender, EventArgs e) //{ // try // { // if (FileUpload1.HasFile) // { // string FileName; // string FileType = Path.GetExtension(FileUpload1.FileName); // if (FileType == ".htm") // { // string FolderPath = Server.MapPath("Upload/"); // FileName = ModCommon.Final_FileUpload(ref FileUpload1, img, FolderPath); // ModCommon.ExecuteQuery("INSERT INTO BEM_Template (Template_Kid, Template_Code, Template_Name) VALUES ('" + ModCommon.NewPrimaryKey(this) + "','" + CommonData.Generate_Code("select count(*) from BEM_Template where Template_Code='", "BEMT") + "','" + FileName + "')"); // string templateurl = Server.MapPath("Upload/Second.htm"); // string str; // str = Server.MapPath("Upload"); // // HttpContent(str + "\\test.htm",index); // System.Net.WebRequest objRequest = System.Net.HttpWebRequest.Create(str + "\\" + FileName); // StreamReader sr = new StreamReader(objRequest.GetResponse().GetResponseStream()); // string result = sr.ReadToEnd(); // string testresult = result; // sr.Close(); // string[] imgtag = new string[10]; // int i = 0; // while (testresult.Contains("")); // } // ModCommon.showmessage("Template Is Uploded Successfully.", lblMsg); // } // else // { // ModCommon.showmessage("Please Select .htm File Only.", lblMsg); // } // } // else // { // ModCommon.showmessage("Please Select .htm File.", lblMsg); // } // //If fuProductImage.HasFile Then // // lblProductImage.Text = "" // // Dim file_name As String // // Dim fileType As String = Path.GetExtension(fuProductImage.FileName) // // If fileType = ".gif" Or fileType = ".png" Or fileType = ".jpg" Or fileType = ".jpeg" Or fileType = ".bmp" Then // // Dim folderpath As String = Server.MapPath("~/Upload Image/Product Image/UploadImages/") // // file_name = Final_FileUpload(fuProductImage, img, folderpath) // // ExecuteQuery("Update Product_Master Set Product_Image = '" & file_name & "' where product_Kid = '" & RemoveLiterals(Session("ProductID").ToString()) & "'") // // fuProductImage.Visible = False // // lblProductImage.Visible = True // // lblProductImage.Text = file_name // // lblProductImage.ForeColor = Drawing.Color.Black // // imgProduct.Visible = True // // imgProduct.ImageUrl = "~/Upload Image/Product Image/UploadImages/" & ReturnValue("Select Product_Image from Product_Master Where Product_Kid ='" & RemoveLiterals(Session("ProductID").ToString) & "'and Product_IsDeleted = '0'") // // Dim imgepath As String // // imgepath = Server.MapPath(imgProduct.ImageUrl) // // KeepAspectRatioNew(imgProduct, imgepath, 208, 176) // // lnkProductImage.Visible = False // // Else // // lblProductImage.Text = "Wrong File" // // lblProductImage.ForeColor = Drawing.Color.Red // // Exit Sub // // End If // // Else // // lblProductImage.Text = "Select Image" // // lblProductImage.ForeColor = Drawing.Color.Red // // fuProductImage.Focus() // // Exit Sub // // End If // } // catch (System.Exception ex) // { // lblMsg.Text = ex.Message; // } //} protected void btnADD_Click(object sender, EventArgs e) { try { if (fuMultiple.HasFile == true) { //fu[count] = fuMultiple; lstMultiple.Items.Add(new ListItem(fuMultiple.FileName)); al.Add(fuMultiple); //count++; } else { ModCommon.showmessage("Please Select File For Upload.", lblMsg); } } catch { } } protected void btnDelete_Click(object sender, EventArgs e) { try { if (lstMultiple.SelectedIndex == -1) { ModCommon.showmessage("Please Select Item For Delete.", lblMsg); return; } else { //int i = int.Parse(lstMultiple.SelectedItem.Value); al.RemoveAt(lstMultiple.SelectedIndex); lstMultiple.Items.RemoveAt(lstMultiple.SelectedIndex); } } catch { } } protected void btnUpload_Click1(object sender, EventArgs e) { try { if (lstMultiple.Items.Count > 0) { for (int i = 0; i < al.Count; i++) { FileUpload f = (FileUpload)al[i]; f.SaveAs(Server.MapPath("Upload") + "\\" + f.FileName); if (Path.GetExtension(f.FileName) == ".htm") { ModCommon.ExecuteQuery("INSERT INTO BEM_Template (Template_Kid, Template_Code, Template_Name) VALUES ('" + ModCommon.NewPrimaryKey(this) + "','" + CommonData.Generate_Code("select count(*) from BEM_Template where Template_Code='", "BEMT") + "','" + f.FileName + "')"); } } ModCommon.showmessage("File is Uploaded Successfully.", lblMsg); lstMultiple.Items.Clear(); al.Clear(); } else { ModCommon.showmessage("Please Browse File First.", lblMsg); } } catch { } } }