Пример #1
0
        public void GetSupplierDetails()
        {
            supplier = new SupplierMasterBL();
            dt       = new DataTable();
            try
            {
                dt = supplier.GetSupplierDetails();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dataGridView1.Rows.Add();
                    dataGridView1["SupplierId", i].Value     = dt.Rows[i]["SupplierId"];
                    dataGridView1["SupplierName", i].Value   = dt.Rows[i]["SupplierName"];
                    dataGridView1["SupplierStatus", i].Value = Convert.ToInt32(dt.Rows[i]["SupplierStatus"]) == 1 ? "Active" : "In Active";
                }
            }

            catch (Exception ex)
            {
                string errorMessage = ErrorHandling.Class1.CreateErrorMessage(ex);
                ErrorHandling.Class1.LogFileWrite(errorMessage);
            }
        }
Пример #2
0
        private void txtSearch_KeyPress(object sender, KeyPressEventArgs e)
        {
            //spSearchSupplierById
            supplier = new SupplierMasterBL();
            dt       = new DataTable();
            int Id = 0;

            if (e.KeyChar == (char)13)
            {
                if (supplier.ValidationOfControls(txtSearch.Text))
                {
                    dataGridView1.Rows.Clear();
                    dt = supplier.GetSupplierDetails(Convert.ToInt32(txtSearch.Text));

                    if (dt.Rows.Count > 0)
                    {
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            dataGridView1.Rows.Add();
                            dataGridView1["SupplierId", i].Value     = dt.Rows[i]["SupplierId"];
                            dataGridView1["SupplierName", i].Value   = dt.Rows[i]["SupplierName"];
                            dataGridView1["SupplierStatus", i].Value = Convert.ToInt32(dt.Rows[i]["SupplierStatus"]) == 1 ? "Active" : "In Active";
                        }
                    }

                    else
                    {
                        MessageBox.Show("There is No Supplier Record with this Id.. ", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }

                else
                {
                    MessageBox.Show("Please Enter the Number", "Earning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtSearch.Focus();
                }
            }
        }