Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            presenter = new OverpaymentsPresenter(this, TransactionReportsService.Create(), ReportManagerFactory.Create(this.CurrentScope(), Context.User as CffPrincipal));
            presenter.ConfigureView(this.CurrentScope());

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }

            presenter.ShowReport(this.CurrentScope(), true);
            UpdateTitle((TransactionStatusTypesFilterControl.Controls[1] as System.Web.UI.WebControls.DropDownList).Text);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            presenter = new CustomerWatchPresenter(this, ReportsService.Create(), ReportManagerFactory.Create(this.CurrentScope(), Context.User as CffPrincipal));

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }

            if (!IsPostBack)
            {
                presenter.ConfigureView(this.CurrentScope());
                presenter.ShowReport(this.CurrentScope(), true);
            }
        }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            InitializeCurrentPathForJavaScript();

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }

            Master.ShowReportViewer();
        }
        public void SelectCustomerByClientAndCustomer(int clientId, int customerId)
        {
            if (securityManager.CanChangeSelectedCustomer())
            {
                if (securityManager.CanChangeSelectedClient())
                {
                    CffClient   client           = clientRepository.GetCffClientByCustomerId(customerId);
                    CffCustomer customer         = customerRepository.GetCffCustomerByCustomerId(customerId);
                    ICffClient  clientByClientId = clientRepository.GetCffClientByClientId(clientId);

                    if (client != null && customer != null && clientByClientId != null)
                    {
                        // view.Client = clientByClientId;
                        //view.Customer = customer;
                    }
                }
                else
                {
                    CffCustomer customer = customerRepository.GetCffCustomerByClientIdAndCustomerId(view.Client.Id, customerId);
                    if (customer != null)
                    {
                        // view.Customer = customer;
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public ICffClient GetCffClientByClientId(int clientId)
        {
            ICffClient cffClient = null;

            using (SqlConnection connection = CreateConnection())
            {
                using (
                    SqlDataReader dataReader = SqlHelper.ExecuteReader(connection, CommandType.StoredProcedure,
                                                                       "Client_GetClientByCleintID",
                                                                       CreateClientIdParameter(clientId)))
                {
                    CleverReader cleverReader = new CleverReader(dataReader);
                    if (!cleverReader.IsNull && cleverReader.Read())
                    {
                        if (cleverReader.FromBigInteger("ClientID") == -1)
                        {
                            cffClient = AllClients.Create();
                        }
                        else
                        {
                            cffClient = new CffClient(cleverReader.ToString("ClientName"),
                                                      cleverReader.FromBigInteger("ClientID"),
                                                      cleverReader.FromBigInteger("ClientNum"),
                                                      cleverReader.ToSmallInteger("FacilityType"),
                                                      cleverReader.ToString("CollectionsBankAccount"),
                                                      cleverReader.ToSmallInteger("CFFDebtorAdmin"),        //MSazra [20151006]
                                                      cleverReader.ToBoolean("ClientHasLetterTemplates")    //MSazra [20151006]
                                                      );
                        }
                    }
                }
            }
            return(cffClient);
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            presenter.ConfigureView(SessionWrapper.Instance.Scope);

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }

            // end
            if (!IsPostBack)
            {
                presenter.ShowReport(this.CurrentScope(), true);
            }
        }
Ejemplo n.º 7
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            int    employeeId = CurrentPrincipal.CffUser.EmployeeId;
            string comment    = string.IsNullOrEmpty(CommentTextBox.Text) ? "" : CommentTextBox.Text;

            if (!string.IsNullOrEmpty(comment))
            {
                //comment = comment.Replace("\n", ";");  //dbb
                comment = comment.Replace("\n", " ");
            }

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrWhiteSpace(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            bool bIsAllClientsSelected = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.IsAllClientsSelected :
                                         (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).IsAllClientsSelected : false;

            bool bIsClientSelected = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.IsClientSelected :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).IsClientSelected : false;

            bool bIsCustomerSelected = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.IsCustomerSelected :
                                       (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).IsCustomerSelected : false;

            if (bIsAllClientsSelected)
            {
                int clientId      = SessionWrapper.Instance.Get.ClientFromQueryString.Id;
                var permanentNote = new PermanentClientNote(comment, clientId, employeeId);
                presenter.SaveClientPermanentNote(permanentNote);
            }
            else if (bIsCustomerSelected)
            {
                //int customerId = SessionWrapper.Instance.Get.Customer.Id;
                int          customerId      = SessionWrapper.Instance.Get.CustomerFromQueryString.Id;
                string       nextCallDueText = EncodedText(NextCallDueTextBox.Text);
                ActivityType activityType    = ActivityType.Parse(int.Parse(ActivityTypeDropDownList.SelectedValue));
                NoteType     noteType        = NoteType.Parse(int.Parse(NoteTypeDropDownList.SelectedValue));

                SaveNoteForCustomer(comment, employeeId, customerId, nextCallDueText, activityType, noteType);
            }
            else if (bIsClientSelected)
            {
                if (PermanentNoteCheckBox.Checked)
                {
                    int clientId      = xClient.Id;
                    var permanentNote = new PermanentClientNote(comment, clientId, employeeId);
                    presenter.SaveClientPermanentNote(permanentNote);
                }
                else
                {
                    int          clientId     = xClient.Id;
                    ActivityType activityType = ActivityType.Parse(int.Parse(ActivityTypeDropDownList.SelectedValue));
                    NoteType     noteType     = NoteType.Parse(int.Parse(NoteTypeDropDownList.SelectedValue));
                    var          clientNote   = new ClientNote(activityType, noteType, comment, clientId, employeeId);
                    presenter.SaveClientNote(clientNote);
                }
            }
        }
        public void SelectClientCustomerAndRedirectToInvoiceBatches(int clientId, int customerId, int batch)
        {
            if (securityManager.CanViewReleaseTab())
            {
                ICffClient  client   = clientRepository.GetCffClientByClientId(clientId);
                CffCustomer customer = customerRepository.GetCffCustomerByCustomerId(customerId);

                view.Client   = client;
                view.Customer = (ICffCustomer)customer;
                RedirectToInvoiceBatchesWithClientCustomer(clientId, customerId, batch);
            }
        }
        public void SelectClientCustomerAndRedirectToDashboard(int clientId, int customerId)
        {
            if (securityManager.CanChangeSelectedCustomer())
            {
                ICffClient  client   = clientRepository.GetCffClientByClientId(clientId);
                CffCustomer customer = customerRepository.GetCffCustomerByCustomerId(customerId);

                view.Client   = client;
                view.Customer = (ICffCustomer)customer;
                view.RedirectTo(DashboardUrl + "?Client=" + clientId + "&Customer=" + customerId + "&ViewID=" + QueryString.ViewIDValue);
            }
        }
        private void LoadReport()
        {
            ReportPanel.ResetPaginationAndFocus();

            if (new ReportScopeManager(this.CurrentScope()).IsPromptReportAvailable())
            {
                bool bIsAllClientSelected = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.IsAllClientsSelected :
                                            (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).IsAllClientsSelected : false;

                bool bIsClientSelected = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.IsClientSelected :
                                         (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).IsClientSelected : false;

                ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

                if (bIsAllClientSelected)
                {
                    reportData.Visible = true;
                    AllClientsReportHelpMessage.Visible = false;

                    if (IsFactoredCheckBox.Checked)
                    {
                        presenter.LoadFactoredPromptReportForAllClients(0, allClientsFilter.FacilityType, allClientsFilter.IsSalvageIncluded);
                    }
                    else
                    {
                        presenter.LoadAllPromptReportForAllClients(0, allClientsFilter.FacilityType, allClientsFilter.IsSalvageIncluded);
                    }
                }
                else if (bIsClientSelected)
                {
                    allClientsFilter.Visible = false;

                    if (xClient != null)
                    {
                        if (IsFactoredCheckBox.Checked)
                        {
                            presenter.LoadFactoredPromptReport(PromptDaysPicker.SelectedPromptDay,
                                                               xClient.Id, xClient.ClientFacilityType);
                        }
                        else
                        {
                            presenter.LoadAllInvoicesPromptReport(PromptDaysPicker.SelectedPromptDay,
                                                                  xClient.Id, xClient.ClientFacilityType);
                        }
                    }
                }
            }
            else
            {
                DisplayReportNotAvailableError();
            }
        }
 public void SelectClient(int clientId)
 {
     if (securityManager.CanChangeSelectedClient())
     {
         ICffClient client = clientRepository.GetCffClientByClientId(clientId);
         if (client != null)
         {
             view.Client   = client;
             view.Customer = null;
         }
     }
 }
        public void CheckClientAndCustomerMatchAndSelectCustomer(int clientId, int customerId)
        {
            if (securityManager.CanChangeSelectedCustomer())
            {
                if (securityManager.CanChangeSelectedClient())
                {
                    ICffClient client             = clientRepository.GetCffClientByClientId(clientId);
                    CffClient  clientBycustomerId = clientRepository.GetCffClientByCustomerId(customerId);


                    if (SessionWrapper.Instance.Get != null)
                    {
                        if (SessionWrapper.Instance.Get.UserIdentity == 1)
                        {
                            if (SessionWrapper.Instance.Get.ClientFromQueryString != null)
                            {
                                System.Web.HttpContext.Current.Response.Redirect(DashBoardUri + "?Client=" + SessionWrapper.Instance.Get.ClientFromQueryString.Id + "&Customer=" + customerId);
                                return;
                            }
                        }
                        else
                        {
                            if (client != null && clientBycustomerId != null)
                            {
                                if (client.Id != clientBycustomerId.Id)
                                {
                                    System.Web.HttpContext.Current.Response.Redirect(DashBoardUri + "?Client=" + clientBycustomerId.Id + "&Customer=" + customerId);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (client != null && clientBycustomerId != null)
                        {
                            if (client.Id != clientBycustomerId.Id)
                            {
                                System.Web.HttpContext.Current.Response.Redirect(DashBoardUri + "?Client=" + clientBycustomerId.Id + "&Customer=" + customerId);
                            }
                        }
                    }
                }
                else
                {
                    CffCustomer customer = customerRepository.GetCffCustomerByClientIdAndCustomerId(view.Client.Id, customerId);
                    if (customer != null)
                    {
                        // view.Customer = customer;
                    }
                }
            }
        }
 public void SelectClientAndRedirectToDashboard(int clientId)
 {
     if (securityManager.CanChangeSelectedClient())
     {
         ICffClient client = clientRepository.GetCffClientByClientId(clientId);
         if (client == null)
         {
             throw new ArgumentException("Cannot select null client");
         }
         view.Client = client;
         view.RedirectTo(DashboardUrl + "?Client=" + clientId + "&ViewID=" + QueryString.ViewIDValue);
     }
 }
 public void SelectCustomerClientAtCustomerScope(int clientId, int customerId)
 {
     if (securityManager.CanChangeSelectedClient())
     {
         ICffClient  client   = clientRepository.GetCffClientByClientId(clientId);
         CffCustomer customer = customerRepository.GetCffCustomerByCustomerId(customerId);
         if (client != null)
         {
             view.Client = client;
             CffCustomerExt xC = new CffCustomerExt(customer.Name, customer.Id, customer.Number);
             view.Customer = (ICffCustomer)xC;
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            presenter = new PromptReportPresenter(this, RepositoryFactory.CreateReportRepository(), ReportManagerFactory.Create(this.CurrentScope(), Context.User as CffPrincipal));

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }

            if (!IsPostBack)
            {
                if (xClient != null)
                {
                    presenter.LoadDefaultPromptDays(xClient.Id);
                }

                LoadReport(); //as per marty's suggestions

                //if (this.CurrentScope() != Scope.AllClientsScope) {
                //    LoadReport();
                //} else {
                //    HideReportContent();
                //}
            }
        }
Ejemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DatePicker.Update += DatePickerUpdated;

            presenter = new StatementPresenter(this, RepositoryFactory.CreateReportRepository(),
                                               ReportManagerFactory.Create(SessionWrapper.Instance.Scope,
                                                                           Context.User as CffPrincipal));

            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }
            // end
            if (!IsPostBack)
            {
                presenter.InitializeForScope();
                presenter.LoadStatementReport();
            }
            else
            {
                ShowReport(ViewState["StatementReport"] as StatementReport);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            reportPanelContainer.ReportParameterUpdated += ReportParameterUpdated;

            presenter = new CreditBalanceTransfersPresenter(this, TransactionReportsService.Create(), ReportManagerFactory.Create(this.CurrentScope(), Context.User as CffPrincipal));
            presenter.ConfigureView(this.CurrentScope());

            // start related ref:CFF-18
            ICffClient xClient = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.ClientFromQueryString :
                                 (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString : null;

            if (xClient != null)
            {
                targetName = ": " + xClient.Name;
            }

            ICffCustomer xCustomer = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue)) ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString : null;

            if (xCustomer != null)
            {
                if (targetName != null || !targetName.Equals(""))
                {
                    targetName += " / ";
                    targetName  = string.Concat(targetName, xCustomer.Name);
                }
                else
                {
                    targetName = ": " + xCustomer.Name;
                }
            }
            // end
            //if (!IsPostBack)
            //{
            presenter.ShowReport(this.CurrentScope(), true);
            UpdateTitle((reportPanelContainer.FindControl("TransactionStatusTypesFilterControl").Controls[1] as System.Web.UI.WebControls.DropDownList).Text);
            //}
        }
        public ICffClient GetClientDetails()
        {
            if (clientDetails == null)
            {
                string clientId = "-1";
                if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["Client"]))
                {
                    clientId = HttpContext.Current.Request.QueryString["Client"];
                }
                else if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString["Customer"]))
                {
                    string customerId = HttpContext.Current.Request.QueryString["Customer"];
                    clientDetails = RepositoryFactory.CreateClientRepository().GetCffClientByCustomerId(Convert.ToInt32(customerId));
                }
                else
                {
                    clientId = "-1";
                }

                clientDetails = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(clientId));
            }

            return(clientDetails);
        }
        private void LoadRetentionSchedules()
        {
            Scope xScope = this.CurrentScope();

            if (xScope == Scope.AllClientsScope)
            {
                presenter.LoadRetentionSchedulesForAllClients(datePicker.Date);
            }
            else
            {
                ICffClient ClientFromQueryString = (SessionWrapper.Instance.Get == null)
                                ? SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString
                                : SessionWrapper.Instance.Get.ClientFromQueryString;
                presenter.LoadRetentionSchedules(ClientFromQueryString.Id, MonthRangePicker.DateRange);
            }

            if (RetentionGridView.FocusedRowIndex < 0)
            {
                if (RetentionGridView.Rows.Count > 0)
                {
                    RetentionGridView.FocusedRowIndex = 0;
                }
            }
        }
        private static SqlParameter[] CreateSqlBuilder(DateRange dateRange, string invoiceNumber, TransactionSearchType transactionSearchType, SearchScope searchScope, CffCustomer customer, ICffClient client, string batchFrom, string batchTo)
        {
            List <SqlParameter> sqlParameterList = new List <SqlParameter>();

            if (!string.IsNullOrEmpty(invoiceNumber))
            {
                SqlParameter invoiceNumberParameter = new SqlParameter("@Seek", SqlDbType.NVarChar, 40);
                invoiceNumberParameter.Value = invoiceNumber + "%";
                sqlParameterList.Add(invoiceNumberParameter);
            }
            SqlParameter clientIdParameter   = new SqlParameter("@ClientID", SqlDbType.Int);
            SqlParameter customerIdParameter = new SqlParameter("@CustID ", SqlDbType.Int);

            switch (searchScope)
            {
            case SearchScope.AllClients:
                clientIdParameter.Value   = -1;
                customerIdParameter.Value = -1;
                break;

            case SearchScope.AllCustomers:
                clientIdParameter.Value   = client.Id;
                customerIdParameter.Value = -1;
                break;

            case SearchScope.CurrentCustomer:
                clientIdParameter.Value   = client.Id;
                customerIdParameter.Value = customer.Id;
                break;
            }
            sqlParameterList.Add(clientIdParameter);
            sqlParameterList.Add(customerIdParameter);
            SqlParameter transactionSearchTypeParameter = new SqlParameter("@SearchBy", SqlDbType.VarChar, 20);

            switch (transactionSearchType)
            {
            case TransactionSearchType.Invoices:
                transactionSearchTypeParameter.Value = "Invoice";
                sqlParameterList.Add(transactionSearchTypeParameter);
                break;

            case TransactionSearchType.CreditNotes:
                transactionSearchTypeParameter.Value = "CreditEtc";
                sqlParameterList.Add(transactionSearchTypeParameter);
                break;
            }
            SqlParameter startDateParameter = new SqlParameter("@dtFrom", SqlDbType.DateTime);

            startDateParameter.Value = dateRange.StartDate.Value.DateTime;
            sqlParameterList.Add(startDateParameter);
            SqlParameter endDateParameter = new SqlParameter("@dtTo", SqlDbType.DateTime);

            endDateParameter.Value = dateRange.EndDate.Value.DateTime;
            sqlParameterList.Add(endDateParameter);
            SqlParameter btFrom = new SqlParameter("@BatchFrom", SqlDbType.VarChar);

            btFrom.Value = batchFrom;
            sqlParameterList.Add(btFrom);
            SqlParameter btTo = new SqlParameter("@BatchTo", SqlDbType.VarChar);

            btTo.Value = batchTo;
            sqlParameterList.Add(btTo);
            return(sqlParameterList.ToArray());
        }
        public IList <CreditNoteSearchResult> SearchCreditNotesTransactions(DateRange dateRange, string transactionNumber, TransactionSearchType transactionSearchType, SearchScope searchScope, CffCustomer customer, ICffClient client, string batchFrom, string batchTo)
        {
            if (transactionNumber.Length < 3)
            {
                throw new ArgumentException("You need more than 3 transaction Number to search ");
            }
            SqlParameter[] queryBuilder = CreateSqlBuilder(dateRange, transactionNumber,
                                                           transactionSearchType, searchScope, customer, client, batchFrom, batchTo);
            IList <CreditNoteSearchResult> creditNoteSearchResults = new List <CreditNoteSearchResult>();

            using (SqlConnection connection = CreateConnection())
            {
                try
                {
                    using (SqlDataReader dataReader = SqlHelper.ExecuteReader(connection,
                                                                              CommandType.StoredProcedure,
                                                                              "stGetCustomersSearchAll",
                                                                              queryBuilder))
                    {
                        CleverReader cleverReader = new CleverReader(dataReader);
                        while (!cleverReader.IsNull && cleverReader.Read())
                        {
                            var transactionSearchResult =
                                new CreditNoteSearchResult(
                                    cleverReader.ToDecimal("Amount"),
                                    cleverReader.ToInteger("BatchID"),
                                    cleverReader.ToDate("datereceived"),
                                    cleverReader.ToString("Reference"),
                                    cleverReader.ToDate("Created"),
                                    cleverReader.FromBigInteger("CustomerID"),
                                    cleverReader.ToString("Customer"),
                                    cleverReader.FromBigInteger("ClientID"),
                                    cleverReader.ToString("ClientName"),
                                    cleverReader.FromBigInteger("CustNum"),
                                    cleverReader.ToString("Title"),
                                    cleverReader.ToDecimal("Balance"),
                                    cleverReader.ToString("BatchFrom"),
                                    cleverReader.ToString("BatchTo"));
                            creditNoteSearchResults.Add(transactionSearchResult);
                        }
                    }
                }
                catch (SqlException exception)
                {
                    if (exception.Message.Contains("Timeout expired"))
                    {
                        throw new CffTimeoutException(exception.Message, exception);
                    }
                    throw;
                }
            }
            return(RecordLimiter.ReturnMaximumRecords(creditNoteSearchResults));
        }
        public void LoadClientAndCustomerContact(CffCustomer customer, ICffClient client)
        {
            if (customer == null)
            {
                view.ClearCffCustomerContactAndLeftInfomationPanel();
                view.DisplayCustomerNameAndClientNameInSearchBox();
                return;
            }

            ClientAndCustomerContacts clientAndCustomerContacts = customerRepository.GetCustomerClientContact(customer.Id);
            int clientID = (client == null) ? clientAndCustomerContacts.ClientContact.ClientId : client.Id;

            ClientAndCustomerInformation cffCustomer = customerRepository.GetMatchedCustomerInfo(customer.Id, clientID);
            ClientInformation            clientInfo  = customerRepository.GetMatchedClientInfo(clientID).ClientInformation;

            if (clientAndCustomerContacts != null)
            {
                //MSarza [20150901]
                //if (clientInfo.AdministeredBy.ToLower() == "no")
                //{ clientAndCustomerContacts.isClientAdministeredByCFF = false; }
                //else
                //{
                //    clientAndCustomerContacts.isClientAdministeredByCFF = true;
                //}
                if (clientInfo.IsClientDebtorAdmin)
                {
                    clientAndCustomerContacts.ClientIsDebtorAdmin = false;
                }
                else
                {
                    clientAndCustomerContacts.ClientIsDebtorAdmin = true;
                }
                if (clientInfo.IsCffDebtorAdminForClient)
                {
                    clientAndCustomerContacts.CffIsDebtorAdminForClient = false;
                }
                else
                {
                    clientAndCustomerContacts.CffIsDebtorAdminForClient = true;
                }
            }

            view.SetFocusToForm();

            if (clientAndCustomerContacts == null)
            {
                clientAndCustomerContacts = new ClientAndCustomerContacts(customerRepository.GetClientContactDetails(clientID), null);
            }

            view.DisplayClientAndCustomerContacts(clientAndCustomerContacts);
            //view.DisplayCustomerInformation(cffCustomer);

            decimal limit     = 0;
            decimal available = 0;

            if (clientInfo.FacilityType == "Current A/c")
            {
                limit = GetCurrentACLimitFromDrMgt(client.Id, System.DateTime.Today);
                if (cffCustomer.CffCustomerInformation.CreditLimit <= limit)
                {
                    available = (cffCustomer.CffCustomerInformation.CreditLimit - cffCustomer.CffCustomerInformation.AgeingBalances.Balance);
                }
                else
                {
                    available = (limit - cffCustomer.CffCustomerInformation.AgeingBalances.Balance);
                }
            }

            view.DisplayCustomerInformation(cffCustomer, clientInfo.FacilityType, limit, available);
        }
