protected void oldTrack_Click() { if (datevalidate()) { if (chkPlotLBS.Checked) { updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = getSelectedCarrierID(); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); // DateTime dt = (DateTime)dateFrom.SelectedDate; ds = obj_report.fn_TrackcarrierWithGPSLBS(obj_report, (DateTime)dateFrom.SelectedDate, (DateTime)dateTo.SelectedDate); plotTrack(ds); //plotLBS(ds); } else { updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = getSelectedCarrierID(); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); ds = obj_report.fn_ReplayOnMap(obj_report); plotTrack(ds); } } }
public void create() { try { DataSet ds = new System.Data.DataSet(); DataSet ds2 = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(getSelectedCarrierID()); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); ds = obj_report.fn_Trackcarrier(obj_report); ds2 = obj_report.fn_CarrierName(obj_report); string carrierName = ds2.Tables[0].Rows[0]["carrierName"].ToString(); DateTime date = DateTime.Now; path = "~/KML/" + obj_report.carrierId + " " + date.Year + " " + date.Month + " " + date.Day + " " + date.Hour + " " + date.Minute + " " + date.Second + " " + date.Millisecond + ".kml"; createRequiredPath("~/KML/"); path = ViewState["path"].ToString() + obj_report.carrierId + " " + date.Year + " " + date.Month + " " + date.Day + " " + date.Hour + " " + date.Minute + " " + date.Second + " " + date.Millisecond + ".kml"; Createkml createkml = new Createkml(); createkml.createKmlAdv(ds, path, obj_report.carrierId, carrierName); createKmz(path); Uri url = Request.Url; string temp = url.ToString(); string str = Request.AppRelativeCurrentExecutionFilePath; str = str.Substring(1); path = temp.Substring(0, temp.IndexOf(str)); path = path + "/KML/" + obj_report.carrierId + " " + date.Year + " " + date.Month + " " + date.Day + " " + date.Hour + " " + date.Minute + " " + date.Second + " " + date.Millisecond + ".kmz"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "MyKey", "init('" + path + "');", true); } catch (Exception e) { cls_fileHandling fh = new cls_fileHandling(); fh.appendToFile("~/logs/error.txt", DateTime.Now + ": " + e.Message); fh.appendToFile("~/logs/stackTrace.txt", DateTime.Now + ": " + e.StackTrace); } }
private void Load_ReportMultiple(string rptNAme, int onOff) { //try //{ cls_Reports rpt = new cls_Reports(); Session["ExportFileNameMultiple"] = dd_reportMultiple.SelectedItem.Text; rpt.dateStart = dateFrom.SelectedDate.ToString(); rpt.dateEnd = dateTo.SelectedDate.ToString(); //if (rptNAme == "rpt_prc_geoFencing") //{ // report_geofence(rpt); //} //else if (rptNAme == "rpt_prc_Daily_Summary") //{ // report_summary(rpt); //} //else if (rptNAme == "rpt_prc_idle") //{ // report_idleTime(rpt); //} //else if (rptNAme == "rpt_prc_KM") { report_kmTravelledMultiple(rpt); } //else if (rptNAme == "rpt_prc_WorkTime") //{ // report_workTime(rpt); //} Session["headerStringMultiple"] = lblRptNameMultiple.Text; gv_ReportMultiple.MasterTableView.FilterExpression = String.Empty; gv_ReportMultiple.MasterTableView.SortExpressions.Clear(); gv_ReportMultiple.MasterTableView.GroupByExpressions.Clear(); gv_ReportMultiple.MasterTableView.ClearSelectedItems(); gv_ReportMultiple.MasterTableView.ClearEditItems(); gv_ReportMultiple.DataBind(); gv_ReportMultiple.Visible = true; Session["reportMultiple"] = gv_ReportMultiple.DataSource; //} //catch (Exception ex) //{ //} }
protected void oldTrack_Click(object sender, EventArgs e) { if (datevalidate()) { Timer1.Enabled = false; autoRefresh.Checked = false; DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(txtVehName.SelectedItem.Value); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); ds = obj_report.fn_Trackcarrier(obj_report); plotTrack(ds); } }
protected void oldTrack_Click(object sender, EventArgs e) { if (datevalidate()) { if (chkPlotLBS.Checked) { Timer1.Enabled = false; autoRefresh.Checked = false; updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(txtVehName.SelectedItem.Value); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); // DateTime dt = (DateTime)dateFrom.SelectedDate; ds = obj_report.fn_TrackcarrierWithLBS(obj_report, (DateTime)dateFrom.SelectedDate, (DateTime)dateTo.SelectedDate); plotTrack(ds); plotLBS(ds); UpdatePanelReplayMap.Update(); } else { Timer1.Enabled = false; autoRefresh.Checked = false; updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(txtVehName.SelectedItem.Value); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); ds = obj_report.fn_Trackcarrier(obj_report); plotTrack(ds); UpdatePanelReplayMap.Update(); } } }
protected void oldTrack_Click(object sender, EventArgs e) { if (datevalidate()) { System.Web.UI.ScriptManager.RegisterClientScriptBlock(UpdatePanel9, UpdatePanel9.GetType(), "clearMarkers", "clearMarkers();", true); if (chkPlotLBS.Checked) { Timer1.Enabled = false; autoRefresh.Checked = false; updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(txtVehName.SelectedItem.Value); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); // DateTime dt = (DateTime)dateFrom.SelectedDate; ds = obj_report.fn_TrackcarrierWithLBS(obj_report, (DateTime)dateFrom.SelectedDate, (DateTime)dateTo.SelectedDate); plotTrack(ds); plotLBS(ds); } else { Timer1.Enabled = false; autoRefresh.Checked = false; updatePanelControlPanel.Update(); DataSet ds = new System.Data.DataSet(); cls_Reports obj_report = new cls_Reports(); obj_report.carrierId = Convert.ToInt32(txtVehName.SelectedItem.Value); obj_report.dateStart = dateFrom.SelectedDate.ToString(); obj_report.dateEnd = dateTo.SelectedDate.ToString(); ds = obj_report.fn_Trackcarrier(obj_report); plotTrack(ds); } } }
protected void fillKmChart(DateTime startdt, DateTime enddt) { cls_Reports rpt = new cls_Reports(); //try //{ DataTable selectedVehiles = getSelectedVehicles(); DataSet ds = rpt.GetKmReportForComparison(selectedVehiles, startdt, enddt); ChartTitle title = new ChartTitle(); ChartKm.ChartTitle.TextBlock.Text = "KMs Travelled from: " + startdt.Date.ToShortDateString() + " to:" + enddt.Date.ToShortDateString(); ChartKm.Appearance.BarOverlapPercent = 0; //ChartKm.Appearance.BarWidthPercent = 80; ChartKm.PlotArea.Appearance.Dimensions.Margins.Left = Telerik.Charting.Styles.Unit.Percentage(0); ChartKm.PlotArea.Appearance.Dimensions.Margins.Bottom = Telerik.Charting.Styles.Unit.Percentage(0); ChartKm.PlotArea.Appearance.Dimensions.Margins.Right = Telerik.Charting.Styles.Unit.Percentage(0); ChartKm.PlotArea.XAxis.Clear(); ChartKm.PlotArea.XAxis.AutoScale = true; ChartKm.SeriesOrientation = ChartSeriesOrientation.Horizontal; ChartKm.Series.Add(new ChartSeries("Carriers")); ChartKm.DataSource = ds.Tables[ds.Tables.Count - 1]; ChartKm.Series.Clear(); ChartKm.PlotArea.XAxis.DataLabelsColumn = "carrierName"; //for (int x = 0; x < ds.Tables[ds.Tables.Count-1].Rows.Count; x ++) //{ // ChartSeries series = new ChartSeries(ds.Tables[ds.Tables.Count - 1].Rows[x]["carrierName"].ToString()); // ChartKm.AddChartSeries(series); // ChartSeriesItem item = new ChartSeriesItem(Math.Round((double)ds.Tables[ds.Tables.Count - 1].Rows[x]["totalDistance"])); // item.Name = ds.Tables[ds.Tables.Count - 1].Rows[x]["carrierName"].ToString(); // ChartKm.Series[x].Items.Add(item); // ChartKm.serie //} ChartKm.DataBind(); ChartkmDayWise.ChartTitle.TextBlock.Text = "DateWise KMs Travelled from: " + startdt.Date.ToShortDateString() + " to:" + enddt.Date.ToShortDateString(); ChartkmDayWise.PlotArea.Appearance.Dimensions.Paddings.Left = Telerik.Charting.Styles.Unit.Percentage(0); ChartkmDayWise.PlotArea.Appearance.Dimensions.Paddings.Bottom = Telerik.Charting.Styles.Unit.Percentage(0); ChartkmDayWise.PlotArea.Appearance.Dimensions.Paddings.Right = Telerik.Charting.Styles.Unit.Percentage(0); ChartkmDayWise.Series.Clear(); ChartkmDayWise.PlotArea.XAxis.Clear(); ChartkmDayWise.PlotArea.XAxis.AutoScale = true; for (int x = 0; x < ds.Tables[1].Rows.Count; x++) { ChartkmDayWise.PlotArea.XAxis.AddItem(((DateTime)ds.Tables[1].Rows[x]["date"]).Date.ToShortDateString()); ChartkmDayWise.PlotArea.XAxis.DataLabelsColumn = "date"; } ChartSeries currentSeries = null; for (int x = 0; x < ds.Tables.Count - 1; x = x + 2) { currentSeries = ChartkmDayWise.CreateSeries(ds.Tables[x].Rows[0]["carrierName"].ToString(), System.Drawing.Color.Empty, System.Drawing.Color.Empty, ChartSeriesType.Line); currentSeries.Appearance.LabelAppearance.Shadow.Color = System.Drawing.Color.White; //Border.Color = System.Drawing.Color.Black; //currentSeries.Appearance.ShowLabels = false; } int m = 0; for (int l = 1; l < ds.Tables.Count - 1; l = l + 2) { for (int x = 0; x < ds.Tables[1].Rows.Count; x++) { ChartkmDayWise.Series[m].AddItem((double)(ds.Tables[l].Rows[x]["distance"])); } m++; } //ChartkmDayWise.ChartTitle.TextBlock.Text = "KMs Travelled from: " + startdt.Date.ToShortDateString() + " to:" + enddt.Date.ToShortDateString(); //ChartkmDayWise.Appearance.BarOverlapPercent = 0; //ChartkmDayWise.PlotArea.XAxis.Clear(); //ChartkmDayWise.PlotArea.XAxis.AutoScale = true; //ChartkmDayWise.SeriesOrientation = ChartSeriesOrientation.Vertical; //ChartkmDayWise.Series.Add(new ChartSeries("Carriers")); //ChartkmDayWise.DataSource = ds.Tables[ds.Tables.Count - 1]; //ChartkmDayWise.Series.Clear(); //ChartkmDayWise.PlotArea.XAxis.DataLabelsColumn = "carrierName"; //ChartkmDayWise.DataBind(); UpdatePanelChartKm.Update(); //} //catch (Exception e) //{ // cls_fileHandling fh = new cls_fileHandling(); // fh.appendToFile("~/logs/error.txt", DateTime.Now + ": " + e.Message); // fh.appendToFile("~/logs/stackTrace.txt", DateTime.Now + ": " + e.StackTrace); //} }
protected void btnSubmit_Click(object sender, EventArgs e) { try { lblmsg.Text = ""; geodata.Columns.Add("Latitude"); geodata.Columns.Add("Longtitude"); geodata.Columns.Add("DateTime"); getMapLoad(3); cls_Reports rpt = new cls_Reports(); DataTable dt_latlong = new DataTable(); string timestart = ""; rpt.carrierId = Convert.ToInt32(ddlcarrier.SelectedItem.Value); rpt.dateStart = txtDateStart.Text + " " + ddl_HH.SelectedItem.Text + ":" + ddl_MM.SelectedItem.Text + ":" + "00"; // txtTimeStart.Text; rpt.dateEnd = txtDateEnd.Text + " " + ddl_HH_end.SelectedItem.Text + ":" + ddl_MM_end.SelectedItem.Text + ":" + "00"; // txtTimeEnd.Text; if (ddl_HH_end.SelectedItem.Text + ":" + ddl_MM_end.SelectedItem.Text == "24:00") { timestart = "23:59:59"; rpt.dateEnd = txtDateEnd.Text + " " + timestart; } dt_latlong = rpt.rpt_prc_Geo_getdata(rpt); int rowcount = dt_latlong.Rows.Count; datalatarray = new string[rowcount]; datalongarray = new string[rowcount]; DateTime date = new DateTime(); for (int i = 0; i < rowcount; i++) { datalatarray[i] = dt_latlong.Rows[i]["lat"].ToString(); datalongarray[i] = dt_latlong.Rows[i]["long"].ToString(); date = Convert.ToDateTime(dt_latlong.Rows[i]["DateT"].ToString()); checkGeoArea(datalatarray[i].ToString(), datalongarray[i].ToString(), date, 1); } if (lblmsg.Text != ddlcarrier.SelectedItem.Text + " " + "Carrier not in geofencing Area") { int row = 0; TimeSpan span; TimeSpan tot = new TimeSpan(0, 0, 0); string date1, date2; DataTable dt = new DataTable(); dt = (DataTable)ViewState["tbl_geodata"]; //addition of timr while (row < dt.Rows.Count) { date1 = dt.Rows[row]["DateTime"].ToString(); row++; if (row < dt.Rows.Count) { date2 = dt.Rows[row]["DateTime"].ToString(); span = Convert.ToDateTime(date2).Subtract(Convert.ToDateTime(date1)); tot = tot + span; } } lblmsg.Text = ddlcarrier.SelectedItem.Text + " " + "Carrier is in geofencing Area" + " " + "For selected Date and Time Span for" + " " + tot; } Panel_geodata.Visible = true; gv_geodata.DataSource = geodata; gv_geodata.DataBind(); ViewState["tbl_data"] = geodata; } catch (Exception ex) { } }
protected void report_kmTravelledMultiple(cls_Reports rpt) { DateTime startdt = Convert.ToDateTime(dateFrom.SelectedDate.ToString(), culturenew); // + " " + ddl_HH.SelectedItem.Text + ":" + ddl_MM.SelectedItem.Text + ":" + ddl_SS.SelectedItem.Text); DateTime enddt = Convert.ToDateTime(dateTo.SelectedDate.ToString(), culturenew); //+ " " + ddl_HH_end.SelectedItem.Text + ":" + ddl_MM_end.SelectedItem.Text + ":" + ddl_SS_end.SelectedItem.Text); btnshowchatMultiple.Visible = true; lblmsgMultiple.Text = ""; try { lblRptNameMultiple.Text = "KILOMETER TRAVEL REPORT FOR SELECTED VEHICLES From" + " " + rpt.dateStart + " " + "To" + " " + rpt.dateEnd; km_table.Columns.Add(new DataColumn("Vehicles/Day")); DateTime tempstartDate = startdt; while (tempstartDate < enddt) { km_table.Columns.Add(new DataColumn(tempstartDate.Date.ToShortDateString())); tempstartDate = tempstartDate.AddDays(1); } km_table.Columns.Add("Total KMS"); lblKM.Text = ""; DataSet fleet = getSelectedVehicles(); DataSet ds = rpt.fn_prc_KMtravelMultiple(rpt, fleet.Tables[0], fleet.Tables[1]); double km = 0; double dayKm = 0; if (ds.Tables[0].Rows.Count > 1) { DataTable carriers = ds.Tables[0].DefaultView.ToTable(true, "carrierFId", "carrierName"); for (int i = 0; i < carriers.Rows.Count; i++) { DataRow dr = km_table.NewRow(); tempstartDate = startdt; DateTime tempEndDate = startdt.AddDays(1); TimeSpan span = enddt - startdt; if (span.Days > 1) { km = dayKm = calculateKm(ds.Tables[0].Select(string.Format("time > \'{0}\' and time<\'{1}\' and carrierFId={2}", tempstartDate, tempstartDate.AddDays(1).Date, carriers.Rows[i]["carrierFId"]), "time asc")); dr[tempstartDate.ToShortDateString()] = Math.Round(dayKm, 0); tempstartDate = tempstartDate.AddDays(1).Date; while (tempstartDate < enddt) { dayKm = calculateKm(ds.Tables[0].Select(string.Format("time > \'{0}\' and time<\'{1}\' and carrierFId={2}", tempstartDate, tempstartDate.AddDays(1).Date, carriers.Rows[i]["carrierFId"]), "time asc")); dr[tempstartDate.ToShortDateString()] = Math.Round(dayKm, 0); km = km + dayKm; tempstartDate = tempstartDate.AddDays(1); } } else { km = calculateKm(ds.Tables[0].Select(string.Format("time > \'{0}\' and time<\'{1}\' and carrierFId={2}", startdt, enddt, carriers.Rows[i]["carrierFId"]), "time asc")); dr[startdt.ToShortDateString()] = Math.Round(km, 0); } dr["Vehicles/Day"] = carriers.Rows[i]["carrierName"]; dr["Total KMS"] = Math.Round(km, 0); km_table.Rows.Add(dr); } } gv_ReportMultiple.DataSource = km_table; // gv_ReportMultiple.Rebind(); ViewState["tbl_KMMultiple"] = km_table; //lblKM.Text = "Total Kilometer Travel is:" + " " + Math.Round(km, 0) + " KM"; //lblKM.Visible = true; } catch (Exception e) { cls_fileHandling fh = new cls_fileHandling(); fh.appendToFile("~/logs/error.txt", DateTime.Now + ": " + e.Message); fh.appendToFile("~/logs/stackTrace.txt", DateTime.Now + ": " + e.StackTrace); } }