コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     /////////////////.................MyLocation....................////////////////
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         UserName          = Session["field1"].ToString();
         User_sno          = Session["field3"].ToString();
         Session["field2"] = "MyLocationtrue";
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         if (!Page.IsPostBack)
         {
             if (!Page.IsCallback)
             {
                 // FillplantName();
                 ddwnldr = new DataDownloader();
                 vdm.InitializeDB();
                 // ImageButton1.ImageUrl = "UserImgs/build10.png";
                 UpdateMyLocationUI();
                 FillCategoryName();
             }
         }
     }
 }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     /////////////////.................MyLocation....................////////////////
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         UserName          = Session["field1"].ToString();
         Session["field2"] = "MyLocationtrue";
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         if (!Page.IsPostBack)
         {
             if (!Page.IsCallback)
             {
                 ddwnldr = new DataDownloader();
                 vdm.InitializeDB();
                 FillSelectVehicle();
                 UpdateVehicleGroupData();
             }
         }
     }
 }
コード例 #3
0
ファイル: Alerts.aspx.cs プロジェクト: vyshnavi-bit/GPS
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         UserName          = Session["field1"].ToString();
         Session["field2"] = "MyLocationtrue";
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         if (!Page.IsPostBack)
         {
             if (!Page.IsCallback)
             {
                 ddwnldr = new DataDownloader();
                 vdm.InitializeDB();
                 fillPlant();
                 fillperson_name();
                 UpdateLogins();
             }
         }
     }
 }
コード例 #4
0
ファイル: DataDownloader.cs プロジェクト: vyshnavi-bit/GPS
    public void UpdateVehicleAssingDataTable(string username)
    {
        lock (VehicleAssighData)
        {
            MySqlCommand cmd = new MySqlCommand("select * from VehicleAssignData where Status='INCOMPLETED' and UserName=@un");
            cmd.Parameters.Add("@un", username);
            vdm.InitializeDB();

            VehicleAssighData = vdm.SelectQuery(cmd).Tables[0];

            //VehicleAssighData = vdm.SelectQuery("VehicleAssignData", "*", "Status='INCOMPLETED'");
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["main_user"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            UserName            = Session["main_user"].ToString();
            Lbl_MsgInfo.Visible = false;
            Fdb = new FleetDBMngr();
            Fdb.InitializeDB();
            vdm = new VehicleDBMgr();
            vdm.InitializeDB();

            lblTitle.Text   = Session["TitleName"].ToString();
            lblAddress.Text = Session["Address"].ToString();

            if (!this.IsPostBack)
            {
                if (!Page.IsCallback)
                {
                    Get_VehicleType();
                    Get_VehicleNo();
                    Get_tripId();
                    Get_TripdDetails();
                }
            }
        }
    }
コード例 #6
0
ファイル: MasterPage.master.cs プロジェクト: vyshnavi-bit/GPS
    protected void Page_Load(object sender, EventArgs e)
    {
        KS.ImageUrl = "~/Images/Vyshnavilogo.png";

        if (Session["field1"] == null)
        {
            Response.Redirect("Login.aspx");
        }
        else
        {
            //vdm.UserName = Session["field1"].ToString();
            UserName = Session["field1"].ToString();
            vdm      = new VehicleDBMgr();
            vdm.InitializeDB();

            if (!this.IsPostBack)
            {
                if (!Page.IsCallback)
                {
                    lblMessage.Text = " " + UserName;
                    // InternetSpeed();
                }
            }
        }
    }
コード例 #7
0
 protected void btn_Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text       = "";
         hidePanel.Visible = true;
         DateTime fromdate = DateTime.Now;
         DateTime todate   = DateTime.Now;
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         string[] datestrig = dtp_FromDate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = dtp_Todate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         trips = new DataTable();
         cmd   = new MySqlCommand("SELECT shiftchangetable.sno, shiftchangetable.doe, shiftchangetable.operatedby, loginstable.loginid AS EmployeeName FROM shiftchangetable INNER JOIN loginstable ON shiftchangetable.operatedby = loginstable.refno WHERE (shiftchangetable.doe BETWEEN @d1 AND @d2) GROUP BY EmployeeName, shiftchangetable.doe");
         cmd.Parameters.Add("@d1", GetLowDate(fromdate));
         cmd.Parameters.Add("@d2", GetHighDate(todate));
         trips = vdm.SelectQuery(cmd).Tables[0];
         if (trips.Rows.Count > 0)
         {
             string title = "Tripsheet Report From: " + fromdate.ToString() + "  To: " + todate.ToString();
             Session["title"]         = title;
             Session["filename"]      = "TripsheetReport";
             Session["xportdata"]     = trips;
             dataGridView1.DataSource = trips;
             dataGridView1.DataBind();
         }
         else
         {
             lblmsg.Text = "No data found";
             dataGridView1.DataSource = trips;
             dataGridView1.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
         dataGridView1.DataSource = trips;
         dataGridView1.DataBind();
     }
 }
コード例 #8
0
    protected void btnSubmitt_Click(object sender, EventArgs e)
    {
        try
        {
            if (Session["field1"] != null)
            {
                lblError.Text = "";
                UserName      = Session["field1"].ToString();
                vdm           = new VehicleDBMgr();
                vdm.InitializeDB();
                cmd = new MySqlCommand("SELECT pwd FROM loginstable WHERE loginid = @UN");
                cmd.Parameters.Add("@UN", UserName);
                DataTable dt = vdm.SelectQuery(cmd).Tables[0];//"ManageData", "UserName", new string[] { "UserName=@UserName" }, new string[] { UserName }, new string[] { "" }).Tables[0];
                vdm = null;
                if (dt.Rows.Count > 0)
                {
                    string password = dt.Rows[0]["pwd"].ToString();
                    if (password == txtOldPassWord.Text)
                    {
                        if (txtNewPassWord.Text == txtConformPassWord.Text)
                        {
                            txtNewPassWord.Text = txtConformPassWord.Text;
                            vdm = new VehicleDBMgr();
                            vdm.InitializeDB();
                            cmd = new MySqlCommand("Update loginstable set pwd=@pwd where loginid=@loginid ");
                            cmd.Parameters.Add("@loginid", UserName);
                            cmd.Parameters.Add("@pwd", txtNewPassWord.Text.Trim());
                            vdm.Update(cmd);
                            vdm = null;

                            lblMessage.Text = "Your Password has been Changed successfully";
                        }
                        else
                        {
                            lblError.Text = "Conform password not match";
                        }
                    }
                    else
                    {
                        lblError.Text = "Entered password is incorrect";
                    }
                }
                else
                {
                    lblError.Text = "Entered username is incorrect";
                }
            }
            else
            {
                Response.Redirect("Login.aspx");
            }
        }
        catch (Exception ex)
        {
            lblError.Text = "Password Changed Failed";
        }
    }
