void frmBookingCancelledPopup_Shown(object sender, EventArgs e) { if (this._jobId > 0) { this.ObjBooking = General.GetObject <Booking>(c => c.Id == this._jobId); if (ObjBooking != null) { LoadData(); this.FormClosing += new FormClosingEventHandler(frmBookingCancelledPopup_FormClosing); Thread.Sleep(300); if (this.ObjBooking.BookingStatusId.ToInt() != Enums.BOOKINGSTATUS.CANCELLED) { using (TaxiDataContext db = new TaxiDataContext()) { db.stp_CancelBooking(this._jobId, "", AppVars.LoginObj.UserName.ToStr()); // db.stp_BookingLog(BookingId, AppVars.LoginObj.UserName.ToStr(), "Job is Cancelled ! Reason : " + reason); } } } } }