Ejemplo n.º 1
0
        protected void trigger_Click(object sender, EventArgs e)
        {
            var orgID = HttpContext.Current.Session["orgID"];

            if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "")
            {
                var ext = FileUpload2.FileName.Split('.')[FileUpload2.FileName.Split('.').Length - 1];

                FileUpload2.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".1." + ext));
            }

            if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "")
            {
                var ext = FileUpload3.FileName.Split('.')[FileUpload3.FileName.Split('.').Length - 1];

                FileUpload3.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".2." + ext));
            }

            if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "")
            {
                var ext = FileUpload4.FileName.Split('.')[FileUpload4.FileName.Split('.').Length - 1];

                FileUpload4.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".3." + ext));
            }

            if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "")
            {
                var ext = FileUpload5.FileName.Split('.')[FileUpload5.FileName.Split('.').Length - 1];

                FileUpload5.SaveAs(Server.MapPath("Images/Organizations/" + orgID + "." + ext));
            }
        }
        public void SaveData()
        {
            FileUpload1.SaveAs(Server.MapPath("~/Images/Poster/") + FileUpload1.FileName);
            FileUpload2.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload2.FileName);
            FileUpload3.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload3.FileName);
            FileUpload4.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload4.FileName);
            FileUpload5.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload5.FileName);
            FileUpload6.SaveAs(Server.MapPath("~/Images/FeaturePhoto/") + FileUpload6.FileName);
            string destiny = "~/Images/Poster/" + 10 + ".jpg";

            File.Copy("~/Images/Poster/" + FileUpload1.FileName, destiny);
            File.Delete("~/Images/Poster/" + FileUpload1.FileName);
            int status = obj.InsertUser(txtMovieName.Text, txtCast.Text, txtPlot.Text, calReleaseDate.SelectedDate.ToString(), FileUpload1.FileName, FileUpload2.FileName, FileUpload3.FileName, FileUpload4.FileName, FileUpload5.FileName, FileUpload6.FileName, txtRoyal.Text, txtClassic.Text, txtExecutive.Text);

            if (status == 1)
            {
                lblMsg.Text       = "Movie Added successfully";
                txtMovieName.Text = "";
                txtCast.Text      = "";
                txtPlot.Text      = "";
                txtClassic.Text   = "";
                txtExecutive.Text = "";
                txtRoyal.Text     = "";
            }
            else
            {
                lblMsg.Text = "OOPS !!! Something went wrong....";
            }
        }
        public void pictures()
        {
            var orgID = HttpContext.Current.Session["orgID"];

            if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.FileName != "")
            {
                var ext = FileUpload2.FileName.Split('.')[FileUpload2.FileName.Split('.').Length - 1];

                FileUpload2.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".1." + ext));
            }

            if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "")
            {
                var ext = FileUpload3.FileName.Split('.')[FileUpload3.FileName.Split('.').Length - 1];

                FileUpload3.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".2." + ext));
            }

            if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.FileName != "")
            {
                var ext = FileUpload4.FileName.Split('.')[FileUpload4.FileName.Split('.').Length - 1];

                FileUpload4.SaveAs(Server.MapPath("Images/Organizations/" + orgID + ".3." + ext));
            }

            if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "")
            {
                var ext = FileUpload5.FileName.Split('.')[FileUpload5.FileName.Split('.').Length - 1];

                FileUpload5.SaveAs(Server.MapPath("Images/Organizations/" + orgID + "." + ext));
            }
        }
 protected void btnUpload_Click(object sender, EventArgs e)
 {
     if (FileUpload1.HasFile)
     {
         FileUpload1.SaveAs(MapPath("~/images/House4/" + FileUpload1.FileName));
         imgViewFile.ImageUrl = "~/images/House4/" + FileUpload1.FileName;
     }
     if (FileUpload2.HasFile)
     {
         FileUpload2.SaveAs(MapPath("~/images/House4/" + FileUpload2.FileName));
         imgA.ImageUrl = "~/images/House4/" + FileUpload2.FileName;
     }
     if (FileUpload3.HasFile)
     {
         FileUpload3.SaveAs(MapPath("~/images/House4/" + FileUpload3.FileName));
         imgB.ImageUrl = "~/images/House4/" + FileUpload3.FileName;
     }
     if (FileUpload4.HasFile)
     {
         FileUpload4.SaveAs(MapPath("~/images/House4/" + FileUpload4.FileName));
         imgC.ImageUrl = "~/images/House4/" + FileUpload4.FileName;
     }
     if (FileUpload5.HasFile)
     {
         FileUpload5.SaveAs(MapPath("~/images/House4/" + FileUpload5.FileName));
         imgD.ImageUrl = "~/images/House4/" + FileUpload5.FileName;
     }
 }
Ejemplo n.º 5
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        ToolTable TT = new ToolTable();

        TT.Cat      = Convert.ToInt32(DropDownList1.SelectedValue);
        TT.ToolName = TextBox2.Text;
        TT.ThumbPic = "~/Dashboard/ThumbnailPic/" + FileUpload1.FileName;
        FileUpload1.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload1.FileName));
        FileUpload2.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload2.FileName));
        FileUpload3.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload3.FileName));
        FileUpload4.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload4.FileName));
        FileUpload5.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload5.FileName));
        FileUpload6.SaveAs(Server.MapPath("~/Dashboard/ThumbnailPic/" + FileUpload5.FileName));

        TT.Content1    = TextBox2.Text;
        TT.Pic1        = "/Dashboard/ThumbnailPic/" + FileUpload2.FileName;
        TT.Content2    = TextBox3.Text;
        TT.Pic2        = "/Dashboard/ThumbnailPic/" + FileUpload3.FileName;
        TT.Content3    = TextBox4.Text;
        TT.Pic3        = "/Dashboard/ThumbnailPic/" + FileUpload4.FileName;
        TT.Content4    = TextBox5.Text;
        TT.Pic4        = "/Dashboard/ThumbnailPic/" + FileUpload5.FileName;
        TT.MianContent = TextBox1.Text;
        TT.SourceCode  = "/Dashboard/SourceCode/" + FileUpload6.FileName;


        dl.da.ToolTables.InsertOnSubmit(TT);
        dl.da.SubmitChanges();
        Response.Write("<script>alert('Success')</script>");
        TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text = "";
    }
Ejemplo n.º 6
0
 public void copyImage()
 {
     if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "")
     {
         FileUpload5.SaveAs(Server.MapPath("Images/Churches/" + FileUpload5.FileName.ToString()));
     }
 }
Ejemplo n.º 7
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        if (FileUpload2.HasFile)
        {
            FileUpload2.SaveAs(Server.MapPath("~/images/Slider/" + "1.jpg"));
        }
        Label4.Text = " İŞLEM BAŞARILI";

        if (FileUpload3.HasFile)
        {
            FileUpload3.SaveAs(Server.MapPath("~/images/Slider/" + "2.jpg"));
        }
        Label4.Text = " İŞLEM BAŞARILI";
        if (FileUpload4.HasFile)
        {
            FileUpload4.SaveAs(Server.MapPath("~/images/Slider/" + "3.jpg"));
        }
        Label4.Text = " İŞLEM BAŞARILI";

        if (FileUpload5.HasFile)
        {
            FileUpload5.SaveAs(Server.MapPath("~/images/Slider/" + "4.jpg"));
        }
        Label4.Text = " İŞLEM BAŞARILI";
    }
Ejemplo n.º 8
0
        protected void Button24_Click(object sender, EventArgs e)
        {
            if (FileUpload5.HasFile)
            {
                try
                {
                    FileUpload5.SaveAs(Server.MapPath("dosyalar\\reklamlar\\") + FileUpload5.FileName);
                    link3 = "dosyalar\\reklamlar\\" + FileUpload5.FileName;
                    baglanti.ConnectionString = "provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("Srezervasyon.mdb");
                    baglanti.Open();
                    OleDbCommand cmd = new OleDbCommand();
                    cmd.Connection  = baglanti;
                    cmd.CommandText = "insert into reklamlar (reklambaslik,reklamlink,reklamresimlink,reklamaciklama) Values ('" + TextBox26.Text + "','" + TextBox27.Text + "','" + link3 + "','" + TextBox28.Text + "')";
                    cmd.ExecuteNonQuery();
                    baglanti.Close();



                    Response.Write("Reklam Oluşturuldu.");
                    texttemizle();
                    reklamgetir();
                }
                catch
                {
                    baglanti.Close();
                    Response.Write("Reklam Oluşturulamadı.");
                }
            }
            else
            {
                Response.Write("Bir Resim Dosyası Seçiniz");
            }
        }
Ejemplo n.º 9
0
        protected void Button4_Click(object sender, EventArgs e)
        {
            string ext = Path.GetExtension(FileUpload5.FileName);

            Console.WriteLine(ext);
            if (FileUpload5.HasFile)
            {
                if (ext.Equals(".xml"))
                {
                    FileUpload5.SaveAs(Server.MapPath("~/ArchivosXml/Monedas.xml"));
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Se subio con exito" + "');</script>");
                    //try
                    {
                        CargarMonedas();
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Se cargaron los datos con exito" + "');</script>");
                    }
                    //catch (Exception)
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error al cargar datos" + "');</script>");
                    }
                }
                else
                {
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error! El archivo debe ser tipo XML" + "');</script>");
                }
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "MessageBox", "<script language='javascript'>alert('" + "Error! Seleccione un archivo XML" + "');</script>");
            }
        }
Ejemplo n.º 10
0
 protected void btn第五張圖_Click(object sender, EventArgs e)
 {
     if (FileUpload5.HasFile)
     {
         string savePath = Server.MapPath(@"/./images/5.jpg");
         FileUpload5.SaveAs(savePath);
         lbl5.Visible = true;
         lbl5.Text    = "上傳成功";
     }
 }
Ejemplo n.º 11
0
    private void UpLoadAndDisplay4()
    {
        string imgName = FileUpload5.FileName;
        string imgPath = "/assets/image/" + "Question" + imgName;
        int    imgSize = FileUpload5.PostedFile.ContentLength;

        if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.FileName != "")
        {
            FileUpload5.SaveAs(Server.MapPath(imgPath));
            Image5.ImageUrl = ".." + imgPath;
        }
    }
