protected void Button3_Click(object sender, EventArgs e)
    {
        string t_Tname = TextBox1.Text.Trim();
        Regex  regExp  = new Regex("^[\u4e00-\u9fa5]{1,}$");

        if (!regExp.IsMatch(TextBox1.Text))
        {
            Response.Write("<script language =javascript>alert('请输入汉字')</script>");
        }
        else if (t_Tname.Length > 10)
        {
            Response.Write("<script language =javascript>alert('地区过长')</script>");
        }
        else
        {
            SqlDataSource1.InsertCommand = "insert into location values ( '" + t_Tname + "')";
            SqlDataSource1.Insert();
            Response.Write("<script language =javascript>alert('添加成功!')</script>");
            GridView1.DataBind();
        }
    }
    protected void btnSalvar_Click(object sender, EventArgs e)
    {
        string email = tbxEmail.Text;
        string senha = tbxSenha.Text;

        Label1.Text = AcertaSenha(email, senha);

        try
        {
            SqlDataSource1.Insert();
            //System.IO.Directory.CreateDirectory(@"D:\Fotografo\Galerias\" + tbxEmail.Text + "");
            tbxEmail.Text = "";
            tbxNome.Text  = "";
            tbxSenha.Text = "";
            Response.Write("<script LANGUAGE='JavaScript' >alert('Usuário cadastrado com sucesso!');location.href='inicio.aspx'</script>");
        }
        catch
        {
            Response.Write("<script LANGUAGE='JavaScript' >alert('Problema ao Cadastrar Usuário, Tente Novamente Mais Tarde!')</script>");
        }
    }
    private Customer GetSelectedCustomer()
    {
        DataView CustomerTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        CustomerTable.RowFilter = "CustomerID ='" + NameList.SelectedValue + "'";
        DataRowView filteredCustomer = CustomerTable[0];
        Customer    CustomerChoice   = new Customer();

        CustomerChoice.CustomerID = filteredCustomer["CustomerID"].ToString();
        CustomerChoice.Name       = filteredCustomer["Name"].ToString();
        CustomerChoice.Address    = filteredCustomer["Address"].ToString();
        CustomerChoice.City       = filteredCustomer["City"].ToString();
        CustomerChoice.State      = filteredCustomer["State"].ToString();
        CustomerChoice.ZipCode    = filteredCustomer["ZipCode"].ToString();
        CustomerChoice.Phone      = filteredCustomer["Phone"].ToString();
        CustomerChoice.Email      = filteredCustomer["Email"].ToString();



        return(CustomerChoice);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        DataView dv1 = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());
        String   s   = "";

        for (int i = 0; i < dv1.Count; i++)
        {
            if (dv1[i][1] != DBNull.Value)
            {
                DateTime dt = (DateTime)dv1[i][1];
                DateTime md = new DateTime(DateTime.Today.Year, dt.Month, dt.Day);
                DateTime cd = DateTime.Today;
                TimeSpan sp = md.Subtract(cd);
                if (sp.Days > 0)
                {
                    s = s + sp.Days.ToString() + " days to go: " + (String)dv1[i][0] + "<br><br><br>";
                }
            }
        }
        Label1.Text = s;
    }
