Пример #1
0
        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();
        }
Пример #2
0
 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";
         }
     }
 }