Example #1
0
 private void Butt_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         enable();
         Button btn = (Button)sender;
         txtroomno.Text = Convert.ToString(btn.Content);
         disc.ROOM_NO   = txtroomno.Text;
         disc.Retrive_guestname();
         DataTable dt = disc.CheckDiscount();
         if (dt.Rows.Count > 0)
         {
             save.Content       = "Update";
             txtguestname.Text  = disc.GUEST_NAME;
             txtparticular.Text = dt.Rows[0]["PARTICULAR"].ToString();
             txtamount.Text     = Math.Round(Convert.ToDecimal(dt.Rows[0]["AMOUNT"]), 2, MidpointRounding.AwayFromZero).ToString();
             txtpercentage.Text = dt.Rows[0]["PERCENTAGE"].ToString();
             Checkin_ID         = dt.Rows[0]["CHECKIN_ID"].ToString();
             if (txtpercentage.Text == "0")
             {
                 txtpercentage.IsEnabled = false;
                 txtamount.IsEnabled     = true;
             }
             else
             {
                 txtpercentage.IsEnabled = true;
                 txtamount.IsEnabled     = false;
             }
         }
         else
         {
             save.Content       = "Save";
             txtparticular.Text = "";
             txtamount.Text     = "0.00";
             txtpercentage.Text = "";
             txtguestname.Text  = disc.GUEST_NAME;
         }
         txtregno.IsEnabled = false;
     }
     catch (Exception)
     {
     }
 }