Ejemplo n.º 1
0
        /// <summary>
        /// For inserting Customer in database.
        /// </summary>
        /// <param name="objLocationEmailContact"></param>
        /// <returns></returns>
        public int InsertCustomer(CustomerSearchProp objCustomer)
        {
            CustomerDAL objCustomerDAL = new CustomerDAL();

            CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                return(objCustomerDAL.InsertCustomer(objCustomer));
            }
            catch (Exception)
            {
                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));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Function To find the vehicle search details.
        /// </summary>
        /// <param name="objVehicleProp"></param>
        /// <returns>List</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May-2,2016</createdOn>
        public List <CustomerSearchProp> GetCustomerSearchDetails(CustomerSearchProp objCustomerProp)
        {
            CustomerDAL objCustomerDAL = new CustomerDAL();

            CommonDAL.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, "Called {2} function ::{0} {1}.", DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
            try
            {
                //Calling the function to get the details of customer searched.
                return(objCustomerDAL.GetCustomerSearchDetails(objCustomerProp));
            }
            catch (Exception)
            {
                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));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Function to Search the Customer List.
        /// </summary>
        /// <param name="objLoginProp"></param>
        /// <returns>void</returns>
        /// <createdBy></createdBy>
        /// <createdOn>May 10,2016</createdOn>
        private async 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 (obj == null)
                {
                    CurrentPageIndex = 0;
                }

                if (CurrentPageIndex == 0)
                {
                    Application.Current.Properties["FindUserGridLastScrollOffset"] = 0;
                    Application.Current.Properties["FindUserGridCurrentPageIndex"] = 0;
                }

                CustomerSearchProp objCustomerSearchProp = new CustomerSearchProp();
                objCustomerSearchProp.CustomerCode           = CustomerCode;
                objCustomerSearchProp.CustomerName           = CustomerName;
                objCustomerSearchProp.CustomerType           = CustomerType;
                objCustomerSearchProp.City                   = City;
                objCustomerSearchProp.State                  = State;
                objCustomerSearchProp.Zip                    = Zip;
                objCustomerSearchProp.DBAName                = dbaName;
                objCustomerSearchProp.ShortName              = shortName;
                objCustomerSearchProp.CurrentPageIndex       = CurrentPageIndex;
                objCustomerSearchProp.PageSize               = CurrentPageIndex > 0 ? _GridPageSizeOnScroll : _GridPageSize;;
                objCustomerSearchProp.DefaultPageSize        = _GridPageSize;
                objCustomerSearchProp.PortStorageCustomerInd = IsPortStorage;

                var data = await _serviceInstance.GetCustomerSearchDetailsAsync(objCustomerSearchProp);

                IEnumerable <CustomerInfo> customerInfo = data.Select(d => new CustomerInfo
                {
                    CustomerID                       = d.CustomerID,
                    CustomerNameInfo                 = d.CustomerName,
                    AddressLine1Info                 = d.AddressLine1,
                    CityInfo                         = d.City,
                    SatetInfo                        = d.State,
                    ZipInfo                          = d.Zip,
                    CustomerCode                     = d.CustomerCode,
                    DBAName                          = d.DBAName,
                    ShortName                        = d.ShortName,
                    CustomerType                     = d.CustomerType,
                    CustomerOf                       = d.CustomerOf,
                    BillingAddressID                 = d.BillingAddressID,
                    MainAddressID                    = d.MainAddressID,
                    VendorNumber                     = d.VendorNumber,
                    DefaultBillingMethod             = d.DefaultBillingMethod,
                    RecordStatus                     = d.RecordStatus,
                    SortOrder                        = d.SortOrder,
                    EligibleForAutoLoad              = d.EligibleForAutoLoad,
                    ALwaysVVIPInd                    = d.ALwaysVVIPInd,
                    CollectionIssueInd               = d.CollectionIssueInd,
                    AssignedToExternalCollectionsInd = d.AssignedToExternalCollectionsInd,
                    BulkBillingInd                   = d.BulkBillingInd,
                    DoNotPrintInvoiceInd             = d.DoNotPrintInvoiceInd,
                    DoNotExportInvoiceInd            = d.DoNotExportInvoiceInd,
                    HideNewFreightFromBrokerInd      = d.HideNewFreightFromBrokerInd,
                    PortStorageCustomerInd           = d.PortStorageCustomerInd,
                    AutoPortExportCustomerInd        = d.AutoPortExportCustomerInd,
                    RequiresPONumberInd              = d.RequiresPONumberInd,
                    SendEmailConfirmationsInd        = d.SendEmailConfirmationsInd,
                    STIFollowupRequiredInd           = d.STIFollowupRequiredInd,
                    DamagePhotoRequiredInd           = d.DamagePhotoRequiredInd,
                    ApplyFuelSurchargeInd            = d.ApplyFuelSurchargeInd,
                    FuelSurchargePercent             = d.FuelSurchargePercent,
                    LoadNumberPrefix                 = d.LoadNumberPrefix,
                    LoadNumberLength                 = d.LoadNumberLength,
                    NextLoadNUmber                   = d.NextLoadNUmber,
                    BookingNumberPrefix              = d.BookingNumberPrefix,
                    HandHeldScannerCustomerCode      = d.HandHeldScannerCustomerCode,
                    DriverComment                    = d.DriverComment,
                    InternalComment                  = d.InternalComment,
                    CreatedDate                      = d.CreatedDate,
                    CreatedBy                        = d.CreatedBy,
                    UpdatedDate                      = d.UpdatedDate,
                    UpdatedBy                        = d.UpdatedBy,
                    TotalPageCount                   = d.TotalPageCount,
                    EntryRate                        = d.EntryRate,
                    PerDiemGraceDays                 = d.PerDiemGraceDays
                });

                //if index is 0 need to fill the List
                if (CurrentPageIndex == 0)
                {
                    CustomerList = null;
                    CustomerList = new ObservableCollection <CustomerInfo>(customerInfo);
                }
                //otherwise add into the list
                else
                {
                    if (CustomerList != null && CustomerList.Count > 0)
                    {
                        foreach (CustomerInfo ud in new ObservableCollection <CustomerInfo>(customerInfo))
                        {
                            CustomerList.Add(ud);
                        }
                    }
                }

                Application.Current.Properties["SearchCount"] = Convert.ToInt32(Application.Current.Properties["SearchCount"]) + 1;

                //If list count is > 0
                if (CustomerList != null && CustomerList.ToList().Count > 0)
                {
                    //Update Total record count on UI
                    Count = CustomerList.ToList().Where(x => x.TotalPageCount > 0).FirstOrDefault().TotalPageCount;
                }
                else
                {
                    Count = 0;
                }
            }
            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));
            }
        }