示例#1
0
        /// <summary>
        /// This method is use to get port storage vehicle summery report from database
        /// </summary>
        /// <param name="ReportType"></param>
        /// <param name="StartDate"></param>
        /// <param name="EndDate"></param>
        /// <returns></returns>
        public IList <VehicleListingReportProp> GetPortStorageVehicleSummeryReport(int ReportType, Nullable <DateTime> StartDate, Nullable <DateTime> EndDate)
        {
            // creating the object of PortStorageEntities Database
            using (PortStorageEntities psEntities = new PortStorageEntities())
            {
                List <VehicleListingReportProp> listVehicleListingReportProp = new List <VehicleListingReportProp>();

                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                try
                {
                    if (StartDate != null && EndDate != null)
                    {
                        var result = psEntities.spGetPortStorageVehicleSummeryReportDetail(ReportType, StartDate, EndDate).ToList();
                        if (result != null)
                        {
                            foreach (var val in result)
                            {
                                VehicleListingReportProp obj = new VehicleListingReportProp();
                                obj.CustomerID   = (int)val.CustomerID;
                                obj.CustomerName = val.CustomerName;
                                obj.Count        = (int)val.Count;
                                listVehicleListingReportProp.Add(obj);
                                obj = null;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw;
                }
                finally
                {
                    CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                }

                return(listVehicleListingReportProp);
            }
        }
示例#2
0
        /// <summary>
        /// This method is used to get vehicle listing repot from database
        /// </summary>
        /// <param name="ReprintType"></param>
        /// <param name="StartDate"></param>
        /// <param name="EndDate"></param>
        /// <param name="GroupByDealerInd"></param>
        /// <returns></returns>

        public IList <VehicleListingReportProp> GetVehicleListingReport(int ReportType, Nullable <DateTime> StartDate, Nullable <DateTime> EndDate, bool GroupByDealerInd)
        {
            // creating the object of PortStorageEntities Database
            using (PortStorageEntities psEntities = new PortStorageEntities())
            {
                List <VehicleListingReportProp> listVehicleListingReportProp = new List <VehicleListingReportProp>();
                List <VehicleListingReportProp> lstVechiles = new List <VehicleListingReportProp>();
                CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                try
                {
                    //
                    if (StartDate != null && EndDate != null)
                    {
                        var result = psEntities.spGetVehicleListingReportDetails(ReportType, StartDate, EndDate).ToList();
                        if (result != null)
                        {
                            foreach (var val in result)
                            {
                                VehicleListingReportProp obj = new VehicleListingReportProp();
                                obj.CustomerID    = (int)val.CustomerID;
                                obj.CustomerName  = (GroupByDealerInd ? val.CustomerName : ""); //For grouping on Dealer
                                obj.CustomerName1 = val.CustomerName;                           //To display
                                obj.VIN           = val.VIN;
                                obj.Make          = val.Make;
                                obj.Model         = val.Model;
                                obj.Color         = val.Color;
                                obj.BayLocation   = val.BayLocation;
                                obj.DateIn        = val.DateIn;
                                obj.DateRequested = val.DateRequested;
                                obj.DateOut       = val.DateOut;
                                obj.Count         = result.Count;
                                listVehicleListingReportProp.Add(obj);
                                obj = null;
                            }
                        }
                    }
                    //if (GroupByDealerInd)
                    //{
                    var group = listVehicleListingReportProp.GroupBy(x => x.CustomerName1);
                    foreach (var innerGroup in group)
                    {
                        List <VehicleListingReportProp> lstVech = innerGroup.ToList();
                        var index = 1;
                        lstVech[0].TempIndex = index;
                        lstVech.Skip(1).ToList().ForEach(x => { index += 1; x.TempIndex = index; x.CustomerName1 = ""; });
                        lstVechiles.AddRange(lstVech);
                    }
                    //return lstVechiles;
                    //}
                }
                catch (Exception ex)
                {
                    throw;
                }
                finally
                {
                    CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "End {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
                }

                //return listVehicleListingReportProp;
                return(lstVechiles);
            }
        }