コード例 #1
0
 protected void Button6_Click(object sender, EventArgs e)
 {
     if (FileUpload4.HasFile == true)
     {
         SqlDataSource4.Insert();
     }
 }
コード例 #2
0
    protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        string id  = ((Label)e.Item.FindControl("Label8")).Text;
        string pid = ((Label)e.Item.FindControl("Label7")).Text;

        if (e.CommandName == "Details")
        {
            Response.RedirectToRoute("ServiceDetails", new { ID = id, PID = pid });
        }

        if (e.CommandName == "favorite")
        {
            if (Page.User.Identity.Name == "")
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "ShowPopup();", true);
            }

            else
            {
                SqlDataSource4.InsertParameters.Add("UserName", Page.User.Identity.Name);
                SqlDataSource4.InsertParameters.Add("ProductId", id);

                SqlDataSource4.Insert();


                ListView1.DataBind();
            }
        }
    }
コード例 #3
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (TextBox3.Text != "")
     {
         int msj;
         SqlDataSource4.InsertParameters["MontoSalida"].DefaultValue = TextBox3.Text;
         SqlDataSource4.InsertParameters["Fecha"].DefaultValue       = TextBox4.Text;
         SqlDataSource4.InsertParameters["ID_Concepto"].DefaultValue = DropDownList3.SelectedValue;
         SqlDataSource4.InsertParameters["ID_Caja"].DefaultValue     = DropDownList2.SelectedValue;
         SqlDataSource4.InsertParameters["Informacion"].DefaultValue = TextBox5.Text;
         msj = SqlDataSource4.Insert();
         if (msj == 1)
         {
             Response.Write("<script>alert('Datos ingresados correctatmente')</script>");
             TextBox3.Text = "";
             Label2.Text   = "Se retiro de la caja: " + TextBox3.Text;
         }
         else
         {
             Response.Write("<script>alert('Error, No se guardaron los datos')</script>");
             Label2.Text = "Error.";
         }
     }
     else
     {
         Response.Write("<script>alert('Ingrese un monto')</script>");
     }
 }
コード例 #4
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!DropDownList1.SelectedItem.Text.Equals("Select Student"))
            {
                SqlConnection conn = new SqlConnection
                                         (@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Ceng.mdf;Integrated Security=True");

                int        courseId    = int.Parse(Request.QueryString["id"]);
                string     studentName = DropDownList1.SelectedItem.Text;
                SqlCommand cmd         = new SqlCommand
                                             ("Select * from Enrolment as e, Students as s where e.StudentID = s.StudentID and " +
                                             "CourseID = " + courseId + " and StudentName = '" + studentName + "'", conn);
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                if (reader.HasRows)
                {
                    Label1.Visible   = true;
                    Label1.Text      = "The selected student is already registered to the course!";
                    Label1.ForeColor = Color.Red;
                }
                else
                {
                    Label1.Visible   = true;
                    Label1.Text      = "Registered!";
                    Label1.ForeColor = Color.Blue;
                    SqlDataSource4.Insert();
                    GridView1.DataBind();
                }
                reader.Close();
                conn.Close();
            }
        }
コード例 #5
0
 protected void lbInsert_Click3(object sender, EventArgs e)
 {
     SqlDataSource4.InsertParameters["boname"].DefaultValue      = ((TextBox)GridView4.FooterRow.FindControl("txtboname")).Text;
     SqlDataSource4.InsertParameters["bocontact"].DefaultValue   = ((TextBox)GridView4.FooterRow.FindControl("txtbocontact")).Text;
     SqlDataSource4.InsertParameters["bosocietyid"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddlbosocietyid")).SelectedValue;
     SqlDataSource4.InsertParameters["botype"].DefaultValue      = ((DropDownList)GridView4.FooterRow.FindControl("ddlbotype")).SelectedValue;
     SqlDataSource4.Insert();
 }
コード例 #6
0
ファイル: add_clubs.aspx.cs プロジェクト: ziakhan78/DD2020-21
 protected void btnAddRtr_Click(object sender, EventArgs e)
 {
     if (Page.IsValid)
     {
         SqlDataSource4.Insert();
         txtRtrClub.Text = "";
     }
 }
コード例 #7
0
 protected void LinkButton4_Click(object sender, EventArgs e)
 {
     SqlDataSource4.InsertParameters["aadhar"].DefaultValue    = ((TextBox)GridView4.FooterRow.FindControl("txtaadhar")).Text;
     SqlDataSource4.InsertParameters["spname"].DefaultValue    = ((TextBox)GridView4.FooterRow.FindControl("txtspname")).Text;
     SqlDataSource4.InsertParameters["contact"].DefaultValue   = ((TextBox)GridView4.FooterRow.FindControl("txtcontact")).Text;
     SqlDataSource4.InsertParameters["societyid"].DefaultValue = ((DropDownList)GridView4.FooterRow.FindControl("ddlsocietyid")).SelectedValue;
     SqlDataSource4.InsertParameters["type"].DefaultValue      = ((DropDownList)GridView4.FooterRow.FindControl("ddltype")).SelectedValue;
     SqlDataSource4.InsertParameters["rating"].DefaultValue    = ((TextBox)GridView4.FooterRow.FindControl("txtrating")).Text;
     SqlDataSource4.Insert();
 }
コード例 #8
0
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         SqlDataSource4.Insert();
         GridView1.DataBind();
     }
     catch
     {
         Label4.Text = "The selected student is already registered to the course";
     }
 }