Example #5
0
        protected void cmdChangePassword_Click(object sender, EventArgs e)
        {
            lblMsg.Text = "";
            //if (CompareValidator1.IsValid)
            //{ return; }
            SqlDataAdapter da = new SqlDataAdapter("SELECT OrgID, UserID, Password FROM UserManager where OrgID = " + Session["OrgID"] + "and UserID ='" + Session["UserID"].ToString() + "' and Password='******'", ConfigurationManager.ConnectionStrings["strConn"].ConnectionString);
            DataSet        ds = new DataSet();

            da.Fill(ds, "UserManager");

            if (ds.Tables[0].Rows.Count > 0)
            {
                SqlDataSource1.Update();
                emptyField();
                lblMsg.Text = "Password has been changed successfully";
            }
            else if (ds.Tables[0].Rows.Count <= 0)
            {
                lblMsg.Text = "Old password is not correct";
            }
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        String error = Utilis.validaPermisos(Session, NUMFUNCION);

        if (!error.Equals(""))
        {
            Response.Redirect(error);
        }
        intBanderaMuestraDescuento = Int32.Parse(Request.QueryString["intMostrarDescuento"]);
        intPrecioSinDescuento      = Int32.Parse(Request.QueryString["intPrecioSinDescuento"]);
        intMostrarComentarios      = Int32.Parse(Request.QueryString["intMostrarComentarios"]);
        //intBanderaMuestraDescuentoGral = Int32.Parse(Request.QueryString["intDescGral"]);
        DataView    dv  = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
        DataRowView drv = dv[0];

        descuentogral = Double.Parse(drv["desctogral"].ToString());
        DataView    dvi  = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataRowView drvi = dvi[0];

        ivacot = Int32.Parse(drvi["iva"].ToString());
    }
 protected void Button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (gb_content.Text != "")
         {
             SqlDataSource1.InsertCommand = "insert into [Table]([image_id],[gb_user],[gb_content])values(@image_id,@gb_user,@gb_content)";
             SqlDataSource1.InsertParameters.Add("image_id", System.TypeCode.String, (Image1.ImageUrl).Remove(0, 6));
             SqlDataSource1.InsertParameters.Add("gb_user", System.TypeCode.String, Label2.Text);
             SqlDataSource1.InsertParameters.Add("gb_content", System.TypeCode.String, gb_content.Text);
             SqlDataSource1.Insert();
             SqlDataSource1.SelectCommand = "SELECT * FROM [Table] WHERE image_id like '%" + (Image1.ImageUrl).Remove(0, 6).Replace("'", "''") + "'";
             GridView1.DataSourceID       = SqlDataSource1.ID;
             gb_content.Text = "";
         }
     }
     catch (Exception ex)
     {
         Label1.Text = ex.Message;
     }
 }
Example #8
0
 protected void btn2_Click(object sender, EventArgs e)
 {
     try
     {
         int n = SqlDataSource1.Insert();
         if (n == 1)
         {
             Response.Write("<script>alert('Data Inserted Successfully')</script>");
             txtAnswer.Text   = "";
             txtQuestion.Text = "";
         }
         else
         {
             Response.Write("<script>alert('Please fill the form Correctly')</script>");
         }
     }
     catch (Exception er)
     {
         Response.Write(er);
     }
 }
Example #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["command"] == null)
            {
                itemCount.InnerText = group.GetTotalNumber(group).ToString();
            }
            else
            {
                SqlDataSource1.SelectCommand = Session["command"].ToString();
                SqlDataSource1.DataBind();
                ListView1.DataBind();
                itemCount.InnerText = group.GetNumber(group, Session["command"].ToString()).ToString();
                Session["command"]  = null;
            }

            if (Session["DDL"] != null)
            {
                DropDownList1.SelectedValue = Session["DDL"].ToString();
                Session["DDL"] = null;
            }
        }
Example #10
0
    protected void lbInsert_Click(object sender, EventArgs e)
    {
        SqlDataSource1.InsertParameters["name"].DefaultValue          = ((TextBox)GridView1.FooterRow.FindControl("txtName")).Text;
        SqlDataSource1.InsertParameters["trucktype"].DefaultValue     = ((DropDownList)GridView1.FooterRow.FindControl("DropDownList1")).SelectedValue;
        SqlDataSource1.InsertParameters["licencesplate"].DefaultValue = ((TextBox)GridView1.FooterRow.FindControl("txtplate")).Text;
        SqlDataSource1.InsertParameters["dateacquired"].DefaultValue  = ((TextBox)GridView1.FooterRow.FindControl("txtacquired")).Text;

        SqlDataSource1.Insert();

        string CS = ConfigurationManager.ConnectionStrings["TMSProgramConnectionString"].ConnectionString;

        using (SqlConnection conn = new SqlConnection(CS))
        {
            SqlDataAdapter da3 = new SqlDataAdapter("INSERT INTO Truck002 VALUES (@lastposition, @lastdateandtime, @name, " + lblcompid.Text + ")", conn);
            da3.SelectCommand.Parameters.AddWithValue("@lastposition", "default place holder");
            da3.SelectCommand.Parameters.AddWithValue("@lastdateandtime", "1900/01/01");
            da3.SelectCommand.Parameters.AddWithValue("@name", ((TextBox)GridView1.FooterRow.FindControl("txtName")).Text);
            DataSet ds3 = new DataSet();
            da3.Fill(ds3);
        }
    }
Example #11
0
 protected void Button7_Click(object sender, EventArgs e)
 {
     SqlDataSource1.Insert();
     using (MailMessage mm = new MailMessage("*****@*****.**", TextBox7.Text))
     {
         //    string n = TextBox1.Text;
         mm.Subject    = "successful registration";
         mm.Body       = "Thankyou";
         mm.IsBodyHtml = false;
         SmtpClient smtp = new SmtpClient();
         smtp.Host      = "smtp.gmail.com";
         smtp.EnableSsl = true;
         NetworkCredential NetworkCred = new NetworkCredential("*****@*****.**", "*************");
         smtp.UseDefaultCredentials = true;
         smtp.Credentials           = NetworkCred;
         smtp.Port = 587;
         smtp.Send(mm);
         ClientScript.RegisterStartupScript(GetType(), "alert", "alert('Email sent.');", true);
     }
     Response.Redirect("~/MainPage/Home.aspx");
 }
Example #12
0
        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Lua chon dong du lieu tai vi tri tren gridview
            DataRow rowSelected = ((SqlDataSource1.Select(DataSourceSelectArguments.Empty) as DataView).ToTable()).Rows[GridView1.SelectedIndex];

            vitri = GridView1.SelectedIndex;
            //Gan noi dung den tung text box
            txtid.Text       = rowSelected.ItemArray[0].ToString();
            txtiddx.Text     = rowSelected.ItemArray[1].ToString();
            txtTenDetai.Text = rowSelected.ItemArray[2].ToString();
            if (rowSelected.ItemArray[28].ToString().Equals("Đã duyệt"))
            {
                btnChiTiet.Visible = true;
            }
            else
            {
                btnChiTiet.Visible = true;
                btnDuyet.Visible   = true;
                btnHuyNop.Visible  = true;
            }
        }
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        try
        {
            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow rr = GridView1.Rows[i];

                if (((CheckBox)rr.FindControl("CheckBox1")).Checked)
                {
                    string trans_id = rr.Cells[1].Text.Trim();
                    SqlDataSource1.DeleteParameters["Original_c_id"].DefaultValue = trans_id;
                    SqlDataSource1.Delete();
                }
                else
                {
                }
            }
        }
        catch { }
    }
    protected void btnSelect_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow row in GridView1.Rows)
        {
            // Access the CheckBox
            CheckBox cb = (CheckBox)row.FindControl("cbSelected");
            if (cb != null && cb.Checked)
            {
                try
                {
                    SqlDataSource1.UpdateParameters["App_No"].DefaultValue = GridView1.DataKeys[row.DataItemIndex]["App_No"].ToString();
                    SqlDataSource1.Update();
                }
                catch (SqlException ex)
                {
                }
            }
        }

        Response.Redirect("listSelected.aspx");
    }
