private void DisplayData() { string vWhere = string.Empty; if (!string.IsNullOrEmpty(txtFilter.Text)) { vWhere = " AND Products.ProductName Like '%" + txtFilter.Text + "%'"; } if (vIsSaleable) { vWhere += " AND Isnull(Products.IsRawMaterial,0)=0"; } if (vIsConsumable) { vWhere += " AND Isnull(Products.IsRawMaterial,0)=1"; } try { DAL.Searches objDAL = new DAL.Searches(); objDAL.connectionstring = connectionString; dt = objDAL.getProducts(vWhere); Grid.DataSource = dt; } catch (Exception exc) { MessageBox.Show(exc.Message.ToString()); } }
private void txt_ProductID_TextChanged(object sender, EventArgs e) { //if (string.IsNullOrEmpty(txt_ProductID.Text)) txt_ProductName.Text = string.Empty; if (string.IsNullOrEmpty(txt_ProductID.Text)) { txt_ProductName.Text = string.Empty; } if (string.IsNullOrEmpty(txt_ProductID.Text)) { txt_ProductName.Text = string.Empty; } else { string vWhere = string.Empty; vWhere = "AND Products.ProductID = " + txt_ProductID.Text; DAL.Searches obj = new DAL.Searches(); obj.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString; DataTable dt = obj.getProducts(vWhere); if (dt.Rows.Count > 0) { txt_ProductID.Text = dt.Rows[0]["ProductID"].ToString(); // vForm.MyID; txt_ProductName.Text = dt.Rows[0]["ProductName"].ToString(); // vForm.MyName; } } }
private void txt_ProductID_TextChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(txt_ProductID.Text)) { ClearBodyControls(); } else { string vWhere = string.Empty; vWhere = "AND Products.ProductID = " + txt_ProductID.Text; DAL.Searches obj = new DAL.Searches(); obj.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString; DataTable dt = obj.getProducts(vWhere); if (dt.Rows.Count > 0) { txt_ProductID.Text = dt.Rows[0]["ProductID"].ToString(); // vForm.MyID; txt_ProductName.Text = dt.Rows[0]["ProductName"].ToString(); // vForm.MyName; txtUnit.Text = dt.Rows[0]["UnitTitle"].ToString(); //vForm.MyUnitName; txtUnit.Tag = dt.Rows[0]["UnitID"].ToString(); //vForm.MyUnitID.ToString(); txt_Qty.Tag = dt.Rows[0]["Units"].ToString(); //vForm.MyMultiplier.ToString("G29"); txt_Price.Text = decimal.Parse(dt.Rows[0]["SalePrice"].ToString()).ToString("G29"); //Math.Round(vForm.MyPurPrice, 2).ToString("G29"); txt_Qty.Focus(); GetCurrentStock(Int64.Parse(txt_ProductID.Text)); } } }
private void txt_ProductID1_TextChanged_1(object sender, EventArgs e) { if (txt_ProductID1.Text != string.Empty) { string vWhere = string.Empty; //vForm.IsSaleable = true; //vForm.IsConsumable = false; bool IsSaleable = true; bool IsConsumable = false; //vWhere = "AND "; if (IsSaleable) { vWhere += " AND Isnull(Products.IsRawMaterial,0)=0 "; } if (IsConsumable) { vWhere += " AND Isnull(Products.IsRawMaterial,0)=1 "; } vWhere += "AND Products.ProductID = " + txt_ProductID1.Text; DAL.Searches obj = new DAL.Searches(); obj.connectionstring = System.Configuration.ConfigurationManager.ConnectionStrings["MyString"].ConnectionString; DataTable dt = obj.getProducts(vWhere); if (dt.Rows.Count > 0) { txt_ProductID1.Text = dt.Rows[0]["ProductID"].ToString(); // vForm.MyID; txt_ProductName1.Text = dt.Rows[0]["ProductName"].ToString(); // vForm.MyName; txtUnit1.Text = dt.Rows[0]["UnitTitle"].ToString(); //vForm.MyUnitName; txtUnit1.Tag = dt.Rows[0]["UnitID"].ToString(); //vForm.MyUnitID.ToString(); txt_Qty1.Tag = dt.Rows[0]["Units"].ToString(); //vForm.MyMultiplier.ToString("G29"); //txt_Qty1.Focus(); GetCurrentStock1(Int64.Parse(txt_ProductID1.Text)); } } else { ClearBodyControls1(); } }