private void BindGrid()
        {
            string RequestID = ""; string status = ""; usr = (User)Session["user"];
            string init = ""; string fromDate = ""; string toDate = "";

            if (!string.IsNullOrWhiteSpace(txtID.Text))
            {
                RequestID = txtID.Text;
            }
            if (!string.IsNullOrWhiteSpace(txtInit.Text))
            {
                init = txtInit.Text;
            }
            if (!string.IsNullOrWhiteSpace(ddlStatus.SelectedValue))
            {
                status = ddlStatus.SelectedValue;
            }
            if (!string.IsNullOrWhiteSpace(txtFromDate.Text))
            {
                fromDate = txtFromDate.Text;
            }

            if (!string.IsNullOrWhiteSpace(txtToDate.Text))
            {
                toDate = txtToDate.Text;
            }
            gvRequest.DataSource = TripBLL.GetTripListByAdmin(usr.LocationID.Value, RequestID, status, init, fromDate, toDate);
            gvRequest.DataBind();
            //gvRequest.DataSource = TripBLL.GetTripListByAdmin();
            //gvRequest.DataBind();
        }
        private void BindTrip()
        {
            usr = (User)Session["user"];
            int id = int.Parse(hid.Value);

            gvTrip.DataSource = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(p => p.AssignedVehicle == id).ToList();
            gvTrip.DataBind();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         if (Session["user"] != null)
         {
             usr = (User)Session["user"];
         }
         else
         {
             Response.Redirect("../Login.aspx", false);
             return;
         }
         if (!IsPostBack)
         {
             if (User.IsInRole(GssAdminRole))
             {
                 btnBatchAppr.Visible = true;
                 dvbatch.Visible      = true;
             }
             if (User.IsInRole(headDriverRole))
             {
                 btnBatch.Visible = true;
                 BindVehicleGrid();
             }
             if (Request.QueryString["vid"] != null)
             {
                 int vId = int.Parse(Request.QueryString["vid"].ToString());
                 gvRequest.DataSource = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(t => t.AssignedVehicle == vId).ToList();
                 gvRequest.DataBind();
             }
             else if (Request.QueryString["stat"] != null)
             {
                 int stId = int.Parse(Request.QueryString["stat"].ToString());
                 gvRequest.DataSource = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(t => t.Status == stId).ToList();
                 gvRequest.DataBind();
             }
             else
             {
                 BindGrid();
             }
             BindList();
         }
     }
     catch (Exception ex)
     {
         error.Visible   = true;
         error.InnerHtml = "<button type='button' class='close' data-dismiss='alert'>&times;</button> An error occurred. kindly try again!!!";
         Utility.WriteError("Error: " + ex.InnerException);
     }
 }
Exemple #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User usr = null;

            if (!IsPostBack)
            {
                if (Session["user"] != null)
                {
                    usr = (User)Session["user"];
                }
                else
                {
                    Response.Redirect("../Login.aspx", false);
                    return;
                }
                int totalPendAppr = 0; int totalPendAss = 0; int totalCmpRequest = 0; int totalVehPool = 0; int totalvehEnt = 0;
                totalPendAppr   = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(t => t.Status == (int)Utility.FleetRequestStatus.Pending_FleetManager_Approval).Count();
                totalPendAss    = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(t => t.Status == (int)Utility.FleetRequestStatus.Pending_Vehicle_Assignment).Count();
                totalCmpRequest = TripBLL.GetTripListByAdmin(usr.LocationID.Value).Where(t => t.Status == (int)Utility.FleetRequestStatus.Completed).Count();
                totalVehPool    = VehicleBLL.GetVehicleList(usr.LocationID.Value).Where(t => t.Status == (int)Utility.VehicleStatus.Available).Count();
                totalvehEnt     = VehicleBLL.GetVehicleList(usr.LocationID.Value).Where(t => t.Status == (int)Utility.VehicleStatus.Enroute).Count();
                //lnkPendAppr.Text = "Total Number of Requests pending Approval ("+totalPendAppr.ToString()+")";
                //lnkPendAppr.NavigateUrl = "ManageFleetRequest.aspx?stat=" + ((int)Utility.FleetRequestStatus.Pending_FleetManager_Approval).ToString();
                lnkPendAppr1.InnerHtml = "Total Number of Requests pending Approval<b> (" + totalPendAppr.ToString() + ")</b>";
                lnkPendAppr1.HRef      = "ManageFleetRequest.aspx?stat=" + ((int)Utility.FleetRequestStatus.Pending_FleetManager_Approval).ToString();

                lnkpendAss.InnerHtml = "Total Number of Requests pending Vehicle Assignment <b>(" + totalPendAss.ToString() + ")</b>";
                lnkpendAss.HRef      = "ManageFleetRequest.aspx?stat=" + ((int)Utility.FleetRequestStatus.Pending_Vehicle_Assignment).ToString();

                lnkCmpReq.InnerHtml = "Total Number of Completed Request (<b>" + totalCmpRequest.ToString() + ")</b>";
                lnkCmpReq.HRef      = "ManageFleetRequest.aspx?stat=" + ((int)Utility.FleetRequestStatus.Completed).ToString();

                lnkVehPool.InnerHtml = "Total Number of Vehicles Available in the Pool <b>(" + totalVehPool + ")</b>";
                lnkVehPool.HRef      = "ManageVehicle.aspx?stat=" + ((int)Utility.VehicleStatus.Available).ToString();

                lnkvehEnt.InnerHtml = "Total Number of Vehicles Enroute <b>(" + totalvehEnt + ")</b>";
                lnkvehEnt.HRef      = "ManageVehicle.aspx?stat=" + ((int)Utility.VehicleStatus.Enroute).ToString();
            }
        }