void btnDelete_Click(object sender, EventArgs e) { try { if (grdLister.CurrentRow != null && grdLister.CurrentRow is GridViewDataRowInfo) { long Id = grdLister.CurrentRow.Cells["Id"].Value.ToLong(); using (Taxi_Model.TaxiDataContext db = new Taxi_Model.TaxiDataContext()) { db.Messages.DeleteOnSubmit(db.Messages.FirstOrDefault(c => c.Id == Id)); db.SubmitChanges(); } PopulateData(); } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void button1_Click(object sender, EventArgs e) { try { if (chkDontRemind.Checked) { using (Taxi_Model.TaxiDataContext db = new Taxi_Model.TaxiDataContext()) { var obj = db.Gen_SysPolicy_Configurations.FirstOrDefault(c => c.SysPolicyId != null); if (obj.AccJobsShowNotificationDay.ToStr().Contains(",")) { obj.AccJobsShowNotificationDay = obj.AccJobsShowNotificationDay.ToStr().Remove(obj.AccJobsShowNotificationDay.ToStr().IndexOf(",")); obj.AccJobsShowNotificationDay += "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } else { if (obj.AccJobsShowNotificationDay.ToStr() == string.Empty) { obj.AccJobsShowNotificationDay = DateTime.Now.DayOfWeek.ToStr() + "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } else { obj.AccJobsShowNotificationDay += "," + string.Format("{0:dd/MM/yyyy}", DateTime.Now.ToDate()); } } db.SubmitChanges(); } } } catch (Exception ex) { } Close(); }
private void TrackDriver() { try { if (string.IsNullOrEmpty(AppVars.objPolicyConfiguration.ListenerIP.ToStr())) { ENUtils.ShowMessage("Server IP is not configured in Settings."); return; } string driverNo = ddl_Driver.SelectedValue.ToStr().Trim(); if (string.IsNullOrEmpty(driverNo)) { return; } DisposeTimer(); // Thread smsThread = new Thread(delegate() // { // new BroadcasterData().BroadCastToPort("**track driver=" + driverNo+"="+Environment.MachineName,3530); // //if (this.IsDisposed == false) // //{ // // SendMessage("request tracking=" + driverNo); // //} // }); // smsThread.Start(); //System.Threading.Thread.Sleep(1000); int driverId = 0; using (Taxi_Model.TaxiDataContext db = new Taxi_Model.TaxiDataContext()) { driverId = db.Fleet_Drivers.FirstOrDefault(c => c.DriverNo == driverNo && c.IsActive == true).DefaultIfEmpty().Id; if (driverId > 0) { long jobId = db.Fleet_DriverQueueLists.FirstOrDefault(c => c.Status == true && c.DriverId == driverId).DefaultIfEmpty().CurrentJobId.ToLong(); if (System.IO.File.Exists(Application.StartupPath + "\\TreasureBooking.exe")) { ClsDataTransfer polObj = new ClsDataTransfer(); foreach (System.Reflection.PropertyInfo item in AppVars.objPolicyConfiguration.GetType().GetProperties()) { try { if (polObj.GetType().GetProperty(item.Name) != null) { polObj.GetType().GetProperty(item.Name).SetValue(polObj, item.GetValue(AppVars.objPolicyConfiguration, null), null); } } catch { } } polObj.DataString = System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"].ToStr().Replace(" ", "**"); string pol = Newtonsoft.Json.JsonConvert.SerializeObject(polObj, Newtonsoft.Json.Formatting.Indented).Replace(" ", "~").Replace(Environment.NewLine, "").Replace("\"", "*"); string s = "XXX"; Process pp = new Process(); pp.StartInfo.FileName = Application.StartupPath + "\\TreasureBooking.exe"; pp.StartInfo.Arguments = s + " " + pol + " " + Newtonsoft.Json.JsonConvert.SerializeObject(AppVars.LoginObj, Newtonsoft.Json.Formatting.Indented).Replace(" ", "").Replace(Environment.NewLine, "").Replace("\"", "*") + " " + Newtonsoft.Json.JsonConvert.SerializeObject(AppVars.keyLocations, Newtonsoft.Json.Formatting.Indented).Replace(" ", "").Replace(Environment.NewLine, "").Replace("\"", "*") + " " + Newtonsoft.Json.JsonConvert.SerializeObject(AppVars.zonesList, Newtonsoft.Json.Formatting.Indented).Replace(" ", "").Replace(Environment.NewLine, "").Replace("\"", "*"); pp.StartInfo.Arguments += " " + "rptJobRouthPathGoogle" + " " + jobId + " " + "true" + " " + driverId; pp.Start(); Thread.Sleep(500); // pp.WaitForExit(); } else { rptJobRouthPathGoogle rpt = new rptJobRouthPathGoogle(jobId > 0 ? db.Bookings.First(c => c.Id == jobId) : null, true, driverId); rpt.Show(); } } } //rpt.Dispose(); this.Close(); } catch (Exception ex) { // ENUtils.ShowMessage(ex.Message); } }