Example #15
0
        private Product GetSelectedProduct()
        {
            //get row from AccessDataSource based on value in dropdownlist
            DataView productsTable = (DataView)
                                     SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            productsTable.RowFilter =
                "ProductID = '" + ddlProducts.SelectedValue + "'";
            DataRowView row = productsTable[0];

            //create a new product object and load with data from row
            Product p = new Product();

            p.ProductID        = row["ProductID"].ToString();
            p.Name             = row["Name"].ToString();
            p.ShortDescription = row["ShortDescription"].ToString();
            p.LongDescription  = row["LongDescription"].ToString();
            p.UnitPrice        = (decimal)row["UnitPrice"];
            p.ImageFile        = row["ImageFile"].ToString();
            return(p);
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        //PostCondition :: Places the values in the Labels for the customer that is selected

        //create an object of Dataview, Filter it by selected customer ID
        if (!IsPostBack)
        {
            DDLCustomers.DataBind();
        }
        DataView customerTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        customerTable.RowFilter = "CustomerID = '" + DDLCustomers.SelectedValue + "'";
        DataRowView row = (DataRowView)customerTable[0];

        //populating the labels with the information of the first customer in the DropDownList
        lblCustomerAddress.Text = getCustomer().Address;
        lblCustomerCity.Text    = getCustomer().City;
        lblCustomerCity.Text    = getCustomer().State;
        lblCustomerPhone.Text   = getCustomer().Phone;
        lblCustomerEmail.Text   = getCustomer().Email;
    }
