コード例 #1
0
        protected void Butstud_Click(object sender, EventArgs e)
        {
            if (Textstud1.Text == "")
            {
                Labmsg.Text      = "ENTER DATA...!";
                Labmsg.ForeColor = System.Drawing.Color.DarkRed;
            }
            else
            {
                String        constring = "Data Source=LAPTOP-7GMLR3NS;Initial Catalog=managementsystem;Integrated Security=True";
                SqlConnection sqlcon    = new SqlConnection(constring);
                FileUpload1.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload1.FileName));
                String link = "images" + Path.GetFileName(FileUpload1.FileName);
                FileUpload2.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload2.FileName));
                String link1 = "images" + Path.GetFileName(FileUpload2.FileName);
                FileUpload3.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload3.FileName));
                String link2 = "images" + Path.GetFileName(FileUpload3.FileName);
                FileUpload4.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload4.FileName));
                String     link3 = "images" + Path.GetFileName(FileUpload4.FileName);
                String     query = "Insert into Student_Documents(StudentName,StudentId,profileimg,aadharimg,sscimg,hscimg) values('" + Textstud1.Text + "','" + Textstud2.Text + "','" + link + "','" + link1 + "','" + link2 + "','" + link3 + "')";
                SqlCommand cmd   = new SqlCommand(query, sqlcon);
                sqlcon.Open();
                cmd.ExecuteNonQuery();
                Labmsg.Text      = "SAVED SUCCESSFULLY...!";
                Labmsg.ForeColor = System.Drawing.Color.DarkGreen;
                sqlcon.Close();

                Textstud1.Text = "";
                Textstud2.Text = "";
            }
        }
コード例 #2
0
    protected void btnSua_Click(object sender, EventArgs e)
    {
        try
        {
            admins a = new admins();
            a.admin_id = int.Parse(txtid.Text);
            a.phone    = txtphone.Text;
            a.password = txtpassword.Text;
            a.email    = txtemail.Text;
            a.address  = txtaddress.Text;

            if (FileUpload3.HasFile)
            {
                string fileName = "images/" + FileUpload3.FileName;
                string filePath = MapPath(fileName);
                FileUpload3.SaveAs(filePath);
                a.avatar = FileUpload3.FileName;
            }
            data.Capnhatadmin(a);
            msg.Text = "Bạn cập nhật thành công.";
        }
        catch (Exception ex)
        {
            msg.Text = "Có lỗi:" + ex;
        }
    }
コード例 #3
0
    protected void btnHRegister_Click(object sender, EventArgs e)
    {
        string imagefile = "notavailable.jpg";

        if (FileUpload3.HasFile) //checking whether the file upload has the file
        {
            imagefile = FileUpload3.FileName;
            FileUpload3.SaveAs(Server.MapPath("~/images/" + imagefile));//store the file in the images folder
        }
        //hotel
        Random rndRandom = new Random();
        int    newLicNo  = rndRandom.Next(1, 1000);
        Hotel  h         = new Hotel()
        {
            OrgEmail     = tbxHEmail.Text,
            Name         = tbxHName.Text,
            RegID        = tbxHRegID.Text,
            Address      = tbxHAddress.Text,
            PostalCode   = tbxHPostalCode.Text,
            City         = tbxHCity.Text,
            Country      = tbxHCountry.Text,
            Password     = tbxHPassword.Text,
            ContactNo    = tbxHPhone.Text,
            Description  = "Not Applicable",
            License      = "SH" + newLicNo,
            StarRating   = Convert.ToInt32(5),
            Photo        = imagefile,
            Verification = false
        };
        int id = HotelDB.insertHotel(h);

        lblOutput.Text = id + "Registered Successfully!";
    }
