Exemple #1
0
        /// <summary>
        /// Method BindGridDetails to bind the grid.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>void</returns>
        public void BindGridDetails(object obj)
        {
            CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                if (obj == null)
                {
                    CurrentPageIndex = 0;
                }
                if (CurrentPageIndex == 0)
                {
                    Application.Current.Properties["FindUserGridLastScrollOffset"] = 0;
                    Application.Current.Properties["FindUserGridCurrentPageIndex"] = 0;
                }
                // creating the object of service property
                AppWorksService.Properties.BillingProp objBillingProp = new AppWorksService.Properties.BillingProp();
                if (vin != null)
                {
                    objBillingProp.Vin = Vin;
                }
                else
                {
                    objBillingProp.Vin = string.Empty;
                }

                objBillingProp.CustomerName     = CustomerName;
                objBillingProp.InvoiceStatus    = SelectedInvoiceStatus;
                objBillingProp.InvoiceType      = SelectedInvoiceType;
                objBillingProp.InvoiceNumber    = InvoiceNumber;
                objBillingProp.Vin              = Vin;
                objBillingProp.CustomerNumber   = CustomerNumber;
                objBillingProp.CustIndent       = CustIndent;
                objBillingProp.CreatedBetwDtFrm = CreatedBetwDtFrm;
                if (CreatedBetwDtTo != null)
                {
                    objBillingProp.CreatedBetwDtTo = CreatedBetwDtTo.Value.AddDays(1);
                }
                objBillingProp.DtInvBetwDtFrm = DtInvBetwDtFrm;
                if (DtInvBetwDtTo != null)
                {
                    objBillingProp.DtInvBetwDtTo = DtInvBetwDtTo.Value.AddDays(1);
                }
                objBillingProp.DtPaidBetwDtFrm = DtPaidBetwDtFrm;
                if (DtPaidBetwDtTo != null)
                {
                    objBillingProp.DtPaidBetwDtTo = DtPaidBetwDtTo.Value.AddDays(1);
                }
                objBillingProp.CurrentPageIndex = CurrentPageIndex;
                objBillingProp.PageSize         = CurrentPageIndex > 0 ? _GridPageSizeOnScroll : _GridPageSize;
                objBillingProp.DefaultPageSize  = _GridPageSize;

                //objBillingProp.Driver = SelectedDriverList;
                //objBillingProp.OutsideCarrier = SelectedoutsideCarrier;
                //objBillingProp.LoadNumber = LoadNumber;
                //objBillingProp.OrderNumber = OrderNumber;
                //objBillingProp.PONumber = PONumber;

                var data = _serviceInstance.BillingSearch(objBillingProp);

                IEnumerable <BillingModel> model = new List <BillingModel>();

                model = data.Select(d => new BillingModel()
                {
                    BillingID      = d.BillingID,
                    InvoiceNumber  = d.InvoiceNumber,
                    CustomerName   = d.CustomerName,
                    CustomerNumber = d.CustomerNumber,
                    VIN            = d.Vin,
                    CustIndent     = d.CustIndent,
                    InvoiceDate    = d.InvoiceDate,
                    InvoiceStatus  = d.InvoiceStatus,
                    InvoiceType    = d.InvoiceType,
                    Address        = d.CustomerAddress,
                    TotalPageCount = d.TotalPageCount
                                     //LoadNumber = d.LoadNumber,
                                     //OutsideCarrier = d.OutsideCarrier,
                                     //Driver = d.Driver,
                                     //CarrierName = d.CarrierName,
                                     //PONumber = d.PONumber,
                                     //OrderNumber = d.OrderNumber,
                });

                if (CurrentPageIndex == 0)
                {
                    BillingList = null;
                    BillingList = new ObservableCollection <BillingModel>(model);
                }
                else
                {
                    if (BillingList != null && BillingList.Count > 0)
                    {
                        foreach (BillingModel ud in new ObservableCollection <BillingModel>(model))
                        {
                            App.Current.Dispatcher.Invoke(() =>
                            {
                                BillingList.Add(ud);
                            });
                        }
                    }
                }

                if (BillingList.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault() != null)
                {
                    Count = BillingList.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault().TotalPageCount;
                }
            }
            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));
            }
        }