Example #17
0
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         idTienda = Convert.ToInt32(Session["IDtienda"].ToString());
         if (CheckBox1.Checked == true)
         {
             SqlDataSource1.SelectCommand = "SELECT DISTINCT Stock.ID_Existencia, Stock.Cantidad, Stock.Cantidad_Min, Stock.Ubicacion, Stock.PrecioUnitario, Stock.PrecioVenta, stuff((Select ', ' + OEM.OEM + ' ~ ' + Marca.Marca From OEM inner join Marca on OEM.ID_Marca = Marca.ID_Marca Where OEM.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTAOEM, stuff((Select ', ' + CodigoProducto.Codigo + ' ~ ' + MarcaProd.MarcaP From CodigoProducto inner join MarcaProd on CodigoProducto.ID_MaraProd = MarcaProd.ID_MaraProd Where CodigoProducto.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTACODP, stuff((Select '| ' + Marca +', '+ Modelo + ', ' + Rubro + ' ~ ' + AnioInicio + '-'+AnioFinal  From Marca inner join Modelo on Marca.ID_Marca = Modelo.ID_Marca inner join Rubro on Modelo.ID_Modelo = Rubro.ID_Modelo inner join AnioProducto on Rubro.ID_Rubro = AnioProducto.ID_Rubro Where AnioProducto.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTANIOP, Producto.Descripcion, MarcaProd.MarcaP, SubCategoria.SubCategoria + ', ' + Categoria.Categoria AS Categoria, Proveedor.Proveedor, Medida.Medida,  Tienda.ID_Tienda FROM  Medida INNER JOIN  Stock INNER JOIN  Tienda ON Stock.ID_Tienda = Tienda.ID_Tienda INNER JOIN Proveedor ON Stock.ID_Proveedor = Proveedor.ID_Proveedor INNER JOIN  Producto ON Stock.ID_Producto = Producto.ID_Producto INNER JOIN SubCategoria ON Producto.ID_SubCategoria = SubCategoria.ID_SubCategoria ON Medida.ID_Medida = Stock.ID_Medida INNER JOIN  MarcaProd ON Stock.ID_MaraProd = MarcaProd.ID_MaraProd INNER JOIN  Categoria ON SubCategoria.ID_Categoria = Categoria.ID_Categoria inner join OEM on Producto.ID_Producto = OEM.ID_Producto inner join CodigoProducto on Producto.ID_Producto = CodigoProducto.ID_Producto Where Producto.Estado = 1 AND Tienda.ID_Tienda =" + idTienda + " AND(OEM.OEM like '%" + TextBox3.Text.Trim() + "%' OR CodigoProducto.Codigo like '%" + TextBox3.Text.Trim() + "%' OR Producto.Producto like '%" + TextBox3.Text.Trim() + "%') AND (" + DropDownList5.SelectedItem.ToString() + " BETWEEN AnioProducto.AnioInicio AND AnioProducto.AnioFinal) AND AnioProducto.ID_Rubro =" + DropDownList6.SelectedValue;
             SqlDataSource1.DataBind();
         }
         else
         {
             SqlDataSource1.SelectCommand = "SELECT DISTINCT Stock.ID_Existencia, Stock.Cantidad, Stock.Cantidad_Min, Stock.Ubicacion, Stock.PrecioUnitario, Stock.PrecioVenta, stuff((Select ', ' + OEM.OEM + ' ~ ' + Marca.Marca From OEM inner join Marca on OEM.ID_Marca = Marca.ID_Marca Where OEM.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTAOEM, stuff((Select ', ' + CodigoProducto.Codigo + ' ~ ' + MarcaProd.MarcaP From CodigoProducto inner join MarcaProd on CodigoProducto.ID_MaraProd = MarcaProd.ID_MaraProd Where CodigoProducto.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTACODP, stuff((Select '| ' + Marca +', '+ Modelo + ', ' + Rubro + ' ~ ' + AnioInicio + '-'+AnioFinal From Marca inner join Modelo on Marca.ID_Marca = Modelo.ID_Marca inner join Rubro on Modelo.ID_Modelo = Rubro.ID_Modelo inner join AnioProducto on Rubro.ID_Rubro = AnioProducto.ID_Rubro Where AnioProducto.ID_Producto = Producto.ID_Producto For XML Path('')), 1,2,'') AS LISTANIOP, Producto.Descripcion, MarcaProd.MarcaP, SubCategoria.SubCategoria + ', ' + Categoria.Categoria AS Categoria, Proveedor.Proveedor, Medida.Medida,  Tienda.ID_Tienda FROM  Medida INNER JOIN  Stock INNER JOIN  Tienda ON Stock.ID_Tienda = Tienda.ID_Tienda INNER JOIN Proveedor ON Stock.ID_Proveedor = Proveedor.ID_Proveedor INNER JOIN  Producto ON Stock.ID_Producto = Producto.ID_Producto INNER JOIN SubCategoria ON Producto.ID_SubCategoria = SubCategoria.ID_SubCategoria ON Medida.ID_Medida = Stock.ID_Medida INNER JOIN  MarcaProd ON Stock.ID_MaraProd = MarcaProd.ID_MaraProd INNER JOIN  Categoria ON SubCategoria.ID_Categoria = Categoria.ID_Categoria inner join OEM on Producto.ID_Producto = OEM.ID_Producto inner join CodigoProducto on Producto.ID_Producto = CodigoProducto.ID_Producto Where Producto.Estado = 1 AND Tienda.ID_Tienda =" + idTienda + " AND(OEM.OEM like '%" + TextBox3.Text.Trim() + "%' OR CodigoProducto.Codigo like '%" + TextBox3.Text.Trim() + "%' OR Producto.Producto like '%" + TextBox3.Text.Trim() + "%')";
             SqlDataSource1.DataBind();
         }
     }
     catch
     {
         Response.Write("<script>alert('Error, revise los campos')</script>");
     }
 }
Example #18
0
    protected void Update_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\slsolution.mdf;Integrated Security=True;User Instance=True");
        SqlCommand    com = new SqlCommand("update customer set c_id=@c_id,c_name=@c_name,c_address=@c_address,c_email=@c_email,c_password=@c_password,c_mobileno=@c_mobileno,c_contactperson=@c_contactperson,c_contactpersonno=@c_contactpersonno where c_id=@c_id", con);

        com.Parameters.AddWithValue("@c_id", TextBox1.Text);
        com.Parameters.AddWithValue("@c_name", TextBox2.Text);
        com.Parameters.AddWithValue("@c_address", TextBox3.Text);
        com.Parameters.AddWithValue("@c_email", TextBox4.Text);
        com.Parameters.AddWithValue("@c_password", TextBox5.Text);
        com.Parameters.AddWithValue("@c_mobileno", TextBox6.Text);
        com.Parameters.AddWithValue("@c_contactperson", TextBox7.Text);
        com.Parameters.AddWithValue("@c_contactpersonno", TextBox8.Text);
        if (con.State != System.Data.ConnectionState.Open)
        {
            con.Open();
        }
        com.ExecuteNonQuery();
        SqlDataSource1.DataBind();
        GridView1.DataBind();
    }