コード例 #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (!Page.IsCallback)
     {
         if (!Page.IsPostBack)
         {
             vdm = new VehicleDBMgr();
             vdm.InitializeDB();
             UserName = Session["field1"].ToString();
             cmd      = new MySqlCommand("SELECT SNo,UserName, BranchID, Description, Latitude, Longitude, PhoneNumber, ImagePath, ImageType, Radious, PlantName, IsPlant FROM branchdata WHERE (UserName = @UserName) AND (IsPlant = '1')");
             cmd.Parameters.Add("@UserName", UserName);
             DataTable plants = vdm.SelectQuery(cmd).Tables[0];
             ddl_plant.Items.Clear();
             DataRow row = plants.NewRow();
             row["SNo"]      = 0;
             row["BranchID"] = "Select Plant";
             plants.Rows.InsertAt(row, 0);
             ddl_plant.DataSource     = plants;
             ddl_plant.DataTextField  = "BranchID";
             ddl_plant.DataValueField = "SNo";
             ddl_plant.DataBind();
             //cmd = new MySqlCommand("SELECT sno, TripName, StartTime, EndTime, RouteID, Status, CreationDate, Isrepeat, UserID, PlantName, Kms, extrakms, Chargeperkm FROM tripconfiguration WHERE (UserID = @UserName)");
             //cmd = new MySqlCommand("SELECT routetable.RouteName, tripconfiguration.StartTime, tripconfiguration.EndTime, routetable.SNo, tripconfiguration.Kms,tripconfiguration.extrakms,tripconfiguration.Chargeperkm FROM loginsconfigtable INNER JOIN loginstable ON loginsconfigtable.Refno = loginstable.refno INNER JOIN cabmanagement ON loginsconfigtable.VehicleID = cabmanagement.VehicleID INNER JOIN vehiclemanage ON cabmanagement.PlantName = vehiclemanage.ItemName INNER JOIN tripconfiguration ON vehiclemanage.SNo = tripconfiguration.PlantName INNER JOIN routetable ON tripconfiguration.RouteID = routetable.SNo WHERE (loginstable.loginid = @UserName) GROUP BY routetable.RouteName");
             cmd = new MySqlCommand("SELECT routetable.RouteName, tripconfiguration.StartTime, tripconfiguration.EndTime, routetable.SNo, tripconfiguration.Kms, tripconfiguration.extrakms, tripconfiguration.Chargeperkm FROM tripconfiguration INNER JOIN branchdata ON tripconfiguration.PlantName = branchdata.Sno INNER JOIN cabmanagement ON branchdata.BranchID = cabmanagement.PlantName INNER JOIN loginsconfigtable ON cabmanagement.VehicleID = loginsconfigtable.VehicleID INNER JOIN loginstable ON loginsconfigtable.Refno = loginstable.refno INNER JOIN routetable ON tripconfiguration.RouteID = routetable.SNo WHERE (loginstable.loginid = @UserName) GROUP BY routetable.RouteName");
             cmd.Parameters.Add("@UserName", UserName);
             DataTable routetabledata = vdm.SelectQuery(cmd).Tables[0];
             ddl_routes.Items.Clear();
             DataRow newrow = routetabledata.NewRow();
             newrow["SNo"]       = 0;
             newrow["RouteName"] = "Select All";
             routetabledata.Rows.InsertAt(newrow, 0);
             ddl_routes.DataSource     = routetabledata;
             ddl_routes.DataTextField  = "RouteName";
             ddl_routes.DataValueField = "SNo";
             ddl_routes.DataBind();
             startdate.Text = GetLowDate(DateTime.Now).ToString("dd-MM-yyyy HH:mm");
             enddate.Text   = GetHighDate(DateTime.Now).ToString("dd-MM-yyyy HH:mm");
             //cmd = new MySqlCommand("SELECT tripdata.RouteName, tripdata.PlantName, routesubtable.LocationID FROM routesubtable INNER JOIN routetable ON routesubtable.SNo = routetable.SNo INNER JOIN tripdata ON routetable.RouteName = tripdata.RouteName GROUP BY routesubtable.LocationID");
             //DataTable plantsdata = vdm.SelectQuery(cmd).Tables[0];
             //cmd = new MySqlCommand("SELECT Sno,UserName, BranchID, Description, Latitude, Longitude, PhoneNumber, ImagePath, ImageType, Radious, PlantName, IsPlant FROM branchdata WHERE (UserName = '******')");
             //DataTable branchdata = vdm.SelectQuery(cmd).Tables[0];
             //foreach (DataRow dr in plantsdata.Rows)
             //{
             //    DataRow[] datarows = branchdata.Select("BranchID='" + dr["PlantName"].ToString() + "' and UserName='******'");
             //    if (datarows.Length > 0)
             //    {
             //        cmd = new MySqlCommand("update branchdata set PlantName='" + datarows[0]["Sno"].ToString() + "' WHERE Sno='" + dr["LocationID"].ToString() + "' and (UserName = '******')");
             //        vdm.Update(cmd);
             //    }
             //}
         }
     }
 }
コード例 #10
0
    public void UpdateRoute()
    {
        vdm = new VehicleDBMgr();
        vdm.InitializeDB();
        cmd = new MySqlCommand("SELECT RouteName,SNo FROM routetable where UserID=@UserName");
        cmd.Parameters.Add("@UserName", UserName);
        DataTable routetabledata = vdm.SelectQuery(cmd).Tables[0];

        grdRouteData.DataSource = routetabledata;
        grdRouteData.DataBind();
    }
コード例 #11
0
    void Fillvehicleno()
    {
        vdm = new VehicleDBMgr();
        vdm.InitializeDB();
        cmd = new MySqlCommand("SELECT UserID, VehicleNumber FROM paireddata where vehicletype='Puff' ");
        DataTable dtRoutedata = vdm.SelectQuery(cmd).Tables[0];

        ddlVehicleno.DataSource     = dtRoutedata;
        ddlVehicleno.DataTextField  = "VehicleNumber";
        ddlVehicleno.DataValueField = "VehicleNumber";
        ddlVehicleno.DataBind();
    }
コード例 #12
0
    void Fillbranchdetails()
    {
        vdm = new VehicleDBMgr();
        vdm.InitializeDB();
        cmd = new MySqlCommand("SELECT SNo,UserName, BranchID, Description, Latitude, Longitude, PhoneNumber, ImagePath, ImageType, Radious, PlantName, IsPlant FROM branchdata WHERE (UserName = @UserName) AND (IsPlant = '1')");
        cmd.Parameters.Add("@UserName", username);
        DataTable dtPlant = vdm.SelectQuery(cmd).Tables[0];

        ddlbranchname.DataSource     = dtPlant;
        ddlbranchname.DataTextField  = "BranchID";
        ddlbranchname.DataValueField = "SNo";
        ddlbranchname.DataBind();
    }