コード例 #9
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        String n  = TextBox1.Text;
        String s  = TextBox2.Text;
        String t  = TextBox3.Text;
        String dl = TextBox4.Text;

        if (n == "" || t == "" || dl == "")
        {
            Label3.Text = "Please. Enter some information in the field."; return;
        }

        DataView dv3      = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
        int      row_num1 = -1;

        for (int i = 0; i < dv3.Table.Rows.Count; i++)
        {
            if (TextBox1.Text.Trim().ToString() == (string)dv3.Table.Rows[i][1].ToString().Trim() &&
                TextBox2.Text.Trim().ToString() == (string)dv3.Table.Rows[i][2].ToString().Trim() &&
                TextBox3.Text.Trim().ToString() == (string)dv3.Table.Rows[i][3].ToString().Trim() &&
                TextBox4.Text.Trim().ToString() == (string)dv3.Table.Rows[i][4].ToString().Trim())
            {
                row_num1 = i;
            }
        }
        int cl_id = -1;

        if (row_num1 > -1)
        {
            cl_id = (int)dv3.Table.Rows[row_num1][0];
        }
        String query = "INSERT INTO client(Name,Surname,Telephone,dl_num) VALUES('" + n + "','" + s + "','" + t + "','" + dl + "')";

        if (cl_id > 0)
        {
            Label3.Text = "You are in our database. Your number is:" + cl_id.ToString();
        }
        else
        {
            SqlDataSource4.InsertCommand = query;
            SqlDataSource4.Insert();

            sendmsg.SendEmail("New client", "New client : " + n + " " + s + ". " + "Tel:" + t + ". " + "Dr. license:" + dl);
        }

        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
    }
コード例 #10
0
        protected void SignInBtn_Click(object sender, EventArgs e)
        {
            bool corrPassw = false;
            bool corrName  = false;

            RError.Text = "";

            SqlDataSource4.InsertParameters["ime"].DefaultValue      = RIme.Text;
            SqlDataSource4.InsertParameters["priimek"].DefaultValue  = RPriimek.Text;
            SqlDataSource4.InsertParameters["username"].DefaultValue = RUsername.Text;
            SqlDataSource4.InsertParameters["admin"].DefaultValue    = "0";
            DataView obstaja = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

            if (RUsername.Text.Equals(""))
            {
                RError.Text = RError.Text + "Vstavite uporabniško ime ";
            }
            else if (!(obstaja[0][0].ToString()).Equals("0"))
            {
                RError.Text = RError.Text + "Uporabnik s tem imenom ze obstaja, prosimo uporabite drugega. ";
            }
            else
            {
                corrName = true;
            }

            if (RGeslo1.Text.Equals(RGeslo2.Text) && Regex.IsMatch(RGeslo1.Text, @"(?=.*[A-Z].*[A-Z])(?=.*[0-9].*[0-9])(?=.*[?.*!:]+).{8,}"))
            {
                corrPassw = true;
                using (MD5 md5Hash = MD5.Create())
                {
                    string password = GetMd5Hash(md5Hash, RGeslo1.Text);
                    SqlDataSource4.InsertParameters["geslo"].DefaultValue = password;
                }
            }
            else
            {
                RError.Text  = RError.Text + "Gesla se ne ujameta ali ali ni veljavno geslo, vnesite znova ";
                RGeslo1.Text = "";
                RGeslo2.Text = "";
            }
            if (corrName && corrPassw)
            {
                SqlDataSource4.Insert();
                RError.Text = "Vaš uporabniški račun je bil uspešno ustvarjen!";
            }
        }