コード例 #4
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            Product p = new Product();

            p.ProductName = TxtPname.Text;
            p.Description = TxtDescription.Text;
            p.CategoryId  = int.Parse(DropDownList1.SelectedItem.Value);
            p.Weight      = TxtWeight.Text;
            p.Price       = int.Parse(TxtPrice.Text);
            p.Dimentions  = TxtDiamentions.Text;
            p.Composition = TxtCompositions.Text;
            p.SizeDfit    = TxtSizeDfit.Text;
            p.OtherInfo   = TxtOtherInfo.Text;
            p.Size        = TxtSize.Text;
            p.Color       = TxtColor.Text;
            p.Pimage1     = FileUpload1.FileName;
            p.Pimage2     = FileUpload2.FileName;
            p.Pimage3     = FileUpload3.FileName;
            p.Pimage4     = FileUpload4.FileName;
            FileUpload1.SaveAs(Server.MapPath("~/Image/" + FileUpload1.FileName));
            FileUpload2.SaveAs(Server.MapPath("~/image/" + FileUpload2.FileName));
            FileUpload3.SaveAs(Server.MapPath("~/image/" + FileUpload3.FileName));
            FileUpload4.SaveAs(Server.MapPath("~/image/" + FileUpload4.FileName));
            ProductHelper.InsertProduct(p);
            Response.Redirect("AddProduct");
        }
コード例 #5
0
    protected void btnThem_Click(object sender, EventArgs e)
    {
        try
        {
            admins a = new admins();
            a.phone    = txtphone.Text;
            a.password = txtpassword.Text;
            a.email    = txtemail.Text;
            a.address  = txtaddress.Text;
            //a.avatar = txtavartar.Text;

            {
                string fileName = "images/" + FileUpload3.FileName;
                string filePath = MapPath(fileName);
                FileUpload3.SaveAs(filePath);
                a.avatar = FileUpload3.FileName;
            }
            data.Themadmin(a);
            msg.ForeColor = System.Drawing.Color.Red;
            msg.Text      = "Thêm thành công";
        }
        catch (Exception ex)
        {
            msg.Text = "Không thêm được,có lỗi:" + ex.Message;
        }
    }
コード例 #6
0
        protected void Button13_Click(object sender, EventArgs e)
        {
            try
            {
                if (FileUpload3.HasFile)
                {
                    FileUpload3.SaveAs(Server.MapPath("dosyalar\\kampanyalar\\") + FileUpload3.FileName);
                    link2 = FileUpload3.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 kampanyalar (kampanyabaslik,kampanyaresim,kampanyaaciklama,kbast,kbitt) Values ('" + TextBox12.Text + "','" + link2 + "','" + TextBox13.Text + "','" + TextBox14.Text + "','" + TextBox15.Text + "')";
                    cmd.ExecuteNonQuery();
                    baglanti.Close();
                    texttemizle();
                    kampanyagetir();
                }
                else
                {
                    Response.Write("Dosya Seçin");
                }
            }
            catch { baglanti.Close();
                    Response.Write("Veri Tabanı Hatası Verdi Kayıt Yapılamadı Tekrar Deneyiniz!!!!"); }
        }
コード例 #7
0
        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));
            }
        }
コード例 #8
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        FileUpload1.SaveAs(Server.MapPath("~/img/") + FileUpload1.FileName);
        FileUpload2.SaveAs(Server.MapPath("~/img/") + FileUpload2.FileName);
        FileUpload3.SaveAs(Server.MapPath("~/img/") + FileUpload3.FileName);
        FileUpload4.SaveAs(Server.MapPath("~/img/") + FileUpload3.FileName);
        int inst = DsAdapter.Insert(txtiname.Text, txtdescrip.Text, Convert.ToDouble(txtprice.Text), "~/img/" + FileUpload1.FileName, Convert.ToInt32(txtquan.Text), DropDownList1.SelectedItem.Text, "~/img/" + FileUpload2.FileName, "~/img/" + FileUpload3.FileName, "~/img/" + FileUpload4.FileName, txtmodel.Text, drpcolor.SelectedItem.Text, drptouch.SelectedItem.Text, drpsim.SelectedItem.Text, txtram.Text, drpmemory.SelectedItem.Text, txtdisplay.Text, txtcamera.Text, txtbattery.Text);

        IDT = DsAdapter.select();
        GridView1.DataSource = IDT;
        GridView1.DataBind();
        txtdescrip.Text             = "";
        txtiname.Text               = "";
        txtprice.Text               = "";
        txtmodel.Text               = "";
        txtdisplay.Text             = "";
        txtbattery.Text             = "";
        txtcamera.Text              = "";
        txtram.Text                 = "";
        drpsim.SelectedIndex        = 0;
        drptouch.SelectedIndex      = 0;
        drpmemory.SelectedIndex     = 0;
        drpcolor.SelectedIndex      = 0;
        txtquan.Text                = "";
        drpcolor.SelectedIndex      = 0;
        DropDownList1.SelectedIndex = 0;
        lblmsg.Text                 = "Items Added Successfully";
    }