コード例 #13
0
ファイル: Login.aspx.cs プロジェクト: vyshnavi-bit/GPS
    protected void btnLogIn_Click(object sender, EventArgs e)
    {
        try
        {
            Session["allvehicles"] = null;
            vdm = new VehicleDBMgr();
            vdm.InitializeDB();

            String UN = "";
            String UserName = txtUserName.Text, PassWord = txtPassword.Text;
            cmd = new MySqlCommand("SELECT refno, main_user, loginid as UserName, pwd, usertype FROM loginstable WHERE (loginid = @UN) and (pwd=@Pwd)");
            cmd.Parameters.Add("@UN", UserName);
            cmd.Parameters.Add("@Pwd", PassWord);
            DataTable dt = vdm.SelectQuery(cmd).Tables[0];//"ManageData", "UserName", new string[] { "UserName=@UserName" }, new string[] { UserName }, new string[] { "" }).Tables[0];
            if (dt.Rows.Count > 0)
            {
                Session["field1"]    = dt.Rows[0]["UserName"].ToString();
                Session["field2"]    = true;
                Session["UserType"]  = dt.Rows[0]["usertype"].ToString();
                Session["field3"]    = dt.Rows[0]["refno"].ToString();
                Session["main_user"] = dt.Rows[0]["main_user"].ToString();
                string   UserType    = dt.Rows[0]["UserType"].ToString();
                DateTime Currentdate = VehicleDBMgr.GetTime(vdm.conn);
                //cmd = new MySqlCommand("insert into logininfo(username,doe) values(@username,@doe)");
                //cmd.Parameters.Add("@username", UserName);
                //cmd.Parameters.Add("@doe", Currentdate);
                //vdm.insert(cmd);
                Session["TitleName"] = "SRI VYSHNAVI DAIRY SPECIALITIES (P) LTD";
                Session["Address"]   = "R.S.No:381/2,Punabaka village Post,Pellakuru Mandal,Nellore District -524129., ANDRAPRADESH (State).Phone: 9440622077, Fax: 044 – 26177799.,";
                if (UserType == "Admin")
                {
                    // Response.Redirect("WelcomePage.aspx", false);
                    Response.Redirect("Default.aspx", false);
                }
                else
                {
                    //Response.Redirect("WelcomePage.aspx", false);
                    Response.Redirect("Default.aspx", false);
                }
            }
            else
            {
                //MessageBox.Show("Please enter Correct User ID",this);
                MessageBox.Show("Please enter Correct User ID and Password", this);
            }
        }
        catch (Exception ex)
        {
            lbl_validation.Text = ex.ToString();
        }
    }
コード例 #14
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (!Page.IsCallback)
     {
         if (!Page.IsPostBack)
         {
             vdm = new VehicleDBMgr();
             vdm.InitializeDB();
             UserName = Session["field1"].ToString();
         }
     }
 }
コード例 #15
0
 protected void grdRouteData_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (grdRouteData.SelectedIndex >= -1)
     {
         GridViewRow selectedrw = grdRouteData.SelectedRow;
         txtRouteName.Text = selectedrw.Cells[1].Text;
         RefSno            = selectedrw.Cells[2].Text;
         Session["Sno"]    = RefSno;
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         cmd = new MySqlCommand("SELECT routesubtable.SNo, routesubtable.Rank, routesubtable.LocationID, branchdata.BranchID AS BranchName FROM routesubtable INNER JOIN branchdata ON routesubtable.LocationID = branchdata.Sno WHERE (routesubtable.SNo = @SNo)");
         //cmd = new MySqlCommand("SELECT LocationID,Rank,BranchName FROM routesubtable where SNo=@SNo order by Rank ");
         cmd.Parameters.Add("@SNo", RefSno);
         DataTable routesubtabledata = vdm.SelectQuery(cmd).Tables[0];
         chblselected.Items.Clear();
         foreach (ListItem LV in chbllocations.Items)
         {
             LV.Selected = false;
         }
         foreach (DataRow dr in routesubtabledata.Rows)
         {
             foreach (ListItem LV in chbllocations.Items)
             {
                 if (LV.Text == dr["BranchName"].ToString())
                 {
                     LV.Selected = true;
                     break;
                 }
             }
         }
         foreach (DataRow LV in routesubtabledata.Rows)
         {
             //if (LV.Selected == true)
             //{
             //if (!chblselected.Items.Contains(LV))
             chblselected.Items.Add(new ListItem(LV["BranchName"].ToString(), LV["LocationID"].ToString()));
             //}
         }
         MapAdd();
         Btnedit           = "true";
         lblmsg.Text       = "";
         btnRouteSave.Text = "Edit";
         ScriptManager.RegisterStartupScript(Page, GetType(), "JsStatus", "ChangeButtonText();", true);
     }
 }
コード例 #16
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["main_user"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (!Page.IsCallback)
     {
         if (!Page.IsPostBack)
         {
             vdm = new VehicleDBMgr();
             vdm.InitializeDB();
             UserName = Session["main_user"].ToString();
             cmd      = new MySqlCommand("SELECT SNo,UserName, BranchID, Description, Latitude, Longitude, PhoneNumber, ImagePath, ImageType, Radious, PlantName, IsPlant FROM branchdata WHERE (UserName = @UserName) AND (IsPlant = '1')");
             cmd.Parameters.Add("@UserName", UserName);
             DataTable plants = vdm.SelectQuery(cmd).Tables[0];
             ddl_plant.Items.Clear();
             DataRow row = plants.NewRow();
             row["SNo"]      = 0;
             row["BranchID"] = "Select Plant";
             plants.Rows.InsertAt(row, 0);
             ddl_plant.DataSource     = plants;
             ddl_plant.DataTextField  = "BranchID";
             ddl_plant.DataValueField = "SNo";
             ddl_plant.DataBind();
             //cmd = new MySqlCommand("SELECT sno, TripName, StartTime, EndTime, RouteID, Status, CreationDate, Isrepeat, UserID, PlantName, Kms, extrakms, Chargeperkm FROM tripconfiguration WHERE (UserID = @UserName)");
             //cmd = new MySqlCommand("SELECT routetable.RouteName, tripconfiguration.StartTime, tripconfiguration.EndTime, routetable.SNo, tripconfiguration.Kms,tripconfiguration.extrakms,tripconfiguration.Chargeperkm FROM loginsconfigtable INNER JOIN loginstable ON loginsconfigtable.Refno = loginstable.refno INNER JOIN cabmanagement ON loginsconfigtable.VehicleID = cabmanagement.VehicleID INNER JOIN vehiclemanage ON cabmanagement.PlantName = vehiclemanage.ItemName INNER JOIN tripconfiguration ON vehiclemanage.SNo = tripconfiguration.PlantName INNER JOIN routetable ON tripconfiguration.RouteID = routetable.SNo WHERE (loginstable.loginid = @UserName) GROUP BY routetable.RouteName");
             cmd = new MySqlCommand("SELECT routetable.RouteName, tripconfiguration.StartTime, tripconfiguration.EndTime, routetable.SNo, tripconfiguration.Kms, tripconfiguration.extrakms, tripconfiguration.Chargeperkm FROM tripconfiguration INNER JOIN branchdata ON tripconfiguration.PlantName = branchdata.Sno INNER JOIN cabmanagement ON branchdata.BranchID = cabmanagement.PlantName INNER JOIN loginsconfigtable ON cabmanagement.VehicleID = loginsconfigtable.VehicleID INNER JOIN loginstable ON loginsconfigtable.Refno = loginstable.refno INNER JOIN routetable ON tripconfiguration.RouteID = routetable.SNo WHERE (loginstable.loginid = @UserName) GROUP BY routetable.RouteName");
             cmd.Parameters.Add("@UserName", UserName);
             DataTable routetabledata = vdm.SelectQuery(cmd).Tables[0];
             ddl_routes.Items.Clear();
             DataRow newrow = routetabledata.NewRow();
             newrow["SNo"]       = 0;
             newrow["RouteName"] = "Select All";
             routetabledata.Rows.InsertAt(newrow, 0);
             ddl_routes.DataSource     = routetabledata;
             ddl_routes.DataTextField  = "RouteName";
             ddl_routes.DataValueField = "SNo";
             ddl_routes.DataBind();
         }
     }
 }