Example #19
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     SqlDataSource1.InsertParameters["ProductCode"].DefaultValue = txtProductCode.Text;
     SqlDataSource1.InsertParameters["Name"].DefaultValue        = txtName.Text;
     SqlDataSource1.InsertParameters["Version"].DefaultValue     = txtVersion.Text;
     SqlDataSource1.InsertParameters["ReleaseDate"].DefaultValue = txtReleaseDate.Text;
     try
     {
         SqlDataSource1.Insert();
         txtProductCode.Text = "";
         txtName.Text        = "";
         txtVersion.Text     = "";
         txtReleaseDate.Text = "mm/dd/yy";
     }
     catch (Exception ex)
     {
         Session["Exception"] = ex;
         Session["Page"]      = "~/Admin/ProductMaintenance.aspx";
         Response.Redirect("~/ErrorMessage.aspx");
     }
 }
Example #20
0
        private Customer GetSelectedCustomer()
        {
            DataView customerTable = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

            customerTable.RowFilter = string.Format("CustomerID = '{0}'", CustomerDDL.SelectedValue);

            DataRowView row = (DataRowView)customerTable[0];

            String streetAddress = row["Address"].ToString() + Environment.NewLine + row["City"].ToString()
                                   + ", " + row["State"].ToString() + " " + row["ZipCode"].ToString();

            Customer customer = new Customer();

            customer.CustomerID = row["CustomerID"].ToString();
            customer.Name       = row["Name"].ToString();
            customer.Address    = streetAddress;
            customer.Phone      = row["Phone"].ToString();
            customer.Email      = row["Email"].ToString();

            return(customer);
        }
 protected void lbDelete_Click(object sender, EventArgs e)
 {
     for (int i = 0; i <= GridView1.Rows.Count - 1; i++)
     {
         CheckBox cbox = (CheckBox)GridView1.Rows[i].FindControl("chkSelectRow");
         if (cbox.Checked)
         {
             try
             {
                 SqlDataSource1.DeleteParameters["Cs_ID"].DefaultValue  = ((Label)GridView1.Rows[i].FindControl("txtCs_ID")).Text;
                 SqlDataSource1.DeleteParameters["Stu_ID"].DefaultValue = ((Label)GridView1.Rows[i].FindControl("txtStu_ID")).Text;
                 SqlDataSource1.Delete();
             }
             catch (SqlException)
             {
                 lblTooltip.Text = string.Format("无法删除该课程号为'{0}',学号为‘{1}’的选课信息!",
                                                 ((Label)GridView1.Rows[i].FindControl("txtCs_ID")).Text, ((Label)GridView1.Rows[i].FindControl("txtStu_ID")).Text);
             }
         }
     }
 }