コード例 #9
0
 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;
     }
 }
コード例 #10
0
    protected void CreateUserWizard1_CreatedUser(object sender, EventArgs e)
    {
        //image
        string s = CreateUserWizard1.UserName;

        string[] ex = FileUpload1.FileName.Split('.');
        FileUpload1.SaveAs(Server.MapPath(@"~\Emp_image\" + s + "." + ex[1]));
        string photo = @"~\Emp_image\" + s + "." + ex[1];

        //cv
        string s1 = CreateUserWizard1.UserName;

        string[] ex1 = FileUpload2.FileName.Split('.');
        FileUpload2.SaveAs(Server.MapPath(@"~\Emp_cv\" + s1 + "." + ex1[1]));
        string cv = @"~\Emp_cv\" + s1 + "." + ex1[1];

        //signature
        string s2 = CreateUserWizard1.UserName;

        string[] ex2 = FileUpload3.FileName.Split('.');
        FileUpload3.SaveAs(Server.MapPath(@"~\Emp_signature\" + s2 + "." + ex2[1]));
        string sign = @"~\Emp_signature\" + s2 + "." + ex2[1];

        obj.insert_li(photo, cv, sign, CreateUserWizard1.UserName, CreateUserWizard1.Password, CreateUserWizard1.Email, CreateUserWizard1.Question, CreateUserWizard1.Answer);
        Session["user"] = CreateUserWizard1.UserName.ToString();
        Response.Redirect("personal refrence.aspx");
    }
コード例 #11
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));
            }
        }
コード例 #12
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     string desig = "2";
     string gen;
     if (RadioButton3.Checked == true)
         gen = "Male";
     else
         gen = "Female";
     string file1 = "";
     string file2 = "";
     string toPath1 = "";
     string toPath2 = "";
     file1 = FileUpload3.FileName.ToString();
     file2 = FileUpload4.FileName.ToString();
     toPath1 = Server.MapPath(".") + "/epics/" + file1;
     toPath2 = Server.MapPath(".") + "/proof/" + file2;
     if (FileUpload3.HasFile)
         FileUpload3.SaveAs(toPath1);
     if (FileUpload4.HasFile)
         FileUpload4.SaveAs(toPath2);
     string f1 = "";
     string f2 = "";
     string.Format("~/epics/{0}", f1);
     string.Format("~/proof/{0}", f2);
     con.Open();
     string s2 = "insert into etbl values('" + Label7.Text + "','" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox3.Text + "','" + desig + "','" + TextBox5.Text + "','" + file1 + "','" + file2 + "','" + TextBox6.Text + "','"+gen+"')";
     SqlCommand cmd2 = new SqlCommand(s2, con);
     cmd2.ExecuteNonQuery();
     MessageBox.Show("Employee added succesfully.");
     con.Close();
     Response.Redirect("addemp.aspx");
 }
コード例 #13
0
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        if (TextBox1.Text == "" || TextBox2.Text == "" || TextBox3.Text == "" || TextBox4.Text == "" || !FileUpload1.HasFile || !FileUpload2.HasFile || !FileUpload3.HasFile || !FileUpload4.HasFile || TextBox16.Text == "" || TextBox17.Text == "" || TextBox18.Text == "" || TextBox19.Text == "" || TextBox20.Text == "")
        {
            Label1.Text = "Please innput all the data";
        }
        else
        {
            String pic1, pic2, pic3, pic4;
            cn.Open();

            pic1 = "~/post/" + FileUpload1.FileName;
            FileUpload1.SaveAs(MapPath(pic1));

            pic2 = "~/post/" + FileUpload2.FileName;
            FileUpload2.SaveAs(MapPath(pic2));

            pic3 = "~/post/" + FileUpload3.FileName;
            FileUpload3.SaveAs(MapPath(pic3));

            pic4 = "~/post/" + FileUpload4.FileName;
            FileUpload4.SaveAs(MapPath(pic4));

            cmd = new SqlCommand("Insert into house values('" + TextBox1.Text + "','" + TextBox2.Text + "','" + TextBox5.Text + "','" + TextBox3.Text + "','" + TextBox4.Text + "','" + pic1 + "','" + pic2 + "','" + pic3 + "','" + pic4 + "','" + TextBox16.Text + "','" + TextBox17.Text + "','" + TextBox18.Text + "','" + TextBox19.Text + "','" + TextBox20.Text + "')", cn);
            cmd.ExecuteNonQuery();
            cn.Close();
            Response.Write("<Script>alert('Thank you for joing us')</Script>");
            Response.Write("<Script>location.href = 'menubar.aspx';</Script>");
        }
    }