コード例 #17
0
 public void getreport()
 {
     try
     {
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         lblmsg.Text       = "";
         hidePanel.Visible = true;
         DataTable Report = new DataTable();
         Report.Columns.Add("Sno");
         Report.Columns.Add("VehicleNumber");
         Report.Columns.Add("GprsDevID");
         Report.Columns.Add("DeviceType");
         Report.Columns.Add("PhoneNumber");
         Report.Columns.Add("PlantName");
         Report.Columns.Add("RouteName");
         int i = 1;
         cmd = new MySqlCommand("SELECT paireddata.VehicleNumber, paireddata.GprsDevID, paireddata.DeviceType, paireddata.PhoneNumber, cabmanagement.PlantName, cabmanagement.RouteCode as RouteName FROM loginsconfigtable INNER JOIN paireddata ON loginsconfigtable.VehicleID = paireddata.VehicleNumber INNER JOIN loginstable ON paireddata.UserID = loginstable.main_user AND loginsconfigtable.Refno = loginstable.refno INNER JOIN cabmanagement ON paireddata.VehicleNumber = cabmanagement.VehicleID WHERE (loginstable.loginid = @UserName) order by PlantName,RouteName");
         cmd.Parameters.Add("@UserName", UserName);
         DataTable dt = vdm.SelectQuery(cmd).Tables[0];
         foreach (DataRow dr in dt.Rows)
         {
             DataRow newrow = Report.NewRow();
             newrow["Sno"]           = i++.ToString();
             newrow["VehicleNumber"] = dr["VehicleNumber"].ToString();
             newrow["GprsDevID"]     = dr["GprsDevID"].ToString();
             newrow["DeviceType"]    = dr["DeviceType"].ToString();
             newrow["PhoneNumber"]   = dr["PhoneNumber"].ToString();
             newrow["PlantName"]     = dr["PlantName"].ToString();
             newrow["RouteName"]     = dr["RouteName"].ToString();
             Report.Rows.Add(newrow);
         }
         grdReport.DataSource = Report;
         grdReport.DataBind();
         Session["xportdata"] = Report;
         Session["title"]     = "Vehicle Master";
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
     }
 }
コード例 #18
0
 protected void ddl_plant_selectionchanged(object sender, EventArgs e)
 {
     if (ddl_plant.SelectedIndex > 0)
     {
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         cmd = new MySqlCommand("SELECT routetable.RouteName, routetable.SNo FROM routetable INNER JOIN tripconfiguration ON routetable.SNo = tripconfiguration.RouteID WHERE (tripconfiguration.PlantName = @PlantNameSno) GROUP BY routetable.SNo");
         cmd.Parameters.Add("@PlantNameSno", ddl_plant.SelectedValue);
         DataTable routetabledata = vdm.SelectQuery(cmd).Tables[0];
         ddl_routes.Items.Clear();
         DataRow newrow = routetabledata.NewRow();
         newrow["SNo"]       = 0;
         newrow["RouteName"] = "Select All";
         routetabledata.Rows.InsertAt(newrow, 0);
         ddl_routes.DataSource     = routetabledata;
         ddl_routes.DataTextField  = "RouteName";
         ddl_routes.DataValueField = "SNo";
         ddl_routes.DataBind();
     }
 }
コード例 #19
0
ファイル: ManageLogins.aspx.cs プロジェクト: vyshnavi-bit/GPS
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     if (!Page.IsCallback)
     {
         if (!Page.IsPostBack)
         {
             vdm = new VehicleDBMgr();
             vdm.InitializeDB();
             UserName = Session["field1"].ToString();
             cmd      = new MySqlCommand("select Sno from paireddata where UserID=@UserID");
             cmd.Parameters.Add("@UserID", UserName);
             mainusrsno = vdm.SelectQuery(cmd).Tables[0].Rows[0][0].ToString();
             FillPlant();
             UpdateLogins();
         }
     }
 }
コード例 #20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["field1"] == null)
     {
         Response.Redirect("Login.aspx");
     }
     else
     {
         UserName = Session["field1"].ToString();
         vdm      = new VehicleDBMgr();
         vdm.InitializeDB();
         if (!this.IsPostBack)
         {
             if (!Page.IsCallback)
             {
                 ddwnldr = new DataDownloader();
                 ddwnldr.UpdateBranchDetails(UserName);
                 FillRoute();
             }
         }
     }
 }
