void btnAccept_Click(object sender, EventArgs e) { try { if (grdAcceptorPooljobs.Rows[0].Cells["Bid"].Value.ToDecimal() < grdAcceptorPooljobs.Rows[0].Cells["OfferPrice"].Value.ToDecimal()) { MessageBox.Show("You cannot Bid on less price than Job Price " + grdAcceptorPooljobs.Rows[0].Cells["OfferPrice"].Value.ToDecimal()); } else { string serverip = string.Empty; using (TaxiDataContext db = new TaxiDataContext("Data Source=213.171.197.98,58416;Initial Catalog=Invoicing;User ID=inv;Password=inv;Trusted_Connection=False;")) { serverip = db.ExecuteQuery <string>("select staticip from gen_client where defaultclientid='" + objBooking.DefaultClientId + "'").FirstOrDefault(); } string msg = new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(objBooking); General.SendSockMessage(("request updatebid>>" + objBooking.ClientBookingId + ">>" + grdAcceptorPooljobs.Rows[0].Cells["Bid"].Value.ToDecimal() + ">>2>>" + AppVars.objSubCompany.CompanyName.ToStr() + ">>" + AppVars.objPolicyConfiguration.DefaultClientId.ToStr() + ">>" + msg), serverip, 1106); Close(); } } catch { } }
private void Display() { try { using (TaxiDataContext db = new TaxiDataContext()) { string APIKey = db.ExecuteQuery <string>("select APIKey from mapkeys where maptype='etakeys'").FirstOrDefault().ToStr().Trim(); if (APIKey.Contains("<etakeys>")) { string[] arr = new string[] { "<etakeys>" }; var list = APIKey.Split(arr, StringSplitOptions.None).ToList(); grdETAKeys.RowCount = list.Count; for (int i = 0; i < grdETAKeys.Rows.Count; i++) { grdETAKeys.Rows[i].Cells["column1"].Value = list[i].ToStr(); } } else { var row = grdETAKeys.Rows.AddNew(); row.Cells["column1"].Value = APIKey; } } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
private void Display(int AppId) { try { ClsAppsLink dt = null; using (TaxiDataContext db = new TaxiDataContext()) { dt = db.ExecuteQuery <ClsAppsLink>("select Link,Version from AppsLink where AppId =" + AppId).FirstOrDefault(); } if (dt != null) { txtLink.Text = dt.Link; lblVersion.Text = dt.Version; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public void LoadReport() { try { DateTime?dtFrom = dtpFromDate.Value.ToDateorNull(); DateTime?dtTill = dtpToDate.Value.ToDateorNull(); if (dtFrom != null && dtpFromTime.Value != null && dtpFromTime.Value.Value != null) { dtFrom = (dtFrom.Value.ToDate() + dtpFromTime.Value.Value.TimeOfDay).ToDateTime(); } if (dtTill != null && dtptilltime.Value != null && dtptilltime.Value.Value != null) { dtTill = (dtTill.Value.ToDate() + dtptilltime.Value.Value.TimeOfDay).ToDateTime(); } string Error = string.Empty; if (dtFrom == null) { Error = "Required: From Date"; } if (dtTill == null) { if (string.IsNullOrEmpty(Error)) { Error = "Required: To Date"; } else { Error += Environment.NewLine + "Required: To Date"; } } if (!string.IsNullOrEmpty(Error)) { ENUtils.ShowMessage(Error); return; } this.reportViewer1.LocalReport.EnableExternalImages = true; using (TaxiDataContext db = new TaxiDataContext()) { var list = db.ExecuteQuery <stp_QuotationReportResult>("exec stp_QuotationReport {0},{1},{2}", dtFrom, dtTill, ddlDateCriteria.SelectedIndex.ToInt()).ToList(); this.stp_QuotationReportResultBindingSource.DataSource = list; Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[5]; string heading = string.Empty; heading = "Date Range: " + string.Format("{0:yyyy-MM-dd HH:mm}", dtFrom) + " to " + string.Format("{0:yyyy-MM-dd HH:mm}", dtTill); heading = "From: " + string.Format("{0:dd/MM/yyyy}", dtFrom) + " To: " + string.Format("{0:dd/MM/yyyy}", dtTill); string EndDate = string.Format("{0:dd/MM/yyyy}", DateTime.Now); string To = string.Format("{0:dd/MM/yyyy}", dtTill); int Cancelled = list.Where(c => c.BookingStatusId == Enums.BOOKINGSTATUS.CANCELLED).Count(); int Total = list.Count; int pending = Total - Cancelled; int confirmed = list.Where(c => c.BookingNo.EndsWith("/Q") && c.IsQuotation.ToBool() == false).Count(); string TotalPending = "Total Pending: " + pending.ToStr(); string TotalCancelled = "Total Cancelled: " + Cancelled.ToStr(); string TotalJobs = "Total Quotations: " + Total.ToStr(); param[0] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterPeriod", heading); param[1] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterTotalPending", TotalPending); param[2] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterTotalCancelled", TotalCancelled); param[3] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterTotalQuotation", TotalJobs); param[4] = new Microsoft.Reporting.WinForms.ReportParameter("ReportParameterTotalConfirmed", "Total Confirmed: " + confirmed); List <ClsLogo> objLogo = new List <ClsLogo>(); objLogo.Add(new ClsLogo { ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null }); ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo); this.reportViewer1.LocalReport.DataSources.Add(imageDataSource); reportViewer1.LocalReport.SetParameters(param); this.reportViewer1.SetDisplayMode(DisplayMode.Normal); this.reportViewer1.ZoomPercent = 100; this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent; this.reportViewer1.RefreshReport(); IsReportLoaded = true; } } catch (Exception ex) { ENUtils.ShowMessage(ex.Message); } }
public static Taxi_AppMain.PlaceSearchResponse SearchPlaces(string keyword, Coords?coords, double radiusInMiles) { if (keyword == null || keyword == string.Empty) { return(null); } var RadiusInMeter = radiusInMiles * 1609.344; string location = string.Empty; if (coords != null) { location = "&location=" + Convert.ToString(coords.Value.Latitude) + "," + Convert.ToString(coords.Value.Longitude); } else { } if (string.IsNullOrEmpty(PlaceKey)) { using (TaxiDataContext db = new TaxiDataContext()) { PlaceKey = db.ExecuteQuery <string>("select APIKey from mapkeys where maptype='places'").FirstOrDefault().ToStr().Trim(); if (PlaceKey.Length == 0) { PlaceKey = "&key=AIzaSyDQRv7o4pxOeXApK6oKGp7U2FEHIttW5KA"; } else { PlaceKey = "&key=" + PlaceKey; } } } var url = "https://maps.googleapis.com/maps/api/place/textsearch/xml?query=" + HttpUtility.UrlEncode(keyword) + location + "&radius=" + Convert.ToString(RadiusInMeter) + PlaceKey + "&sensor=true®ion=GB"; Taxi_AppMain.PlaceSearchResponse response = new Taxi_AppMain.PlaceSearchResponse(); using (WebClient client = new WebClient()) { client.Proxy = null; var xml = client.DownloadString(url); response = DeserializeXMLToObject <Taxi_AppMain.PlaceSearchResponse>(xml); if (response != null && response.Status == "OK" && coords != null) { if (response.Result.Count > 3) { response.Result = response.Result //.Where(c=>c.Name.ToUpper().Contains(keyword)) .Select(m => new Taxi_AppMain.Result() { Name = m.Name, Type = m.Type, Vicinity = m.Vicinity, Formatted_address = m.Formatted_address, Geometry = m.Geometry, Rating = m.Rating, Icon = m.Icon, Reference = m.Reference, Id = m.Id, Opening_hours = m.Opening_hours, Photo = m.Photo, Place_id = m.Place_id, Scope = m.Scope, Distance = new LatLng(coords.Value.Latitude, coords.Value.Longitude).DistanceMiles(new LatLng(Convert.ToDouble(m.Geometry.Location.Lat), Convert.ToDouble(m.Geometry.Location.Lng))) //new LatLng(Convert.ToDouble(m.Geometry.Location.Lat), Convert.ToDouble(m.Geometry.Location.Lng)).DistanceMiles(new LatLng(coords.Value.Latitude, coords.Value.Longitude)) }).OrderBy(m => m.Distance).ThenByDescending(m => m.Rating).Where(c => c.Distance <= radiusInMiles).Distinct().ToList(); } } } return(response); }
public override void Save() { try { if (objMaster.PrimaryKeyValue == null) { objMaster.New(); } else { objMaster.Edit(); } objMaster.Current.LocationName = txtLocName.Text.Trim(); objMaster.Current.LocationTypeId = ddlLocationType.SelectedValue.ToIntorNull(); objMaster.Current.Address = txtAddress.Text.Trim(); objMaster.Current.PostCode = txtPostCode.Text.Trim(); objMaster.Current.ZoneId = ddlZone.SelectedValue.ToIntorNull(); objMaster.Current.ExtraCommission = numExtraChrgs.Value.ToDecimal(); objMaster.Current.CustomShortKey = chkShortKey.Checked; objMaster.Current.ShortCutKey = txtShortCutKey.Text.Trim().ToLower(); objMaster.Current.Latitude = txtLat.Text.Trim().Length > 0 ? Convert.ToDouble(txtLat.Text.Trim()):0; objMaster.Current.Longitude = txtLng.Text.Trim().Length > 0 ? Convert.ToDouble(txtLng.Text.Trim()):0; if (objMaster.Current.Latitude > 0 && objMaster.Current.ZoneId == null) { try { var plot = (from a in General.GetQueryable <Gen_Zone>(c => (c.ShapeType != null && c.ShapeType == "circle") || (c.MinLatitude != null && (objMaster.Current.Latitude >= c.MinLatitude && objMaster.Current.Latitude <= c.MaxLatitude) && (objMaster.Current.Longitude <= c.MaxLongitude && objMaster.Current.Longitude >= c.MinLongitude))) orderby a.PlotKind select a.Id).ToArray <int>(); if (plot.Count() > 0) { using (TaxiDataContext DB = new TaxiDataContext()) { foreach (var item in plot) { if (FindPoint(Convert.ToDouble(objMaster.Current.Latitude), Convert.ToDouble(objMaster.Current.Longitude), DB.Gen_Zone_PolyVertices.Where(c => c.ZoneId == item).ToList())) { objMaster.Current.ZoneId = item; break; } } } } } catch { } } // objMaster.Current.FullLocationName= (REPLACE(( objMaster.Current.LocationName + ' '+REPLACE(((objMaster.Current.Address,objMaster.Current.PostCode,"")),objMaster.Current.LocationName,"") + " "+objMaster.Current.PostCode)," "," "); objMaster.IsManualLocation = true; objMaster.Save(); AppVars.keyLocations = (from a in AppVars.BLData.GetAll <Gen_Location>(c => c.ShortCutKey != string.Empty) select a.ShortCutKey).Distinct().ToList(); LocationId = objMaster.Current.Id.ToIntorNull(); using (TaxiDataContext db = new TaxiDataContext()) { long locationAddressId = db.ExecuteQuery <long>("select AddressId from Gen_Locations_Address where locationId=" + LocationId).FirstOrDefault(); Gen_Address objAddress = db.Gen_Addresses.FirstOrDefault(c => c.EntityID == locationAddressId); if (objAddress != null) { if (AppVars.listOfAddress.Count(c => c.AddressLine1 == objAddress.AddressLine1) == 0) { AppVars.listOfAddress.Insert(0, new stp_GetFullAddressesResult { AddressLine1 = objAddress.AddressLine1, PostalCode = objAddress.PostalCode, ZoneId = objAddress.ZoneId }); } } } General.RefreshListWithoutSelected <frmLocationList>("frmLocationList1"); } catch (Exception ex) { if (objMaster.Errors.Count > 0) { ENUtils.ShowMessage(objMaster.ShowErrors()); } else { ENUtils.ShowMessage(ex.Message); } } }