コード例 #14
0
        protected void Butfac_Click(object sender, EventArgs e)
        {
            if (Textfac1.Text == "")
            {
                Labmsg.Text      = "ENTER DATA...!";
                Labmsg.ForeColor = System.Drawing.Color.DarkRed;
            }
            else
            {
                String        constring = "Data Source=LAPTOP-T30095AD;Initial Catalog=managementsystem;Integrated Security=True";
                SqlConnection sqlcon    = new SqlConnection(constring);
                FileUpload1.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload1.FileName));
                String link4 = "images" + Path.GetFileName(FileUpload1.FileName);
                FileUpload2.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload2.FileName));
                String link5 = "images" + Path.GetFileName(FileUpload2.FileName);
                FileUpload3.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload3.FileName));
                String link6 = "images" + Path.GetFileName(FileUpload3.FileName);
                FileUpload4.SaveAs(Server.MapPath("images") + Path.GetFileName(FileUpload4.FileName));
                String     link7 = "images" + Path.GetFileName(FileUpload4.FileName);
                String     query = "Insert into Faculty_Documents(facultyName,facultyId,profileimg,aadharcard,othercard1,othercard2) values('" + Textfac1.Text + "','" + Textfac2.Text + "','" + link4 + "','" + link5 + "','" + link6 + "','" + link7 + "')";
                SqlCommand cmd   = new SqlCommand(query, sqlcon);
                sqlcon.Open();
                cmd.ExecuteNonQuery();
                Labmsg.Text      = "SAVED SUCCESSFULLY...!";
                Labmsg.ForeColor = System.Drawing.Color.DarkGreen;
                sqlcon.Close();

                Textfac1.Text = "";
                Textfac2.Text = "";
            }
        }
コード例 #15
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";
    }
コード例 #16
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            string ext = Path.GetExtension(FileUpload3.FileName);

            Console.WriteLine(ext);
            if (FileUpload3.HasFile)
            {
                if (ext.Equals(".xml"))
                {
                    FileUpload3.SaveAs(Server.MapPath("~/ArchivosXml/Productos.xml"));
                    try
                    {
                        CargarProductos();
                        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>");
            }
        }
コード例 #17
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 = "";
    }
コード例 #18
0
        protected void btnEkle_Click(object sender, EventArgs e)
        {
            FileUpload1.SaveAs(Server.MapPath("/Resim/") + FileUpload1.FileName);
            FileUpload2.SaveAs(Server.MapPath("/Resim/") + FileUpload2.FileName);
            FileUpload3.SaveAs(Server.MapPath("/Resim/") + FileUpload3.FileName);

            objConn.Open();
            OleDbCommand objCmd = new OleDbCommand("insert into urun(urun_ad,urun_fiyat,urun_yapimci,urun_kategori,urun_stok,on_siparis,urun_aciklama,urun_tarih,urun_resim,urun_resim1,urun_resim2) values(@a,@b,@c,@d,@e,@f,@g,@z,@x,@w,@k)", objConn);

            objCmd.Parameters.AddWithValue("@a", txtAd.Text);
            objCmd.Parameters.AddWithValue("@b", Convert.ToInt32(txtFiyat.Text));
            objCmd.Parameters.AddWithValue("@c", ddlYapimci.SelectedIndex);
            objCmd.Parameters.AddWithValue("@d", ddlKategori.SelectedIndex + 1);
            objCmd.Parameters.AddWithValue("@e", ddlStok.SelectedIndex);
            objCmd.Parameters.AddWithValue("@f", ddlOnSiparis.SelectedIndex);
            objCmd.Parameters.AddWithValue("@g", txtAciklama.Text);
            objCmd.Parameters.AddWithValue("@z", Convert.ToDateTime(txtTarih.Text));
            objCmd.Parameters.AddWithValue("@x", "/Resim/" + FileUpload1.FileName);
            objCmd.Parameters.AddWithValue("@w", "/Resim/" + FileUpload2.FileName);
            objCmd.Parameters.AddWithValue("@k", "/Resim/" + FileUpload3.FileName);
            objCmd.ExecuteNonQuery();
            objConn.Close();
            Response.Write("<script language='JavaScript'>alert('Kayıt Başarılı');</script>");
            txtAd.Text       = "";
            txtAciklama.Text = "";
            txtFiyat.Text    = "";
        }