コード例 #21
0
 void GetReport()
 {
     try
     {
         lbl_msg.Text         = "";
         pnlHide.Visible      = true;
         Session["RouteName"] = ddlbranchname.SelectedItem.Text;
         Session["IDate"]     = DateTime.Now.AddDays(1).ToString("dd/MM/yyyy");
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         DateTime fromdate      = DateTime.Now;
         string[] dateFromstrig = txtFromdate.Text.Split(' ');
         if (dateFromstrig.Length > 1)
         {
             if (dateFromstrig[0].Split('-').Length > 0)
             {
                 string[] dates = dateFromstrig[0].Split('-');
                 string[] times = dateFromstrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         lbl_selfromdate.Text = fromdate.ToString("dd/MM/yyyy");
         lblRoutName.Text     = ddlbranchname.SelectedItem.Text;
         Session["xporttype"] = "TallyJV";
         string ledger = "";
         Report.Columns.Add("JV No.");
         Report.Columns.Add("JV Date");
         Report.Columns.Add("Ledger Name");
         Report.Columns.Add("Amount");
         Report.Columns.Add("Narration");
         Session["filename"] = ddlbranchname.SelectedItem.Text + " Tally JV" + fromdate.ToString("dd/MM/yyyy");
         cmd = new MySqlCommand("SELECT journel_entry.sno, journel_entry.plantid, journel_entry.amount, journel_entry.remarks, journel_entry.doe, journel_entry.createdby, journel_entry.status,  branchdata.BranchID AS Branchname FROM journel_entry INNER JOIN branchdata ON journel_entry.plantid = branchdata.Sno WHERE (journel_entry.doe BETWEEN @d1 AND @d2) AND (journel_entry.plantid = @plantid) ORDER BY journel_entry.doe");
         cmd.Parameters.Add("@plantid", ddlbranchname.SelectedValue);
         cmd.Parameters.Add("@d1", GetLowDate(fromdate));
         cmd.Parameters.Add("@d2", GetHighDate(fromdate));
         DataTable dtble     = vdm.SelectQuery(cmd).Tables[0];
         double    totamount = 0;
         fromdate = fromdate.AddDays(-1);
         string   frmdate = fromdate.ToString("dd-MM-yyyy");
         string[] strjv   = frmdate.Split('-');
         foreach (DataRow branch in dtble.Rows)
         {
             cmd = new MySqlCommand("SELECT headofaccounts_master.accountname, subjournel_entry.amount FROM subjournel_entry INNER JOIN headofaccounts_master ON subjournel_entry.headofaccount = headofaccounts_master.sno WHERE (subjournel_entry.refno = @RefNo)");
             cmd.Parameters.Add("@RefNo", branch["sno"].ToString());
             DataTable dtdebit = vdm.SelectQuery(cmd).Tables[0];
             foreach (DataRow drdebit in dtdebit.Rows)
             {
                 DataRow newrow = Report.NewRow();
                 newrow["JV No."]      = "PROCTRANS" + "_" + branch["sno"].ToString();
                 newrow["JV Date"]     = fromdate.ToString("dd-MMM-yyyy");
                 newrow["Ledger Name"] = drdebit["accountname"].ToString();
                 double amount = 0;
                 double.TryParse(drdebit["amount"].ToString(), out amount);
                 totamount          += amount;
                 newrow["Amount"]    = amount;
                 newrow["Narration"] = "Being the " + drdebit["accountname"].ToString() + " for the month of " + fromdate.ToString("MMM-yyyy") + " Total Amount " + drdebit["amount"].ToString() + ",Emp Name  " + Session["field1"].ToString();
                 Report.Rows.Add(newrow);
             }
             cmd = new MySqlCommand("SELECT headofaccounts_master.accountname, subjournel_credit_entry.amount, subjournel_credit_entry.sno FROM headofaccounts_master INNER JOIN subjournel_credit_entry ON headofaccounts_master.sno = subjournel_credit_entry.headofaccount WHERE (subjournel_credit_entry.refno = @refno)");
             cmd.Parameters.Add("@RefNo", branch["sno"].ToString());
             DataTable dtcredit = vdm.SelectQuery(cmd).Tables[0];
             foreach (DataRow drcredit in dtcredit.Rows)
             {
                 DataRow newrow = Report.NewRow();
                 newrow["JV No."]      = "PROCTRANS" + "_" + branch["sno"].ToString();
                 newrow["JV Date"]     = fromdate.ToString("dd-MMM-yyyy");
                 newrow["Ledger Name"] = drcredit["accountname"].ToString();
                 double amount = 0;
                 double.TryParse(drcredit["amount"].ToString(), out amount);
                 totamount          += amount;
                 newrow["Amount"]    = "-" + amount;
                 newrow["Narration"] = "Being the " + drcredit["accountname"].ToString() + " for the month of " + fromdate.ToString("MMM-yyyy") + " Total Amount " + drcredit["amount"].ToString() + ",Emp Name  " + Session["field1"].ToString();
                 Report.Rows.Add(newrow);
             }
         }
         grdReports.DataSource = Report;
         grdReports.DataBind();
         Session["xportdata"] = Report;
     }
     catch (Exception ex)
     {
         lbl_msg.Text          = ex.Message;
         grdReports.DataSource = Report;
         grdReports.DataBind();
     }
 }
コード例 #22
0
    protected void btn_Generate_Click(object sender, EventArgs e)
    {
        try
        {
            lblmsg.Text       = "";
            hidePanel.Visible = true;
            DateTime fromdate = DateTime.Now;
            DateTime todate   = DateTime.Now;
            vdm = new VehicleDBMgr();
            vdm.InitializeDB();
            string[] datestrig = dtp_FromDate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            datestrig = dtp_Todate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }
            Report.Columns.Add("VehicleID");
            Report.Columns.Add("DateTime");
            Report.Columns.Add("Diesel");
            Report.Columns.Add("ConsumedDiesel");
            Report.Columns.Add("Speed");
            Report.Columns.Add("Latitiude");
            Report.Columns.Add("Longitude");
            Report.Columns.Add("difference");
            List <string> logstbls = new List <string>();
            logstbls.Add("GpsTrackVehicleLogs");
            logstbls.Add("GpsTrackVehicleLogs1");
            logstbls.Add("GpsTrackVehicleLogs2");
            logstbls.Add("GpsTrackVehicleLogs3");
            logstbls.Add("GpsTrackVehicleLogs4");
            DataTable logs     = new DataTable();
            DataTable tottable = new DataTable();
            string    veh      = "AP26TC6786";
            string    user     = Session["field1"].ToString();
            foreach (string tbname in logstbls)
            {
                cmd = new MySqlCommand("SELECT " + tbname + ".VehicleID, " + tbname + ".Speed, " + tbname + ".DateTime, " + tbname + ".Diesel, " + tbname + ".Latitiude, " + tbname + ".Longitude, " + tbname + ".TimeInterval, " + tbname + ".inp4, " + tbname + ".Status, " + tbname + ".Odometer, " + tbname + ".Direction, " + tbname + ".Direction AS Expr1," + tbname + ".Latitiude," + tbname + ".Longitude FROM " + tbname + "  WHERE (" + tbname + ".DateTime >= @starttime) AND (" + tbname + ".DateTime <= @endtime) AND (" + tbname + ".VehicleID = '" + veh + "') and (" + tbname + ".UserID='" + user + "') and (" + tbname + ".Diesel<=350)  ORDER BY " + tbname + ".DateTime");
                cmd.Parameters.Add(new MySqlParameter("@starttime", GetLowDate(fromdate)));
                cmd.Parameters.Add(new MySqlParameter("@endtime", GetHighDate(todate)));
                logs = vdm.SelectQuery(cmd).Tables[0];
                if (tottable.Rows.Count == 0)
                {
                    tottable = logs.Clone();
                }
                foreach (DataRow dr in logs.Rows)
                {
                    tottable.ImportRow(dr);
                }
            }
            DataView dv1 = tottable.DefaultView;
            dv1.Sort = "DateTime ASC";
            table    = dv1.ToTable();
            if (table.Rows.Count > 0)
            {
                DataView dv = table.DefaultView;
                dv.Sort = "DateTime ASC";
                DataTable sortedProductDT = dv.ToTable();
                double    prevLat         = 0.0;
                double    prevLon         = 0.0;
                double    difference      = 0.0;
                double    Totdifference   = 0.0;

                double   prevdiesel              = 0.0;
                int      status                  = 0;
                int      speedstopstatus         = 0;
                double   prevconsumeddieselvalue = 0.0;
                int      prevspeed               = 0;
                double   dieselmainvalue         = 0.0;
                DateTime startdt3                = new DateTime();
                DateTime Enddt      = new DateTime();
                double   diffdiesel = 0.0;

                int[] arrminspeed = new int[table.Rows.Count];
                int[] arrmaxspeed = new int[table.Rows.Count];


                foreach (DataRow dr in sortedProductDT.Rows)
                {
                    DataRow newrow = Report.NewRow();
                    newrow["VehicleID"] = dr["VehicleID"].ToString();
                    newrow["DateTime"]  = dr["DateTime"].ToString();
                    newrow["Diesel"]    = dr["Diesel"].ToString();
                    newrow["Speed"]     = dr["Speed"].ToString();
                    newrow["Latitiude"] = dr["Latitiude"].ToString();
                    newrow["Longitude"] = dr["Longitude"].ToString();
                    //
                    double presLat    = Convert.ToDouble(dr["Latitiude"].ToString());
                    double presLon    = Convert.ToDouble(dr["Longitude"].ToString());
                    double presdiesel = Convert.ToDouble(dr["Diesel"].ToString());


                    if (status > 0)
                    {
                        difference = GPSApplication.GeoCodeCalc.CalcDistance(presLat, presLon, prevLat, prevLon);
                    }
                    Totdifference        = Totdifference + Convert.ToDouble(difference.ToString("F2"));
                    newrow["difference"] = Totdifference.ToString("F2");

                    prevLat = presLat;
                    prevLon = presLon;


                    int speed = 0;
                    int.TryParse(dr["Speed"].ToString(), out speed);

                    prevspeed = speed;
                    //Speed
                    if (speed > 0)
                    {
                        arrminspeed[status] = speed;
                        arrmaxspeed[status] = speed;
                    }
                    Lbl_minspeed.Text = "Min Speed :" + arrminspeed.Min().ToString();

                    Lbl_maxspeed.Text = "Max Speed" + arrmaxspeed.Max().ToString();


                    //
                    if (speed >= 5)
                    {
                        if (prevdiesel == 0.0)
                        {
                            prevdiesel = Convert.ToDouble(dr["Diesel"].ToString());
                        }
                        newrow["ConsumedDiesel"] = (prevdiesel - (avgltrperkm * difference)).ToString("F2");
                        dieselmainvalue          = Convert.ToDouble(newrow["ConsumedDiesel"]);
                        prevdiesel      = (prevdiesel - (avgltrperkm * difference));
                        speedstopstatus = 0;
                    }
                    else
                    {
                        // newrow["ConsumedDiesel"] = dr["Diesel"].ToString();
                        if (prevdiesel == 0.0)
                        {
                            prevdiesel = Convert.ToDouble(dr["Diesel"].ToString());
                        }
                        speedstopstatus++;
                        if (speedstopstatus > 2)
                        {
                            if (prevspeed == 0)
                            {
                                //  newrow["ConsumedDiesel"] = prevconsumeddieselvalue.ToString("F2");
                                // prevdiesel = prevconsumeddieselvalue;

                                if (speedstopstatus == 3)
                                {
                                    // startdt3 = Convert.ToDateTime(dr["DateTime"].ToString());
                                    startdt3 = DateTime.Parse(dr["DateTime"].ToString());
                                }
                                Enddt = DateTime.Parse(dr["DateTime"].ToString());
                                string h1 = startdt3.ToString("mm");
                                string h2 = Enddt.ToString("mm");
                                int    d  = (Convert.ToInt32(h2) - Convert.ToInt32(h1));


                                diffdiesel = (presdiesel - prevdiesel);
                                if (diffdiesel > dieselcutvalue && d > 5)
                                {
                                    newrow["ConsumedDiesel"] = dr["Diesel"].ToString();
                                    dieselmainvalue          = Convert.ToDouble(newrow["ConsumedDiesel"]);
                                    prevdiesel = presdiesel;
                                }
                                else
                                {
                                    newrow["ConsumedDiesel"] = (prevdiesel - (avgltrperkm * difference)).ToString("F2");
                                    prevconsumeddieselvalue  = (prevdiesel - (avgltrperkm * difference));
                                    prevdiesel = prevconsumeddieselvalue;
                                }
                                //  speedstopstatus = 0;
                            }
                            else
                            {
                                newrow["ConsumedDiesel"] = (prevdiesel - (avgltrperkm * difference)).ToString("F2");
                                dieselmainvalue          = Convert.ToDouble(newrow["ConsumedDiesel"]);
                                prevdiesel = prevconsumeddieselvalue;
                            }
                        }
                        else
                        {
                            if (speedstopstatus > 0 && speedstopstatus <= 2)
                            {
                                newrow["ConsumedDiesel"] = (prevdiesel - (avgltrperkm * difference)).ToString("F2");
                                dieselmainvalue          = Convert.ToDouble(newrow["ConsumedDiesel"]);
                                prevconsumeddieselvalue  = prevdiesel - (avgltrperkm * difference);
                                prevdiesel = prevconsumeddieselvalue;
                            }
                            else
                            {
                                //newrow["ConsumedDiesel"] = (prevdiesel - (0.26 * difference)).ToString("F2");
                                //  prevconsumeddieselvalue = prevdiesel - (0.26 * difference);

                                // double diffdiesel = presdiesel - Convert.ToDouble(dr["Diesel"].ToString());
                                if (diffdiesel > 30)
                                {
                                    newrow["ConsumedDiesel"] = dr["Diesel"].ToString();
                                    prevconsumeddieselvalue  = Convert.ToDouble(dr["Diesel"].ToString());
                                    prevdiesel = prevconsumeddieselvalue;
                                }
                                else
                                {
                                    newrow["ConsumedDiesel"] = (prevdiesel - (avgltrperkm * difference)).ToString("F2");
                                    prevconsumeddieselvalue  = (prevdiesel - (avgltrperkm * difference));
                                    prevdiesel = prevconsumeddieselvalue;
                                }
                            }

                            // prevdiesel = prevconsumeddieselvalue;
                        }
                    }
                    prevspeed = speed;
                    //
                    Report.Rows.Add(newrow);
                    status++;
                    //1.Totdifference  2.TotalDieselConsumed=(avgltrperkm*Totdifference)
                    //3.Avgspeed=   4.Maxspeed=   5.TotalTriptime=   6. Trip Idletime  7.Trip Traveltime  8.No of stops

                    startdt3 = fromdate;
                    Enddt    = todate;
                    //string dd = Enddt.Subtract(startdt3).TotalDays.ToString();
                    string hd = Enddt.Subtract(startdt3).TotalHours.ToString();
                    string md = Enddt.Subtract(startdt3).TotalMinutes.ToString();

                    //DateTime Tripstarttime = DateTime.Parse(dtp_FromDate.ToString());
                    //DateTime TripEndtime = DateTime.Parse(dtp_Todate.ToString());
                    Lbl_Totdistance.Text   = "TotTravel Distance :" + Totdifference.ToString();
                    Lbl_TotFuel.Text       = "TotFuel :" + (avgltrperkm * Totdifference).ToString("F2");
                    Lbl_TripStarttime.Text = "Trip Start :" + dtp_FromDate.Text.ToString();
                    Lbl_TripEndtime.Text   = "Trip End :" + dtp_Todate.Text.ToString();
                    Lbl_TotalTripinfo.Text = "Total Trip Info :" + hd + "hr" + ":" + md + "min";
                }
                string title = "Fuel Report From: " + fromdate.ToString() + "  To: " + todate.ToString();
                Session["title"]         = title;
                Session["filename"]      = "FuelReport";
                Session["xportdata"]     = Report;
                dataGridView1.DataSource = Report;
                dataGridView1.DataBind();
            }
            else
            {
                lblmsg.Text = "No data found";
                dataGridView1.DataSource = Report;
                dataGridView1.DataBind();
            }
        }
        catch (Exception ex)
        {
            lblmsg.Text = ex.Message;
            dataGridView1.DataSource = Report;
            dataGridView1.DataBind();
        }
    }
コード例 #23
0
 protected void btnRouteSave_OnClick(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text = "";
         vdm         = new VehicleDBMgr();
         vdm.InitializeDB();
         string RouteName = txtRouteName.Text;
         //string BrachNames = chblselected.Items;
         //BrachNames = BrachNames.Substring(0, BrachNames.Length - 1);
         //string Ranks = context.Request["Ranks"];
         //string[] strBrachNames = BrachNames.Split('-');
         //Ranks = Ranks.Substring(0, Ranks.Length - 1);
         //string[] strRanks = Ranks.Split('-');
         //string strSno = context.Request["Sno"];
         //string[] SpltSno = strSno.Split('-');
         //int rank = 0;
         //int.TryParse(Ranks.ToString(), out rank);
         //string Username = context.Session["field1"].ToString();
         //string btnSave = context.Request["btnRouteSave"];
         if (btnRouteSave.Text == "Save")
         {
             cmd = new MySqlCommand("Insert into Routetable(RouteName,UserID) values(@RouteName,@UserID)");
             cmd.Parameters.Add("@RouteName", RouteName);
             cmd.Parameters.Add("@UserID", UserName);
             vdm.insert(cmd);
             cmd = new MySqlCommand("Select SNo from Routetable where RouteName=@RouteName and UserID=@UserID ");
             cmd.Parameters.Add("@RouteName", RouteName);
             cmd.Parameters.Add("@UserID", UserName);
             DataTable dt    = vdm.SelectQuery(cmd).Tables[0];
             int       Sno   = (int)dt.Rows[0]["Sno"];
             DataTable dtSno = (DataTable)Session["Branchdata"];
             int       i     = 0;
             foreach (ListItem str in chblselected.Items)
             {
                 foreach (DataRow dr in dtSno.Rows)
                 {
                     if (str.Text == dr["BranchID"].ToString())
                     {
                         //cmd = new MySqlCommand("Select BranchID from branchdata where UserName=@UserName and Sno=@Sno");
                         //cmd.Parameters.Add("@UserName", UserName);
                         //cmd.Parameters.Add("@Sno", SpltSno[i]);
                         //DataTable dtBranch = vdm.SelectQuery(cmd).Tables[0];
                         //string BranchID = dtBranch.Rows[0]["BranchID"].ToString();
                         cmd = new MySqlCommand("Insert into Routesubtable(SNo,LocationID,BranchName,Rank) values(@SNo,@LocationID,@BranchName,@Rank)");
                         cmd.Parameters.Add("@SNo", Sno);
                         cmd.Parameters.Add("@LocationID", dr["Sno"].ToString());
                         cmd.Parameters.Add("@BranchName", dr["BranchID"].ToString());
                         cmd.Parameters.Add("@Rank", i);
                         vdm.insert(cmd);
                         i++;
                     }
                 }
             }
             lblmsg.Text = "Route Saved Successfully";
             UpdateRoute();
             refresh();
         }
         else if (btnRouteSave.Text == "Edit")
         {
             vdm = new VehicleDBMgr();
             vdm.InitializeDB();
             cmd = new MySqlCommand("Update Routetable set RouteName=@RouteName where UserID=@UserID and SNo=@SNo");
             cmd.Parameters.Add("@RouteName", txtRouteName.Text);
             cmd.Parameters.Add("@UserID", UserName);
             cmd.Parameters.Add("@SNo", RefSno);
             vdm.insert(cmd);
             cmd = new MySqlCommand("Select SNo from Routetable where RouteName=@RouteName and UserID=@UserID ");
             cmd.Parameters.Add("@RouteName", txtRouteName.Text);
             cmd.Parameters.Add("@UserID", UserName);
             DataTable dt  = vdm.SelectQuery(cmd).Tables[0];
             int       Sno = (int)dt.Rows[0]["Sno"];
             cmd = new MySqlCommand("Delete from  Routesubtable where SNo=@SNo");
             cmd.Parameters.Add("@Sno", Sno);
             vdm.Delete(cmd);
             DataTable dtSno = (DataTable)Session["Branchdata"];
             int       i     = 0;
             foreach (ListItem str in chblselected.Items)
             {
                 foreach (DataRow dr in dtSno.Rows)
                 {
                     if (str.Text == dr["BranchID"].ToString())
                     {
                         //cmd = new MySqlCommand("Select BranchID from branchdata where UserName=@UserName and Sno=@Sno");
                         //cmd.Parameters.Add("@UserName", UserName);
                         //cmd.Parameters.Add("@Sno", SpltSno[i]);
                         //DataTable dtBranch = vdm.SelectQuery(cmd).Tables[0];
                         //string BranchID = dtBranch.Rows[0]["BranchID"].ToString();
                         cmd = new MySqlCommand("Insert into Routesubtable(SNo,LocationID,BranchName,Rank) values(@SNo,@LocationID,@BranchName,@Rank)");
                         cmd.Parameters.Add("@SNo", Sno);
                         cmd.Parameters.Add("@LocationID", dr["Sno"].ToString());
                         cmd.Parameters.Add("@BranchName", dr["BranchID"].ToString());
                         cmd.Parameters.Add("@Rank", i);
                         vdm.insert(cmd);
                         i++;
                     }
                 }
             }
             lblmsg.Text = "Route Modified Successfully";
             UpdateRoute();
             refresh();
         }
         ScriptManager.RegisterStartupScript(Page, GetType(), "JsStatus", "ClearPolylines();", true);
     }
     catch
     {
     }
 }