Ejemplo n.º 23
0
        public void SearchTransactions(DateRange dateRange, string invoiceNumber, TransactionSearchType transactionType,
                                       SearchScope searchScope, CffCustomer customer, ICffClient client, string batchFrom, string batchTo)
        {
            if (transactionType == TransactionSearchType.Invoices)
            {
                SearchingStatus = 1;
                if (CallBackHandler != null)
                {
                    this.CallBackHandler(this, new EventArgs());
                }

                IList <TransactionSearchResult> transactions = transactionSearchRepository.SearchTransactions(dateRange,
                                                                                                              invoiceNumber,
                                                                                                              transactionType,
                                                                                                              searchScope,
                                                                                                              customer,
                                                                                                              client,
                                                                                                              batchFrom,
                                                                                                              batchTo);

                SearchingStatus = 2;
                if (CallBackHandler != null)
                {
                    this.CallBackHandler(this, new EventArgs());
                }

                view.DisplayMatchedTransactions(transactions);
            }
            else
            {
                IList <CreditNoteSearchResult> transactions =
                    transactionSearchRepository.SearchCreditNotesTransactions(dateRange,
                                                                              invoiceNumber,
                                                                              transactionType,
                                                                              searchScope, customer,
                                                                              client,
                                                                              batchFrom,
                                                                              batchTo);
                view.DisplayMatchedCreditNotesTransactions(transactions);
            }
        }