コード例 #19
0
        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....";
            }
        }
コード例 #20
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string filePath1 = "C:\\ASP2019\\0322ASP\\rmimg\\" + FileUpload1.FileName;
        string filePath2 = "C:\\ASP2019\\0322ASP\\rmimg\\" + FileUpload2.FileName;
        string filePath3 = "C:\\ASP2019\\0322ASP\\rmimg\\" + FileUpload3.FileName;

        FileUpload1.SaveAs(filePath1);
        FileUpload2.SaveAs(filePath2);
        FileUpload3.SaveAs(filePath3);


        string imageUrl1 = "~/rmimg/" + FileUpload1.FileName;
        string imageUrl2 = "~/rmimg/" + FileUpload2.FileName;
        string imageUrl3 = "~/rmimg/" + FileUpload3.FileName;


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

        cmd.CommandType = CommandType.StoredProcedure;
        cmd.Parameters.AddWithValue("@rmimg1", imageUrl1);
        cmd.Parameters.AddWithValue("@rmimg2", imageUrl2);
        cmd.Parameters.AddWithValue("@rmimg3", imageUrl3);

        con.Open();
        cmd.ExecuteNonQuery();
        con.Close();



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

        cmd1.CommandType = CommandType.StoredProcedure;

        cmd1.Parameters.AddWithValue("@rmname", RoomName.Text);
        cmd1.Parameters.AddWithValue("@rmpeo", DropDownList1.SelectedValue);
        cmd1.Parameters.AddWithValue("@rmprc", RoomPrice.Text);
        cmd1.Parameters.AddWithValue("@rmcom", RoomComment.Text);
        cmd1.Parameters.AddWithValue("@residx", residx);

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

        SqlConnection con2 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyAspDB"].ConnectionString);
        SqlCommand    cmd2 = new SqlCommand("RoomInsert9", con2);

        cmd2.CommandType = CommandType.StoredProcedure;

        cmd2.Parameters.AddWithValue("@rmfri", RMFRI);
        cmd2.Parameters.AddWithValue("@rmair", RMAIR);
        cmd2.Parameters.AddWithValue("@rmbat", RMBAT);
        cmd2.Parameters.AddWithValue("@rmtv", RMTV);

        con2.Open();
        cmd2.ExecuteNonQuery();
        con2.Close();
    }
コード例 #21
0
        protected void btnaddrest_Click(object sender, EventArgs e)
        {
            if (RadioButtonList1.SelectedIndex < 0)
            {
                Response.Write("<script>alert('Thank you for rating us');</script>");
                Response.Redirect(Request.RawUrl);
            }

            int feenum = 0;

            coon.Open();
            int            rescode = 0;
            string         restCode;
            string         query1 = "SELECT MAX(Res_Code) FROM tblrestaurant";
            OdbcCommand    cmd1   = new OdbcCommand(query1, coon);
            OdbcDataReader adt    = cmd1.ExecuteReader();

            while (adt.Read())
            {
                rescode = Convert.ToInt32(adt[0].ToString().Substring(1, 2)) + 1;
            }
            restCode = "R" + rescode;
            if (FileUpload3.HasFile && FileUpload4.HasFile)
            {
                FileUpload3.SaveAs(Server.MapPath("~/Restaurants/" + FileUpload3.FileName));
                FileUpload4.SaveAs(Server.MapPath("~/Restaurants/" + FileUpload3.FileName));
                lbllogo.Text      = "File Uploaded";
                lblupl2.Text      = "File Uploaded";
                lbllogo.Visible   = true;
                lblupl2.Visible   = true;
                lbllogo.ForeColor = System.Drawing.Color.Green;
                lblupl2.ForeColor = System.Drawing.Color.Green;
                string imagename  = FileUpload3.FileName;
                string imagename2 = FileUpload4.FileName;
                string path       = "~//Restaurants//" + imagename.ToString();
                string path2      = "~//Restaurants//" + imagename2.ToString();

                feenum = Convert.ToInt32(RadioButtonList1.SelectedItem.Value);

                string      query  = "INSERT INTO  tblpayment(Payment_Date,Fee_Num,Res_Code) VALUES('" + DateTime.Now.ToShortDateString() + "','" + feenum + "','" + restCode + "')";
                string      query2 = "INSERT INTO  tblrestaurant(Res_Code,Res_Name,Res_TelNo,Res_Town,Res_Logo,Res_Loc,Res_Web,Res_Address) VALUES('" + restCode + "','" + txtname.Text + "','" + txttell.Text + "','" + DropDownList1.SelectedValue + "','" + path + "','" + path2 + "','" + txtwb.Text + "','" + txtwb.Text + "')";
                OdbcCommand cmd2   = new OdbcCommand(query2, coon);
                OdbcCommand cmd    = new OdbcCommand(query, coon);
                cmd2.ExecuteNonQuery();
                cmd.ExecuteNonQuery();
                lbladdedRes.Text    = "Restuarent Added within 3 working days";
                lbladdedRes.Visible = true;
            }
            else
            {
                lbllogo.Text      = "File Not Uploaded";
                lblupl2.Text      = "File Not Uploaded";
                lbllogo.Visible   = true;
                lblupl2.Visible   = true;
                lbllogo.ForeColor = System.Drawing.Color.Red;
                lblupl2.ForeColor = System.Drawing.Color.Red;
            }
        }