Example #22
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        Label  id         = GridView1.Rows[e.RowIndex].FindControl("Label2") as Label;
        String mycon      = "Data Source=.\\SQLEXPRESS;AttachDbFilename=D:\\ASP CHARTS\\Admin\\App_Data\\RiceDatabase.mdf;Integrated Security=True;User Instance=True";
        String updatedata = "delete from Dhaka where id=" + id.Text;

        SqlConnection con = new SqlConnection(mycon);

        con.Open();
        SqlCommand cmd = new SqlCommand();

        cmd.CommandText = updatedata;
        cmd.Connection  = con;
        cmd.ExecuteNonQuery();

        Label6.Text         = "Row Data Has Been Deleted Successfully";
        GridView1.EditIndex = -1;
        SqlDataSource1.DataBind();
        GridView1.DataSource = SqlDataSource1;
        GridView1.DataBind();
    }
 protected void Button2_Click(object sender, EventArgs e)
 {
     try
     {
         SqlDataSource1.UpdateParameters["CardNO"].DefaultValue   = Session["CardNo"].ToString();
         SqlDataSource1.UpdateParameters["withdraw"].DefaultValue = TextBox1.Text;
         SqlDataSource1.Update();
         SqlDataSource2.InsertParameters["deposit"].DefaultValue  = "False";
         SqlDataSource2.InsertParameters["withdrow"].DefaultValue = "True";
         SqlDataSource2.InsertParameters["CardNO"].DefaultValue   = Session["CardNo"].ToString();
         SqlDataSource2.InsertParameters["BranchID"].DefaultValue = DropDownList1.Text;
         SqlDataSource2.InsertParameters["Ammount"].DefaultValue  = TextBox1.Text;
         SqlDataSource2.InsertParameters["date"].DefaultValue     = DateTime.Today.ToString("dd-MM-yyyy") + "  " + DateTime.Now.ToString("HH: mm:ss");
         SqlDataSource2.Insert();
         Label1.Text = "Successfull!! Done ! , Go to view Balance To Check your Update Balance!!";
     }
     catch (Exception ee)
     {
         Label1.Text = ee.StackTrace;
     }
 }
Example #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["session state"] == null)
        {
            count = 0;
        }
        else
        {
            count = Convert.ToInt32(Session["session state"]);
        }
        DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        try
        {
            DataRow row = dv.Table.Rows[count];
            string  s   = (string)row["comment"];
            num           = count + 1;
            TextBox1.Text = s + "\n" + "-------------------------------" + "\nThis is comment number " + num + ".";
        }
        catch { TextBox1.Text = "No Comment Exits!"; }
    }
Example #25
0
    protected void Button4_Click(object sender, EventArgs e)
    {
        DataView dv1 = (DataView)Checking.Select(DataSourceSelectArguments.Empty);

        if ((int)dv1.Table.Rows[0][0] == 1)
        {
            TextBox1.Enabled  = true;
            TextBox2.Enabled  = true;
            TextBox3.Enabled  = true;
            Button1.Enabled   = true;
            Button2.Enabled   = true;
            TextBox4.ReadOnly = true;
            DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            x             = (Double)dv.Table.Rows[0][0];
            TextBox8.Text = x.ToString();
            RangeValidator1.MaximumValue = x.ToString();
            DataView dv3 = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            vid           = (int)dv3.Table.Rows[0][0];
            TextBox7.Text = vid.ToString();
        }
    }
Example #26
0
        protected void btnShow_Click(object sender, EventArgs e)
        {
            fld       = cboSearch.SelectedValue.ToString();
            txt       = txtSearch.Text;
            A_Handler = new Purchase_DetailHandler();
            sql       = "select * from " + Tbl_Name + " where " + fld + " like '" + txt + "%' ";
            //Grid1.DataSource = A_Handler.GetPurchase_DetailList(sql);
            //Grid1.DataBind();
            SqlDataSource1.SelectCommand = sql;
            SqlDataSource1.DataBind();


            if (Grid1.Rows.Count > 0)
            {
                lblRec.Text = "Total Records : " + Grid1.Rows.Count.ToString();
            }
            else
            {
                lblRec.Text = "Record Not Found...";
            }
        }
