protected void Category_SelectedIndexChanged(object sender, EventArgs e)
    {
        con.Open();
        ds.Clear();
        string get_name, name;

        name     = Category.SelectedItem.Text;
        get_name = Category.SelectedValue.ToString();
        if (get_name != "0")
        {
            query = "select Product_Name,Product_Id from Product_Details where Category_Id='" + get_name.ToString() + "' ";
            da    = new SqlDataAdapter(query, con);
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count >= 0)
            {
                ProdName.DataSource     = ds;
                ProdName.DataTextField  = "Product_Name";
                ProdName.DataValueField = "Product_Id";
                ProdName.DataBind();
                ProdName.Items.Insert(0, new ListItem("Choose " + name.ToString() + " Product ", "0"));
                ProdName.SelectedIndex = 0;
            }
        }
        else
        {
            ProdName.Items.Insert(0, "No Product Available");
            ProdName.DataBind();
        }
    }
 private void Clear_Click(object sender, EventArgs e)
 {
     ProdName.Clear();
     Amount.Clear();
     VendorID.Clear();
     ProductName.Clear();
     ProductID.Clear();
 }
    protected void Category_SelectedIndexChanged(object sender, EventArgs e)
    {
        /*   con.Open();
         * // String cat = "Laptops";
         * String cat = ProdName.SelectedItem.Text.ToString();
         * //Console.WriteLine(cat,"g");
         * SqlCommand cmd1 = new SqlCommand("Select Product_Name from Product_Details where Category_Id = (Select Category_Id from Category where Name = '" + cat.ToString() + "')", con);
         * SqlDataReader dr1 = cmd1.ExecuteReader(CommandBehavior.CloseConnection);
         * ProdName.Items.Clear();
         * while (dr1.Read())
         * {
         *     ProdName.Items.Add(new ListItem(dr1[0].ToString()));
         * }*/
        ds.Clear();
        string get_name, name;

        name     = Category.SelectedItem.Text;
        get_name = Category.SelectedValue.ToString();
        if (get_name != "0")
        {
            query = "select Product_Name,Product_Id from Product_Details where Category_Id='" + get_name.ToString() + "' ";
            da    = new SqlDataAdapter(query, con);
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count >= 0)
            {
                ProdName.DataSource     = ds;
                ProdName.DataTextField  = "Product_Name";
                ProdName.DataValueField = "Product_Id";
                ProdName.DataBind();
                ProdName.Items.Insert(0, new ListItem("Choose " + name.ToString() + " Product ", "0"));
                ProdName.SelectedIndex = 0;
            }
        }
        else
        {
            ProdName.Items.Insert(0, "No Product Available");
            ProdName.DataBind();
        }
    }
Beispiel #4
0
 public override string Log() => $"{AssetId.ToString().PadRight(15)}{Category.PadRight(17)}{Office.Name.PadRight(15)}{ProdName.PadRight(15)}{ModelName.PadRight(15)}{PurchaseDate.ToShortDateString().PadRight(15)}{Price.ToString().PadRight(15)}{Currency.PadRight(15)} {ExchangeRate.ToString().PadRight(10)}USD";
Beispiel #5
0
 public override string ToString()
 {
     return(ProdName.ToString());
 }
Beispiel #6
0
 public override string Log() => $"{Category.PadRight(15)}{ProdName.PadRight(8)}{ModelName.PadRight(8)}{PurchaseDate.ToShortDateString().PadRight(8)}\t{Price}";
Beispiel #7
0
 public override string Log() => $"{Location.PadRight(20)}{Category.PadRight(15)}{ProdName.PadRight(15)}{ModelName.PadRight(8)}{PurchaseDate.ToShortDateString().PadRight(8)}\t{Price.ToString().PadRight(10)}{CurrencyFormat.PadLeft(10)}";