コード例 #22
0
        protected void btn第三張圖_Click(object sender, EventArgs e)
        {
            //string path = Server.MapPath("..");
            //FileUpload3.SaveAs(path + @"\headImg\3.jpg");
            string path = Server.MapPath(@"\.\headImg\3.jpg");

            //FileUpload3.SaveAs(@"\.\headImg\3.jpg");
            FileUpload3.SaveAs(path);
        }
 protected void Button4_Click(object sender, EventArgs e)
 {
     if (FileUpload3.PostedFile != null)
     {
         string FileName = Path.GetFileName(FileUpload3.PostedFile.FileName);
         //Save files to images folder
         FileUpload3.SaveAs(Server.MapPath("Images/" + FileName));
         this.Image3.ImageUrl = "Images/" + FileName;
     }
 }
コード例 #24
0
ファイル: BS_連結.aspx.cs プロジェクト: redmars000/KSYY
 protected void btn第三張圖_Click(object sender, EventArgs e)
 {
     if (FileUpload3.HasFile)
     {
         string savePath = Server.MapPath(@"/./images/3.jpg");
         FileUpload3.SaveAs(savePath);
         lbl3.Visible = true;
         lbl3.Text    = "上傳成功";
     }
 }
コード例 #25
0
    private void UpLoadAndDisplay2()
    {
        string imgName = FileUpload3.FileName;
        string imgPath = "/assets/image/" + "Question" + imgName;
        int    imgSize = FileUpload3.PostedFile.ContentLength;

        if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.FileName != "")
        {
            FileUpload3.SaveAs(Server.MapPath(imgPath));
            Image3.ImageUrl = ".." + imgPath;
        }
    }
コード例 #26
0
 protected void BtnFert1_Click(object sender, EventArgs e)
 {
     if ((TBFert1.Text == "") && (TBFert2.Text == "") && (TBFert3.Text == ""))
     {
         LblResult.Text    = "Enter the required Fields";
         LblResult.Visible = true;
         return;
     }
     else
     {
         if (FileUpload3.HasFile)
         {
             try
             {
                 if (FileUpload3.PostedFile.ContentType == "image/jpeg")
                 {
                     if
                     (FileUpload3.PostedFile.ContentLength < 512000)
                     {
                         string filename = Path.GetFileName(FileUpload3.FileName);
                         FileUpload3.SaveAs(Server.MapPath("store/" + FileUpload3.FileName));
                         LblResult.Text    = "File uploaded successfully!";
                         LblResult.Visible = true;
                     }
                     else
                     {
                         LblResult.Text = "File maximum size is 500 Kb";
                     }
                 }
                 else
                 {
                     LblResult.Text = "Only JPEG files are accepted!";
                 }
             }
             catch
             (Exception exc)
             {
                 LblResult.Text = "The file could not be uploaded. The following error occured: " + exc.Message;
             }
         }
         mycon = new SqlConnection(con);
         mycon.Open();
         //   FileUpload3.SaveAs(Server.MapPath("store/" + FileUpload3.FileName));
         string insert = "insert into Krishibhavan.dbo.online(type,name,description,prize,picture) values('fertilizer','" + TBFert1.Text + "','" + TBFert2.Text + "','" + TBFert3.Text + "','store/" + FileUpload3.FileName + "')";
         cmd = new SqlCommand(insert, mycon);
         cmd.ExecuteNonQuery();
         mycon.Close();
         Panel1.Visible    = false;
         LblResult.Text    = "New Fertilizer Added Successfully";
         LblResult.Visible = true;
     }
 }
