private bool IfIdExists(string Item_Name, string Item_Id)
        {
            con2.dataGet2("select 1 from [dbo].[Stock] where Item_Name='" + textBox2.Text + "'and Item_Id='" + textBox1.Text + "'");
            DataTable dt = new DataTable();

            con2.sda2.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public void disp_data()
 {
     try
     {
         con2.dataGet2("select * from [dbo].[Billing_Details]");
         DataTable dt = new DataTable();
         con2.sda2.Fill(dt);
         dataGridView1.Rows.Clear();
         foreach (DataRow row in dt.Rows)
         {
             int n = dataGridView1.Rows.Add();
             dataGridView1.Rows[n].Cells["Customer_Name"].Value = row["Customer_Name"].ToString();
             dataGridView1.Rows[n].Cells["Date"].Value          = Convert.ToDateTime(row["Date"].ToString()).ToString("dd-MM-yyyy");
             dataGridView1.Rows[n].Cells["Sub_Total"].Value     = row["Sub_Total"].ToString();
             dataGridView1.Rows[n].Cells["Discount"].Value      = row["Discount"].ToString();
             dataGridView1.Rows[n].Cells["Net_Total"].Value     = row["Net_Total"].ToString();
             dataGridView1.Rows[n].Cells["Paid"].Value          = row["Paid"].ToString();
             dataGridView1.Rows[n].Cells["Balance"].Value       = row["Balance"].ToString();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Example #3
0
 private void Bill_Output_Page_Load_1(object sender, EventArgs e)
 {
     try
     {
         crypt.Load(@"C:\Users\Prageeth Thilina\source\repos\Group Project\Group Project\Bill_Report.rpt");
         Connection2 con2 = new Connection2();
         DataSet     dst  = new DataSet();
         con2.dataGet2("select top 1 Customer_Name,Date,Sub_Total,Discount,Net_Total,Paid,Balance from Billing_Details order by Date desc");
         con2.sda2.Fill(dst, "Billing_Details");
         crypt.SetDataSource(dst);
         crystalReportViewer1.ReportSource = crypt;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void disp_data()
 {
     try
     {
         con2.dataGet2("select * from [dbo].[SupDetails]");
         DataTable dt = new DataTable();
         con2.sda2.Fill(dt);
         SupDetailGrid.Rows.Clear();
         foreach (DataRow row in dt.Rows)
         {
             int n = SupDetailGrid.Rows.Add();
             SupDetailGrid.Rows[n].Cells["SupID"].Value     = row["SupID"].ToString();
             SupDetailGrid.Rows[n].Cells["SupName"].Value   = row["SupName"].ToString();
             SupDetailGrid.Rows[n].Cells["SupConNum"].Value = row["SupNum"].ToString();
             SupDetailGrid.Rows[n].Cells["SupAdd"].Value    = row["SupAdd"].ToString();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
 }