private void btnsearch_Click(object sender, RoutedEventArgs e) { Enquiry1 n = new Enquiry1(); if (date.Text == "" || date1.Text == "") { } else { datet = DateTime.Parse(date.Text); datet1 = DateTime.Parse(date1.Text); if (datet1.Ticks > datet.Ticks) { DataTable d = n.insertdate(); if (d.Rows.Count == 0) { date.Text = ""; date1.Text = ""; MessageBox.Show("there is no data please check the value"); } else { dg.ItemsSource = d.DefaultView; } } else { date.Text = ""; date1.Text = ""; MessageBox.Show("Select to-date greter then from-date"); } } }
public enquiry() { data.COUNT = 0; InitializeComponent(); data.COUNT = 1; txtdate.Text = DateTime.Today.Date.ToString(); DataTable dt = E.fill_enquirygrid(); dg.ItemsSource = dt.DefaultView; DataTable d = R.GET(); cbroomtype.ItemsSource = d.DefaultView; Enquiry1 e = new Enquiry1(); txtenquiryno.Text = e.getid().ToString(); }
//private void Button_Click_1(object sender, RoutedEventArgs e) //{ // Enquiry1 n = new Enquiry1(); // if (enquiryid.Text != "") // { // n.Enquiry_id = Convert.ToInt32(enquiryid.Text); // DataTable d = n.id(); // dg.ItemsSource = d.DefaultView; // } // else if (enquirydate.Text != "") // { // n.Expected_Arrival_Date = enquirydate.Text; // // Convert.ToDateTime(enquirydate.Text); // DataTable d1 = n.date(); // dg.ItemsSource = d1.DefaultView; // } // else if (enquiryname.Text != "") // { // n.Name = enquiryname.Text; // DataTable d2 = n.Name1(); // dg.ItemsSource = d2.DefaultView; // } // else if (enquirycontact.Text != "") // { // n.Contact = Convert.ToInt64(enquirycontact.Text); // DataTable d3 = n.Contact1(); // dg.ItemsSource = d3.DefaultView; // } //} private void btnok_Click(object sender, RoutedEventArgs e) { Enquiry1 n = new Enquiry1(); //var list = new List<SqlParameter>(); //string s = "select * from Enquiry where Insert_Date between @fromdate and @todate"; //string a = date.Text; //string b = date1.Text; //list.AddSqlParameter("@fromdate", date); //list.AddSqlParameter("@todate", date1); //n.Date = CHANGEFORMAT(date.Text); //n.Date1 = CHANGEFORMAT(date1.Text); n.Date = date.Text; n.Date1 = date1.Text; DataTable d = n.insertdate(); dg.ItemsSource = d.DefaultView; }
private void Button_Click(object sender, RoutedEventArgs e) { if (error != 0 || txtname.Text == "" || txtcontact.Text == "" || txtpax.Text == "" || txtdate.Text == "" || txttime.Text == "" || txtrooms.Text == "") { txtdate.Text = ""; //pop1.IsOpen = true; if (txtname.Text == "") { txtname.Text = ""; } if (txtcontact.Text == "") { txtcontact.Text = ""; } if (txtrooms.Text == "") { txtrooms.Text = ""; } if (txtpax.Text == "") { txtpax.Text = ""; } if (txtdate.Text == "") { txtdate.Text = string.Empty; txtdate.Text = null; } if (txttime.Text == "") { txttime.Text = ""; } } else { Enquiry1 EN = new Enquiry1(); //string a= txtdate.Text; EN.Enquiry_id = Convert.ToInt32(txtenquiryno.Text); EN.Name = txtname.Text; EN.Contact = Convert.ToInt64(txtcontact.Text); EN.ComingFrom = txtcomingfrom.Text; EN.RoomType = cbroomtype.Text; EN.Expected_Rooms = Convert.ToInt32(txtrooms.Text); EN.Expected_Pax = Convert.ToInt32(txtpax.Text); EN.Expected_Arrival_Date = Convert.ToDateTime(txtdate.Text); EN.Time = txttime.Text; EN.Insert_by = login.u; EN.Insert_date = DateTime.Today; string a = "Save"; string b = Convert.ToString(Save.Content); if (a == b) { EN.insert(); DataTable dt = EN.fill_enquirygrid(); dg.ItemsSource = dt.DefaultView; //MessageBox.Show("Saved sucessfully"); popup_insert.IsOpen = true; clear(); } else { EN.UPDATE(); DataTable dt = EN.fetch_data(); dg.ItemsSource = dt.DefaultView; //MessageBox.Show("Updated sucessfully"); popup_update.IsOpen = true; clear(); Save.Content = "Save"; } } }