コード例 #27
0
ファイル: GetCode.aspx.cs プロジェクト: uwitec/ideacode
    //上传主动邀请图片
    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>");
        }
    }
コード例 #28
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        String validFiles = "gif, jpg, bmp, png, GIF, JPG, BMP, PNG";

        if (FileUpload2.HasFile && FileUpload2.Enabled == true)
        {
            String         filename = FileUpload2.FileName;
            HttpPostedFile file     = FileUpload2.PostedFile;

            if (file.ContentLength > 0)
            {
                if (validFiles.IndexOf(filename.Substring(filename.LastIndexOf(".") + 1)) > 0)
                {
                    String filepath = Server.MapPath("Hinh Anh\\") + "\\" + filename;
                    FileUpload2.SaveAs(filepath);

                    XmlDocument Tai_lieu = new XmlDocument();
                    XmlElement  Cong_ty  = null;

                    Tai_lieu.Load(Server.MapPath("He Phuc Vu/CONG_TY.xml"));
                    Cong_ty = Tai_lieu.DocumentElement;

                    Cong_ty.SetAttribute("Logo", "./Hinh Anh/" + filename);
                    Tai_lieu.Save(Server.MapPath("He Phuc Vu/CONG_TY.xml"));
                }
            }
        }

        if (FileUpload3.HasFile && FileUpload3.Enabled == true)
        {
            String         filename = FileUpload3.FileName;
            HttpPostedFile file     = FileUpload3.PostedFile;

            if (file.ContentLength > 0)
            {
                if (validFiles.IndexOf(filename.Substring(filename.LastIndexOf(".") + 1)) > 0)
                {
                    String filepath = Server.MapPath("Hinh Anh\\") + "\\" + filename;
                    FileUpload3.SaveAs(filepath);

                    XmlDocument Tai_lieu = new XmlDocument();
                    XmlElement  Cong_ty  = null;

                    Tai_lieu.Load(Server.MapPath("He Phuc Vu/CONG_TY.xml"));
                    Cong_ty = Tai_lieu.DocumentElement;

                    Cong_ty.SetAttribute("Banner", "./Hinh Anh/" + filename);
                    Tai_lieu.Save(Server.MapPath("He Phuc Vu/CONG_TY.xml"));
                }
            }
        }
    }
コード例 #29
0
 protected void UploadButton_Click3(object sender, EventArgs e)
 {
     if (FileUpload3.HasFile)
     {
         string theFileName = Path.Combine(Server.MapPath("~/Assets/PDF/"), FileUpload3.FileName);
         if (File.Exists(theFileName))
         {
             File.Delete(theFileName);
         }
         FileUpload3.SaveAs(theFileName);
         SavePDFUpload(FileUpload3.FileName, "Download3");
     }
 }
コード例 #30
0
    protected void Button9_Click(object sender, EventArgs e)
    {
        FileUpload1.SaveAs(Server.MapPath("~/img/") + FileUpload1.FileName);
        FileUpload2.SaveAs(Server.MapPath("~/img/") + FileUpload2.FileName);
        FileUpload3.SaveAs(Server.MapPath("~/img/") + FileUpload3.FileName);

        int inst = DsAdapter.Insert(txtiname.Text, txtdescrip.Text, Convert.ToDouble(txtprice.Text), "~/img/" + FileUpload1.FileName, Convert.ToInt32(txtquan.Text), DropDownList1.SelectedItem.Text, "~/img/" + FileUpload2.FileName, "~/img/" + FileUpload3.FileName, Convert.ToInt32(DropDownList2.SelectedItem.Text));

        IDT = DsAdapter.select();
        GridView1.DataSource = IDT;
        GridView1.DataBind();
        lblmsg.Text = "Items are Added";
    }