Monday 29 July 2013

Notification

 //dateTimePicker1.Text = DateTime.Parse(dateTimePicker1.Text).ToString();
            da = new OleDbDataAdapter("select distinct(Customer_Name) from cpayment",con);
            dt = new DataTable();
            da.Fill(dt);
           // dataGridView1.DataSource = dt;
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string st = dt.Rows[i][0].ToString();
                da = new OleDbDataAdapter("select Max(Payment_Date) from cpayment where Customer_Name='" + dt.Rows[i][0] + "'", con);
                dt = new DataTable();
                da.Fill(dt);
                //dataGridView1.DataSource = dt;
                // MessageBox.Show("" + dt.Rows[0][0].ToString());
                DateTime dd = Convert.ToDateTime(dt.Rows[0][0]);
                DateTime dd1 = Convert.ToDateTime(DateTime.Now.ToShortDateString());
                TimeSpan dd2 = dd1 - dd;
                int dd3 = Convert.ToInt32(dd2.TotalDays);
                if (dd3 >= 40)
                {

                    da = new OleDbDataAdapter("select * from cpayment where Payment_Date=" + dd.ToOADate() + " and Customer_Name='" + st + "'", con);
                    dt = new DataTable();
                    da.Fill(dt);
                   // dataGridView1.DataSource = dt;
                    DateTime mt = Convert.ToDateTime(dt.Rows[0][3].ToString());
                    listView1.Items.Add(""+dt.Rows[0][1].ToString()+  "");
                    listView2.Items.Add("" + mt.ToShortDateString() + "");
                    listView3.Items.Add(""+ dt.Rows[0][4].ToString()+ "");
                }
                else
                {
                    // MessageBox.Show("No");
                }

                da = new OleDbDataAdapter("select distinct(Customer_Name) from cpayment", con);
                dt = new DataTable();
                da.Fill(dt);
            }

No comments:

Post a Comment