protected void admin_Click(object sender, EventArgs e)
        {
            if (MUsername.Text != "")
            {
                DataView obstaja = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

                //ListBox1.Items.Add(obstaja[0][0].ToString()+" "+ obstaja[0][1].ToString()+" "+ obstaja[0][2].ToString()+" "+ obstaja[0][3].ToString());

                if (!((obstaja[0][0].ToString()).Equals(null)))
                {
                    SqlDataSource5.UpdateParameters["username"].DefaultValue = MUsername.Text;
                    SqlDataSource5.UpdateParameters["admin"].DefaultValue    = "1";
                    SqlDataSource5.Update();
                    Label1.Text = "Uporabnik " + MUsername.Text + " ima administratorske pravice.";
                }
                else
                {
                    Label1.Text = "Uporabnik ne obstaja.";
                }
            }
            else
            {
                Label1.Text = "Prosim dopolnite polje.";
            }
        }
 protected void save_button_Click(object sender, EventArgs e)
 {
     //save edited info
     //collect input in textbox
     //pass as parameters for update stored procedure
     SqlDataSource5.Update();
     //Response.Redirect("~/User_Home.aspx");
 }
예제 #3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (tipoGrid == 1)
            {
                int msj = 0;
                SqlDataSource1.UpdateParameters["ID_Venta"].DefaultValue = DropDownList1.SelectedValue;
                msj = SqlDataSource1.Update();
                if (msj > 0)
                {
                    Response.Write("<script>alert('Entrega exitosa!')</script>");
                    Response.Redirect("EntregaPB.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Error, no se realizo cambio en la Base de datos!')</script>");
                }
                //   SqlDataSource2.SelectCommand = "SELECT DISTINCT Venta.ID_Venta, 'ID Venta' + ': '+ CAST(Venta.ID_Venta AS nvarchar) +' - '+ Cliente.Nombre + ' ' + Cliente.Apellidos AS Cliente FROM Venta INNER JOIN Estados ON Venta.ID_Venta = Estados.ID_Venta inner join Cliente on Venta.ID_Cliente = Cliente.ID_Cliente WHERE (Estados.ID_Tienda = "+ Session["IdTienda"].ToString()+") AND Estados.EstadoBodega = 1";
                //  SqlDataSource2.DataBind();
                SqlDataSource3.SelectParameters["IdTienda"].DefaultValue = Session["IdTienda"].ToString();
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader totalP;
                totalP = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (totalP.Read())
                {
                    Label1.Text = totalP["total"].ToString();
                }
            }
            else if (tipoGrid == 2)
            {
                int msj = 0;
                SqlDataSource5.UpdateParameters["ID_Cotizacion"].DefaultValue = DropDownList2.SelectedValue;
                msj = SqlDataSource5.Update();
                if (msj > 0)
                {
                    Response.Write("<script>alert('Entrega exitosa!')</script>");
                    Response.Redirect("EntregaPB.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Error, no se realizo cambio en la Base de datos!')</script>");
                }

                SqlDataSource3.SelectParameters["IdTienda"].DefaultValue = Session["IdTienda"].ToString();
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader totalP;
                totalP = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (totalP.Read())
                {
                    Label1.Text = totalP["total"].ToString();
                }
            }
        }
예제 #4
0
        protected void btnCadastrar_Click(object sender, EventArgs e)
        {
            Usuarios User = new Usuarios();

            User = (Usuarios)Session["usuario"];

            SqlDataSource1.SelectParameters["IDCond"].DefaultValue = Convert.ToString(User.Cond);

            SqlDataSource4.UpdateParameters["Nome"].DefaultValue  = ddlNome.SelectedItem.Value;
            SqlDataSource4.UpdateParameters["Bloco"].DefaultValue = ddlBloco.SelectedItem.Value;
            SqlDataSource4.UpdateParameters["Apart"].DefaultValue = ddlApartamento.SelectedItem.Value;

            SqlDataSource5.UpdateParameters["Nome"].DefaultValue  = ddlNome0.SelectedItem.Value;
            SqlDataSource5.UpdateParameters["Bloco"].DefaultValue = ddlBloco0.SelectedItem.Value;
            SqlDataSource5.UpdateParameters["Apart"].DefaultValue = ddlApartamento0.SelectedItem.Value;

            SqlDataSource4.Update();
            SqlDataSource5.Update();
            SqlDataSource6.Update();
        }