コード例 #24
0
 protected void btn_Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text       = "";
         hidePanel.Visible = true;
         DateTime fromdate = DateTime.Now;
         DateTime todate   = DateTime.Now;
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         string[] datestrig = dtp_FromDate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = dtp_Todate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         Report.Columns.Add("VehicleID");
         Report.Columns.Add("DateTime");
         Report.Columns.Add("Temprature");
         Report.Columns.Add("Speed");
         List <string> logstbls = new List <string>();
         logstbls.Add("GpsTrackVehicleLogs");
         logstbls.Add("GpsTrackVehicleLogs1");
         logstbls.Add("GpsTrackVehicleLogs2");
         logstbls.Add("GpsTrackVehicleLogs3");
         logstbls.Add("GpsTrackVehicleLogs4");
         DataTable logs     = new DataTable();
         DataTable tottable = new DataTable();
         string    veh      = ddlVehicleno.SelectedValue;
         string    user     = Session["field1"].ToString();
         foreach (string tbname in logstbls)
         {
             cmd = new MySqlCommand("SELECT " + tbname + ".VehicleID, " + tbname + ".Speed, " + tbname + ".DateTime, " + tbname + ".tempsensor1, " + tbname + ".Latitiude, " + tbname + ".Longitude, " + tbname + ".TimeInterval, " + tbname + ".inp4, " + tbname + ".Status, " + tbname + ".Odometer, " + tbname + ".Direction, " + tbname + ".Direction AS Expr1 FROM " + tbname + "  WHERE (" + tbname + ".DateTime >= @starttime) and (" + tbname + ".tempsensor1 >0) AND (" + tbname + ".DateTime <= @endtime) AND (" + tbname + ".VehicleID = '" + veh + "') and (" + tbname + ".UserID='" + user + "') ORDER BY " + tbname + ".DateTime");
             cmd.Parameters.Add(new MySqlParameter("@starttime", GetLowDate(fromdate)));
             cmd.Parameters.Add(new MySqlParameter("@endtime", GetHighDate(todate)));
             logs = vdm.SelectQuery(cmd).Tables[0];
             if (tottable.Rows.Count == 0)
             {
                 tottable = logs.Clone();
             }
             foreach (DataRow dr in logs.Rows)
             {
                 tottable.ImportRow(dr);
             }
         }
         DataView dv1 = tottable.DefaultView;
         dv1.Sort = "DateTime ASC";
         table    = dv1.ToTable();
         if (table.Rows.Count > 0)
         {
             DataView dv = table.DefaultView;
             dv.Sort = "DateTime ASC";
             DataTable sortedProductDT = dv.ToTable();
             foreach (DataRow dr in sortedProductDT.Rows)
             {
                 DataRow newrow = Report.NewRow();
                 newrow["VehicleID"]  = dr["VehicleID"].ToString();
                 newrow["DateTime"]   = dr["DateTime"].ToString();
                 newrow["Temprature"] = dr["tempsensor1"].ToString();
                 newrow["Speed"]      = dr["Speed"].ToString();
                 Report.Rows.Add(newrow);
             }
             string title = "Temprature Report From: " + fromdate.ToString() + "  To: " + todate.ToString();
             Session["title"]         = title;
             Session["filename"]      = "FuelReport";
             Session["xportdata"]     = Report;
             dataGridView1.DataSource = Report;
             dataGridView1.DataBind();
         }
         else
         {
             lblmsg.Text = "No data found";
             dataGridView1.DataSource = Report;
             dataGridView1.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
         dataGridView1.DataSource = Report;
         dataGridView1.DataBind();
     }
 }
