Ejemplo n.º 1
0
        public JsonResult GetWorkOrderList(long LocationId, long workRequestProjectId, string filterwrtype, string filterqrc, string filter)
        {
            eTracLoginModel    ObjLoginModel = null;
            var                details = new List <WorkRequestAssignmentModelList>();
            long               UserId = 0, RequestedBy = 0;
            int?               rows = 20; int?page = 1;
            int?               TotalRecords = 10; string sord = null; String sidx = null; string txtSearch = "";
            GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager();

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                UserId        = ObjLoginModel.UserId;
                if (LocationId == 0)
                {
                    LocationId = Convert.ToInt32(ObjLoginModel.LocationID);
                }
            }
            sord = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx = string.IsNullOrEmpty(sidx) ? "CreatedDate" : sidx;
            DateTime        StartDate         = DateTime.UtcNow;
            DateTime        EndDate           = DateTime.UtcNow;
            var             obj_Common_B      = new Common_B();
            ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int));
            var             data = _GlobalAdminManager.GetAllWorkRequestAssignmentList(workRequestProjectId, RequestedBy, "GetAllWorkRequestAssignment", page, rows, sidx, sord, txtSearch, LocationId, UserId, StartDate, EndDate, (filter == "All" ? "" : filter), (filterqrc == "All" ? "" : filterqrc), (filterwrtype == "All" ? "" : filterwrtype), paramTotalRecords);

            if (data.Count() > 0)
            {
                foreach (var item in data)
                {
                    item.id                     = Cryptography.GetEncryptedData(item.WorkRequestAssignmentID.ToString(), true);
                    item.QRCType                = String.IsNullOrEmpty(item.QRCType) ? ((item.eFleetVehicleID != null && item.eFleetVehicleID != "" ? "Shuttle Bus" : "N/A")) : item.QRCType + " (" + item.QRCodeID + ")";
                    item.FacilityRequestType    = (item.FacilityRequestType == null || item.FacilityRequestType.TrimWhiteSpace() == "" || item.FacilityRequestType.Trim() == "") ? "N/A" : item.FacilityRequestType;
                    item.ProfileImage           = item.ProfileImage == null ? HostingPrefix + ConstantImages.Replace("~", "") + "no-profile-pic.jpg" : HostingPrefix + ProfilePicPath.Replace("~", "") + item.ProfileImage;
                    item.AssignedWorkOrderImage = item.AssignedWorkOrderImage == null ? HostingPrefix + ConstantImages.Replace("~", "") + "no-asset-pic.png" : HostingPrefix + WorkRequestImagepath.Replace("~", "") + item.AssignedWorkOrderImage;
                    details.Add(item);
                }
                return(Json(details, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(details, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            int?ProjectID = 0, UserID = 0;
            GlobalAdminManager _GlobalAdminManager = new GlobalAdminManager();

            System.Collections.Specialized.NameValueCollection forms = context.Request.Form;
            HttpRequest  request  = context.Request;
            HttpResponse response = context.Response;

            string strOperation   = forms.Get("oper");
            string _search        = request["_search"];
            string textSearch     = request["txtSearch"] ?? "";
            int?   numberOfRows   = Convert.ToInt32(request["rows"]);
            int?   pageIndex      = Convert.ToInt32(request["page"]);
            string sortColumnName = request["sidx"];
            string sortOrderBy    = request["sord"];
            string Location       = request["LocationId"];
            string filter         = (request["filter"] == null || request["filter"] == "Select All") ? "" : request["filter"];
            string filterqrc      = (request["filterqrc"] == null || request["filterqrc"] == "Select All") ? "" : request["filterqrc"];
            string filterwrtype   = (request["filterwrtype"] == null || request["filterwrtype"] == "Select All") ? "" : request["filterwrtype"];

            if (request["UserID"] != "")
            {
                UserID = Convert.ToInt32(request["UserID"]);
                //obj_StaffUserBusiness.Deleteuser(id);
            }
            DateTime        StartDate     = DateTime.UtcNow;
            DateTime        EndDate       = DateTime.UtcNow;
            eTracLoginModel ObjLoginModel = null;
            long            iUserID       = 0;
            long            LocationID    = 0;

            if (context.Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(context.Session["eTrac"]);

                if (!string.IsNullOrEmpty(Location))
                {
                    LocationID = Convert.ToInt64(Location);
                    //LocationID = 0;
                    iUserID = ObjLoginModel.UserId;
                }
                else
                {
                    iUserID    = ObjLoginModel.UserId;
                    LocationID = ObjLoginModel.LocationID;
                }
            }
            else
            {
                return;
            }
            //long LocationID = Convert.ToInt64(context.Session["eTrac_SelectedDasboardLocationID"]);
            ObjectParameter paramTotalRecords = new ObjectParameter("TotalRecords", typeof(int));

            //var WorkRequestList = _GlobalAdminManager.GetAllWorkRequestAssignment(ProjectID, UserID, "GetAllWorkRequestAssignment", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, LocationID, iUserID, StartDate, EndDate, (filter == "All" ? "" : filter), (filterqrc == "All" ? "" : filterqrc), paramTotalRecords);
            var WorkRequestList = _GlobalAdminManager.GetAllWorkRequestAssignmentList(ProjectID, UserID, "GetAllWorkRequestAssignment", pageIndex, numberOfRows, sortColumnName, sortOrderBy, textSearch, LocationID, iUserID, StartDate, EndDate, (filter == "All" ? "" : filter), (filterqrc == "All" ? "" : filterqrc), (filterwrtype == "All" ? "" : filterwrtype), paramTotalRecords);

            if (WorkRequestList.Count() > 0)
            {
                string output = BuildJQGridResults(WorkRequestList, Convert.ToInt32(numberOfRows), Convert.ToInt32(pageIndex), Convert.ToInt32(paramTotalRecords.Value));
                response.Write(output);
            }
            else
            {
                JQGridResults    result = new JQGridResults();
                List <JQGridRow> rows   = new List <JQGridRow>();
                result.rows    = rows.ToArray();
                result.page    = 0;
                result.total   = 0;
                result.records = 0;
                response.Write(new JavaScriptSerializer().Serialize(result));
            }
        }