コード例 #11
0
        //protected void DropDownList6_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    int idTtienda = 0;
        //    idTtienda = Convert.ToInt32(Session["IDtienda"]);
        //    SqlDataSource2.SelectCommand = "SELECT Producto.Codigo, Producto.Codigo2, Producto.Descripcion AS Producto, MarcaProd.MarcaP, Rubro.Rubro, Modelo.Modelo, Marca.Marca, Anio.Anio, Stock.Cantidad, Stock.Ubicacion, Stock.PrecioUnitario, Stock.PrecioVenta, Stock.ID_Existencia, Medida.Medida FROM Anio INNER JOIN Stock INNER JOIN Producto ON Stock.Codigo = Producto.Codigo ON Anio.ID_Anio = Stock.ID_Anio INNER JOIN Rubro ON Producto.ID_Rubro = Rubro.ID_Rubro INNER JOIN Marca INNER JOIN Modelo ON Marca.ID_Marca = Modelo.ID_Marca ON Rubro.ID_Modelo = Modelo.ID_Modelo INNER JOIN MarcaProd ON Producto.ID_MaraProd = MarcaProd.ID_MaraProd INNER JOIN Medida on Stock.ID_Medida = Medida.ID_Medida Where (Producto.Estado = 1) AND Rubro.ID_Rubro = " + DropDownList6.SelectedValue + "AND Stock.ID_Tienda = " + idTtienda;
        //    SqlDataSource2.DataBind();
        //}

        protected void  OnClick_LinkButton1(object sender, EventArgs e)
        {
            GridViewRow tabla = (GridViewRow)(((LinkButton)sender).Parent.Parent);

            SqlDataSource4.InsertParameters["ID_Existencia"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString();
            SqlDataSource4.InsertParameters["ID_Proveedor"].DefaultValue  = ((Label)tabla.FindControl("Label9")).Text.ToString();
            SqlDataSource4.InsertParameters["Factura"].DefaultValue       = ((Label)tabla.FindControl("Label2")).Text.ToString();
            SqlDataSource4.InsertParameters["Motivo"].DefaultValue        = ((Label)tabla.FindControl("Label3")).Text.ToString();
            SqlDataSource4.InsertParameters["Cantidad"].DefaultValue      = ((Label)tabla.FindControl("Label4")).Text.ToString();
            SqlDataSource4.InsertParameters["ID_Compra"].DefaultValue     = ((Label)tabla.FindControl("Label10")).Text.ToString();
            SqlDataSource4.Insert();
            SqlDataSource10.UpdateParameters["ID_DevProPro"].DefaultValue = ((Label)tabla.FindControl("Label1")).Text.ToString();
            //SqlDataSource4.UpdateParameters["Cantidad"].DefaultValue = ((Label)tabla.FindControl("Label4")).Text.ToString();
            //SqlDataSource4.UpdateParameters["idStock"].DefaultValue = ((Label)tabla.FindControl("Label8")).Text.ToString();
            SqlDataSource10.Update();

            Response.Redirect("DevProPro.aspx");
        }
コード例 #12
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlCommand cm = new SqlCommand("select * from restaurante " +
                                           " where nomRest='" + this.DropDownList1.SelectedValue + "'", cn);

            cn.Open();
            SqlDataReader dr = cm.ExecuteReader();

            if (dr.Read())
            {
                codRest.Text = dr["codRest"].ToString();
            }

            SqlDataSource4.InsertParameters["restaurante"].DefaultValue = codRest.Text;
            SqlDataSource4.InsertParameters["cliente"].DefaultValue     = GridView3.Rows[0].Cells[0].Text;
            SqlDataSource4.InsertParameters["personas"].DefaultValue    = TextBox2.Text;
            SqlDataSource4.InsertParameters["fecha"].DefaultValue       = "2019-07-31";
            SqlDataSource4.InsertParameters["hora"].DefaultValue        = "15:25";
            SqlDataSource4.Insert();
        }