コード例 #25
0
ファイル: Logininfo.aspx.cs プロジェクト: vyshnavi-bit/GPS
 protected void btn_Generate_Click(object sender, EventArgs e)
 {
     try
     {
         lblmsg.Text       = "";
         hidePanel.Visible = true;
         DateTime fromdate = DateTime.Now;
         DateTime todate   = DateTime.Now;
         vdm = new VehicleDBMgr();
         vdm.InitializeDB();
         string[] datestrig = dtp_FromDate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         datestrig = dtp_Todate.Text.Split(' ');
         if (datestrig.Length > 1)
         {
             if (datestrig[0].Split('-').Length > 0)
             {
                 string[] dates = datestrig[0].Split('-');
                 string[] times = datestrig[1].Split(':');
                 todate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
             }
         }
         Report.Columns.Add("User Name");
         Report.Columns.Add("DateTime");
         cmd = new MySqlCommand("SELECT sno, username, doe FROM logininfo WHERE (doe BETWEEN @d1 AND @d2) order by username");
         cmd.Parameters.Add(new MySqlParameter("@d1", GetLowDate(fromdate)));
         cmd.Parameters.Add(new MySqlParameter("@d2", GetHighDate(todate)));
         DataTable dtlogins = vdm.SelectQuery(cmd).Tables[0];
         if (dtlogins.Rows.Count > 0)
         {
             foreach (DataRow dr in dtlogins.Rows)
             {
                 DataRow newrow = Report.NewRow();
                 newrow["User Name"] = dr["username"].ToString();
                 newrow["DateTime"]  = dr["doe"].ToString();
                 Report.Rows.Add(newrow);
             }
             string title = "Login Report From: " + fromdate.ToString() + "  To: " + todate.ToString();
             Session["title"]         = title;
             Session["filename"]      = "LoginReport";
             Session["xportdata"]     = Report;
             dataGridView1.DataSource = Report;
             dataGridView1.DataBind();
         }
         else
         {
             lblmsg.Text = "No data found";
             dataGridView1.DataSource = Report;
             dataGridView1.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblmsg.Text = ex.Message;
         dataGridView1.DataSource = Report;
         dataGridView1.DataBind();
     }
 }
コード例 #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     vdm     = new VehicleDBMgr();
     ddwnldr = new DataDownloader();
     vdm.InitializeDB();
 }
