示例#1
0
 /// <summary>
 /// Created By: Bhushan Dod
 /// Created Date: Oct-13-2017
 /// List of Passenger tracking route according to service type in jqgrid list.
 /// </summary>
 /// <param name="UserId"></param>
 /// <param name="pageIndex"></param>
 /// <param name="numberOfRows"></param>
 /// <param name="sortColumnName"></param>
 /// <param name="sortOrderBy"></param>
 /// <param name="locationId"></param>
 /// <param name="textSearch"></param>
 /// <param name="statusType"></param>
 /// <returns></returns>
 public JQGridModel <eFleetPassengerTrackingModel> GetListeFleetPassengerRoutewithJQGridDetails(int?pageIndex, int?numberOfRows, string sortColumnName, string sortOrderBy, string textSearch, long?statusType)
 {
     try
     {
         workorderEMSEntities db             = new workorderEMSEntities();
         var objeFleetPassengerTrackingModel = new JQGridModel <eFleetPassengerTrackingModel>();
         int pageindex      = Convert.ToInt32(pageIndex) - 1;
         int pageSize       = Convert.ToInt32(numberOfRows);
         var objeFleetRoute = new eFleetPassengerTrackingModel();
         var Results        = db.eFleetPassengerTrackingRoutes.Where(a => (a.IsDeleted == false) &&
                                                                     (((statusType == 0) ? null : statusType) == null || a.ServiceType == statusType)).Select(a => new eFleetPassengerTrackingModel()
         {
             DropPoint       = a.DropPoint,
             EndDate         = a.EndDate,
             PickUpPoint     = a.PickUpPoint,
             ServiceTypeName = a.GlobalCode.CodeName,
             StartDate       = a.StartDate,
             RouteID         = a.RouteID,
             RouteName       = a.RouteName,
             CreatedDate     = a.CreatedDate
         }).OrderByDescending(x => x.CreatedDate).ToList();
         int totRecords = Results.Count();
         var totalPages = (int)Math.Ceiling((float)totRecords / (float)numberOfRows);
         objeFleetPassengerTrackingModel.pageindex = pageindex;
         objeFleetPassengerTrackingModel.total     = totalPages;
         objeFleetPassengerTrackingModel.records   = totRecords;
         objeFleetPassengerTrackingModel.rows      = Results.ToList();
         return(objeFleetPassengerTrackingModel);
     }
     catch (Exception ex)
     {
         Exception_B.Exception_B.exceptionHandel_Runtime(ex, "JQGridModel<eFleetPassengerTrackingModel> GetListeFleetPassengerRoutewithJQGridDetails(int? pageIndex, int? numberOfRows, string sortColumnName, string sortOrderBy, string textSearch, long? statusType)", "Exception While fetching ", statusType);
         throw;
     }
 }
示例#2
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));
        }
示例#3
0
        /// <summary>
        /// Created By Bhushan Dod
        /// Dated : Oct-12-2017
        /// For Saving and editing passenger route.
        /// </summary>
        /// <param name="objeFleetPassengerTrackingModel"></param>
        /// <returns></returns>
        public Result SavePassengerTrackingRoute(eFleetPassengerTrackingModel objeFleetPassengerTrackingModel)
        {
            Result obj;

            try
            {
                var objeFleetPassengerTrackingRoute      = new eFleetPassengerTrackingRoute();
                var objeFleetPassengerTrackingRepository = new eFleetPassengerTrackingRepository();
                var objeTracLoginModel = new eTracLoginModel();

                if (objeFleetPassengerTrackingModel.RouteID == 0)
                {
                    AutoMapper.Mapper.CreateMap <eFleetPassengerTrackingRoute, eFleetPassengerTrackingModel>();
                    var objfleetMaintenanceMapper = AutoMapper.Mapper.Map(objeFleetPassengerTrackingModel, objeFleetPassengerTrackingRoute);
                    objeFleetPassengerTrackingRepository.Add(objfleetMaintenanceMapper);
                    objeFleetPassengerTrackingRepository.SaveChanges();
                    obj = Result.Completed;
                }
                //edit Data
                else
                {
                    var RouteData = objeFleetPassengerTrackingRepository.GetAll(v => v.IsDeleted == false && v.RouteID == objeFleetPassengerTrackingModel.RouteID).SingleOrDefault();
                    AutoMapper.Mapper.CreateMap <eFleetPassengerTrackingModel, eFleetPassengerTrackingRoute>();
                    var objfleetDriverMapper = AutoMapper.Mapper.Map(objeFleetPassengerTrackingModel, RouteData);
                    objeFleetPassengerTrackingRepository.SaveChanges();
                    obj = Result.UpdatedSuccessfully;
                }
                return(obj);
            }
            catch (Exception ex)
            {
                Exception_B.Exception_B.exceptionHandel_Runtime(ex, "Result SavePassengerTrackingRoute(eFleetPassengerTrackingModel objeFleetPassengerTrackingModel)", "Exception While saving efleet passenger route.", objeFleetPassengerTrackingModel);
                throw;
            }
        }