コード例 #13
0
    protected void IngredientButton_Click(object sender, EventArgs e)
    {
        double k = 0;

        if (QuantityTextBox.Text != null && QuantityTextBox.Text != "")
        {
            k = Double.Parse(QuantityTextBox.Text);
        }
        Ingredient ing = new Ingredient(IngrNameTextBox.Text, k, UnitMeasureText.Text);

        SqlDataSource4.InsertParameters["Ingredient_name"].DefaultValue      = IngrNameTextBox.Text;
        SqlDataSource4.InsertParameters["Ingredient_measure"].DefaultValue   = UnitMeasureText.Text;
        SqlDataSource4.InsertParameters["Ingredieent_quantity"].DefaultValue = QuantityTextBox.Text;
        SqlDataSource4.Insert();

        IngrNameTextBox.Text = "";
        QuantityTextBox.Text = "";
        UnitMeasureText.Text = "";

        DataList1.DataBind();
    }
コード例 #14
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Double amount = Convert.ToDouble(TextBox2.Text) * Convert.ToInt32(TextBox3.Text);

        TextBox7.Text = amount.ToString("n2");
        DataView dvgroup     = (DataView)SqlDataSource9.Select(DataSourceSelectArguments.Empty);
        int      returncount = (int)dvgroup.Table.Rows[0][0];

        if (returncount >= 1)
        {
            Label11.Text = "Unable to Insert same Facility";
        }
        else
        {
            Label11.Text = "";
            SqlDataSource4.Insert();
            DataView dvx = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
            Double   tl  = (Double)dvx.Table.Rows[0][0];
            Label10.Text = tl.ToString("n2");
            Response.Redirect(Request.RawUrl);
        }
    }
コード例 #15
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (String.IsNullOrEmpty(drpClient.Text) || String.IsNullOrEmpty(drpManufacturer.Text) ||
            String.IsNullOrEmpty(txtOrderNum.Text) || String.IsNullOrEmpty(txtDateEntered.Text) ||
            String.IsNullOrEmpty(txtDescription.Text) || String.IsNullOrEmpty(txtPartNo.Text) ||
            String.IsNullOrEmpty(txtSerial.Text) || String.IsNullOrEmpty(txtModel.Text))
        {
            lblResultMsg.Visible = true;
            lblResultMsg.Text    = "The required fields in the first section have not been populated. Please try again.";

            return; //cancel submittion
        }


        Dictionary <string, string> results = SavePart();
        string json = JsonConvert.SerializeObject(results, Formatting.Indented);

        hdnSavedValues.Value   = json;
        txtSavedValues.Text    = json;
        txtSavedValues.Visible = true;

        prgHide.Visible      = false;
        lblResultMsg.Text    = "Your entries have been saved, you can be my wingman anytime.";
        lblResultMsg.Visible = true;


        try
        {
            SqlDataSource4.Insert();
        }
        catch (Exception ex)
        {
            prgHide.Visible      = false;
            lblResultMsg.Text    = ex.Message;
            lblResultMsg.Visible = true;
        }
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     SqlDataSource4.Insert();
     Response.Redirect("~/Dodaj/Dodaj_pracownika.aspx");
 }
コード例 #17
0
ファイル: WebForm3.aspx.cs プロジェクト: 171952544/demo
 protected void Button1_Click(object sender, EventArgs e)
 {
     SqlDataSource4.Insert();
     Response.Redirect("登陆.aspx");
 }
コード例 #18
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     SqlDataSource4.Insert();
     Response.Write("thanks");
     Button1.Visible = false;
 }
