示例#1
0
        public void ShowDespatchForm(Booking obj)
        {
            try
            {
                bool rtn = false;

                frmDespatchJob frm = new frmDespatchJob(obj);

                frm.ShowDialog();



                if (frm.SmsThread != null)
                {
                    frm.SmsThread.Start();
                }

                rtn = frm.SuccessDespatched;

                frm.Dispose();

                GC.Collect();
            }
            catch (Exception ex)
            {
            }
        }
示例#2
0
        void grdDrivers_CommandCellClick(object sender, EventArgs e)
        {
            try
            {
                if (grdDrivers.CurrentRow != null && grdDrivers.CurrentRow is GridViewDataRowInfo)
                {
                    decimal drvfares = grdDrivers.CurrentRow.Cells["Bid"].Value.ToDecimal();
                    int?    driverId = grdDrivers.CurrentRow.Cells["DriverId"].Value.ToIntorNull();

                    bool IsDespatched = false;
                    long jobId        = _objBooking.Id;


                    using (TaxiDataContext db = new TaxiDataContext())
                    {
                        Booking obj = db.Bookings.FirstOrDefault(c => c.Id == jobId);

                        if (obj != null)
                        {
                            obj.Booking_Logs.Add(new Booking_Log
                            {
                                BookingId    = obj.Id,
                                UpdateDate   = DateTime.Now,
                                BeforeUpdate = "Old Fares : £" + Math.Round(obj.FareRate.ToDecimal(), 2),
                                AfterUpdate  = "Fares changed to Lowest Bid Driver Rate £" + drvfares
                            });

                            obj.FareRate = drvfares;
                            db.SubmitChanges();
                        }
                    }



                    if (_objBooking.PickupDateTime.Value.Date <= DateTime.Now.Date && General.GetQueryable <Fleet_DriverQueueList>(c => c.DriverId == driverId && c.Status == true).Count() > 0)
                    {
                        frmDespatchJob frm = new frmDespatchJob((General.GetObject <Booking>(c => c.Id == _objBooking.Id)), driverId, true);
                        frm.StartPosition = FormStartPosition.CenterScreen;
                        frm.ShowDialog();
                        IsDespatched = frm.IsDespatched;

                        frm.Dispose();
                    }
                    else
                    {
                        frmDespatchPreBooking frmPreDespatch = new frmDespatchPreBooking(General.GetObject <Booking>(c => c.Id == _objBooking.Id), driverId, true);
                        frmPreDespatch.StartPosition = FormStartPosition.CenterScreen;
                        frmPreDespatch.ShowDialog();
                        IsDespatched = frmPreDespatch.SuccessDespatched;

                        frmPreDespatch.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }