private string BuildJQGridResults(Collection <User> users, int numberOfRows, int pageIndex, int totalRecords)
    {
        JQGridResults    result = new JQGridResults();
        List <JQGridRow> rows   = new List <JQGridRow>();

        foreach (User user in users)
        {
            JQGridRow row = new JQGridRow();
            row.ItemCode             = user.ItemCode;
            row.PartNumber           = user.PartNumber;
            row.ItemDescriptionShort = user.ItemDescriptionShort;
            row.ItemDescriptionLong  = user.ItemDescriptionLong;
            row.ProductCode          = user.ProductCode;
            row.GroupCode            = user.GroupCode;
            row.BusinessUnit         = user.BusinessUnit;

            rows.Add(row);
        }
        result.rows    = rows.ToArray();
        result.page    = pageIndex;
        result.total   = (totalRecords + numberOfRows - 1) / 8;
        result.records = totalRecords;
        JavaScriptSerializer serializer = new JavaScriptSerializer()
        {
            MaxJsonLength = Int32.MaxValue, RecursionLimit = 100
        };

        //return new JavaScriptSerializer().Serialize(result);
        return(serializer.Serialize(result));
    }
示例#2
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.ListLocationModel> ListLocation, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var locList in ListLocation)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(locList.LocationId.ToString(), true);
                    row.cell    = new string[11];
                    row.cell[0] = locList.LocationName;
                    row.cell[1] = locList.Address + "," + locList.City + ", " + locList.State + ", " + locList.ZipCode + "," + locList.Country;
                    row.cell[2] = locList.LocationAdministrator;
                    row.cell[3] = locList.LocationManager;
                    row.cell[4] = locList.LocationEmployee;
                    //row.cell[4] = locList.LocationClient;
                    row.cell[5]  = locList.City;
                    row.cell[6]  = locList.State;
                    row.cell[7]  = locList.Country;
                    row.cell[8]  = locList.PhoneNo + " / " + locList.Mobile;
                    row.cell[9]  = locList.Description;
                    row.cell[10] = Convert.ToString(locList.QRCID);
                    rows.Add(row);
                }
                result.rows    = rows.ToArray(); result.page = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex) { string error = ex.Message; }
            catch (Exception ex) { string error = ex.Message; }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#3
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.RuleMasterModelList> RuleList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var Rule in RuleList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Project.ProjectID;
                    row.id      = Cryptography.GetEncryptedData(Rule.RuleID.ToString(), true);
                    row.cell    = new string[6];
                    row.cell[0] = Rule.RuleName;
                    row.cell[1] = Convert.ToString(Rule.VoilationCharges);
                    row.cell[2] = Rule.Description;
                    row.cell[3] = Rule.IsActive == true ? "Active" : "Inactive";

                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#4
0
        public JsonResult GetPassengerRouteList(string _search, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string statusType = null)
        {
            var              objeFleetPassengerTrackingModel = new eFleetPassengerTrackingModel();
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "StartDate" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch;         //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var eFleetPTList = _IPassengerTracking.GetListeFleetPassengerRoutewithJQGridDetails(rows, TotalRecords, sidx, sord, txtSearch, Convert.ToInt64(statusType));
                foreach (var eFleetPT in eFleetPTList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(eFleetPT.RouteID), true);
                    row.cell    = new string[6];
                    row.cell[0] = eFleetPT.RouteName;
                    row.cell[1] = eFleetPT.ServiceTypeName;
                    row.cell[2] = eFleetPT.StartDate.ToString("dd/MM/yyyy");
                    row.cell[3] = eFleetPT.EndDate.ToString("dd/MM/yyyy");
                    row.cell[4] = eFleetPT.PickUpPoint;
                    row.cell[5] = eFleetPT.DropPoint;
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        private string BuildJQGridResults(List <WorkOrderEMS.Models.CommonModels.WorkRequestAssignmentModelList> WorkRequestList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var WorkRequest in WorkRequestList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Project.ProjectID;
                    row.id   = Cryptography.GetEncryptedData(WorkRequest.WorkRequestAssignmentID.ToString(), true);
                    row.cell = new string[26];

                    row.cell[0]  = Convert.ToString(WorkRequest.WorkRequestType);
                    row.cell[1]  = WorkRequest.WorkRequestTypeName;
                    row.cell[2]  = Convert.ToString(WorkRequest.AssetID);
                    row.cell[3]  = Convert.ToString(WorkRequest.LocationID);
                    row.cell[4]  = WorkRequest.LocationName;
                    row.cell[5]  = WorkRequest.ProblemDesc;
                    row.cell[6]  = Convert.ToString(WorkRequest.PriorityLevel);
                    row.cell[7]  = WorkRequest.PriorityLevelName;
                    row.cell[8]  = WorkRequest.WorkRequestImage;
                    row.cell[9]  = Convert.ToString(WorkRequest.SafetyHazard);
                    row.cell[10] = WorkRequest.ProjectDesc;
                    row.cell[11] = Convert.ToString(WorkRequest.WorkRequestStatus);
                    row.cell[12] = WorkRequest.WorkRequestStatusName;
                    row.cell[13] = Convert.ToString(WorkRequest.RequestBy);
                    row.cell[14] = Convert.ToString(WorkRequest.AssignToUserId);
                    row.cell[15] = WorkRequest.AssignToUserName;
                    row.cell[16] = Convert.ToString(WorkRequest.AssignByUserId);
                    row.cell[17] = WorkRequest.Remarks;
                    row.cell[18] = Convert.ToString(WorkRequest.WorkRequestProjectType);
                    row.cell[19] = WorkRequest.WorkRequestProjectTypeName;
                    row.cell[20] = WorkRequest.CreationDate;
                    row.cell[21] = WorkRequest.AssignedTime != null?Convert.ToDateTime(WorkRequest.AssignedTime).ToString("MM/dd/yyyy HH:mm:ss") : null;

                    row.cell[22] = WorkRequest.StartTime != null?Convert.ToDateTime(WorkRequest.StartTime).ToString("MM/dd/yyyy HH:mm:ss") : null;

                    row.cell[23] = WorkRequest.EndTime != null?Convert.ToDateTime(WorkRequest.EndTime).ToString("MM/dd/yyyy HH:mm:ss") : null;

                    row.cell[24] = WorkRequest.CodeID;
                    row.cell[25] = WorkRequest.PauseStatus.ToString();
                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#6
0
        public JsonResult GetAllPOFacilityByPOIdList(string _search, long?UserId, string POId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            LocationId    = 0;
            long            Id            = 0;
            decimal?        Calculation   = 0;

            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (LocationId == null)
                {
                    LocationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            if (!string.IsNullOrEmpty(POId))
            {
                POId = Cryptography.GetDecryptedData(POId, true);
                long.TryParse(POId, out Id);
            }
            JQGridResults    result     = new JQGridResults();
            List <JQGridRow> rowss      = new List <JQGridRow>();
            decimal?         grandTotal = 0;

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var AllPOFacilityList = _IPOTypeDetails.GetAllPOFacilityByPOIdList(UserId, Id, rows, TotalRecords, sidx, sord);
                foreach (var poFacilityList in AllPOFacilityList.rows)
                {
                    grandTotal += poFacilityList.UnitPrice * poFacilityList.Quantity;
                    poFacilityList.TotalPrice = grandTotal;
                    poFacilityList.TotalPrice = poFacilityList.UnitPrice * poFacilityList.Quantity;
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(poFacilityList.COM_FacilityId), true);
                    row.cell    = new string[10];
                    row.cell[0] = poFacilityList.COM_FacilityId.ToString();
                    row.cell[1] = poFacilityList.CostCode.ToString();
                    row.cell[2] = poFacilityList.FacilityType.ToString();
                    row.cell[3] = poFacilityList.COM_Facility_Desc.ToString();
                    row.cell[4] = poFacilityList.UnitPrice.ToString();
                    row.cell[5] = poFacilityList.Tax.ToString();
                    row.cell[6] = poFacilityList.Quantity.ToString();
                    row.cell[7] = poFacilityList.Total.ToString();
                    row.cell[8] = poFacilityList.TotalPrice.ToString();
                    row.cell[9] = poFacilityList.CostCodeName.ToString();
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Created By: Bhushan Dod
        /// Created On: Dec 12 2016
        /// Description : Get server side details of print all record for QRC code.
        /// </summary>
        /// <param name="_search"></param>
        /// <param name="sidx"></param>
        /// <param name="sord"></param>
        /// <param name="locationId"></param>
        /// <param name="SearchText"></param>
        /// <param name="SearchQRCType"></param>
        /// <returns></returns>
        public JsonResult GetQRCListforPrint(string sidx = null, string sord = null, long?locationId = 0, string SearchText = "", long SearchQRCType = 0)
        {
            JQGridResults    result        = new JQGridResults();
            List <JQGridRow> jqRows        = new List <JQGridRow>();
            eTracLoginModel  ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                ObjectParameter TotalRecords = new ObjectParameter("TotalRecords", typeof(int));
                var             QRCList      = _IQRCSetup.GetAllQRCListPrint(null, locationId, sidx, sord, SearchText, SearchQRCType, ObjLoginModel.UserId);
                try
                {
                    foreach (var QRCode in QRCList)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = QRCode.EncryptQRC;
                        row.cell    = new string[6];
                        row.cell[0] = QRCode.QRCodeID;
                        row.cell[1] = QRCode.QRCName;
                        row.cell[2] = QRCode.QRCTYPE;
                        row.cell[3] = Convert.ToString(QRCode.QRCTYPEId);
                        row.cell[4] = QRCode.LocationName;
                        row.cell[5] = QRCode.QRCSize;

                        jqRows.Add(row);
                    }
                    result.rows = jqRows.ToArray();
                }

                catch (Exception ex)
                { string error = ex.Message; }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#8
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.EmailLogModel> emailList, int numberOfRows, int pageIndex, int totalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var emailDetails in emailList)
                {
                    JQGridRow row = new JQGridRow();

                    row.id      = Cryptography.GetEncryptedData(emailDetails.EmailLogId.ToString(), true);
                    row.cell    = new string[4];
                    row.cell[0] = emailDetails.SentByUser;
                    row.cell[1] = emailDetails.SentTo;
                    row.cell[2] = emailDetails.Subject;
                    row.cell[3] = emailDetails.CreatedDate;
                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)totalRecords / numberOfRows);
                result.records = totalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#9
0
        public JsonResult GetPaymentListByLocation(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            MISNumber     = 0;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                locationId = 0;//Need to fetch all data
                var paymentList = _IPaymentManager.GetListPaymentByLocationId(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var payment in paymentList.rows)
                {
                    if (payment.BillNo != null)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id       = Cryptography.GetEncryptedData(Convert.ToString(payment.BillNo), true);
                        row.cell     = new string[14];
                        row.cell[0]  = payment.BillNo.ToString();
                        row.cell[1]  = payment.LocationName == null ? "N/A" : payment.LocationName;
                        row.cell[2]  = payment.VendorName == null ? "N/A" : payment.VendorName;
                        row.cell[3]  = payment.OperatingCompany == null ? "N/A" : payment.OperatingCompany;
                        row.cell[4]  = payment.BillType == null ? "N/A" : payment.BillType;
                        row.cell[5]  = payment.BillAmount.ToString();
                        row.cell[6]  = payment.BillDate.ToString();
                        row.cell[7]  = payment.GracePeriod == null ? "N/A" : payment.GracePeriod.ToString();
                        row.cell[8]  = (payment.PaymentMode == null && payment.BillType == "MIS") ? "MISC" : (payment.PaymentMode == null && payment.BillType == "ManualBill") ? "ManualBill" : payment.PaymentMode.ToString();
                        row.cell[9]  = payment.Status.ToString();
                        row.cell[10] = payment.VendorId > 0 ? payment.VendorId.ToString() : "0";
                        row.cell[11] = payment.OperatingCompanyId > 0 ? payment.OperatingCompanyId.ToString() : "0";
                        row.cell[12] = payment.LocationId > 0 ? payment.LocationId.ToString() : "0";
                        row.cell[13] = payment.LLBL_ID.ToString();
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetListMaintenance(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            var              objeFleetMaintenanceModel = new eFleetMaintenanceModel();
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var eFleetMaintenanceList = _IEfleetMaintenance.GetListeFleetMaintenanceDetails(UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var efleetmaintenanceList in eFleetMaintenanceList.rows)
                {
                    if (efleetmaintenanceList.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(efleetmaintenanceList.MaintenanceID), true);
                        row.cell    = new string[10];
                        row.cell[0] = efleetmaintenanceList.VehicleNumber;
                        row.cell[1] = efleetmaintenanceList.MaintenanceTypeList;
                        row.cell[2] = efleetmaintenanceList.MaintenanceDate.Value.ToString("dd/MM/yyyy");
                        row.cell[3] = efleetmaintenanceList.ReminderMetricDesc;
                        row.cell[4] = efleetmaintenanceList.DaysOutOfService.ToString();
                        row.cell[5] = efleetmaintenanceList.DriverName;
                        //  row.cell[6] = Convert.ToString(efleetmaintenanceList.OthersCosts == "") ? efleetmaintenanceList.OthersCosts.ToString() : "N/A";
                        row.cell[6] = efleetmaintenanceList.TotalCost.ToString();
                        row.cell[7] = efleetmaintenanceList.Miles;
                        row.cell[8] = efleetmaintenanceList.Note;
                        row.cell[9] = efleetmaintenanceList.MaintenanceAttachment;
                        // Vehicle Image will be use in Future if Image is Required for PM
                        // row.cell[5] = (vehicleList.VehicleImage == "" || vehicleList.VehicleImage == null) ? "" : HostingPrefix + ProfileImagePath.Replace("~", "") + vehicleList.VehicleImage;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            //{ViewBag.Message = ex.Message;ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;}
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#11
0
        public JsonResult GetListPreBill(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var billList = _IBillDataManager.GetListPreBill(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var bill in billList.rows)
                {
                    if (bill.BillId != null)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(bill.BillId), true);
                        row.cell    = new string[11];
                        row.cell[0] = bill.BillId.ToString();
                        row.cell[1] = bill.VendorName;
                        row.cell[2] = bill.EmployeeName;
                        row.cell[3] = bill.VendorType;
                        row.cell[4] = bill.BillDate.ToString();
                        row.cell[5] = bill.BillAmount.ToString();
                        //row.cell[5] = bill.InvoiceDate.ToString();
                        //row.cell[6] = bill.BillType;
                        row.cell[6]  = bill.Status == "W" ?"Pending": bill.Status == "Y" ?"Approved":"Reject";
                        row.cell[7]  = bill.Comment == null?"N/A": bill.Comment;
                        row.cell[8]  = (bill.BillImage == "" || bill.BillImage == null) ? HostingPrefix + ProfileImagePath.Replace("~", "") + "no-profile-pic.jpg" : HostingPrefix + BillPath.Replace("~", "") + bill.BillImage;
                        row.cell[9]  = bill.LBLL_Id.ToString();
                        row.cell[10] = bill.VendorId.ToString();
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#12
0
        public JsonResult GetListOfSubCostCode(string id, string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            ViewBag.AccountSection = true;
            long _CostCodeId = 0;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            if (!string.IsNullOrEmpty(id))
            {
                id = Cryptography.GetDecryptedData(id, true);
                long.TryParse(id, out _CostCodeId);
            }
            CostCodeModel    objCostCodeModel = new CostCodeModel();
            JQGridResults    result           = new JQGridResults();
            List <JQGridRow> rowss            = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var costCodeList = _ICostCode.GetListOfSubCostCode(_CostCodeId, UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var costCode in costCodeList.rows)
                {
                    if (costCode.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(costCode.CCM_CostCode), true);
                        row.cell    = new string[3];
                        row.cell[0] = costCode.CCM_CostCode.ToString();
                        row.cell[1] = costCode.Description;
                        row.cell[2] = costCode.IsActive == "Y"?"Active":"Not Activated";
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#13
0
        public JsonResult GetListVehicle(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            eFleetVehicleModel objeFleetVehicleModel = new eFleetVehicleModel();
            JQGridResults      result = new JQGridResults();
            List <JQGridRow>   rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch;
            try
            {
                var eFleetVehicleList = _IEfleetVehicle.GetListVehicleDetails(UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var vehicleList in eFleetVehicleList.rows)
                {
                    if (vehicleList.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id       = Cryptography.GetEncryptedData(Convert.ToString(vehicleList.VehicleID), true);
                        row.cell     = new string[11];
                        row.cell[0]  = vehicleList.QRCodeID;
                        row.cell[1]  = vehicleList.VehicleIdentificationNo;
                        row.cell[2]  = vehicleList.VehicleNumber;
                        row.cell[3]  = vehicleList.Make;
                        row.cell[4]  = vehicleList.Model;
                        row.cell[5]  = vehicleList.ListFuelType;
                        row.cell[6]  = (vehicleList.VehicleImage == "" || vehicleList.VehicleImage == null) ? "" : HostingPrefix + VehicleImagePath.Replace("~", "") + vehicleList.VehicleImage;
                        row.cell[7]  = vehicleList.GVWR;
                        row.cell[8]  = vehicleList.Year;
                        row.cell[9]  = vehicleList.StorageAddress;
                        row.cell[10] = vehicleList.DummyField;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#14
0
        public JsonResult GetListeFleetPM(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            eFleetVehicleModel objeFleetVehicleModel = new eFleetVehicleModel();
            JQGridResults      result = new JQGridResults();
            List <JQGridRow>   rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch;
            try
            {
                var eFleetPMList = _IEfleetPM.GetListeFleetPMDetails(UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var efleetpmList in eFleetPMList.rows)
                {
                    if (efleetpmList.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(efleetpmList.PmID), true);
                        row.cell    = new string[9];
                        row.cell[0] = efleetpmList.QRCodeID;
                        row.cell[1] = efleetpmList.VehicleNumber;
                        row.cell[2] = efleetpmList.ListMeter;
                        row.cell[3] = (efleetpmList.ListMeter == "Hours" || efleetpmList.ListMeter == "Annual") ? (efleetpmList.ListMeter == "Hours") ? efleetpmList.HoursValue.ToString() : "N/A" : efleetpmList.ListReminderMetric;
                        row.cell[4] = (efleetpmList.PMCategoryList != null) ? efleetpmList.PMCategoryList : null;
                        row.cell[5] = efleetpmList.ServiceDueDate.Value.ToString("dd/MM/yyyy");
                        row.cell[6] = efleetpmList.ReminderMetricDesc;
                        row.cell[7] = (efleetpmList.ListReminderMetric == "Other") ? efleetpmList.OtherMilesComment.ToString() : "N/A";
                        row.cell[8] = efleetpmList.PmID.ToString();
                        // Vehicle Image will be use in Future if Image is Required for PM
                        // row.cell[5] = (vehicleList.VehicleImage == "" || vehicleList.VehicleImage == null) ? "" : HostingPrefix + ProfileImagePath.Replace("~", "") + vehicleList.VehicleImage;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#15
0
        public JsonResult GetAllSelfCreatedPOList(string _search, long?UserId, long?LocationId, string status, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            UserTypeId    = 0;

            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (LocationId == null)
                {
                    LocationId = ObjLoginModel.LocationID;
                }
                UserId     = ObjLoginModel.UserId;
                UserTypeId = ObjLoginModel.UserType;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var AllPOList = _IPOTypeDetails.GetAllSelfPOList(UserId, LocationId, status, UserTypeId, rows, TotalRecords, sidx, sord);
                foreach (var poList in AllPOList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id       = Cryptography.GetEncryptedData(Convert.ToString(poList.LogPOId), true);
                    row.cell     = new string[11];
                    row.cell[0]  = "PO" + poList.LogPOId.ToString();
                    row.cell[1]  = poList.POType;
                    row.cell[2]  = (poList.CompanyName == null) ? "N/A" : poList.CompanyName.ToString();
                    row.cell[3]  = poList.LocationName;
                    row.cell[4]  = poList.UserName == null?"N/A": poList.UserName;
                    row.cell[5]  = poList.PODate.ToString("MM/dd/yyyy");
                    row.cell[6]  = (poList.DeliveryDate == null) ? "N/A" : poList.DeliveryDate.ToString("MM/dd/yyyy");
                    row.cell[7]  = (poList.POStatus == null) ? "Not Approved" : poList.POStatus.ToString();
                    row.cell[8]  = (poList.POStatusToDisplay == "W") ? "Waiting" : (poList.POStatusToDisplay == "Y") ? "Approved" : "Reject";
                    row.cell[9]  = poList.LogId.ToString();
                    row.cell[10] = (poList.Total == null) ? "N/A" : poList.Total.ToString();

                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetListIncidentVehicle(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            eFleetVehicleIncidentModel objeFleetVehicleIncidentModel = new eFleetVehicleIncidentModel();
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch;
            try
            {
                var eFleetVehicleIncidentList = _IEfleetVehicleIncidentReport.GetListVahicleListDetails(UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var vehicleIncidentList in eFleetVehicleIncidentList.rows)
                {
                    if (vehicleIncidentList.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(vehicleIncidentList.IncidentID), true);
                        row.cell    = new string[10];
                        row.cell[0] = vehicleIncidentList.QRCodeID;
                        row.cell[1] = vehicleIncidentList.VehicleNumber;
                        row.cell[2] = vehicleIncidentList.DriverName;
                        row.cell[3] = vehicleIncidentList.AccidentDate.Value.ToString("MM'/'dd'/'yyyy hh:mm tt");
                        row.cell[4] = vehicleIncidentList.NumberOfInjuries;
                        row.cell[5] = vehicleIncidentList.NumberOfFatalities.ToString();
                        row.cell[6] = (vehicleIncidentList.Preventability == true) ? "Yes" : "No";
                        row.cell[7] = vehicleIncidentList.Description;
                        row.cell[8] = vehicleIncidentList.IncidentID.ToString();
                        row.cell[9] = (vehicleIncidentList.IncidentImage == "" || vehicleIncidentList.IncidentImage == null) ? "" : HostingPrefix + IncidentImagePath.Replace("~", "") + vehicleIncidentList.IncidentImage;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#17
0
        public JsonResult GetComapnyFacilityList(string _search, long?UserId, long?VendorId, long?Location, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (Location == null)
                {
                    Location = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var companyFacilityList = _IPOTypeDetails.GetPOTypeDetailsOfCompanyFacilityList(UserId, Location, VendorId, rows, TotalRecords, sidx, sord);
                foreach (var compFacility in companyFacilityList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(compFacility.COM_FacilityId), true);
                    row.cell    = new string[12];
                    row.cell[0] = compFacility.COM_Facility_Desc;
                    row.cell[1] = compFacility.Quantity == 0?"": compFacility.Quantity.ToString();
                    row.cell[2] = compFacility.UnitPrice.ToString();
                    row.cell[3] = compFacility.TotalPrice.ToString();
                    row.cell[4] = compFacility.Tax.ToString();
                    // row.cell[5] = compFacility.Resourse.ToList().ToString();
                    row.cell[5]  = compFacility.Status;
                    row.cell[6]  = compFacility.CostCode.ToString();
                    row.cell[7]  = compFacility.CFM_CMP_Id.ToString();
                    row.cell[8]  = compFacility.COM_FacilityId.ToString();
                    row.cell[9]  = compFacility.RemainingAmt.ToString();
                    row.cell[10] = compFacility.LastRemainingAmount.ToString();
                    row.cell[11] = compFacility.StatusCalculation.ToString();
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#18
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.WorkRequestModelList> WorkRequestList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var WorkRequest in WorkRequestList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Project.ProjectID;
                    row.id      = Cryptography.GetEncryptedData(WorkRequest.WorkRequestID.ToString(), true);
                    row.cell    = new string[18];
                    row.cell[0] = WorkRequest.TaskName;
                    // row.cell[1] = Convert.ToString(WorkRequest.TaskType);
                    // row.cell[2] = WorkRequest.TaskTypeName;
                    row.cell[1]  = Convert.ToString(WorkRequest.TaskPriority);
                    row.cell[2]  = WorkRequest.TaskPriorityName;
                    row.cell[3]  = Convert.ToString(WorkRequest.RequestBy);
                    row.cell[4]  = WorkRequest.RequestByName;
                    row.cell[5]  = Convert.ToString(WorkRequest.WorkArea);
                    row.cell[6]  = WorkRequest.AreaName;
                    row.cell[7]  = WorkRequest.StartTime;
                    row.cell[8]  = WorkRequest.CompletionTime;
                    row.cell[9]  = Convert.ToString(WorkRequest.AssignedToUser);
                    row.cell[10] = WorkRequest.AssignedToUserName;
                    row.cell[11] = Convert.ToString(WorkRequest.TaskStatus);
                    row.cell[12] = Convert.ToString(WorkRequest.ProjectId);
                    row.cell[13] = WorkRequest.Remarks;
                    row.cell[14] = WorkRequest.TaskStatusName;
                    row.cell[15] = Convert.ToString(WorkRequest.WorkOrderID);
                    row.cell[16] = Convert.ToString(WorkRequest.AssetID);
                    row.cell[17] = WorkRequest.AssetNo;
                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#19
0
        public JsonResult GetListDriver(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            eFleetDriverModel objeFleetDriverModel = new eFleetDriverModel();
            JQGridResults     result = new JQGridResults();
            List <JQGridRow>  rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var eFleetDriverList = _IEfleetDriver.GetListDriverDetails(UserId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var driverList in eFleetDriverList.rows)
                {
                    if (driverList.IsDeleted == false)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id   = Cryptography.GetEncryptedData(Convert.ToString(driverList.DriverID), true);
                        row.cell = new string[6];
                        //row.cell[0] = driverList.QRCCodeID;
                        row.cell[0] = driverList.EmployeeNameList;
                        row.cell[1] = driverList.DriverLicenseNo;
                        row.cell[2] = driverList.CDLType;
                        row.cell[3] = (driverList.CDLExpiration == null) ? "" : driverList.CDLExpiration.Value.ToShortDateString();
                        row.cell[4] = driverList.MVRExpiration.Value.ToShortDateString();
                        row.cell[5] = driverList.DriverImage;// == "" || driverList.DriverImage == null) ? "" : HostingPrefix + ProfileImagePath.Replace("~", "") + driverList.DriverImage;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#20
0
        public JsonResult GetListMasterMiscellaneous(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var miscList = _IMiscellaneousManager.GetListMiscellaneous(UserId, locationId, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var misc in miscList.rows)
                {
                    if (misc.MISId != null)
                    {
                        JQGridRow row = new JQGridRow();
                        row.id      = Cryptography.GetEncryptedData(Convert.ToString(misc.MISId), true);
                        row.cell    = new string[7];
                        row.cell[0] = misc.MISId.ToString();
                        row.cell[1] = misc.LocationName;
                        row.cell[2] = misc.VendorName == null ? misc.UserName : misc.VendorName;
                        row.cell[3] = misc.UserName;
                        row.cell[4] = misc.InvoiceAmount.ToString();
                        row.cell[5] = misc.MISDate;
                        row.cell[6] = misc.Status;
                        rowss.Add(row);
                    }
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#21
0
        public JsonResult GetAllCompanyAdminList(string _search, long?LocatonId, long?LocationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            UserId        = 0;

            ViewBag.AccountSection = true;
            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (LocationId == null)
                {
                    LocationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var AllCompanyList = _ICompanyAdmin.GetAllCompanyAdmiDataList(LocationId, rows, TotalRecords, sidx, sord);
                foreach (var company in AllCompanyList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(company.VendorId), true);
                    row.cell    = new string[7];
                    row.cell[0] = company.VendorId.ToString();
                    row.cell[1] = company.CompanyNameLegal == null ?"N/A": company.CompanyNameLegal;
                    row.cell[2] = company.CompanyType == null ?"N/A": company.CompanyType;
                    row.cell[3] = company.Address == null ?"N/A": company.Address;
                    row.cell[4] = company.TaxIdNo == null?"N/A": company.TaxIdNo;
                    row.cell[5] = company.StateLicExpDate == null ? "N/A": company.StateLicExpDate;
                    row.cell[6] = company.StateLicDoc == null ?"":HostingPrefix + LicensePath.Replace("~", "") + company.StateLicDoc;
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#22
0
        public JsonResult GetRuleList(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            ViewBag.AccountSection = true;
            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }

            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var ruleList = _IRuleManager.GetRuleList(UserId, rows, TotalRecords, sidx, sord);
                foreach (var rule in ruleList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(rule.RuleId), true);
                    row.cell    = new string[7];
                    row.cell[0] = rule.RuleName;
                    row.cell[1] = rule.ModuleName;
                    row.cell[2] = Convert.ToString(rule.Level);
                    row.cell[3] = Convert.ToString(rule.Date);
                    row.cell[4] = Convert.ToString(rule.SlabFrom);
                    row.cell[5] = Convert.ToString(rule.SlabTo);
                    row.cell[6] = rule.IsActive == "Y"?"Active":"Deactive";
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#23
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.InventoryMasterModelList> InventoryList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var Inventory in InventoryList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Location.LocationId;
                    //row.id = Cryptography.GetEncryptedData(Inventory.InventoryID.ToString(), true);
                    row.id       = Cryptography.GetEncryptedData(Inventory.InventoryID.ToString(), true);
                    row.cell     = new string[15];
                    row.cell[0]  = Inventory.ItemName;
                    row.cell[1]  = Inventory.ItemCode;
                    row.cell[2]  = Convert.ToString(Inventory.ItemType);
                    row.cell[3]  = Inventory.ItemTypeName;
                    row.cell[4]  = Inventory.Description;
                    row.cell[5]  = Convert.ToString(Inventory.Quantity);
                    row.cell[6]  = Convert.ToString(Inventory.AssginedQuantity);
                    row.cell[7]  = Convert.ToString(Inventory.LocationId);
                    row.cell[8]  = Convert.ToString(Inventory.AssignInventoryID);
                    row.cell[9]  = Convert.ToString(Inventory.AssignedUserID);
                    row.cell[10] = Convert.ToString(Inventory.IssueDate);
                    row.cell[11] = Convert.ToString(Inventory.IssuedBy);
                    row.cell[12] = Convert.ToString(Inventory.AssignedToName);
                    row.cell[13] = Convert.ToString(Inventory.ReturnDate);
                    row.cell[14] = Convert.ToString(Inventory.ItemOwnership);

                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#24
0
        public JsonResult GetQRCList(bool _search, long?nd, int page, int rows, string sidx = null, string sord = null, long?locationId = 0, string SearchText = "", long SearchQRCType = 0)
        {
            JQGridResults    result        = new JQGridResults();
            List <JQGridRow> jqRows        = new List <JQGridRow>();
            eTracLoginModel  ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                ObjectParameter TotalRecords = new ObjectParameter("TotalRecords", typeof(int));
                var             QRCList      = _IQRCSetup.GetAllQRCList(null, locationId, page, rows, sidx, sord, SearchText, SearchQRCType, ObjLoginModel.UserId, TotalRecords);

                try
                {
                    foreach (var QRCode in QRCList)
                    {
                        JQGridRow row = new JQGridRow();
                        //row.id = Location.LocationId;
                        row.id       = QRCode.EncryptQRC;
                        row.cell     = new string[11];
                        row.cell[0]  = QRCode.QRCodeID;
                        row.cell[1]  = QRCode.QRCName;
                        row.cell[2]  = QRCode.QRCTYPE;
                        row.cell[3]  = QRCode.SpecialNotes;
                        row.cell[4]  = QRCode.WarrentyDoc;
                        row.cell[5]  = Convert.ToString(QRCode.QRCTYPEId);
                        row.cell[6]  = Convert.ToString(QRCode.CheckOutStatus);
                        row.cell[7]  = Convert.ToString(QRCode.IsDamage);
                        row.cell[8]  = (QRCode.IsDamageVerified == null) ? "YesNull" : Convert.ToString(QRCode.IsDamageVerified);//This is just to check condition on JS
                        row.cell[9]  = QRCode.LocationName;
                        row.cell[10] = QRCode.QRCSize;

                        jqRows.Add(row);
                    }
                    result.rows    = jqRows.ToArray();
                    result.page    = Convert.ToInt32(page);
                    result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows);
                    result.records = Convert.ToInt32(TotalRecords.Value);
                }

                catch (Exception ex)
                { string error = ex.Message; }
            }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#25
0
        public JsonResult GetPDFFormDetailsList(string _search, long?UserId, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            ViewBag.AccountSection = true;
            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }

            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var pdfFormList = _IPDFFormManager.GetPDFFormList(UserId, rows, TotalRecords, sidx, sord);
                foreach (var pdffrom in pdfFormList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(pdffrom.FormId), true);
                    row.cell    = new string[3];
                    row.cell[0] = Convert.ToString(pdffrom.FormName);
                    row.cell[1] = Convert.ToString(pdffrom.IsActive);
                    row.cell[2] = pdffrom.FormPath == null ? "N/A":HostingPrefix + DocPath.Replace("~", "") + pdffrom.FormPath;
                    //DocPath + ProfileImagePath.Replace("~", "") + objeFleetDriverModel.DriverImage;
                    //row.cell[2] = Convert.ToString(pdffrom.FormPath);
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#26
0
        public JsonResult UnclosedWorkOrder(string _search, long?LocationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;
            long            UserId        = 0;

            ViewBag.AccountSection = true;
            if (Session != null && Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (LocationId == null)
                {
                    LocationId = ObjLoginModel.LocationID;
                }
                UserId = ObjLoginModel.UserId;
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var AllUnClosedWOList = _IUnclosedWOManager.GetAllUnOrderList(LocationId, rows, TotalRecords, sidx, sord);
                foreach (var workOrder in AllUnClosedWOList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    row.id      = Cryptography.GetEncryptedData(Convert.ToString(workOrder.WorkRequestId), true);
                    row.cell    = new string[4];
                    row.cell[0] = workOrder.WorkOrder == null ? "N/A" : workOrder.WorkOrder;
                    row.cell[1] = workOrder.AssignedTo == null ? "N/A" : workOrder.AssignedTo;
                    row.cell[2] = workOrder.StartTime == null ? "N/A" : workOrder.StartTime;
                    row.cell[3] = workOrder.LocationName == null ? "N/A" : workOrder.LocationName;
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetVendorCountList(string _search, long?VendorId, DateTime?fromDate, DateTime?toDate, long?locationId, int?rows = 20, int?page = 1, int?TotalRecords = 10, string sord = null, string txtSearch = null, string sidx = null, string UserType = null)
        {
            eTracLoginModel ObjLoginModel = null;

            if (Session["eTrac"] != null)
            {
                ObjLoginModel = (eTracLoginModel)(Session["eTrac"]);
                if (locationId == null)
                {
                    locationId = ObjLoginModel.LocationID;
                }
            }
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rowss  = new List <JQGridRow>();

            sord      = string.IsNullOrEmpty(sord) ? "desc" : sord;
            sidx      = string.IsNullOrEmpty(sidx) ? "UserEmail" : sidx;
            txtSearch = string.IsNullOrEmpty(txtSearch) ? "" : txtSearch; //UserType = Convert.ToInt64(Helper.UserType.ITAdministrator);
            try
            {
                var CoutList = _IeCountingReport.GetListVendorCount(VendorId, locationId, fromDate, toDate, rows, TotalRecords, sidx, sord, locationId, txtSearch, UserType);
                foreach (var count in CoutList.rows)
                {
                    JQGridRow row = new JQGridRow();
                    // row.id = Cryptography.GetEncryptedData(Convert.ToString(misc.MISId), true);
                    row.cell    = new string[5];
                    row.cell[0] = count.PendingPO.ToString();
                    row.cell[1] = count.ApprovePO.ToString();
                    row.cell[2] = count.PendingBill.ToString();
                    row.cell[3] = count.ApproveBill.ToString();
                    row.cell[4] = count.PendingPayment.ToString();
                    rowss.Add(row);
                }
                result.rows    = rowss.ToArray();
                result.page    = Convert.ToInt32(page);
                result.total   = (int)Math.Ceiling((decimal)Convert.ToInt32(TotalRecords.Value) / rows.Value);
                result.records = Convert.ToInt32(TotalRecords.Value);
            }
            catch (Exception ex)
            { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); }
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
示例#28
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.ProjectMasterListModel> ProjectList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var Project in ProjectList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Project.ProjectID;
                    row.id      = Cryptography.GetEncryptedData(Project.ProjectID.ToString(), true);
                    row.cell    = new string[10];
                    row.cell[0] = Project.Location;
                    row.cell[1] = Project.LocationName;
                    row.cell[2] = Project.ProjectCategoryName;
                    row.cell[3] = Project.ProjectServiceName;
                    row.cell[4] = Project.Description;
                    row.cell[5] = Convert.ToString(Project.LocationID);
                    row.cell[6] = Convert.ToString(Project.ProjectCategory);
                    row.cell[7] = Convert.ToString(Project.ProjectServicesID);
                    row.cell[8] = Project.ProjectLogoName;
                    row.cell[9] = Convert.ToString(Project.QRCID);

                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
        private string BuildJQGridResults(List <WorkOrderEMS.Models.UserModelList> ManagaerList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var Manager in ManagaerList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Project.ProjectID;
                    row.id      = Manager.UserId;
                    row.cell    = new string[8];
                    row.cell[0] = Manager.Name;
                    row.cell[1] = Manager.UserEmail;
                    row.cell[2] = Convert.ToString(Manager.DOB);
                    row.cell[3] = Convert.ToString(Manager.UserId);
                    row.cell[4] = Manager.Name;
                    row.cell[5] = Manager.ProfileImage;
                    row.cell[6] = Manager.UserType;
                    row.cell[7] = Manager.HiringDate != null?Convert.ToDateTime(Manager.HiringDate).ToShortDateString() : "";

                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#30
0
        private string BuildJQGridResults(List <WorkOrderEMS.Models.LocationListModel> LocationList, int numberOfRows, int pageIndex, int TotalRecords)
        {
            JQGridResults    result = new JQGridResults();
            List <JQGridRow> rows   = new List <JQGridRow>();

            try
            {
                foreach (var Location in LocationList)
                {
                    JQGridRow row = new JQGridRow();
                    //row.id = Location.LocationId;
                    row.id      = Cryptography.GetEncryptedData(Location.LocationId.ToString(), true);
                    row.cell    = new string[8];
                    row.cell[0] = Location.LocationName;
                    row.cell[1] = Location.Address1 + ' ' + Location.Address2 + Location.ZipCode;
                    row.cell[2] = Location.City;
                    row.cell[3] = Location.StateName;
                    row.cell[4] = Location.CountryName;
                    row.cell[5] = Location.PhoneNo + " / " + Location.Mobile;
                    row.cell[6] = Location.Description;
                    row.cell[7] = Convert.ToString(Location.QRCID);
                    rows.Add(row);
                }
                result.rows    = rows.ToArray();
                result.page    = pageIndex;
                result.total   = (int)Math.Ceiling((decimal)TotalRecords / numberOfRows);
                result.records = TotalRecords;
            }
            catch (DivideByZeroException ex)
            {
                string error = ex.Message;
            }
            catch (Exception ex)
            {
                string error = ex.Message;
            }
            return(new JavaScriptSerializer().Serialize(result));
        }
示例#31
0
        private string BuildJQGridAllResults(int numberOfRows, int pageIndex)
        {
            using (ProductRepository repo = new ProductRepository())
            {

                List<Product> allProducts = repo.GetProductList();

                JQGridResults result = new JQGridResults();
                List<JQGridRow> rows = new List<JQGridRow>();

                foreach (Product prod in allProducts)
                {
                    JQGridRow row = new JQGridRow();
                    row.id = prod.ProductID;
                    row.cell = new string[6];
                    row.cell[0] = prod.ProductID.ToString();
                    row.cell[1] = prod.ProductName;
                    row.cell[2] = prod.SupplierID.ToString();
                    row.cell[3] = prod.UnitPrice.ToString();
                    row.cell[4] = prod.UnitsInStock.ToString();
                    row.cell[5] = prod.UnitsOnOrder.ToString();

                    rows.Add(row);
                }

                result.rows = rows.ToArray();
                result.page = pageIndex;
                result.total = (allProducts.Count + numberOfRows - 1) / numberOfRows;
                result.records = allProducts.Count;

                String jsonResult = new JavaScriptSerializer().Serialize(result);

                return jsonResult;
            }
        }
示例#32
0
        // To get JSON result with just the Sort functionality
        private string BuildJQGridResults(string sortColumnName, string sortOrderBy, int numberOfRows, int pageNum)
        {
            using (ProductRepository repo = new ProductRepository())
            {
                int totalRecordsCount;

                List<Product> filteredProducts = repo.GetProductList(sortColumnName, sortOrderBy, numberOfRows, pageNum, out totalRecordsCount);

                JQGridResults result = new JQGridResults();
                List<JQGridRow> rows = new List<JQGridRow>();

                foreach (Product prod in filteredProducts)
                {
                    JQGridRow row = new JQGridRow();
                    row.id = prod.ProductID;
                    row.cell = new string[6];
                    row.cell[0] = prod.ProductID.ToString();
                    row.cell[1] = prod.ProductName;
                    row.cell[2] = prod.SupplierID.ToString();
                    row.cell[3] = prod.UnitPrice.ToString();
                    row.cell[4] = prod.UnitsInStock.ToString();
                    row.cell[5] = prod.UnitsOnOrder.ToString();

                    rows.Add(row);
                }

                result.rows = rows.ToArray();
                result.page = pageNum;
                result.total = (totalRecordsCount + numberOfRows - 1) / numberOfRows;
                result.records = totalRecordsCount;

                String jsonResult = new JavaScriptSerializer().Serialize(result);

                return jsonResult;
            }
        }
示例#33
0
        private string BuildJQGridResults(int numberOfRows, int pageIndex)
        {
            using (ProductRepository repo = new ProductRepository())
            {

                List<Product> allProducts = repo.GetProductList();

                int FirstRecordID = ((pageIndex - 1) * numberOfRows) + 1;
                int LastRecordID = pageIndex * numberOfRows;

                //Filtering recordset using LINQ
                List<Product> resultset = (from p in allProducts where p.ProductID >= FirstRecordID && p.ProductID <= LastRecordID select p).ToList<Product>();

                JQGridResults result = new JQGridResults();
                List<JQGridRow> rows = new List<JQGridRow>();

                foreach (Product prod in resultset)
                {
                    JQGridRow row = new JQGridRow();
                    row.id = prod.ProductID;
                    row.cell = new string[6];
                    row.cell[0] = prod.ProductID.ToString();
                    row.cell[1] = prod.ProductName;
                    row.cell[2] = prod.SupplierID.ToString();
                    row.cell[3] = prod.UnitPrice.ToString();
                    row.cell[4] = prod.UnitsInStock.ToString();
                    row.cell[5] = prod.UnitsOnOrder.ToString();

                    rows.Add(row);
                }

                result.rows = rows.ToArray();
                result.page = pageIndex;
                result.total = (allProducts.Count + numberOfRows - 1) / numberOfRows;
                result.records = allProducts.Count;

                String jsonResult = new JavaScriptSerializer().Serialize(result);

                return jsonResult;
            }
        }
示例#34
0
    public string GetColumnNameListJSON(int aoid)
    {
        Assessment ass = new Assessment();
         JQGridResults result = new JQGridResults();
            List<JQGridRow> rows = new List<JQGridRow>();

        string col = ass.GetColumnNameList(aoid);
        string staticCol= col+ ",hidden,FullTimeOrPartTimeIndicator,CumulativeGPA,CreditsAttempted,CreditsEarned,LatestCompassPrealgebraTestScore,LatestCompassAlgebraTestScore,LatestCompassWritingTestScore,LatestCompassReadingTestScore,LatestACTEnglishAssessmentScore,LatestACTMathAssessmentScore,LatestACTReadingAssessmentScore,LatestACTScienceAssessmentScore,LatestTestingDate,HighSchoolName,HighSchoolGraduationDate,HomeTelephoneNumber,MailingAddressLineOne,MailingAddressLineTwo,MailingAddressLineThree,City,StateName,ZipCode,EmailAddress";
        string JsonCol = "";
        string[] colArray = staticCol.Split(',');
        JQGridRow row = new JQGridRow();
        int i = 0;
        row.cell = new string[colArray.Length];
        foreach (string str in colArray)
        {

             row.cell[i++] = str;

        }
           rows.Add(row);

            result.rows = rows.ToArray();
            result.page = 0;
            result.total = 0;
            result.records = 0;

        return new JavaScriptSerializer().Serialize(result);
    }
示例#35
0
    //public string GetAssessmentResult(int AOID, string numberOfRows, string pageIndex, out int totalRecords, string sortColumnName, string sortOrderBy, string bannerID, string program, string studentName, string flag, string numberOfPrinted)
    //public string GetAssessmentResult(int AOID, string numberOfRows, string pageIndex, out int totalRecords, string sortColumnName, string sortOrderBy, string bannerID, string program, string studentName,string searchingField,string searchngValue)
    public string GetAssessmentResult(int AOID, string numberOfRows, string pageIndex, out int totalRecords, string searchColumnName, string searchVal, string sortColumnName, string sortOrderBy, string bannerID, string program, string studentName,string SortOrSearchFlag)
    {
        try
        {
            string MultipleSearch = "Yes";
            searchColumnName = (searchColumnName == null) ? "" : searchColumnName;
            sortOrderBy = (sortOrderBy == null) ? "" : sortOrderBy;
            bannerID = (bannerID == null) ? "" : bannerID;
            program = (program == null) ? "" : program;
            studentName = (studentName == null) ? "" : studentName;
            //flag  = (flag  == null) ? "" : flag ;
            //numberOfPrinted = (numberOfPrinted == null) ? "" : numberOfPrinted;
            //string sortingVal = "";
            totalRecords = 0;
            //int numberOfRows=10,  pageIndex=1,  totalRecords=10;
            int Start = (Convert.ToInt32(pageIndex) - 1) * Convert.ToInt32(numberOfRows);
            int Last = Convert.ToInt32(pageIndex) * Convert.ToInt32(numberOfRows);
            JQGridResults result = new JQGridResults();
            List<JQGridRow> rows = new List<JQGridRow>();

            #region Get Flag
            ////To get FlagRating
            DataTable flagDt = new DataTable();
            flagDt.Columns.Add("StudentOID", typeof(string));
            flagDt.Columns.Add("FlagRating", typeof(string));
            flagDt.Columns.Add("NumberOfPrinted", typeof(string));

            DataRow dr = null;

            using (OdbcConnection connection = new OdbcConnection(connectionString))
            {
                using (OdbcCommand command = new OdbcCommand())
                {
                    command.Connection = connection;
                    command.CommandText = "{CALL GetNoOfFlagByAOID1(?)}";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@AOID", AOID);

                    connection.Open();

                    using (OdbcDataReader dataReader = command.ExecuteReader())
                    {

                        while (dataReader.Read())
                        {
                            dr = flagDt.NewRow();
                            dr["StudentOID"] = Convert.ToString(dataReader["StudentOID"]);
                            dr["FlagRating"] = Convert.ToString(dataReader["FlagRating"]);
                            dr["NumberOfPrinted"] = Convert.ToString(dataReader["NumberOfPrinted"]);
                            flagDt.Rows.Add(dr);
                        }
                        #region Unused
                        //while (dataReader.Read())
                        //{
                        //    dr = flagDt.NewRow();
                        //    dr["StudentOID"] = Convert.ToString(dataReader["StudentOID"]);
                        //    dr["FlagRating"] = Convert.ToString(dataReader["FlagRating"]);
                        //    //flagDt.Rows.Add(dr);
                        //    //int flag = 0;
                        //    //for (int i = 0; i < flagDt.Rows.Count; i++)
                        //    //{
                        //    //    //if (dr["StudentOID"] == flagDt.Rows[i]["StudentOID"] && dr["AssessmentOID"] == flagDt.Rows[i]["AssessmentOID"])
                        //    //    string sb =Convert .ToString ( flagDt.Rows[i]["StudentOID"]);
                        //    //    if (Convert.ToString(dr["StudentOID"]) == sb)
                        //    //    {

                        //    //        flag = 1;
                        //    //        int updatedVal = Convert.ToInt32(dataReader["FlagRating"]) + Convert.ToInt32(flagDt.Rows[i]["FlagRating"]);
                        //    //        flagDt.Rows[i]["FlagRating"] = updatedVal;

                        //    //    }
                        //    //}
                        //    //if (flag == 0)
                        //    //{
                        //    //    flagDt.Rows.Add(dr);
                        //    //}
                        //    //else
                        //    //{
                        //    //    //Do Something
                        //    //}

                        //}
                        #endregion
                    }
                }
            }
            //////
            #endregion

            using (OdbcConnection connection = new OdbcConnection(connectionString))
            {
                using (OdbcCommand command = new OdbcCommand())
                {

                    command.Connection = connection;
                    command.CommandText = "{CALL Assessement_ResultByAOID(?,?,?,?,?,?,?,?,?,?,?,?,?)}";
                    command.CommandType = CommandType.StoredProcedure;

                    //OdbcParameter returnParam = command.Parameters.Add("@totalRecords", OdbcType.Int);
                    ////// set the direction flag so that it will be filled with the return value
                    //returnParam.Direction = ParameterDirection.ReturnValue;

                    if (searchColumnName == "" || searchColumnName == null || searchColumnName == "StudentOID")
                    {
                        searchColumnName = "BannerID";
                    }
                    if (searchVal == "" || searchVal == null)
                    {
                        searchVal = "@";
                    }

                    if (sortColumnName == "" || sortColumnName == null || sortColumnName == "StudentOID")
                    {
                        sortColumnName = "BannerID";
                    }

                    //Parameter Setting

                    OdbcParameter paramPageIndex = new OdbcParameter("@PageIndex", OdbcType.Int);
                    paramPageIndex.Value = Convert.ToInt32(pageIndex);
                    command.Parameters.Add(paramPageIndex);

                    OdbcParameter paramNumberOfRows = new OdbcParameter("@NumberOfRows", OdbcType.Int);
                    paramNumberOfRows.Value = Convert.ToInt32(numberOfRows);
                    command.Parameters.Add(paramNumberOfRows);

                    OdbcParameter paramTotalRecords = new OdbcParameter("@TotalRecords", OdbcType.Int);
                    totalRecords = 0;
                    paramTotalRecords.Value = totalRecords;
                    paramTotalRecords.Direction = ParameterDirection.Output;
                    command.Parameters.Add(paramTotalRecords);

                    command.Parameters.AddWithValue("@AOID", AOID);
                    command.Parameters.AddWithValue("@SearchColumnName", searchColumnName+",");
                    command.Parameters.AddWithValue("@SortOrderBy", sortOrderBy);
                    command.Parameters.AddWithValue("@BannerID", bannerID);
                    command.Parameters.AddWithValue("@Program", program);
                    command.Parameters.AddWithValue("@StudentName", studentName);
                    command.Parameters.AddWithValue("@SearchValue", searchVal+",");
                    command.Parameters.AddWithValue("@SortColumnName", sortColumnName);
                    command.Parameters.AddWithValue("@SortOrSearchFlag", SortOrSearchFlag);
                    command.Parameters.AddWithValue("@MultiCoulumn", MultipleSearch);
                    connection.Open();

                    using (OdbcDataReader dataReader = command.ExecuteReader())
                    {

                        JQGridRow row;
                        //..dataReader.FieldCount
                        while (dataReader.Read())
                        {
                                //string SectionRank = null;
                                row = new JQGridRow();
                                row.cell = new string[dataReader.FieldCount];

                                for (int j = 0; j < dataReader.FieldCount; j++)
                                {
                                    row.cell[j] = Convert.ToString(dataReader[j]);

                                    if (dataReader[j].ToString ().Contains (','))
                                    {
                                        row.cell[j] =dataReader[j].ToString ().Replace (',',' ');
                                    }

                                    if (j == 5)
                                    {
                                        string SOID = Convert.ToString(dataReader[j]);
                                        //row.cell[j] = GetNoOfFlagByAOIDANDSOID(AOID, Convert.ToInt32(SOID)).ToString();
                                        row.cell[j] = "0";
                                        for (int k = 0; k < flagDt.Rows.Count; k++)
                                        {
                                            if (Convert.ToString(flagDt.Rows[k]["StudentOID"]) == SOID)
                                            {
                                                row.cell[j] = Convert.ToString(flagDt.Rows[k]["FlagRating"]);
                                                break;
                                            }
                                        }
                                    }
                                    if (j==6)
                                    {
                                        string SOID = Convert.ToString(dataReader[j-1]);
                                        row.cell[j] = "0";
                                        for (int k = 0; k < flagDt.Rows.Count; k++)
                                        {
                                            if (Convert.ToString(flagDt.Rows[k]["StudentOID"]) == SOID)
                                            {
                                                row.cell[j] = Convert.ToString(flagDt.Rows[k]["NumberOfPrinted"]);
                                                break;
                                            }
                                        }
                                    }
                                }

                                rows.Add(row);
                            //}
                                //totalRecords++;
                        }
        //                        totalRecords = (command.Parameters["@totalRecords"].Value==null)?0:(int)command.Parameters["@totalRecords"].Value;
                    }
                    totalRecords = (int)paramTotalRecords.Value;
                }
            }
            //totalRecords = GetRowCount();

            result.rows = rows.ToArray();
            result.page = Convert.ToInt32(pageIndex);
            result.total = totalRecords /Convert.ToInt32( numberOfRows);
            if (totalRecords % Convert.ToInt32(numberOfRows) != 0) result.total += 1;
            result.records = totalRecords;
            return new JavaScriptSerializer().Serialize(result);
        }
        catch (Exception ex)
        {
            totalRecords = 20;
            return "";
        }
    }
示例#36
0
        private string BuildJQGridResults(JqSearchIn jqInputs)
        {
            using (ProductRepository repo = new ProductRepository())
            {
                int totalRecordsCount;

                // Now call the actual function which reads from the database and performs search and filtering
                List<Product> filteredProducts = repo.GetProductList(jqInputs, out totalRecordsCount);

                JQGridResults result = new JQGridResults();
                List<JQGridRow> rows = new List<JQGridRow>();

                foreach (Product prod in filteredProducts)
                {
                    JQGridRow row = new JQGridRow();
                    row.id = prod.ProductID;
                    row.cell = new string[6];
                    row.cell[0] = prod.ProductID.ToString();
                    row.cell[1] = prod.ProductName;
                    row.cell[2] = prod.SupplierID.ToString();
                    row.cell[3] = prod.UnitPrice.ToString();
                    row.cell[4] = prod.UnitsInStock.ToString();
                    row.cell[5] = prod.UnitsOnOrder.ToString();

                    rows.Add(row);
                }

                result.rows = rows.ToArray();
                result.page = jqInputs.page;
                result.total = (totalRecordsCount + jqInputs.rows - 1) / jqInputs.rows;
                result.records = totalRecordsCount;

                String jsonResult = new JavaScriptSerializer().Serialize(result);

                return jsonResult;
            }
        }
示例#37
0
    public string BuildJQGridResults(Collection<CVTCMenu> menu, int numberOfRows, int pageIndex, int totalRecords)
    {
        JQGridResults result = new JQGridResults();
        List<JQGridRow> rows = new List<JQGridRow>();
        foreach (CVTCMenu m in menu)
        {
            JQGridRow row = new JQGridRow();
            row.id = m.OID;
            row.cell = new string[7];
            row.cell[0] = m.OID.ToString();
            row.cell[1] = m.NameMenu;
            row.cell[2] = m.MenuID.ToString();
            row.cell[3] = m.MenuLevel.ToString();
            row.cell[4] = m.Parent.ToString();
            row.cell[5] = m.IsLeave.ToString();
            row.cell[6] = m.IsExpanded.ToString();

            rows.Add(row);
        }
        result.rows = rows.ToArray();
        result.page = pageIndex;
           result.total = totalRecords / numberOfRows;
           if (totalRecords % numberOfRows != 0) result.total += 1;
           result.records = totalRecords;
        return new JavaScriptSerializer().Serialize(result);
        //return new JavaScriptSerializer().Serialize(rows);
    }