Example #1
0
 protected void CalcelButton_Click(object sender, EventArgs e)
 {
     try
     {
         HRSBookingsBLL bookingBLLObject = new HRSBookingsBLL();
         string         bookingID        = BookingIDDropDownList.SelectedItem.Text;
         string         customerID       = Session["userId"].ToString();
         DateTime       bookingDate      = DateTime.Parse(BookingDateLabel.Text);
         if ((DateTime.Now - bookingDate).TotalDays <= 3)
         {
             int result = bookingBLLObject.DeleteBookingDetails(bookingID, customerID);
             if (result >= 1)
             {
                 ReseltLabel.Text = "Successfully Cancelled";
             }
             else
             {
                 ReseltLabel.Text = "Error Occured";
             }
         }
         else
         {
             ReseltLabel.Text = "Cancellation Not Allowed";
         }
         System.Text.StringBuilder sb = new System.Text.StringBuilder();
         sb.Append(@"<script type='text/javascript'>");
         sb.Append("$(function () {");
         sb.Append(" $('#Result').modal('show');});");
         sb.Append("</script>");
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ModelScript", sb.ToString(), false);
     }
     catch (Exception ex)
     {
         Utility.ExceptionUtility.ExceptionLog(ex);
         throw;
     }
 }