Ejemplo n.º 12
0
    //上传主动邀请图片
    protected void Button5_Click(object sender, EventArgs e)
    {
        Label2.Visible = false;
        string bgStyle = this.FileUpload3.FileName;
        string okbtn   = this.FileUpload4.FileName;
        string nobtn   = this.FileUpload5.FileName;

        if (string.IsNullOrEmpty(bgStyle) || string.IsNullOrEmpty(okbtn) || string.IsNullOrEmpty(nobtn))
        {
            Label2.Text = "请选择上传图片";
            this.ModalPopupExtender2.Show();
            return;
        }
        if (!string.IsNullOrEmpty(LoadImageType(bgStyle)) || !string.IsNullOrEmpty(LoadImageType(okbtn)) || !string.IsNullOrEmpty(LoadImageType(nobtn)))
        {
            Label2.Text = "图片,请上传格式为jpg,gif,png,bmp图片";
            this.ModalPopupExtender2.Show();
            return;
        }
        WebSite wst = WebSiteManager.GetWebSiteByDomainName(this.drpDomainName.SelectedValue);

        if (wst != null)
        {
            if (Session["User"] != null)
            {
                oper = (Operator)Session["User"];
                string path = ConfigurationManager.AppSettings["UserDefinedPath"] + "\\" + oper.Account.AccountNumber + "\\" + drpDomainName.SelectedValue;
                Directory.CreateDirectory(path);
                string aa          = LiveSupport.BLL.WebSiteManager.WebSite_UserDefined;
                string inviteBGimg = "invite_bg" + aa + Path.GetExtension(bgStyle);
                string inviteOKimg = "btn_ok" + aa + Path.GetExtension(okbtn);
                string inviteNOimg = "btn_no" + aa + Path.GetExtension(nobtn);
                FileUpload3.SaveAs(path + "\\" + inviteBGimg);
                FileUpload4.SaveAs(path + "\\" + inviteOKimg);
                FileUpload5.SaveAs(path + "\\" + inviteNOimg);
                wst.InviteStyle = aa + "|" + inviteBGimg + "|" + inviteOKimg + "|" + inviteNOimg;
                WebSiteManager.Update(wst);
                AddIcoLocation(wst.IcoLocation);
                AddBannerStyle(wst.IconStyle);
                AddInviteStyle(wst.InviteStyle);
                AddChatStyle(wst.ChatStyle);
            }
            else
            {
                Response.Redirect("../Index.aspx");
            }
        }
        else
        {
            Response.Write("<script>alert('请选择上传到那个域名!');</script>");
        }
    }