コード例 #19
0
        protected void DiseaseDataSource_Inserted(object sender, SqlDataSourceStatusEventArgs e)
        {
            String Data_Id = Request.QueryString["boosh"];

            string txt2 = txtValues.Text;

            string[] newlist         = txt2.Split(new Char[] { ';', '\\' }, StringSplitOptions.RemoveEmptyEntries);
            string[] IdSstring       = new String[newlist.Length];
            System.Data.DataTable dt = new System.Data.DataTable();
            string        bush       = string.Empty;
            SqlConnection connection = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\DiseaseDatabase.mdf;Integrated Security=True");

            connection.Open();

            Disease_SymptomsDataSource.DeleteCommandType = SqlDataSourceCommandType.Text;
            Disease_SymptomsDataSource.DeleteCommand     = "DELETE FROM Disease_Symptoms WHERE [Disease_Id] = " + Data_Id + "";

            Disease_SymptomsDataSource.Delete();

            DataTable  dt3     = new DataTable();
            SqlCommand sqlCmd3 = new SqlCommand("SELECT * from Symptoms ", connection);
            // sqlCmd3.Parameters.AddWithValue("@username", user);
            SqlDataAdapter sqlDa3 = new SqlDataAdapter(sqlCmd3);

            sqlDa3.Fill(dt3);

            int comcheck = 0;
            int Incre    = 0;
            int DSincr   = 0;

            while (comcheck < newlist.Length)
            {
                for (int hu = 0; hu < dt3.Rows.Count; hu++)
                {
                    if (newlist[comcheck] == dt3.Rows[hu]["Name"].ToString())
                    {
                        IdSstring[Incre] = dt3.Rows[hu]["Id"].ToString();
                        Incre++;
                        break;
                    }
                }
                comcheck++;
            }
            for (int q = 0; q < IdSstring.Length; q++)
            {
                string Sym_Check = "Symp" + q;
                Disease_SymptomsDataSource.InsertParameters.Add(Sym_Check, newlist[q]);
                Disease_SymptomsDataSource.InsertCommandType = SqlDataSourceCommandType.Text;
                Disease_SymptomsDataSource.InsertCommand     = "INSERT INTO Disease_Symptoms(Disease_Id, Symptom_Id) VALUES(" + Data_Id + ", " + IdSstring[q] + ")";

                Disease_SymptomsDataSource.Insert();
            }

            String s   = Request.QueryString["boosh"];
            string txt = TextBox5.Text;

            string[] lst = txt.Split(new Char[] { '\n', '\r', ' ' }, StringSplitOptions.RemoveEmptyEntries);

            string[] Add = new String[lst.Length];;

            //int a = lst.Length;

            DataTable dtAliases = new DataTable();

            DataTable  dtAl     = new DataTable();
            SqlCommand sqlCmdAl = new SqlCommand("SELECT * from Aliases WHERE Disease_Id = " + s + "", connection);

            sqlCmdAl.Parameters.AddWithValue("@username", s);
            SqlDataAdapter sqlDaAl = new SqlDataAdapter(sqlCmdAl);



            //SqlDataSource3.DeleteParameters.Add(check1, Delete[aop]);
            SqlDataSource3.DeleteCommandType = SqlDataSourceCommandType.Text;
            SqlDataSource3.DeleteCommand     = "DELETE FROM Aliases WHERE Aliases.Disease_Id = " + s + "";
            SqlDataSource3.Delete();

            for (int a = 0; a < lst.Length; a++)
            {
                string check = "AliasName" + a;
                SqlDataSource3.InsertParameters.Add(check, lst[a]);
                SqlDataSource3.InsertCommandType = SqlDataSourceCommandType.Text;
                SqlDataSource3.InsertCommand     = "INSERT INTO Aliases(Name, Disease_Id) VALUES(@" + check + ", " + Data_Id + ")";
                SqlDataSource3.Insert();
            }

            DataTable  dtVe     = new DataTable();
            SqlCommand sqlCmdVe = new SqlCommand("SELECT * from Disease_Vectors WHERE Disease_Id = " + s + "", connection);

            sqlCmdAl.Parameters.AddWithValue("@username", s);
            SqlDataAdapter sqlDaVe = new SqlDataAdapter(sqlCmdVe);


            sqlDaVe.Fill(dtVe);
            CheckBoxList chkbx = (CheckBoxList)FindControl("CheckBoxList1");



            //SqlDataSource4.DeleteParameters.Add(check1, Delete1[b]);
            SqlDataSource4.DeleteCommandType = SqlDataSourceCommandType.Text;
            SqlDataSource4.DeleteCommand     = "DELETE FROM Disease_Vectors WHERE [Disease_Id] = " + s + "";

            SqlDataSource4.Delete();

            for (int fo = 0; fo < 5; fo++)
            {
                string check12 = "Vector_Id" + fo;
                if (CheckBoxList1.Items[fo].Selected)
                {
                    SqlDataSource4.InsertParameters.Add(check12, CheckBoxList1.Items[fo].Value);
                    SqlDataSource4.InsertCommandType = SqlDataSourceCommandType.Text;
                    SqlDataSource4.InsertCommand     = "INSERT INTO Disease_Vectors(Disease_Id, Vector_Id) VALUES(" + Data_Id + ", @" + check12 + ")";

                    SqlDataSource4.Insert();
                }
            }



            //"INSERT INTO Disease_Vectors(Disease_Id, Vector_Id) VALUES(" + Data_Id + ", @" + check1 + ")"
            //String myStringVariable = "Disease Updated";
        }
コード例 #20
0
ファイル: Sitemanage.aspx.cs プロジェクト: saedc55/WebSite3
 protected void Button1_Click1(object sender, EventArgs e)
 {
     SqlDataSource4.Insert();
 }