コード例 #27
0
    protected void btnGenerate_Click(object sender, EventArgs e)
    {
        try
        {
            vdm = new VehicleDBMgr();
            vdm.InitializeDB();
            lblmsg.Text = "";
            lblmsg.Text = "";
            DateTime fromdate  = DateTime.Now;
            DateTime todate    = DateTime.Now;
            string[] datestrig = dtp_Todate.Text.Split(' ');
            if (datestrig.Length > 1)
            {
                if (datestrig[0].Split('-').Length > 0)
                {
                    string[] dates = datestrig[0].Split('-');
                    string[] times = datestrig[1].Split(':');
                    fromdate = new DateTime(int.Parse(dates[2]), int.Parse(dates[1]), int.Parse(dates[0]), int.Parse(times[0]), int.Parse(times[1]), 0);
                }
            }

            DataTable trips = new DataTable();
            lblDate.Text = fromdate.ToString("dd/MM/yyyy");
            DataTable Report = new DataTable();
            Report.Columns.Add("Sno");
            Report.Columns.Add("DespTime");
            Report.Columns.Add("Vehicle No");
            Report.Columns.Add("Description");
            Report.Columns.Add("Driver Name");
            Report.Columns.Add("Phone No");
            Report.Columns.Add("Route Name");
            Report.Columns.Add("Power On");
            Report.Columns.Add("Type");
            Report.Columns.Add("Problems");
            Report.Columns.Add("Solutions");
            Report.Columns.Add("Work To Be Done");
            cmd = new MySqlCommand("SELECT shiftchangetable.sno, shiftchangetable.desptime, shiftchangetable.vehicleno, shiftchangetable.description, shiftchangetable.drivername, shiftchangetable.phoneno, shiftchangetable.routename, shiftchangetable.poweron, shiftchangetable.pbms, shiftchangetable.slns, shiftchangetable.work, shiftchangetable.type, loginstable.loginid FROM shiftchangetable INNER JOIN loginstable ON shiftchangetable.operatedby = loginstable.refno WHERE (shiftchangetable.doe BETWEEN @d1 AND @d2) AND (shiftchangetable.operatedby = @EmpID)");
            cmd.Parameters.Add("@d1", GetLowDate(fromdate));
            cmd.Parameters.Add("@d2", GetHighDate(todate));
            cmd.Parameters.Add("@EmpID", txtEmpID.Text);
            trips = vdm.SelectQuery(cmd).Tables[0];
            if (trips.Rows.Count > 0)
            {
                int i = 1;
                foreach (DataRow dr in trips.Rows)
                {
                    DataRow newrow = Report.NewRow();
                    newrow["Sno"]             = i++.ToString();
                    newrow["DespTime"]        = dr["desptime"].ToString();
                    newrow["Vehicle No"]      = dr["vehicleno"].ToString();
                    newrow["Description"]     = dr["description"].ToString();
                    newrow["Driver Name"]     = dr["drivername"].ToString();
                    newrow["Phone No"]        = dr["phoneno"].ToString();
                    newrow["Route Name"]      = dr["routename"].ToString();
                    newrow["Power On"]        = dr["poweron"].ToString();
                    newrow["Type"]            = dr["type"].ToString();
                    newrow["Problems"]        = dr["pbms"].ToString();
                    newrow["Solutions"]       = dr["slns"].ToString();
                    newrow["Work To Be Done"] = dr["work"].ToString();
                    Report.Rows.Add(newrow);
                }
                string title = "ShiftChange Report From: " + fromdate.ToString() + "  To: " + todate.ToString();
                Session["title"]      = title;
                Session["filename"]   = "ShiftChangeReport";
                Session["xportdata"]  = Report;
                grdReports.DataSource = Report;
                grdReports.DataBind();
            }
            else
            {
                lblmsg.Text           = "No data found";
                grdReports.DataSource = Report;
                grdReports.DataBind();
            }
        }
        catch
        {
        }
    }