示例#4
0
 /// <summary>
 /// Created By Ashwajit Bansod
 /// Dated : Oct/13/2017
 /// Fetching the data for edit
 /// </summary>
 /// <param name="RouteId"></param>
 /// <returns></returns>
 public eFleetPassengerTrackingModel GeteFleetPassengerTrackingDetailsById(long RouteId)
 {
     try
     {
         var objeFleetPassengerTrackingRepository = new eFleetPassengerTrackingRepository();
         var editeFleetPassengerTrackingDetails   = new eFleetPassengerTrackingModel();
         var PassengerTrackingDetails             = objeFleetPassengerTrackingRepository.GetSingleOrDefault(u => u.RouteID == RouteId);
         if (PassengerTrackingDetails.RouteID > 0) // PmID in Ashwajit created Table
         {
             AutoMapper.Mapper.CreateMap <eFleetPassengerTrackingRoute, eFleetPassengerTrackingModel>();
             editeFleetPassengerTrackingDetails.RouteID = PassengerTrackingDetails.RouteID;
             var objfleetPassengerTackMapper = AutoMapper.Mapper.Map(PassengerTrackingDetails, editeFleetPassengerTrackingDetails);
         }
         return(editeFleetPassengerTrackingDetails);
     }
     catch (Exception ex)
     {
         Exception_B.Exception_B.exceptionHandel_Runtime(ex, "public eFleetPassengerTrackingModel GeteFleetPassengerTrackingDetailsById(long RouteId)", "Exception While Editing Passenger Tracking Route.", null);
         throw;
     }
 }
        public ActionResult CreateRoute(eFleetPassengerTrackingModel objeFleetPassengerTrackingModel)
        {
            try
            {
                eTracLoginModel objeTracLoginModel = (eTracLoginModel)(Session["eTrac"]);
                Result          objStatus;
                bool            isUpdate = false;
                if (Session != null)
                {
                    if (Session["eTrac"] != null)
                    {
                        objeTracLoginModel = (eTracLoginModel)(Session["eTrac"]);
                        if (Convert.ToInt64(Session["eTrac_SelectedDasboardLocationID"]) == 0)
                        {
                            (Session["eTrac_SelectedDasboardLocationID"]) = objeTracLoginModel.LocationID;
                        }
                    }
                }
                if (objeFleetPassengerTrackingModel.RouteID == 0)
                {
                    objeFleetPassengerTrackingModel.CreatedBy   = objeTracLoginModel.UserId;
                    objeFleetPassengerTrackingModel.CreatedDate = DateTime.UtcNow;
                }
                else
                {
                    objeFleetPassengerTrackingModel.CreatedBy   = objeTracLoginModel.UserId;
                    objeFleetPassengerTrackingModel.CreatedDate = DateTime.UtcNow;
                }
                objStatus = _IPassengerTracking.SavePassengerTrackingRoute(objeFleetPassengerTrackingModel);

                if (objStatus == Result.Completed)
                {
                    ModelState.Clear();
                    ViewBag.Message           = CommonMessage.WorkOrderSaveSuccessMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;
                }
                else if (objStatus == Result.DuplicateRecord)
                {
                    ViewBag.Message           = CommonMessage.DuplicateRecordMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Info; // store the message for successful in tempdata to display in view.
                }
                else if (objStatus == Result.UpdatedSuccessfully)
                {
                    ModelState.Clear();
                    ViewBag.Message           = CommonMessage.WorkOrderUpdateMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Success;// store the message for successful in tempdata to display in view.
                }
                else
                {
                    ViewBag.Message           = CommonMessage.FailureMessage();
                    ViewBag.AlertMessageClass = ObjAlertMessageClass.Danger;// store the failure message in tempdata to display in view.
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
            }
            return(View());
        }
示例#6
0
        /// <summary>
        /// Created By Bhushan Dod
        /// Dated : Oct-12-2017
        /// For Saving and editing passenger route.
        /// </summary>
        /// <param name="objeFleetPassengerTrackingModel"></param>
        /// <returns></returns>
        ///
        public Result SavePassengerTrackingRoute(eFleetPassengerTrackingModel objeFleetPassengerTrackingModel)
        {
            Result obj;

            try
            {
                var objeFleetPassengerTrackingRoute      = new eFleetPassengerTrackingRoute();
                var objeFleetPassengerTrackingRepository = new eFleetPassengerTrackingRepository();
                var objeTracLoginModel = new eTracLoginModel();

                if (objeFleetPassengerTrackingModel.RouteID == 0)
                {
                    //code to insert new record if user added new route while edit
                    if ((objeFleetPassengerTrackingModel.PickupList != null || objeFleetPassengerTrackingModel.PickupList != "") &&
                        (objeFleetPassengerTrackingModel.DropList != null || objeFleetPassengerTrackingModel.DropList != ""))
                    {
                        objeFleetPassengerTrackingModel.PickupList = objeFleetPassengerTrackingModel.PickupList.Remove(objeFleetPassengerTrackingModel.PickupList.ToString().LastIndexOf(','), 1);
                        objeFleetPassengerTrackingModel.DropList   = objeFleetPassengerTrackingModel.DropList.Remove(objeFleetPassengerTrackingModel.DropList.ToString().LastIndexOf(','), 1);

                        var picklist = objeFleetPassengerTrackingModel.PickupList.Split(',').ToList();
                        var droplist = objeFleetPassengerTrackingModel.DropList.Split(',').ToList();

                        //AutoMapper.Mapper.CreateMap<eFleetPassengerTrackingModel, eFleetPassengerTrackingRoute>();
                        if (picklist.Count == droplist.Count)
                        {
                            var listPassengerRoutemodel1 = new List <eFleetPassengerTrackingRoute>();
                            for (int i = 0; i < picklist.Count; i++)
                            {
                                var objfleetPTMapperLoop = new eFleetPassengerTrackingRoute();
                                //AutoMapper.Mapper.CreateMap<eFleetPassengerTrackingModel, eFleetPassengerTrackingRoute>();
                                // objfleetPTMapperLoop = AutoMapper.Mapper.Map(objeFleetPassengerTrackingModel, objeFleetPassengerTrackingRoute);
                                objfleetPTMapperLoop.PickUpPoint = picklist[i];
                                objfleetPTMapperLoop.DropPoint   = droplist[i];
                                objfleetPTMapperLoop.CreatedBy   = objeFleetPassengerTrackingModel.CreatedBy;
                                objfleetPTMapperLoop.CreatedDate = DateTime.UtcNow;
                                objfleetPTMapperLoop.EndDate     = objeFleetPassengerTrackingModel.EndDate;
                                objfleetPTMapperLoop.StartDate   = objeFleetPassengerTrackingModel.StartDate;
                                objfleetPTMapperLoop.ServiceType = objeFleetPassengerTrackingModel.ServiceType;
                                objfleetPTMapperLoop.RouteName   = objeFleetPassengerTrackingModel.RouteName;
                                // objfleetPTMapperLoop. = objeFleetPassengerTrackingModel.RouteName;

                                listPassengerRoutemodel1.Add(objfleetPTMapperLoop);
                            }
                            using (var context = new workorderEMSEntities())
                            {
                                context.eFleetPassengerTrackingRoutes.AddRange(listPassengerRoutemodel1);
                                context.SaveChanges();
                            }
                            //objeFleetPassengerTrackingRepository.BulkAdd(listPassengerRoutemodel);
                        }
                    }

                    obj = Result.Completed;
                }
                //edit Data
                else
                {
                    var RouteData = objeFleetPassengerTrackingRepository.GetAll(v => v.IsDeleted == false && v.RouteID == objeFleetPassengerTrackingModel.RouteID).SingleOrDefault();
                    RouteData.ModifiedBy   = objeFleetPassengerTrackingModel.ModifiedBy;
                    RouteData.ModifiedDate = objeFleetPassengerTrackingModel.ModifiedDate;
                    RouteData.DropPoint    = objeFleetPassengerTrackingModel.DropPoint;
                    RouteData.PickUpPoint  = objeFleetPassengerTrackingModel.PickUpPoint;
                    RouteData.RouteName    = objeFleetPassengerTrackingModel.RouteName;
                    RouteData.ServiceType  = objeFleetPassengerTrackingModel.ServiceType;
                    RouteData.StartDate    = objeFleetPassengerTrackingModel.StartDate;
                    RouteData.EndDate      = objeFleetPassengerTrackingModel.EndDate;
                    objeFleetPassengerTrackingRepository.Update(RouteData);

                    //code to insert new record if user added new route while edit
                    if ((objeFleetPassengerTrackingModel.PickupList != null && objeFleetPassengerTrackingModel.PickupList != "") &&
                        (objeFleetPassengerTrackingModel.DropList != null && objeFleetPassengerTrackingModel.DropList != ""))
                    {
                        objeFleetPassengerTrackingModel.PickupList = objeFleetPassengerTrackingModel.PickupList.Remove(objeFleetPassengerTrackingModel.PickupList.ToString().LastIndexOf(','), 1);
                        objeFleetPassengerTrackingModel.DropList   = objeFleetPassengerTrackingModel.DropList.Remove(objeFleetPassengerTrackingModel.DropList.ToString().LastIndexOf(','), 1);

                        var picklist = objeFleetPassengerTrackingModel.PickupList.Split(',').ToList();
                        var droplist = objeFleetPassengerTrackingModel.DropList.Split(',').ToList();
                        picklist.RemoveAt(0); //for no need to first entry to insert as above code already updating
                        droplist.RemoveAt(0);
                        //AutoMapper.Mapper.CreateMap<eFleetPassengerTrackingModel, eFleetPassengerTrackingRoute>();
                        if (picklist.Count == droplist.Count)
                        {
                            var listPassengerRoutemodel11 = new List <eFleetPassengerTrackingRoute>();
                            for (int i = 0; i < picklist.Count; i++)
                            {
                                var objfleetPTMapperLoop = new eFleetPassengerTrackingRoute();
                                //AutoMapper.Mapper.CreateMap<eFleetPassengerTrackingModel, eFleetPassengerTrackingRoute>();
                                // objfleetPTMapperLoop = AutoMapper.Mapper.Map(objeFleetPassengerTrackingModel, objeFleetPassengerTrackingRoute);
                                objfleetPTMapperLoop.PickUpPoint = picklist[i];
                                objfleetPTMapperLoop.DropPoint   = droplist[i];
                                objfleetPTMapperLoop.CreatedBy   = objeFleetPassengerTrackingModel.ModifiedBy ?? RouteData.CreatedBy;
                                objfleetPTMapperLoop.CreatedDate = DateTime.UtcNow;
                                objfleetPTMapperLoop.EndDate     = objeFleetPassengerTrackingModel.EndDate;
                                objfleetPTMapperLoop.StartDate   = objeFleetPassengerTrackingModel.StartDate;
                                objfleetPTMapperLoop.ServiceType = objeFleetPassengerTrackingModel.ServiceType;
                                objfleetPTMapperLoop.RouteName   = objeFleetPassengerTrackingModel.RouteName;
                                // objfleetPTMapperLoop. = objeFleetPassengerTrackingModel.RouteName;

                                listPassengerRoutemodel11.Add(objfleetPTMapperLoop);
                            }
                            using (var context = new workorderEMSEntities())
                            {
                                context.eFleetPassengerTrackingRoutes.AddRange(listPassengerRoutemodel11);
                                context.SaveChanges();
                            }
                            //objeFleetPassengerTrackingRepository.BulkAdd(listPassengerRoutemodel);
                        }
                    }
                    obj = Result.UpdatedSuccessfully;
                }
                return(obj);
            }
            catch (Exception ex)
            {
                Exception_B.Exception_B.exceptionHandel_Runtime(ex, "Result SavePassengerTrackingRoute(eFleetPassengerTrackingModel objeFleetPassengerTrackingModel)", "Exception While saving efleet passenger route.", objeFleetPassengerTrackingModel);
                throw;
            }
        }