Ejemplo n.º 1
0
        /// <summary>
        /// This function is used to search report according to date
        /// </summary>
        /// <param name="obj"></param>
        public void Search(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if (BatchID > 0)
                {
                    // get data and create report here
                    var report = new InventoryComparisionRPT();
                    var data   = _serviceInstance.GetInventoryComparisionList(BatchID).Select(d => new InventoryComparisionReport
                    {
                        VIN          = d.VIN,
                        Make         = d.Make,
                        Model        = d.Model,
                        Color        = d.Color,
                        DateIn       = d.DateIn,
                        Status       = d.Status,
                        Location     = d.Location,
                        CompanyName  = CompanyName,
                        AddressLine1 = AddressLine1,
                        City         = city,
                        Phone        = Phone
                    });

                    report.DataSource = data;
                    MyReportSource    = report;
                }
                else
                {
                    MessageBox.Show(Resources.msgBatchReq);
                }
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }
Ejemplo n.º 2
0
        public InventoryComparisionReportVM()
        {
            DelegateEventRequestProcessing.OnReprintGridSorted += new DelegateEventRequestProcessing.SetSortingParams(SortReprintGrid);
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                var data = _serviceInstance.GetDAIAddressName(userCode).Select(d => new InventoryComparisionReport
                {
                    CompanyName  = d.CompanyName,
                    AddressLine1 = d.AddressLine1,
                    City         = d.City,
                    Phone        = d.Phone
                }).FirstOrDefault();
                CompanyName  = data.CompanyName;
                AddressLine1 = data.AddressLine1;
                City         = data.City;
                Phone        = data.Phone;


                var batchData = _serviceInstance.GetBatchLocationImport().Select(d => new InventoryComparisionReport
                {
                    BatchID       = d.BatchID,
                    RecordsCount  = d.RecordsCount,
                    CreattionDate = d.CreattionDate
                }).OrderByDescending(x => x.BatchID);

                BatchList = new List <InventoryComparisionReport>(batchData);
                // get data and create report here
                var report = new InventoryComparisionRPT();

                var data1 = _serviceInstance.GetInventoryComparisionList(0).Select(d => new InventoryComparisionReport
                {
                    VIN          = d.VIN,
                    Make         = d.Make,
                    Model        = d.Model,
                    Color        = d.Color,
                    DateIn       = d.DateIn,
                    Status       = d.Status,
                    Location     = d.Location,
                    CompanyName  = CompanyName,
                    AddressLine1 = AddressLine1,
                    City         = city,
                    Phone        = Phone
                }).ToList();
                if (data1 != null)
                {
                    data1.Add(new InventoryComparisionReport
                    {
                        CompanyName  = CompanyName,
                        AddressLine1 = AddressLine1,
                        City         = City,
                        Phone        = Phone
                    });
                }

                report.DataSource = data1;
                // MyReportSource = report;
            }
            catch (Exception ex)
            {
                LogHelper.LogErrorToDb(ex);
                bool displayErrorOnUI = false;
                CommonSettings.logger.LogError(this.GetType(), ex);
                if (displayErrorOnUI)
                {
                    throw;
                }
            }
            finally
            {
                CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            }
        }