private void txtroomno_LostFocus(object sender, RoutedEventArgs e) { try { INGUESTHOUSEINFOS I = new INGUESTHOUSEINFOS(); I.ROOM_NO = txtroomno.Text; DataTable dl = I.guest(); if (dl.Rows.Count == 0) { Save.IsEnabled = false; txtroomno.IsReadOnly = false; } else { txtroomno.IsReadOnly = true; Save.IsEnabled = true; txtname.Text = I.GUEST_NAME; txttariff.Text = I.CHARGED_TARRIF.ToString(); txtcompanyname.Text = I.COMPANY_NAME; dt.Text = I.ARRIVAL_DATE; txtarrivaltime.Text = I.ARRIVAL_TIME; dt1.Text = I.DEPARTURE_DATE; txtdeparturetime.Text = I.DEPARTURE_TIME; txtcontactno.Text = I.CONTACT_NO; txtemail.Text = I.EMAIL; idproof.Text = I.ID_TYPE; txtproof.Text = I.ID_DATA; } } catch (Exception) { } }
private void Save_Click(object sender, RoutedEventArgs e) { try { if (error != 0 || txtroomno.Text == "" || txtcontactno.Text == "") { //pop1.IsOpen = true; if (txtroomno.Text == "") { txtroomno.Text = ""; } if (txtcontactno.Text == "") { txtcontactno.Text = ""; } } else { INGUESTHOUSEINFOS IN = new INGUESTHOUSEINFOS(); Checksin ch = new Checksin(); IN.ROOM_NO = txtroomno.Text; IN.GUEST_NAME = txtname.Text; IN.COMPANY_NAME = txtcompanyname.Text; IN.Company_Gst = txtcompanygst.Text; IN.ARRIVAL_DATE = dt.Text; IN.ARRIVAL_TIME = txtarrivaltime.Text; IN.DEPARTURE_DATE = dt1.Text; IN.DEPARTURE_TIME = txtdeparturetime.Text; IN.CONTACT_NO = txtcontactno.Text; IN.EMAIL = txtemail.Text; IN.ID_TYPE = idproof.Text; IN.ID_DATA = txtproof.Text; //11/15/2017 dddd //IN.USER_NAME = login.u; IN.INSERT_BY = login.u; IN.INSERT_DATE = DateTime.Today; IN.CHARGED_TARRIF = Math.Round(Convert.ToDecimal(txttariff.Text), 2, MidpointRounding.AwayFromZero); ch.FETCH_TAX(txttariff.Text); IN.TAX = Math.Round(Convert.ToDecimal(ch.TAX), 2, MidpointRounding.AwayFromZero); string a1 = "Save", b1 = Convert.ToString(Save.Content); if (b1 == a1) { IN.INSERT(); IN.guestupdate(); IN.NightAuditUpdate(); //MessageBox.Show("Saved sucessfully"); // Save.Content = "Save"; insert.Text = "Data Inserted.!"; pop2.IsOpen = true; } string a = "Update", b = Convert.ToString(Save.Content); if (b == a) { IN.INSERT(); insert.Text = "Data Updated.!"; pop2.IsOpen = true; //MessageBox.Show("Updated sucessfully"); } IN.UPDTE(); CLEAR(); } } catch (Exception) { } }