Example #27
0
        protected void snimiKategorijuButton_Click(object sender, EventArgs e)
        {
            if (KategorijaTextBox.Text == "")
            {
            }
            SqlConnection conn = new SqlConnection(GetConnectionString());

            conn.Open();
            SqlCommand cmn = new SqlCommand("INSERT INTO Kategorija(Name) VALUES" +
                                            " (@name)");

            cmn.CommandType = System.Data.CommandType.Text;
            cmn.Connection  = conn;
            cmn.Parameters.AddWithValue("@name", KategorijaTextBox.Text);
            cmn.ExecuteNonQuery();
            conn.Close();

            KategorijaTextBox.Text = "";
            SqlDataSource1.DataBind();
            CheckBoxList1.DataBind();
        }
        // Requires error checking and validation !!
        protected void lbSaveArticle_Click(object sender, EventArgs e)
        {
            // The Insert Parameters... click the SqlDataSource1 in design view - in properties click Insert Query button
            // and you will see the following

            // INSERT INTO [Content] ([Title], [CategoryID], [MenuName], [MenuNumber], [SubTitle], [MainBody], 
            // [Footer], [Published]) VALUES (@Title, @CategoryID, @MenuName, @MenuNumber, @SubTitle, @MainBody, @Footer, @Published)

            SqlDataSource1.InsertParameters[0].DefaultValue = tbTitle.Text;
            SqlDataSource1.InsertParameters[1].DefaultValue = lbCategory.SelectedIndex.ToString();
            SqlDataSource1.InsertParameters[2].DefaultValue = tbMenuName.Text;
            SqlDataSource1.InsertParameters[3].DefaultValue = tbMenuPosition.Text;
            SqlDataSource1.InsertParameters[4].DefaultValue = tbSubTitle.Text;
            SqlDataSource1.InsertParameters[5].DefaultValue = CKEditor1.Text;
            SqlDataSource1.InsertParameters[6].DefaultValue = tbFooter.Text;

            SqlDataSource1.InsertParameters[7].DefaultValue = cbPublished.Checked.ToString();
           
            SqlDataSource1.Insert();
            GridView1.DataBind();
        }
Example #29
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlDataSource1.InsertParameters["IDVotacao"].DefaultValue = SqlDataSource4.SelectParameters["IDVotacao"].DefaultValue;
            SqlDataSource1.InsertParameters["Login"].DefaultValue     = SqlDataSource4.SelectParameters["Login"].DefaultValue;
            SqlDataSource1.InsertParameters["IDCond"].DefaultValue    = SqlDataSource4.SelectParameters["IDCond"].DefaultValue;
            SqlDataSource1.InsertParameters["IDBloco"].DefaultValue   = SqlDataSource4.SelectParameters["IDBloco"].DefaultValue;
            SqlDataSource1.InsertParameters["IDUnit"].DefaultValue    = SqlDataSource4.SelectParameters["IDUnit"].DefaultValue;
            SqlDataSource1.InsertParameters["Voto"].DefaultValue      = rblVoto.SelectedItem.Value;

            SqlDataSource1.Insert();

            rblVoto.Enabled      = false;
            rblVoto.Visible      = false;
            lblPerc1.Visible     = true;
            lblPerc0.Visible     = true;
            Label11.Visible      = true;
            Label9.Visible       = true;
            lblPerc0.Text        = SqlDataSource3.SelectCommand[7].ToString();
            lblPerc1.Text        = SqlDataSource2.SelectCommand[7].ToString();
            btnCadastrar.Visible = false;
        }
Example #30
0
    protected void Page_Load(object sender, EventArgs e)
    {
        a1 = new connection();
        Page.MaintainScrollPositionOnPostBack = true;

        if (IsPostBack == false)
        {
            string s, staffId;
            staffId = Session["staffId"].ToString();

            s = "select * from request where reqmode ='D' and reqno not in (select reqno from response)";
            SqlDataSource1.SelectCommand = s;
            SqlDataSource1.DataBind();
            Panel2.Visible = false;
            dr             = a1.disp(s);
            if (dr.HasRows == false)
            {
                Response.Write("<script>alert('No request waiting....');</script>");
            }
        }
    }