Ejemplo n.º 13
0
 protected void Button6_Click(object sender, EventArgs e)
 {
     if (FileUpload5.HasFile)
     {
         FileUpload5.SaveAs(@"C:\Users\KA20094837\Desktop\Jacob\" + FileUpload5.FileName);
         Label12.ForeColor = System.Drawing.Color.ForestGreen;
         Label12.Text      = "File Uploaded: " + FileUpload5.FileName;
     }
     else
     {
         Label12.Text = "No File Uploaded.";
     }
 }
        List <string> SaveImage(int gfid)
        {
            List <string> listurl = new List <string>();

            string newName;

            if (FileUpload1.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload1.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload1.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            if (FileUpload2.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload2.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload2.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            if (FileUpload3.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload3.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload3.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            if (FileUpload4.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload4.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload4.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            if (FileUpload5.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload5.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload5.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            if (FileUpload6.FileName != "")
            {
                System.IO.FileInfo f = new System.IO.FileInfo(FileUpload6.FileName);
                newName = "Girl" + gfid + "-" + Guid.NewGuid().ToString("N") + f.Extension;
                FileUpload6.SaveAs(Server.MapPath("/") + "Content/Image/" + newName);
                listurl.Add(newName);
            }
            return(listurl);
        }
Ejemplo n.º 15
0
 protected void btnupload_Click(object sender, EventArgs e)
 {
     FileUpload2.SaveAs(Server.MapPath(img1));
     Image1.ImageUrl = img1;
     FileUpload3.SaveAs(Server.MapPath(img2));
     Image2.ImageUrl = img2;
     FileUpload4.SaveAs(Server.MapPath(img3));
     Image3.ImageUrl = img3;
     FileUpload5.SaveAs(Server.MapPath(img4));
     Image4.ImageUrl = img4;
     FileUpload6.SaveAs(Server.MapPath(img5));
     Image5.ImageUrl = img5;
     FileUpload7.SaveAs(Server.MapPath(img6));
     Image6.ImageUrl = img6;
 }
Ejemplo n.º 16
0
    protected void Button6_Click(object sender, EventArgs e)
    {
        string strMsgSuccess = "Upload Success";
        string strMsgSelect  = "Please select your file";

        if (FileUpload5.HasFile)
        {
            String strFileName = FileUpload5.FileName;
            FileUpload5.SaveAs(Server.MapPath("lecture5/" + strFileName));
            //Response.Write("<script> alert('Upload Success');<script>");
            TextBox5.Text = strMsgSuccess;
        }
        else
        {
            //Response.Write("<script> alert('Pleases select your file');<script>");
            TextBox5.Text = strMsgSelect;
        }
    }
Ejemplo n.º 17
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string filePath1 = "C:\\ASP2019\\0322ASP\\resimg\\" + FileUpload1.FileName;
        string filePath2 = "C:\\ASP2019\\0322ASP\\resimg\\" + FileUpload2.FileName;
        string filePath3 = "C:\\ASP2019\\0322ASP\\resimg\\" + FileUpload3.FileName;
        string filePath4 = "C:\\ASP2019\\0322ASP\\resimg\\" + FileUpload4.FileName;
        string filePath5 = "C:\\ASP2019\\0322ASP\\resimg\\" + FileUpload5.FileName;

        FileUpload1.SaveAs(filePath1);
        FileUpload2.SaveAs(filePath2);
        FileUpload3.SaveAs(filePath3);
        FileUpload4.SaveAs(filePath4);
        FileUpload5.SaveAs(filePath5);

        string imageUrl1 = "~/resimg/" + FileUpload1.FileName;
        string imageUrl2 = "~/resimg/" + FileUpload2.FileName;
        string imageUrl3 = "~/resimg/" + FileUpload3.FileName;
        string imageUrl4 = "~/resimg/" + FileUpload4.FileName;
        string imageUrl5 = "~/resimg/" + FileUpload5.FileName;

        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["MyAspDB"].ConnectionString);
        SqlCommand    cmd = new SqlCommand("RoomInsert4", con);

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@resimg1", imageUrl1);
        cmd.Parameters.AddWithValue("@resimg2", imageUrl2);
        cmd.Parameters.AddWithValue("@resimg3", imageUrl3);
        cmd.Parameters.AddWithValue("@resimg4", imageUrl4);
        cmd.Parameters.AddWithValue("@resimg5", imageUrl5);
        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();



        SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyAspDB"].ConnectionString);
        SqlCommand    cmd1 = new SqlCommand("RoomInsert6", con1);

        cmd1.CommandType = CommandType.StoredProcedure;

        cmd1.Parameters.AddWithValue("@KeyWord1", RoomsKeyWord.Text);
        cmd1.Parameters.AddWithValue("@KeyWord2", RoomsKeyWord1.Text);
        cmd1.Parameters.AddWithValue("@KeyWord3", RoomsKeyWord2.Text);
        cmd1.Parameters.AddWithValue("@KeyWord4", RoomsKeyWord3.Text);
        cmd1.Parameters.AddWithValue("@KeyWord5", RoomsKeyWord4.Text);

        con1.Open();
        cmd1.ExecuteNonQuery();
        con1.Close();

        SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyAspDB"].ConnectionString);


        SqlCommand cmd2 = new SqlCommand("RoomInsert5", con2);

        cmd2.CommandType = CommandType.StoredProcedure;

        cmd2.Parameters.AddWithValue("@resname", RoomsName.Text);
        cmd2.Parameters.AddWithValue("@resaddr", resaddr.Text);
        cmd2.Parameters.AddWithValue("@resevt", resevt.Text);
        cmd2.Parameters.AddWithValue("@resinfo", resinfo.Text);
        cmd2.Parameters.AddWithValue("@rescom", rescom.Text);
        cmd2.Parameters.AddWithValue("@lcode", DropDownList1.SelectedValue);
        con2.Open();
        cmd2.ExecuteNonQuery();
        con2.Close();

        SqlConnection con3 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyAspDB"].ConnectionString);

        SqlCommand cmd3 = new SqlCommand("RoomInsert7", con3);

        cmd3.CommandType = CommandType.StoredProcedure;

        cmd3.Parameters.AddWithValue("@wasmac", WASMAC);
        cmd3.Parameters.AddWithValue("@paklot", PAKLOT);
        cmd3.Parameters.AddWithValue("@bbq", BBQ);
        cmd3.Parameters.AddWithValue("@wifi", WIFI);
        cmd3.Parameters.AddWithValue("@resfri", RESFRI);
        cmd3.Parameters.AddWithValue("@resair", RESAIR);
        cmd3.Parameters.AddWithValue("@resbat", RESBAT);
        cmd3.Parameters.AddWithValue("@restv", RESTV);
        cmd3.Parameters.AddWithValue("@brkfat", BRKFAT);
        cmd3.Parameters.AddWithValue("@pet", PET);
        cmd3.Parameters.AddWithValue("@somke", SOMKE);
        cmd3.Parameters.AddWithValue("@event", EVENT);

        con3.Open();
        cmd3.ExecuteNonQuery();
        con3.Close();
    }
Ejemplo n.º 18
0
    protected void Button7_Click(object sender, EventArgs e)
    {
        try{
            if (FileUpload1.HasFile || FileUpload2.HasFile || FileUpload3.HasFile || FileUpload4.HasFile || FileUpload5.HasFile || FileUpload6.HasFile || FileUpload7.HasFile || FileUpload8.HasFile || FileUpload9.HasFile || FileUpload10.HasFile)
            {
                string path = Server.MapPath("Images/");

                //first
                if (FileUpload1.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload1.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload1.SaveAs(path + FileUpload1.FileName);
                        string name = "Images/" + FileUpload1.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox1.Text + "',city='" + TextBox2.Text + "',contentt='" + TextBox3.Text + "' where id=1";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //second
                if (FileUpload2.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload2.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload2.SaveAs(path + FileUpload2.FileName);
                        string name = "Images/" + FileUpload2.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox4.Text + "',city='" + TextBox5.Text + "',contentt='" + TextBox6.Text + "' where id=2";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //third
                if (FileUpload3.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload3.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload3.SaveAs(path + FileUpload3.FileName);
                        string name = "Images/" + FileUpload3.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox7.Text + "',city='" + TextBox8.Text + "',contentt='" + TextBox9.Text + "' where id=3";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //forth
                if (FileUpload4.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload4.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload4.SaveAs(path + FileUpload4.FileName);
                        string name = "Images/" + FileUpload4.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox10.Text + "',city='" + TextBox11.Text + "',contentt='" + TextBox12.Text + "' where id=4";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //fifth
                if (FileUpload5.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload5.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload5.SaveAs(path + FileUpload5.FileName);
                        string name = "Images/" + FileUpload5.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox13.Text + "',city='" + TextBox14.Text + "',contentt='" + TextBox15.Text + "' where id=5";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //sixth
                if (FileUpload6.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload6.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload6.SaveAs(path + FileUpload6.FileName);
                        string name = "Images/" + FileUpload6.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox16.Text + "',city='" + TextBox17.Text + "',contentt='" + TextBox18.Text + "' where id=6";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //first
                if (FileUpload7.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload7.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload7.SaveAs(path + FileUpload7.FileName);
                        string name = "Images/" + FileUpload7.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox19.Text + "',city='" + TextBox20.Text + "',contentt='" + TextBox21.Text + "' where id=7";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //eighth
                if (FileUpload8.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload8.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload8.SaveAs(path + FileUpload8.FileName);
                        string name = "Images/" + FileUpload8.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox22.Text + "',city='" + TextBox23.Text + "',contentt='" + TextBox24.Text + "' where id=8";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //nineth
                if (FileUpload9.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload9.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload9.SaveAs(path + FileUpload9.FileName);
                        string name = "Images/" + FileUpload9.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox25.Text + "',city='" + TextBox26.Text + "',contentt='" + TextBox27.Text + "' where id=9";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }
                //tenth
                if (FileUpload10.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload10.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload10.SaveAs(path + FileUpload10.FileName);
                        string name = "Images/" + FileUpload10.FileName;
                        string ss   = "update user_review set image='" + name + "', name='" + TextBox28.Text + "',city='" + TextBox29.Text + "',contentt='" + TextBox30.Text + "' where id=10";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                count++;
                Response.Redirect("adminpanel-user-review.aspx");
            }
            else
            {
                a++;
                Response.Redirect("adminpanel-user-review.aspx");
            }
        }

        catch (Exception)
        {
            Label2.Visible = true;
        }
    }
Ejemplo n.º 19
0
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        if (btnsubmit.Text == "Submit")
        {
            product.Product_name = txtproductname.Text;
            product.Cat_id       = Convert.ToInt32(drpcat.SelectedValue);
            product.Status       = chkstatus.Checked;
            //product.Cdate = Convert.ToDateTime(DateTime.Now.ToShortDateString());

            product.Our_latest_product = chklatest.Checked;
            product.OurBestProduct     = chkbest.Checked;
            product.HomePage           = chkhome.Checked;
            product.HomePage2          = chkhome2.Checked;
            product.Product_Dec        = txtdescription.Text;
            product.Product_Price      = txtprice.Text;
            product.Product_Unit       = txtunit.Text;

            string gid = Guid.NewGuid().ToString().Substring(0, 4);

            if (FileUpload1.HasFile)
            {
                string filename = FileUpload1.FileName;
                FileUpload1.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image = gid + filename;
            }



            if (FileUpload2.HasFile)
            {
                string filename = FileUpload2.FileName;
                FileUpload2.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image1 = gid + filename;
            }


            if (FileUpload3.HasFile)
            {
                string filename = FileUpload3.FileName;
                FileUpload3.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image2 = gid + filename;
            }


            if (FileUpload4.HasFile)
            {
                string filename = FileUpload4.FileName;
                FileUpload4.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image3 = gid + filename;
            }


            if (FileUpload5.HasFile)
            {
                string filename = FileUpload5.FileName;
                FileUpload5.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image4 = gid + filename;
            }

            db.Tb_Product.Add(product);
            db.SaveChanges();
            clear();
            Response.Redirect("~/Admin/ShowProduct.aspx?msg=" + "Svd");
        }
        else
        {
            product = db.Tb_Product.Find(Convert.ToInt32(ViewState["id"]));
            product.Product_name = txtproductname.Text;
            product.Cat_id       = Convert.ToInt32(drpcat.SelectedValue);
            product.Status       = chkstatus.Checked;
            //product.Cdate = Convert.ToDateTime(DateTime.Now.ToShortDateString());
            product.Status        = chkstatus.Checked;
            product.Product_Dec   = txtdescription.Text;
            product.Product_Price = txtprice.Text;
            product.Product_Unit  = txtunit.Text;

            string gid = Guid.NewGuid().ToString().Substring(0, 4);

            if (FileUpload1.HasFile)
            {
                string filename = FileUpload1.FileName;
                FileUpload1.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image = gid + filename;
            }



            if (FileUpload2.HasFile)
            {
                string filename = FileUpload2.FileName;
                FileUpload2.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image1 = gid + filename;
            }


            if (FileUpload3.HasFile)
            {
                string filename = FileUpload3.FileName;
                FileUpload3.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image2 = gid + filename;
            }


            if (FileUpload4.HasFile)
            {
                string filename = FileUpload4.FileName;
                FileUpload4.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image3 = gid + filename;
            }


            if (FileUpload5.HasFile)
            {
                string filename = FileUpload5.FileName;
                FileUpload5.SaveAs(Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString()));
                //  jp.IPath = Server.MapPath("~\\Upload\\Product\\" + gid + filename.ToString());
                product.Product_Image4 = gid + filename;
            }
            else
            {
                product.Product_Image = ViewState["image"].ToString();
            }
            db.SaveChanges();
            clear();
            Response.Redirect("~/Admin/ShowProduct.aspx?msg=" + "upd");
        }
    }
Ejemplo n.º 20
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ClearMessages();
            StringBuilder sb       = new StringBuilder();
            bool          uploaded = false;

            if (FileUpload1.HasFile)
            {
                if (FileUpload1.FileName.Contains(" "))
                {
                    lblError.Text = "File 1 Name contains space. Please replace space with underscore(_).";
                    return;
                }
                try
                {
                    if (FileUpload1.PostedFile.ContentType == "image/jpeg" || FileUpload1.PostedFile.ContentType == "image / pjpeg")
                    {
                        if (FileUpload1.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUpload1.FileName);
                            FileUpload1.SaveAs(Server.MapPath("~/Email/EmailCerts/") + filename);
                            uploaded = true;
                        }
                        else
                        {
                            sb.Append("Certificate 1 Upload status: The file has to be less than 1 mb!<br/>");
                        }
                    }
                    else
                    {
                        sb.Append("Certificate 1 Upload status: Only Image files are accepted!<br/>");
                    }
                }
                catch (Exception ex)
                {
                    sb.AppendFormat("Certificate 1 Upload status: The file could not be uploaded. The following error occured: {0}<br/>", ex.Message);
                }
            }

            if (FileUpload2.HasFile)
            {
                if (FileUpload2.FileName.Contains(" "))
                {
                    lblError.Text = "File 2 Name contains space. Please replace space with underscore(_).";
                    return;
                }
                try
                {
                    if (FileUpload2.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUpload2.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUpload2.FileName);
                            FileUpload2.SaveAs(Server.MapPath("~/Email/EmailCerts/") + filename);
                            uploaded = true;
                        }
                        else
                        {
                            sb.Append("Certificate 2 Upload status: The file has to be less than 1 mb!<br/>");
                        }
                    }
                    else
                    {
                        sb.Append("Certificate 2 Upload status: Only Image files are accepted!<br/>");
                    }
                }
                catch (Exception ex)
                {
                    sb.AppendFormat("Certificate 2 Upload status: The file could not be uploaded. The following error occured: {0}<br/>", ex.Message);
                }
            }

            if (FileUpload3.HasFile)
            {
                if (FileUpload3.FileName.Contains(" "))
                {
                    lblError.Text = "File 3 Name contains space. Please replace space with underscore(_).";
                    return;
                }
                try
                {
                    if (FileUpload3.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUpload3.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUpload3.FileName);
                            FileUpload3.SaveAs(Server.MapPath("~/Email/EmailCerts/") + filename);
                            uploaded = true;
                        }
                        else
                        {
                            sb.Append("Certificate 3 Upload status: The file has to be less than 1 mb!<br/>");
                        }
                    }
                    else
                    {
                        sb.Append("Certificate 3 Upload status: Only Image files are accepted!<br/>");
                    }
                }
                catch (Exception ex)
                {
                    sb.AppendFormat("Certificate 3 Upload status: The file could not be uploaded. The following error occured: {0}<br/>", ex.Message);
                }
            }

            if (FileUpload4.HasFile)
            {
                if (FileUpload4.FileName.Contains(" "))
                {
                    lblError.Text = "File 4 Name contains space. Please replace space with underscore(_).";
                    return;
                }
                try
                {
                    if (FileUpload4.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUpload4.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUpload4.FileName);
                            FileUpload4.SaveAs(Server.MapPath("~/Email/EmailCerts/") + filename);
                            uploaded = true;
                        }
                        else
                        {
                            sb.Append("Certificate 4 Upload status: The file has to be less than 1 mb!<br/>");
                        }
                    }
                    else
                    {
                        sb.Append("Certificate 4 Upload status: Only Image files are accepted!<br/>");
                    }
                }
                catch (Exception ex)
                {
                    sb.AppendFormat("Certificate 4 Upload status: The file could not be uploaded. The following error occured: {0}<br/>", ex.Message);
                }
            }

            if (FileUpload5.HasFile)
            {
                if (FileUpload4.FileName.Contains(" "))
                {
                    lblError.Text = "File 4 Name contains space. Please replace space with underscore(_).";
                    return;
                }
                try
                {
                    if (FileUpload5.PostedFile.ContentType == "image/jpeg")
                    {
                        if (FileUpload5.PostedFile.ContentLength < 1024000)
                        {
                            string filename = Path.GetFileName(FileUpload5.FileName);
                            FileUpload5.SaveAs(Server.MapPath("~/Email/EmailCerts/") + filename);
                            uploaded = true;
                        }
                        else
                        {
                            sb.Append("Certificate 5 Upload status: The file has to be less than 1 mb!<br/>");
                        }
                    }
                    else
                    {
                        sb.Append("Certificate 5 Upload status: Only Image files are accepted!<br/>");
                    }
                }
                catch (Exception ex)
                {
                    sb.AppendFormat("Certificate 5 Upload status: The file could not be uploaded. The following error occured: {0}<br/>", ex.Message);
                }
            }
            if (string.IsNullOrEmpty(sb.ToString()) && uploaded == true)
            {
                lblMsg.Text = "File(s) uploaded successfully";
            }
            else
            {
                lblError.Text = sb.ToString();
            }
            populateImageDropDown();
        }
Ejemplo n.º 21
0
    protected void team_save_click(object sender, EventArgs e)
    {
        ////////////////////////////1
        if (FileUpload1.HasFile)
        {
            if (!Directory.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/", "1"))))
            {
                Directory.CreateDirectory(Server.MapPath(string.Format("~/Npanel/image/{0}/", "1")));
            }

            if (File.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "1", "1"))))
            {
                File.Delete(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "1", "1")));
            }

            FileUpload1.SaveAs(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "1", "1")));

            if (FileUpload1.PostedFile != null)
            {
                // Check the extension of image
                string extension = Path.GetExtension(FileUpload1.FileName);

                if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg")
                {
                    Stream strm = FileUpload1.PostedFile.InputStream;
                    using (var image = System.Drawing.Image.FromStream(strm))
                    {
                        // Print Original Size of file (Height or Width)
                        int newWidth   = 400; // New Width of Image in Pixel
                        int newHeight  = 350; // New Height of Image in Pixel
                        var thumbImg   = new Bitmap(newWidth, newHeight);
                        var thumbGraph = Graphics.FromImage(thumbImg);
                        thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                        thumbGraph.SmoothingMode      = SmoothingMode.HighQuality;
                        thumbGraph.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                        var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                        thumbGraph.DrawImage(image, imgRectangle);
                        // Save the file
                        string targetPath = Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "1", "1"));
                        thumbImg.Save(targetPath, image.RawFormat);
                        // Print new Size of file (height or Width)
                        //Show Image
                    }
                }
            }
        }
        ////////////////////////////2

        if (FileUpload2.HasFile)
        {
            if (!Directory.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/", "2"))))
            {
                Directory.CreateDirectory(Server.MapPath(string.Format("~/Npanel/image/{0}/", "2")));
            }

            if (File.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "2", "2"))))
            {
                File.Delete(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "2", "2")));
            }

            FileUpload2.SaveAs(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "2", "2")));

            if (FileUpload2.PostedFile != null)
            {
                // Check the extension of image
                string extension = Path.GetExtension(FileUpload2.FileName);

                if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg")
                {
                    Stream strm = FileUpload2.PostedFile.InputStream;
                    using (var image = System.Drawing.Image.FromStream(strm))
                    {
                        // Print Original Size of file (Height or Width)
                        int newWidth   = 400; // New Width of Image in Pixel
                        int newHeight  = 350; // New Height of Image in Pixel
                        var thumbImg   = new Bitmap(newWidth, newHeight);
                        var thumbGraph = Graphics.FromImage(thumbImg);
                        thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                        thumbGraph.SmoothingMode      = SmoothingMode.HighQuality;
                        thumbGraph.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                        var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                        thumbGraph.DrawImage(image, imgRectangle);
                        // Save the file
                        string targetPath = Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "2", "2"));
                        thumbImg.Save(targetPath, image.RawFormat);
                        // Print new Size of file (height or Width)
                        //Show Image
                    }
                }
            }
        }
        ////////////////////////////3

        if (FileUpload3.HasFile)
        {
            if (!Directory.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/", "3"))))
            {
                Directory.CreateDirectory(Server.MapPath(string.Format("~/Npanel/image/{0}/", "3")));
            }

            if (File.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "3", "3"))))
            {
                File.Delete(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "3", "3")));
            }

            FileUpload3.SaveAs(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "3", "3")));

            if (FileUpload3.PostedFile != null)
            {
                // Check the extension of image
                string extension = Path.GetExtension(FileUpload3.FileName);

                if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg")
                {
                    Stream strm = FileUpload3.PostedFile.InputStream;
                    using (var image = System.Drawing.Image.FromStream(strm))
                    {
                        // Print Original Size of file (Height or Width)
                        int newWidth   = 400; // New Width of Image in Pixel
                        int newHeight  = 350; // New Height of Image in Pixel
                        var thumbImg   = new Bitmap(newWidth, newHeight);
                        var thumbGraph = Graphics.FromImage(thumbImg);
                        thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                        thumbGraph.SmoothingMode      = SmoothingMode.HighQuality;
                        thumbGraph.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                        var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                        thumbGraph.DrawImage(image, imgRectangle);
                        // Save the file
                        string targetPath = Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "3", "3"));
                        thumbImg.Save(targetPath, image.RawFormat);
                        // Print new Size of file (height or Width)
                        //Show Image
                    }
                }
            }
        }
        ////////////////////////////4

        if (FileUpload4.HasFile)
        {
            if (!Directory.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/", "4"))))
            {
                Directory.CreateDirectory(Server.MapPath(string.Format("~/Npanel/image/{0}/", "4")));
            }

            if (File.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "4", "4"))))
            {
                File.Delete(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "4", "4")));
            }

            FileUpload4.SaveAs(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "4", "4")));

            if (FileUpload4.PostedFile != null)
            {
                // Check the extension of image
                string extension = Path.GetExtension(FileUpload4.FileName);

                if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg")
                {
                    Stream strm = FileUpload4.PostedFile.InputStream;
                    using (var image = System.Drawing.Image.FromStream(strm))
                    {
                        // Print Original Size of file (Height or Width)
                        int newWidth   = 400; // New Width of Image in Pixel
                        int newHeight  = 350; // New Height of Image in Pixel
                        var thumbImg   = new Bitmap(newWidth, newHeight);
                        var thumbGraph = Graphics.FromImage(thumbImg);
                        thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                        thumbGraph.SmoothingMode      = SmoothingMode.HighQuality;
                        thumbGraph.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                        var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                        thumbGraph.DrawImage(image, imgRectangle);
                        // Save the file
                        string targetPath = Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "4", "4"));
                        thumbImg.Save(targetPath, image.RawFormat);
                        // Print new Size of file (height or Width)
                        //Show Image
                    }
                }
            }
        }

        ////////////////////////////5

        if (FileUpload5.HasFile)
        {
            if (!Directory.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/", "5"))))
            {
                Directory.CreateDirectory(Server.MapPath(string.Format("~/Npanel/image/{0}/", "5")));
            }

            if (File.Exists(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "5", "5"))))
            {
                File.Delete(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "5", "5")));
            }

            FileUpload5.SaveAs(Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "5", "5")));

            if (FileUpload5.PostedFile != null)
            {
                // Check the extension of image
                string extension = Path.GetExtension(FileUpload5.FileName);

                if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg" || extension.ToLower() == ".jpeg")
                {
                    Stream strm = FileUpload5.PostedFile.InputStream;
                    using (var image = System.Drawing.Image.FromStream(strm))
                    {
                        // Print Original Size of file (Height or Width)
                        int newWidth   = 400; // New Width of Image in Pixel
                        int newHeight  = 350; // New Height of Image in Pixel
                        var thumbImg   = new Bitmap(newWidth, newHeight);
                        var thumbGraph = Graphics.FromImage(thumbImg);
                        thumbGraph.CompositingQuality = CompositingQuality.HighQuality;
                        thumbGraph.SmoothingMode      = SmoothingMode.HighQuality;
                        thumbGraph.InterpolationMode  = InterpolationMode.HighQualityBicubic;
                        var imgRectangle = new Rectangle(0, 0, newWidth, newHeight);
                        thumbGraph.DrawImage(image, imgRectangle);
                        // Save the file
                        string targetPath = Server.MapPath(string.Format("~/Npanel/image/{0}/_{1}.jpg", "5", "5"));
                        thumbImg.Save(targetPath, image.RawFormat);
                        // Print new Size of file (height or Width)
                        //Show Image
                    }
                }
            }
        }
    }
    protected void Button7_Click(object sender, EventArgs e)
    {
        try
        {
            if (FileUpload1.HasFile || FileUpload2.HasFile || FileUpload3.HasFile || FileUpload4.HasFile || FileUpload5.HasFile || FileUpload6.HasFile || FileUpload7.HasFile || FileUpload8.HasFile || FileUpload9.HasFile || FileUpload10.HasFile || FileUpload11.HasFile || FileUpload12.HasFile || FileUpload13.HasFile || FileUpload14.HasFile || FileUpload15.HasFile || FileUpload16.HasFile || FileUpload17.HasFile || FileUpload18.HasFile || FileUpload19.HasFile || FileUpload20.HasFile || FileUpload21.HasFile || FileUpload22.HasFile || FileUpload23.HasFile || FileUpload24.HasFile || FileUpload25.HasFile || FileUpload26.HasFile || FileUpload27.HasFile || FileUpload28.HasFile || FileUpload29.HasFile || FileUpload30.HasFile || FileUpload31.HasFile || FileUpload32.HasFile || FileUpload33.HasFile || FileUpload34.HasFile || FileUpload35.HasFile || FileUpload36.HasFile || FileUpload37.HasFile || FileUpload38.HasFile || FileUpload39.HasFile)
            {
                string path = Server.MapPath("Images/");

                //HOME
                if (FileUpload1.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload1.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload1.SaveAs(path + FileUpload1.FileName);
                        string name = "Images/" + FileUpload1.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=14";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload2.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload2.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload2.SaveAs(path + FileUpload2.FileName);
                        string name = "Images/" + FileUpload2.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=14";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload3.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload3.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload3.SaveAs(path + FileUpload3.FileName);
                        string name = "Images/" + FileUpload3.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=14";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BUY FLAT
                if (FileUpload4.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload4.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload4.SaveAs(path + FileUpload4.FileName);
                        string name = "Images/" + FileUpload4.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=1";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload5.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload5.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload5.SaveAs(path + FileUpload5.FileName);
                        string name = "Images/" + FileUpload5.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=1";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload6.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload6.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload6.SaveAs(path + FileUpload6.FileName);
                        string name = "Images/" + FileUpload6.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=1";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BUY HOUSE
                if (FileUpload7.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload7.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload7.SaveAs(path + FileUpload7.FileName);
                        string name = "Images/" + FileUpload7.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=2";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload8.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload8.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload8.SaveAs(path + FileUpload8.FileName);
                        string name = "Images/" + FileUpload8.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=2";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload9.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload9.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload9.SaveAs(path + FileUpload9.FileName);
                        string name = "Images/" + FileUpload9.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=2";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BUY VILLA
                if (FileUpload10.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload10.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload10.SaveAs(path + FileUpload10.FileName);
                        string name = "Images/" + FileUpload10.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=3";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload11.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload11.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload11.SaveAs(path + FileUpload11.FileName);
                        string name = "Images/" + FileUpload11.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=3";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload12.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload12.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload12.SaveAs(path + FileUpload12.FileName);
                        string name = "Images/" + FileUpload12.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=3";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BUY LUXURY HOUSE
                if (FileUpload13.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload13.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload13.SaveAs(path + FileUpload13.FileName);
                        string name = "Images/" + FileUpload13.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=5";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload14.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload14.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload14.SaveAs(path + FileUpload14.FileName);
                        string name = "Images/" + FileUpload14.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=5";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload15.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload15.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload15.SaveAs(path + FileUpload15.FileName);
                        string name = "Images/" + FileUpload15.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=5";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BUY BUDGET DEAL
                if (FileUpload16.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload16.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload16.SaveAs(path + FileUpload16.FileName);
                        string name = "Images/" + FileUpload16.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=6";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload17.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload17.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload17.SaveAs(path + FileUpload17.FileName);
                        string name = "Images/" + FileUpload17.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=6";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload18.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload18.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload18.SaveAs(path + FileUpload18.FileName);
                        string name = "Images/" + FileUpload18.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=6";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //RENT FLAT
                if (FileUpload19.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload19.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload19.SaveAs(path + FileUpload19.FileName);
                        string name = "Images/" + FileUpload19.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=7";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload20.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload20.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload20.SaveAs(path + FileUpload20.FileName);
                        string name = "Images/" + FileUpload20.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=7";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload21.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload21.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload21.SaveAs(path + FileUpload21.FileName);
                        string name = "Images/" + FileUpload21.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=7";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //RENT HOUSE
                if (FileUpload22.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload22.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload22.SaveAs(path + FileUpload22.FileName);
                        string name = "Images/" + FileUpload22.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=8";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload23.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload23.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload23.SaveAs(path + FileUpload23.FileName);
                        string name = "Images/" + FileUpload23.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=8";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload24.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload24.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload24.SaveAs(path + FileUpload24.FileName);
                        string name = "Images/" + FileUpload24.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=8";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //RENT VILLA
                if (FileUpload25.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload25.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload25.SaveAs(path + FileUpload25.FileName);
                        string name = "Images/" + FileUpload25.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=9";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload26.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload26.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload26.SaveAs(path + FileUpload26.FileName);
                        string name = "Images/" + FileUpload26.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=9";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload27.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload27.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload27.SaveAs(path + FileUpload27.FileName);
                        string name = "Images/" + FileUpload27.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=9";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //RENT BACHELOR FRIENDLY
                if (FileUpload28.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload28.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload28.SaveAs(path + FileUpload28.FileName);
                        string name = "Images/" + FileUpload28.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=10";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload29.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload29.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload29.SaveAs(path + FileUpload29.FileName);
                        string name = "Images/" + FileUpload29.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=10";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload30.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload30.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload30.SaveAs(path + FileUpload30.FileName);
                        string name = "Images/" + FileUpload30.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=10";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //RENT BUDGET DEAL
                if (FileUpload31.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload31.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload31.SaveAs(path + FileUpload31.FileName);
                        string name = "Images/" + FileUpload31.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=11";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload32.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload32.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload32.SaveAs(path + FileUpload32.FileName);
                        string name = "Images/" + FileUpload32.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=11";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload33.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload33.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload33.SaveAs(path + FileUpload33.FileName);
                        string name = "Images/" + FileUpload33.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=11";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //OFFICE SPACE
                if (FileUpload34.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload34.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload34.SaveAs(path + FileUpload34.FileName);
                        string name = "Images/" + FileUpload34.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=11";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload35.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload35.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload35.SaveAs(path + FileUpload35.FileName);
                        string name = "Images/" + FileUpload35.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=12";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload36.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload36.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload36.SaveAs(path + FileUpload36.FileName);
                        string name = "Images/" + FileUpload36.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=12";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                //BHK FLAT
                if (FileUpload37.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload37.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload37.SaveAs(path + FileUpload37.FileName);
                        string name = "Images/" + FileUpload37.FileName;
                        string ss   = "update slider set image1='" + name + "' where id=13";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload38.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload38.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload38.SaveAs(path + FileUpload38.FileName);
                        string name = "Images/" + FileUpload38.FileName;
                        string ss   = "update slider set image2='" + name + "' where id=13";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                if (FileUpload39.HasFile)
                {
                    string ext = Path.GetExtension(FileUpload39.FileName);
                    if (ext == ".jpg" || ext == ".png")
                    {
                        FileUpload39.SaveAs(path + FileUpload39.FileName);
                        string name = "Images/" + FileUpload39.FileName;
                        string ss   = "update slider set image3='" + name + "' where id=13";

                        con.Open();
                        cmd = new SqlCommand(ss, con);
                        cmd.ExecuteNonQuery();
                        con.Close();
                    }
                }

                count++;
                Response.Redirect("adminpanel-slider.aspx");
            }
            else
            {
                a++;
                Response.Redirect("adminpanel-slider.aspx");
            }
        }

        catch (Exception)
        {
            Label2.Visible = true;
        }
    }
Ejemplo n.º 23
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (FileUpload1.HasFile)
        {
            String photo = Path.GetFileName(FileUpload1.FileName);
            FileUpload1.SaveAs(Server.MapPath("~/Teacher/pic/" + photo));

            string        conn   = ConfigurationManager.ConnectionStrings["totalschoolConnectionString"].ConnectionString;
            SqlConnection objcon = new SqlConnection(conn);
            objcon.Open();
            SqlCommand objcmd = new SqlCommand("spgal", objcon);
            objcmd.CommandType = CommandType.StoredProcedure;

            SqlParameter p2 = new SqlParameter();
            p2.ParameterName = "@pic";
            p2.SqlDbType     = SqlDbType.NVarChar;
            p2.Value         = FileUpload1.FileName;
            objcmd.Parameters.Add(p2);

            SqlParameter p3 = new SqlParameter();
            p3.ParameterName = "@id";
            p3.SqlDbType     = SqlDbType.NVarChar;
            p3.Value         = lblid.Text;
            objcmd.Parameters.Add(p3);


            SqlParameter p1 = new SqlParameter();
            p1.ParameterName = "@school";
            p1.SqlDbType     = SqlDbType.NVarChar;
            p1.Value         = lblsch.Text;
            objcmd.Parameters.Add(p1);

            //Class1.WebMsgBox.Show("1 Added successfully");
            objcmd.ExecuteNonQuery();
            // Response.Write("Created Successfully");
            objcon.Close();
        }

        if (FileUpload2.HasFile)
        {
            String photo1 = Path.GetFileName(FileUpload2.FileName);
            FileUpload2.SaveAs(Server.MapPath("~/Teacher/pic/" + photo1));

            string        conn1   = ConfigurationManager.ConnectionStrings["totalschoolConnectionString"].ConnectionString;
            SqlConnection objcon1 = new SqlConnection(conn1);
            objcon1.Open();
            SqlCommand objcmd1 = new SqlCommand("spgal", objcon1);
            objcmd1.CommandType = CommandType.StoredProcedure;

            SqlParameter p21 = new SqlParameter();
            p21.ParameterName = "@pic";
            p21.SqlDbType     = SqlDbType.NVarChar;
            p21.Value         = FileUpload2.FileName;
            objcmd1.Parameters.Add(p21);

            SqlParameter p31 = new SqlParameter();
            p31.ParameterName = "@id";
            p31.SqlDbType     = SqlDbType.NVarChar;
            p31.Value         = lblid.Text;
            objcmd1.Parameters.Add(p31);

            SqlParameter p1 = new SqlParameter();
            p1.ParameterName = "@school";
            p1.SqlDbType     = SqlDbType.NVarChar;
            p1.Value         = lblsch.Text;
            objcmd1.Parameters.Add(p1);

            //Class1.WebMsgBox.Show("2 Added successfully");
            objcmd1.ExecuteNonQuery();
            // Response.Write("Created Successfully");
            objcon1.Close();
        }

        if (FileUpload3.HasFile)
        {
            String photo2 = Path.GetFileName(FileUpload3.FileName);
            FileUpload3.SaveAs(Server.MapPath("~/Teacher/pic/" + photo2));


            string        conn2   = ConfigurationManager.ConnectionStrings["totalschoolConnectionString"].ConnectionString;
            SqlConnection objcon2 = new SqlConnection(conn2);
            objcon2.Open();
            SqlCommand objcmd2 = new SqlCommand("spgal", objcon2);
            objcmd2.CommandType = CommandType.StoredProcedure;

            SqlParameter p22 = new SqlParameter();
            p22.ParameterName = "@pic";
            p22.SqlDbType     = SqlDbType.NVarChar;
            p22.Value         = FileUpload3.FileName;
            objcmd2.Parameters.Add(p22);

            SqlParameter p32 = new SqlParameter();
            p32.ParameterName = "@id";
            p32.SqlDbType     = SqlDbType.NVarChar;
            p32.Value         = lblid.Text;
            objcmd2.Parameters.Add(p32);

            SqlParameter p1 = new SqlParameter();
            p1.ParameterName = "@school";
            p1.SqlDbType     = SqlDbType.NVarChar;
            p1.Value         = lblsch.Text;
            objcmd2.Parameters.Add(p1);

            //Class1.WebMsgBox.Show("3 Added successfully");
            objcmd2.ExecuteNonQuery();
            // Response.Write("Created Successfully");
            objcon2.Close();
        }

        if (FileUpload4.HasFile)
        {
            String photo3 = Path.GetFileName(FileUpload4.FileName);
            FileUpload4.SaveAs(Server.MapPath("~/Teacher/pic/" + photo3));

            string        conn3   = ConfigurationManager.ConnectionStrings["totalschoolConnectionString"].ConnectionString;
            SqlConnection objcon3 = new SqlConnection(conn3);
            objcon3.Open();
            SqlCommand objcmd3 = new SqlCommand("spgal", objcon3);
            objcmd3.CommandType = CommandType.StoredProcedure;

            SqlParameter p23 = new SqlParameter();
            p23.ParameterName = "@pic";
            p23.SqlDbType     = SqlDbType.NVarChar;
            p23.Value         = FileUpload4.FileName;
            objcmd3.Parameters.Add(p23);

            SqlParameter p33 = new SqlParameter();
            p33.ParameterName = "@id";
            p33.SqlDbType     = SqlDbType.NVarChar;
            p33.Value         = lblid.Text;
            objcmd3.Parameters.Add(p33);

            SqlParameter p1 = new SqlParameter();
            p1.ParameterName = "@school";
            p1.SqlDbType     = SqlDbType.NVarChar;
            p1.Value         = lblsch.Text;
            objcmd3.Parameters.Add(p1);

            // Class1.WebMsgBox.Show("4 Added successfully");
            objcmd3.ExecuteNonQuery();
            // Response.Write("Created Successfully");
            objcon3.Close();
        }

        if (FileUpload5.HasFile)
        {
            String photo4 = Path.GetFileName(FileUpload5.FileName);
            FileUpload5.SaveAs(Server.MapPath("~/Teacher/pic/" + photo4));

            string        conn4   = ConfigurationManager.ConnectionStrings["totalschoolConnectionString"].ConnectionString;
            SqlConnection objcon4 = new SqlConnection(conn4);
            objcon4.Open();
            SqlCommand objcmd4 = new SqlCommand("spgal", objcon4);
            objcmd4.CommandType = CommandType.StoredProcedure;

            SqlParameter p24 = new SqlParameter();
            p24.ParameterName = "@pic";
            p24.SqlDbType     = SqlDbType.NVarChar;
            p24.Value         = FileUpload5.FileName;
            objcmd4.Parameters.Add(p24);

            SqlParameter p34 = new SqlParameter();
            p34.ParameterName = "@id";
            p34.SqlDbType     = SqlDbType.NVarChar;
            p34.Value         = lblid.Text;
            objcmd4.Parameters.Add(p34);

            SqlParameter p1 = new SqlParameter();
            p1.ParameterName = "@school";
            p1.SqlDbType     = SqlDbType.NVarChar;
            p1.Value         = lblsch.Text;
            objcmd4.Parameters.Add(p1);

            //Class1.WebMsgBox.Show("5 Added successfully");
            objcmd4.ExecuteNonQuery();
            // Response.Write("Created Successfully");
            objcon4.Close();
        }

        Class1.WebMsgBox.Show("Pics Added to Gallery Successfully");
    }
Ejemplo n.º 24
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (Name.Text != null && Price.Text != null && Selling.Text != null && Brand.SelectedItem.Value != null && Category.SelectedItem.Value != null && Sub.SelectedItem.Value != null && Gender.SelectedItem.Value != null && Description.Text != null && MetCare.Text != null && Productdtl.Text != null)
        {
            string path1 = "";
            path1 = "~/Img/" + FileUpload1.FileName;
            FileUpload1.SaveAs(Server.MapPath(path1));

            string path2 = "";
            path2 = "~/Img/" + FileUpload2.FileName;
            FileUpload2.SaveAs(Server.MapPath(path2));

            string path3 = "";
            path3 = "~/Img/" + FileUpload3.FileName;
            FileUpload3.SaveAs(Server.MapPath(path3));

            string path4 = "";
            path4 = "~/Img/" + FileUpload4.FileName;
            FileUpload4.SaveAs(Server.MapPath(path4));

            string path5 = "";
            path5 = "~/Img/" + FileUpload5.FileName;
            FileUpload5.SaveAs(Server.MapPath(path5));

            SqlCommand cmd = new SqlCommand("sp_Project", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@PName", Name.Text);
            cmd.Parameters.AddWithValue("@PPrice", Price.Text);
            cmd.Parameters.AddWithValue("@PSellPrice", Selling.Text);
            cmd.Parameters.AddWithValue("@PBrand", Brand.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@PCatId", Category.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@SubCatId", Sub.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@PGender", Gender.SelectedItem.Value);
            cmd.Parameters.AddWithValue("@PDesc", Description.Text);
            cmd.Parameters.AddWithValue("@PDetail", Productdtl.Text);
            cmd.Parameters.AddWithValue("@PMet", MetCare.Text);
            cmd.Parameters.AddWithValue("@P1", path1);
            cmd.Parameters.AddWithValue("@P2", path2);
            cmd.Parameters.AddWithValue("@P3", path3);
            cmd.Parameters.AddWithValue("@P4", path4);
            cmd.Parameters.AddWithValue("@P5", path5);

            if (free.Checked == true)
            {
                cmd.Parameters.AddWithValue("@free", 1.ToString());
            }
            else
            {
                cmd.Parameters.AddWithValue("@free", 0.ToString());
            }

            if (txtcod.Checked == true)
            {
                cmd.Parameters.AddWithValue("@COD", 1.ToString());
            }
            else
            {
                cmd.Parameters.AddWithValue("@COD", 0.ToString());
            }
            if (txt30.Checked == true)
            {
                cmd.Parameters.AddWithValue("@replace", 1.ToString());
            }
            else
            {
                cmd.Parameters.AddWithValue("@replace", 0.ToString());
            }
            con.Open();
            int k = (int)cmd.ExecuteNonQuery();

            if (k == 1)
            {
                Response.Write("<Script>alert('Data recorded');/<Script>");
            }
            else
            {
                Response.Write("<Script>alert('Data not recorded');/<Script>");
            }

            con.Close();


            Name.Text    = string.Empty;
            Price.Text   = string.Empty;
            Selling.Text = string.Empty;
            Brand.ClearSelection();
            Category.ClearSelection();
            Sub.ClearSelection();
            Gender.ClearSelection();
            Description.Text = string.Empty;
            MetCare.Text     = string.Empty;
            Productdtl.Text  = string.Empty;
        }
        else
        {
            Response.Write("<Script>alert('Product Cannot be Added');</Script>");
        }
    }
Ejemplo n.º 25
0
        protected void uploadbtn_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["teacher"]))
            {
                HAP.MyFiles.Homework.Homework Homework = new HAP.MyFiles.Homework.Homeworks().Homework.Single(hw => hw.Teacher == Request.QueryString["teacher"] && hw.Name == Request.QueryString["name"] && hw.Start == Request.QueryString["start"].Replace('.', ':') && hw.End == Request.QueryString["end"].Replace('.', ':'));
                ADUser.Authenticate(Homework.Teacher, TokenGenerator.ConvertToPlain(Homework.Token));
            }
            ADUser.Impersonate();
            message.Text = "";
            string       path = Server.UrlDecode(Request.QueryString["path"].Remove(0, 1).Replace('^', '&').Replace("|", "%"));
            string       p    = Request.QueryString["path"].Substring(0, 1);
            DriveMapping unc  = null;

            unc = config.MyFiles.Mappings.FilteredMappings[p.ToCharArray()[0]];
            if (unc == null || !isWriteAuth(unc))
            {
                Response.Redirect(Request.ApplicationPath + "/unauthorised.aspx", true);
            }
            else
            {
                path = Converter.FormatMapping(unc.UNC, ADUser) + path.Replace('/', '\\');
            }
            if (FileUpload1.HasFile && isAuth(Path.GetExtension(FileUpload1.FileName)))
            {
                FileUpload1.SaveAs(Path.Combine(path, (string.IsNullOrEmpty(Request.QueryString["teacher"]) ? "" : User.Identity.Name + " - ") + FileUpload1.FileName)); message.Text += FileUpload1.FileName + " has been uploaded<br />";
            }
            else if (FileUpload1.HasFile)
            {
                message.Text += "Error: " + FileUpload1.FileName + " is a restricted file type<br/>";
            }
            if (FileUpload2.HasFile && isAuth(Path.GetExtension(FileUpload2.FileName)))
            {
                FileUpload2.SaveAs(Path.Combine(path, (string.IsNullOrEmpty(Request.QueryString["teacher"]) ? "" : User.Identity.Name + " - ") + FileUpload2.FileName)); message.Text += FileUpload2.FileName + " has been uploaded<br />";
            }
            else if (FileUpload2.HasFile)
            {
                message.Text += "Error: " + FileUpload2.FileName + " is a restricted file type<br/>";
            }
            if (FileUpload3.HasFile && isAuth(Path.GetExtension(FileUpload3.FileName)))
            {
                FileUpload3.SaveAs(Path.Combine(path, (string.IsNullOrEmpty(Request.QueryString["teacher"]) ? "" : User.Identity.Name + " - ") + FileUpload3.FileName)); message.Text += FileUpload3.FileName + " has been uploaded<br />";
            }
            else if (FileUpload3.HasFile)
            {
                message.Text += "Error: " + FileUpload3.FileName + " is a restricted file type<br/>";
            }
            if (FileUpload4.HasFile && isAuth(Path.GetExtension(FileUpload4.FileName)))
            {
                FileUpload4.SaveAs(Path.Combine(path, (string.IsNullOrEmpty(Request.QueryString["teacher"]) ? "" : User.Identity.Name + " - ") + FileUpload4.FileName)); message.Text += FileUpload4.FileName + " has been uploaded<br />";
            }
            else if (FileUpload4.HasFile)
            {
                message.Text += "Error: " + FileUpload4.FileName + " is a restricted file type<br/>";
            }
            if (FileUpload5.HasFile && isAuth(Path.GetExtension(FileUpload5.FileName)))
            {
                FileUpload5.SaveAs(Path.Combine(path, (string.IsNullOrEmpty(Request.QueryString["teacher"]) ? "" : User.Identity.Name + " - ") + FileUpload5.FileName)); message.Text += FileUpload5.FileName + " has been uploaded<br />";
            }
            else if (FileUpload5.HasFile)
            {
                message.Text += "Error: " + FileUpload5.FileName + " is a restricted file type<br/>";
            }
            if (!string.IsNullOrEmpty(message.Text))
            {
                message.Text = "<div style=\"padding: 4px; color: red;\">" + message.Text + "</div>";
            }
            closeb.Visible = (((Button)sender).ID == "uploadbtnClose");
            ADUser.EndImpersonate();
        }
    protected void btnEkle_Click(object sender, EventArgs e)
    {
        string rsm1, rsm2, rsm3, rsm4, rsm5, video1;

        //Eğer FileUpload Tıklanmıssa ybai resim silmişse
        if (FileUpload1.HasFile && FileUpload1.PostedFile.ContentType == "image/jpeg")
        {
            rsm1 = zaman + ".jpg";
        }
        else
        {
            rsm1 = ""; // file upload tıklanmamışsa boş bırakacak.
        }
        if (FileUpload2.HasFile && FileUpload2.PostedFile.ContentType == "image/jpeg")
        {
            rsm2 = zaman + "2.jpg";
        }
        else
        {
            rsm2 = "";
        }
        if (FileUpload3.HasFile && FileUpload3.PostedFile.ContentType == "image/jpeg")
        {
            rsm3 = zaman + "3.jpg";
        }
        else
        {
            rsm3 = "";
        }
        if (FileUpload4.HasFile && FileUpload4.PostedFile.ContentType == "image/jpeg")
        {
            rsm4 = zaman + "4.jpg";
        }
        else
        {
            rsm4 = "";
        }
        if (FileUpload5.HasFile && FileUpload5.PostedFile.ContentType == "image/jpeg")
        {
            rsm5 = zaman + "5.jpg";
        }
        else
        {
            rsm5 = "";
        }

        if (FileUpload6.HasFile && FileUpload6.PostedFile.ContentType == "video/x-ms-wsv")
        {
            video1 = zaman + ".wmv";
        }
        else
        {
            video1 = "";
        }

        //Kampanyanın işaretli olup olmadığının kontrolunu yaptık eğer tıklanmıssa kampanya ya 1 değerini verdirdik.
        //Tıklanmıs değil ise 0 değerini verdirdik.
        int kampanya;

        if (CheckKampanya.Checked)
        {
            kampanya = 1;
        }
        else
        {
            kampanya = 0;
        }

        // Checkboxun tıklanıp tıklanmadıgının kontrolunu yaptık.
        int yayinD;

        if (CheckYayin.Checked)
        {
            yayinD = 1;
        }
        else
        {
            yayinD = 0;
        }

        // Girilecek olan ürünlerin veri tabanına kayıt işlemini yaptık.
        et.Urunlers.InsertOnSubmit(new Urunler
        {
            AKID      = int.Parse(DropDownList1.SelectedValue), ALTID = int.Parse(DropDownList4.SelectedValue),
            MarkaID   = int.Parse(DropDownList3.SelectedValue), UrunAD = txtUrunAD.Text, UrunDetay = FCKeditor1.Value,
            UrunFiyat = Convert.ToDecimal(txtFiyat.Text), KDV = Convert.ToDecimal(txtKDV.Text),
            Taksit    = FCKeditor2.Value, EklenmeTarihi = Convert.ToDateTime(DateTime.Now),
            Resim1    = rsm1, Resim2 = rsm2, Resim3 = rsm3, Resim4 = rsm4, Resim5 = rsm5, Video = video1, Kampanya = kampanya, YayinDurumu = yayinD
        });


        //Seçilmiş olan ürün resimlerini Urunler adında bir dosya açarak eklenme işlemini yaptık.
        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(Server.MapPath("../Urunler/" + rsm1));
        }
        if (FileUpload2.HasFile)
        {
            FileUpload2.SaveAs(Server.MapPath("../Urunler/" + rsm2));
        }
        if (FileUpload3.HasFile)
        {
            FileUpload3.SaveAs(Server.MapPath("../Urunler/" + rsm3));
        }
        if (FileUpload4.HasFile)
        {
            FileUpload4.SaveAs(Server.MapPath("../Urunler/" + rsm4));
        }
        if (FileUpload5.HasFile)
        {
            FileUpload5.SaveAs(Server.MapPath("../Urunler/" + rsm5));
        }
        if (FileUpload6.HasFile)
        {
            FileUpload6.SaveAs(Server.MapPath("../Urunler/" + video1));
        }
        //veritabanında yapılan değişiklikleri kaydettik.
        et.SubmitChanges();
        // Response.Redirect("Yonetim.aspx?ad=urunler"); // Sayfımızı yeniledik.

        Panel1.Visible = false;
        Panel2.Visible = true;
    }
Ejemplo n.º 27
0
        protected void SaveInfo()
        {
            DateTime DateRange      = new DateTime();
            DateTime DateExpiration = new DateTime();

            if (txtDateRange.Text != "")
            {
                DateRange = DateTime.ParseExact(txtDateRange.Text, "dd/MM/yyyy", null);
            }
            if (txtDateExpiration.Text != "")
            {
                DateExpiration = DateTime.ParseExact(txtDateExpiration.Text, "dd/MM/yyyy", null);
            }
            Cooperative_Info cop = new Cooperative_Info();

            cop.Cooperative_Key    = Convert.ToInt32(lbkey.Text);
            cop.Cooperative_ID     = txtCooperative_ID.Text;
            cop.Cooperative_Name   = txtCooperative_Name.Text;
            cop.ProvincesCities_ID = ddProvincesCitiesID.SelectedValue;
            cop.Address            = txtAddress.Text;
            cop.VietGAPCode        = txtVietGAPCode.Text;
            cop.Phone                 = txtPhone.Text;
            cop.Members               = Convert.ToInt32(txtMembers.Text);
            cop.Area                  = Convert.ToInt32(txtArea.Text);
            cop.Quantity              = Convert.ToInt32(txtQuantity.Text);
            cop.TreeType              = txtTreeType.Text;
            cop.DateRange             = DateRange;
            cop.DateExpiration        = DateExpiration;
            cop.Owner                 = txtOwner.Text;
            cop.Description           = txtDescription.Text;
            cop.CertifiedOrganization = ddCertifiedOrganization.SelectedValue;
            string[] arrListStr = txtlat.Text.Split(',');
            cop.Lat    = arrListStr[0];
            cop.Lng    = arrListStr[1];
            cop.Images = ddImage.SelectedValue;
            if (FileUploadControl.HasFile)
            {
                try
                {
                    string filename = Path.GetFileName(FileUploadControl.FileName);
                    FileUploadControl.SaveAs(Server.MapPath("~/Img/Tree/") + filename);
                    cop.Images = filename;
                }
                catch (Exception ex) {}
            }
            cop.Save();
            Cooperative_Image_Info cooImg = new Cooperative_Image_Info();

            if (FileUpload1.HasFile)
            {
                try{
                    string Name = lbkey.Text + "_1";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img1.png";
                    FileUpload1.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }catch (Exception ex) { }
            }
            if (FileUpload2.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_2";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img2.png";
                    FileUpload2.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload3.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_3";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img3.png";
                    FileUpload3.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload4.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_4";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img4.png";
                    FileUpload4.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload5.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_5";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img5.png";
                    FileUpload5.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload6.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_6";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img6.png";
                    FileUpload6.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload7.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_7";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img7.png";
                    FileUpload7.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload8.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_8";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img8.png";
                    FileUpload8.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload9.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_9";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img9.png";
                    FileUpload9.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
            if (FileUpload10.HasFile)
            {
                try
                {
                    string Name = lbkey.Text + "_10";
                    Cooperative_Image_Info cooImgName = new Cooperative_Image_Info(Name);
                    cooImg.Cooperative_Image_Key = cooImgName.Cooperative_Image_Key;
                    cooImg.Name            = Name;
                    cooImg.Cooperative_Key = Convert.ToInt32(lbkey.Text);
                    cooImg.DateTime        = DateTime.Now;
                    cooImg.Description     = txtCooperative_Name.Text;
                    string filename = lbkey.Text + "_img10.png";
                    FileUpload10.SaveAs(Server.MapPath("~/Img/coop/") + filename);
                    cooImg.Images = "../Img/coop/" + filename;
                    cooImg.Save();
                }
                catch (Exception ex) { }
            }
        }
Ejemplo n.º 28
0
 void imageup()
 {
     if (FileUpload1.HasFile)
     {
         FileUpload1.SaveAs(Server.MapPath("/profilepics/") + FileUpload1.FileName);
         image[1] = "~/profilepics/" + FileUpload1.FileName;
         count++;
     }
     else
     {
         image[1] = "";
     }
     if (FileUpload2.HasFile)
     {
         FileUpload2.SaveAs(Server.MapPath("/profilepics/") + FileUpload2.FileName);
         image[2] = "~/profilepics/" + FileUpload2.FileName;
         count++;
     }
     else
     {
         image[2] = "";
     }
     if (FileUpload3.HasFile)
     {
         FileUpload3.SaveAs(Server.MapPath("/profilepics/") + FileUpload3.FileName);
         image[3] = "~/profilepics/" + FileUpload3.FileName;
         count++;
     }
     else
     {
         image[3] = "";
     }
     if (FileUpload4.HasFile)
     {
         FileUpload4.SaveAs(Server.MapPath("/profilepics/") + FileUpload4.FileName);
         image[4] = "~/profilepics/" + FileUpload4.FileName;
         count++;
     }
     else
     {
         image[4] = "";
     }
     if (FileUpload5.HasFile)
     {
         FileUpload5.SaveAs(Server.MapPath("/profilepics/") + FileUpload5.FileName);
         image[5] = "~/profilepics/" + FileUpload5.FileName;
         count++;
     }
     else
     {
         image[5] = "";
     }
     if (FileUpload6.HasFile)
     {
         FileUpload6.SaveAs(Server.MapPath("/profilepics/") + FileUpload6.FileName);
         image[6] = "~/profilepics/" + FileUpload6.FileName;
         count++;
     }
     else
     {
         image[6] = "";
     }
     if (FileUpload7.HasFile)
     {
         FileUpload7.SaveAs(Server.MapPath("/profilepics/") + FileUpload7.FileName);
         image[7] = "~/profilepics/" + FileUpload7.FileName;
         count++;
     }
     else
     {
         image[7] = "";
     }
     if (FileUpload8.HasFile)
     {
         FileUpload8.SaveAs(Server.MapPath("/profilepics/") + FileUpload8.FileName);
         image[8] = "~/profilepics/" + FileUpload8.FileName;
         count++;
     }
     else
     {
         image[8] = "";
     }
     if (FileUpload9.HasFile)
     {
         FileUpload9.SaveAs(Server.MapPath("/profilepics/") + FileUpload9.FileName);
         image[9] = "~/profilepics/" + FileUpload9.FileName;
         count++;
     }
     else
     {
         image[9] = "";
     }
     if (FileUpload10.HasFile)
     {
         FileUpload10.SaveAs(Server.MapPath("/profilepics/") + FileUpload10.FileName);
         image[10] = "~/profilepics/" + FileUpload10.FileName;
         count++;
     }
     else
     {
         image[10] = "";
     }
 }
    protected void btnsubmit_Click(object sender, EventArgs e)
    {
        string temp = null, temp1 = null, temp2 = null, temp3 = null, temp4 = null;

        if (FileUpload1.HasFile)
        {
            temp = "~/img/" + FileUpload1.FileName;
            FileUpload1.SaveAs(Server.MapPath(temp));
        }


        if (FileUpload2.HasFile)
        {
            temp1 = "~/img/" + FileUpload2.FileName;
            FileUpload2.SaveAs(Server.MapPath(temp1));
        }

        if (FileUpload3.HasFile)
        {
            temp2 = "~/img/" + FileUpload3.FileName;
            FileUpload3.SaveAs(Server.MapPath(temp2));
        }

        if (FileUpload4.HasFile)
        {
            temp3 = "~/img/" + FileUpload4.FileName;
            FileUpload4.SaveAs(Server.MapPath(temp3));
        }


        if (FileUpload5.HasFile)
        {
            temp4 = "~/img/" + FileUpload5.FileName;
            FileUpload5.SaveAs(Server.MapPath(temp4));
        }



        SqlParameter pid         = new SqlParameter("@projectid", txtProjectId.Text);
        SqlParameter description = new SqlParameter("@description", txtdescription.Text);
        SqlParameter image1      = new SqlParameter("@image1", temp);
        SqlParameter image2      = new SqlParameter("@image2", temp1);
        SqlParameter image3      = new SqlParameter("@image3", temp2);
        SqlParameter image4      = new SqlParameter("@image4", temp3);
        SqlParameter video       = new SqlParameter("@video", FileUpload5.FileName);

        SqlParameter[] pdata = new SqlParameter[7] {
            pid, description, image1, image2, image3, image4, video
        };

        try
        {
            int x = bobj.insert("projectdetailInfo", pdata);
            if (x != 0)
            {
                lblerror.Visible = true;
                lblerror.Text    = "Successfully Inserted";
            }
        }
        catch (Exception ex)
        {
            lblerror.Visible = true;
            lblerror.Text    = ex.Message;
        }
    }
Ejemplo n.º 30
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        try
        {
            bl.id       = Convert.ToInt32(Request.QueryString["id"].ToString());
            bl.comp_nm  = txt_cmp.Text;
            bl.address1 = txt_add1.Text;
            bl.address2 = txt_add2.Text;
            bl.state_id = Convert.ToInt32(dwd_st.SelectedValue.ToString());

            bl.city_id  = Convert.ToInt32(dwd_ct.SelectedValue.ToString());
            bl.range    = txt_range.Text;
            bl.division = txt_division.Text;
            bl.phone    = txt_phn.Text;
            // bl.vat_1 = dwd_vat.Text;
            //bl.tax_4 = DropDownList1.Text;
            // bl.ecc_p = dwd_exc.Text;
            bl.openinig_date = txt_form.Text;

            if (FileUpload7.HasFile)
            {
                string filename = Path.GetFileName(FileUpload7.FileName);
                FileUpload7.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "." + Path.GetExtension(FileUpload7.FileName));
                filename = "img/" + txt_cmp.Text + "logo." + Path.GetExtension(FileUpload7.FileName);
                bl.logo  = filename;
            }
            else
            {
                bl.logo = dd_logo.NavigateUrl;
            }
            bl.vat     = txt_vat.Text;
            bl.vatdate = txt_dt.Text;
            if (FileUpload1.HasFile)
            {
                string filename = Path.GetFileName(FileUpload1.FileName);
                FileUpload1.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "vat." + Path.GetExtension(FileUpload1.FileName));
                filename  = "img/" + txt_cmp.Text + "vat." + Path.GetExtension(FileUpload1.FileName);
                bl.vatcrt = filename;
            }
            else
            {
                bl.vatcrt = dd_vat_crt.NavigateUrl;
            }
            bl.cst      = txt_cst.Text;
            bl.cst_date = txt_cstdt.Text;
            if (FileUpload2.HasFile)
            {
                string filename = Path.GetFileName(FileUpload2.FileName);
                FileUpload2.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "cst." + Path.GetExtension(FileUpload2.FileName));
                filename = "img/" + txt_cmp.Text + "cst." + Path.GetExtension(FileUpload2.FileName);
                bl.cts   = filename;
            }
            else
            {
                bl.cts = dd_cst_crt.NavigateUrl;
            }
            bl.exse      = txt_exse.Text;
            bl.exse_date = txt_exedt.Text;

            if (FileUpload3.HasFile)
            {
                string filename = Path.GetFileName(FileUpload3.FileName);
                FileUpload3.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "ecc." + Path.GetExtension(FileUpload3.FileName));
                filename    = "img/" + txt_cmp.Text + "ecc." + Path.GetExtension(FileUpload3.FileName);
                bl.exse_crt = filename;
            }
            else
            {
                bl.exse_crt = dd_exc_crt.NavigateUrl;
            }
            bl.st     = txt_st.Text;
            bl.stdate = txt_stdt.Text;

            if (FileUpload4.HasFile)
            {
                string filename = Path.GetFileName(FileUpload4.FileName);
                FileUpload4.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "st." + Path.GetExtension(FileUpload4.FileName));
                filename  = "img/" + txt_cmp.Text + "st." + Path.GetExtension(FileUpload4.FileName);
                bl.st_crt = filename;
            }
            else
            {
                bl.st_crt = dd_st_crt.NavigateUrl;
            }

            bl.tds      = txt_tds.Text;
            bl.tds_date = txt_tdsdt.Text;

            if (FileUpload8.HasFile)
            {
                string filename = Path.GetFileName(FileUpload8.FileName);
                FileUpload7.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "." + Path.GetExtension(FileUpload8.FileName));
                filename   = "img/" + txt_cmp.Text + "tds." + Path.GetExtension(FileUpload8.FileName);
                bl.tds_crt = filename;
            }
            else
            {
                bl.tds_crt = dd_tds_crt.NavigateUrl;
            }
            bl.cin = txt_cin.Text;

            if (FileUpload5.HasFile)
            {
                string filename = Path.GetFileName(FileUpload5.FileName);
                FileUpload5.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "cin." + Path.GetExtension(FileUpload5.FileName));
                filename  = "img/" + txt_cmp.Text + "cin." + Path.GetExtension(FileUpload5.FileName);
                bl.cincrt = filename;
            }
            else
            {
                bl.cincrt = dd_cin_crt.NavigateUrl;
            }
            bl.pan = txt_pan.Text;

            if (FileUpload6.HasFile)
            {
                string filename = Path.GetFileName(FileUpload6.FileName);
                FileUpload6.SaveAs(Server.MapPath("~/img/") + txt_cmp.Text + "pan." + Path.GetExtension(FileUpload6.FileName));
                filename  = "img/" + txt_cmp.Text + "pan." + Path.GetExtension(FileUpload6.FileName);
                bl.pancrt = filename;
            }
            else
            {
                bl.pancrt = dd_pan_crt.NavigateUrl;
            }
            bl.website    = txt_website.Text;
            bl.email      = txt_email.Text;
            bl.mobile     = txt_mobile.Text;
            bl.pin_code   = txt_pincd.Text;
            bl.comissinrt = txt_comis_rt.Text;
            bl.notfy      = txt_not_under.Text;
            dl.update_comapnymaster(bl);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "redirect", "alert('Comapany Master update successfully'); window.location='edit_cmp.aspx';", true);
        }
        catch
        {
        }
    }