Exemple #2
0
        /*PayBillSchedulePost
         * User submits the view to view the pending billpay jobs
         * This post also retrieves the current jobs for the particular account and creates a list for the view to display
         */
        public ATMBillSchedule_ViewModel billSchedulePost(int sessionID, ATMBillSchedule_ViewModel models)
        {
            NWBAEntities db        = new NWBAEntities();
            int          accountID = models.AccountNumber;

            if (accountID != 0)
            {
                var accountQuery        = Repo.GetAccount(accountID);
                var customerQuery       = Repo.GetCustomerAccountQueryable(sessionID);
                var singleCustomerQuery = Repo.GetCustomerSingle(sessionID);

                IEnumerable <SelectListItem> accounts = customerQuery.OrderBy(c => c.AccountNumber).ToList().
                                                        Select(c => new SelectListItem
                {
                    Value = Convert.ToString(c.AccountNumber),
                    Text  = (c.AccountType.Equals("S")) ? "Saving " + c.AccountNumber.ToString()
                             : "Checkings " + " " + c.AccountNumber.ToString()
                });

                //This fetches a list of current billpay jobs scheduled #########

                var currentJobsList = Repo.GetCurrentBillPayJobs();

                //Get all Billpay records in the system that are currently being schedueld and for the particular account
                var billList = (from a in db.BillPays
                                where a.AccountNumber.Equals(accountID) && currentJobsList.Contains(a.BillPayID)
                                select a);

                var payeeList = Repo.GetAllPayeeQueryable();


                //If the account has at least 1 schecduled billpay job
                //enter this if, Else display empty record string
                if (billList.Count() > 0)
                {
                    //select [WDT].[dbo].[Payee].PayeeName, [WDT].[dbo].[BillPay].PayeeID,
                    //       [WDT].[dbo].[BillPay].Amount, [WDT].[dbo].[BillPay].ScheduleDate, [WDT].[dbo].[BillPay].Period
                    //from [WDT].[dbo].[Payee]
                    //join [WDT].[dbo].[BillPay]
                    //on [WDT].[dbo].[Payee].PayeeID=[WDT].[dbo].[BillPay].PayeeID


                    //Creates a list of billing list objects which is needed by the grid to display the current scheduled jobs for the account
                    List <BillingList> BillPayGridList = new List <BillingList>();

                    // Contains an annomous object with properties from billpay and payee
                    //A list of current billpay jobs with information from payee table
                    var CustomScheduledList = (from x in db.BillPays
                                               join y in db.Payees on x.PayeeID equals y.PayeeID
                                               where x.AccountNumber.Equals(accountID) && currentJobsList.Contains(x.BillPayID)
                                               select new
                    {
                        x.BillPayID,
                        y.PayeeName,
                        x.Amount,
                        x.ScheduleDate,
                        x.Period
                    });

                    foreach (var z in CustomScheduledList)
                    {
                        string scheduleDateFormat = z.ScheduleDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture);

                        BillingList bl = new BillingList();
                        bl.BillPayID    = z.BillPayID;
                        bl.PayeeName    = z.PayeeName;
                        bl.Amount       = (double)z.Amount;
                        bl.ScheduleDate = scheduleDateFormat;
                        bl.Period       = z.Period;

                        BillPayGridList.Add(bl);
                    }

                    models.CustomerName     = singleCustomerQuery.CustomerName;
                    models.AccountNumber    = accountID;
                    models.accountList      = accounts;
                    models.scheduleBillList = BillPayGridList;
                }
                else
                {
                    //This part basically creates a viewmodel that tells the user
                    //they dont have any schduled bill pay jobs
                    List <BillingList> bList = new List <BillingList>();
                    models.CustomerName     = singleCustomerQuery.CustomerName;
                    models.AccountNumber    = accountID;
                    models.accountList      = accounts;
                    models.scheduleBillList = bList;
                    models.Message          = "Empty Record";
                }
            }
            else
            {
                billSchedule(sessionID);
            }
            return(models);
        }