protected void Page_Load(object sender, EventArgs e)
        {
            ConfigureGridColumns();
            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());

            presenter = new TransactionsPresenter(this, RepositoryFactory.CreateTransactionRepository(), RedirectionService.Create(this, securityManager));
            presenter.InitializeForScope(this.CurrentScope());


            int customerId = (SessionWrapper.Instance.Get != null) ? SessionWrapper.Instance.Get.CustomerFromQueryString.Id : SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString.Id;

            if (IsPostBack)
            {
                if (ChkBoxTransactionInvoices.Checked)
                {
                    presenter.LoadCurrentTransactionsInvoices(customerId);
                }
                else
                {
                    presenter.LoadCurrentTransactions(customerId);
                }
            }
            else
            {
                presenter.LoadCurrentTransactions(customerId);
            }

            TransactionCurrentLink.Visible = false;
            TransactionArchiveLink.HRef    = "~/TransactionArchive.aspx" + QueryStringParameters;
            TransactionHistoryLink.HRef    = "~/TransactionHistory.aspx" + QueryStringParameters;
            TransactionSearchLink.HRef     = "~/TransactionSearch.aspx" + QueryStringParameters;
        }
Esempio n. 2
0
        public bool PermanentCheckBoxEnable()
        {
            ISecurityManager securityManager = SecurityManagerFactory.Create(CurrentPrincipal, this.CurrentScope());

            PermCheckBoxEnable = securityManager.CanCreatePermanentNotes();
            return(PermCheckBoxEnable);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            ConfigureGridColumns();
            MonthRangePicker.Update += MonthRangePickerUpdate;
            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());

            presenter = new TransactionArchivePresenter(this, RepositoryFactory.CreateTransactionRepository(), RedirectionService.Create(this, securityManager));
            presenter.InitializeForScope(this.CurrentScope());

            int?custId = (SessionWrapper.Instance.Get == null) ?
                         ((QueryString.ViewIDValue == null)? 0 : SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString.Id)
                                  : SessionWrapper.Instance.Get.CustomerFromQueryString.Id;

            if (IsPostBack)
            {
                presenter.LoadTransactionArchive(MonthRangePicker.DateRange, (int)custId, ChkBoxTransactionInvoices.Checked);
            }
            else
            {
                presenter.LoadTransactionArchive(MonthRangePicker.DateRange, (int)custId, ChkBoxTransactionInvoices.Checked);
            }

            TransactionsLink.HRef       = "~/Transactions.aspx" + QueryStringParameters;
            TransactionHistoryLink.HRef = "~/TransactionHistory.aspx" + QueryStringParameters;
            TransactionSearchLink.HRef  = "~/TransactionSearch.aspx" + QueryStringParameters;
        }
Esempio n. 4
0
        private void ShowHideTabNavigations()
        {
            bool isInCustomerScope = (this.CurrentScope() == Scope.CustomerScope);

            currentTransactionsLink.Visible = isInCustomerScope;
            transactionArchiveLink.Visible  = isInCustomerScope;

            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());

            transactionHistoryLink.Visible = securityManager.CanViewTransactionHistoryLink();
        }
        protected void TransactionGridViewCustomCallback(object sender, ReportGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter   parameter   = CallbackParameter.Parse(e.Parameters);
            ArchivedTransaction transaction = (ArchivedTransaction)TransactionGridView.GetRow(parameter.RowIndex);

            var redirectionParameter = new RedirectionParameter(parameter.FieldName, SessionWrapper.Instance.Get.ClientFromQueryString.Id, SessionWrapper.Instance.Get.CustomerFromQueryString.Id, transaction.Batch);

            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.Get.Scope);
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
Esempio n. 6
0
        protected void ReportGridViewCustomCallback(object sender, ASPxGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter        parameter            = CallbackParameter.Parse(e.Parameters);
            AgedBalancesReportRecord record               = (AgedBalancesReportRecord)reportGridView.GetRow(parameter.RowIndex);
            RedirectionParameter     redirectionParameter = new RedirectionParameter(parameter.FieldName,
                                                                                     record.ClientNumber, record.Id);

            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.Scope);
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
Esempio n. 7
0
        protected void CreditSearchGridViewCustomCallback(object sender, ReportGridViewCustomCallbackEventArgs e)
        {
            CallbackParameter parameter = CallbackParameter.Parse(e.Parameters);

            CreditNoteSearchResult creditNote = (CreditNoteSearchResult)creditSearchGridView.GetRow(parameter.RowIndex);

            RedirectionParameter redirectionParameter = new RedirectionParameter(parameter.FieldName,
                                                                                 creditNote.ClientId,
                                                                                 creditNote.CustomerId, creditNote.Batch);
            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());
            Redirector       redirector      = new Redirector(RedirectionService.Create(this, securityManager));

            redirector.Redirect(redirectionParameter);
        }
Esempio n. 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            NextCallDueTextBox.Attributes.Add("readonly", "readonly");
            ISecurityManager securityManager = SecurityManagerFactory.Create(CurrentPrincipal, this.CurrentScope());

            presenter = new CustomerNotesAdderPresenter(this,
                                                        RepositoryFactory.CreateDictionaryRepository(),
                                                        RepositoryFactory.CreateCustomerNotesRepository(),
                                                        RepositoryFactory.CreateCustomerRepository(), securityManager);
            presenter.LockDown();

            if (!IsPostBack)
            {
                ClearControls();
                PopulateDropDownLists();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //todo: We should be able to filter out if query string clientid=selected client id from drop down
            //if not equal redirect to dashboard

            ISecurityManager        securityManager = SecurityManagerFactory.Create(CurrentPrincipal, this.CurrentScope());
            MainNavigationPresenter presenter       = new MainNavigationPresenter(this, securityManager);

            int ClientFacilityType = (SessionWrapper.Instance.Get != null)?SessionWrapper.Instance.Get.ClientFromQueryString.ClientFacilityType :
                                     (!string.IsNullOrEmpty(QueryString.ViewIDValue))?SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString.ClientFacilityType : 0;

            if (ClientFacilityType == 5)//Current Account
            {
                InvoiceBatchesLink.Text     = "Drawing Schedules";
                RetentionSchedulesLink.Text = "Monthly Charges";
                releaseTabLabel.Text        = "Drawings/Charges";
            }
            else if (ClientFacilityType == 2)//Dr Management
            {
                InvoiceBatchesLink.Text     = "Invoice Batches";
                RetentionSchedulesLink.Text = "Monthly Charges";
                releaseTabLabel.Text        = "Invoices/Charges";
            }
            else if (ClientFacilityType == 3)//CFSL
            {
                InvoiceBatchesLink.Text     = "Funding Schedules";
                RetentionSchedulesLink.Text = "Monthly Charges";
                releaseTabLabel.Text        = "Advances/Charges";
            }
            else if (ClientFacilityType == 4)//Loan
            {
                InvoiceBatchesLink.Text = "Advance Schedules";
                //RetentionSchedulesLink.Text = "Monthly Charges";  //dbb
                RetentionSchedulesLink.Visible = false;
                releaseTabLabel.Text           = "Advances/Charges";
            }
            else // factoring
            {
                InvoiceBatchesLink.Text     = "Invoice Batches";
                RetentionSchedulesLink.Text = "Monthly Schedules";
                releaseTabLabel.Text        = "Releases";
            }

            AppendQueryStringParameters();
            presenter.LockDown();
        }
Esempio n. 10
0
        public string SelectClientFromAutoCompleteDropDown(string clientId)
        {
            try
            {
                string[] strDummy = clientId.Split('_');
                clientId = (strDummy[0].Contains("("))?parseClientID(strDummy[0]):strDummy[0];
                string viewID = strDummy[1];

                if (!string.IsNullOrEmpty(clientId))
                {
                    if ((((CffPrincipal)Context.User).IsInClientRole == true || ((CffPrincipal)Context.User).IsInCustomerRole == true) && (clientId == "-1"))
                    {  //force to zero to return an error so we do not allow allclients scope for client or customer role
                        clientId = "0";
                    }

                    SessionWrapper.Instance.GetSession(viewID).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(clientId));
                    SessionWrapper.Instance.GetSession(viewID).IsDeselectingCustomer = false;
                    if (SessionWrapper.Instance.GetSession(viewID).CurrentUserID != (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString())
                    {
                        SessionWrapper.Instance.GetSession(viewID).CurrentUserID = (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString();
                    }

                    if (SessionWrapper.Instance.Get != null)
                    {
                        SessionWrapper.Instance.Get.ClientFromQueryString = SessionWrapper.Instance.GetSession(viewID).ClientFromQueryString;
                    }
                }

                IScopeService scopeService = new ScopeService(this,
                                                              SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.GetSession(viewID).Scope),
                                                              RepositoryFactory.CreateClientRepository(),
                                                              RepositoryFactory.CreateCustomerRepository()
                                                              );

                scopeService.SelectClient(int.Parse(clientId));
            }
            catch (FormatException)
            {
            }
            return(string.Empty);
        }
Esempio n. 11
0
        public string SelectCustomerFromAutoCompleteDropDown(string customerId)
        {
            //assign new customer instance here based from retrieved customer number and existing clientid
            Scope          xScope    = Scope.AllClientsScope;
            CffCustomerExt xCustomer = null;
            CffCustomer    cCustomer = null;

            if (SessionWrapper.Instance.Get != null)
            {
                if (SessionWrapper.Instance.Get.EmptyWindowHit == 0)
                {
                    SessionWrapper.Instance.Get.EmptyWindowHit = 1;
                }
                if (xCustomer == null)
                {
                    if (customerId.Contains("("))
                    { //this is customer number! we should be able to retrieve correct customer id + client id
                        customerId = customerId.Substring(customerId.IndexOf("(") + 1);
                        customerId = customerId.Replace(")", "");
                    }

                    if (!string.IsNullOrEmpty(customerId))
                    {
                        cCustomer = (RepositoryFactory.CreateCustomerRepository().GetMatchedCustomerInfo(Convert.ToInt32(customerId),
                                                                                                         SessionWrapper.Instance.Get.ClientFromQueryString.Id).CffCustomerInformation.Customer);
                        xCustomer = new CffCustomerExt(cCustomer.Name, cCustomer.Id, cCustomer.Number);
                    }
                }

                if (xCustomer != null)
                {
                    SessionWrapper.Instance.Get.CustomerFromQueryString = (ICffCustomer)xCustomer;
                    if (SessionWrapper.Instance.Get.CurrentUserID != (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString())
                    {
                        SessionWrapper.Instance.Get.CurrentUserID = (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString();
                    }
                }
            }
            else if (!string.IsNullOrEmpty(QueryString.ViewIDValue))
            {
                if (SessionWrapper.Instance.GetSession(QueryString.ViewIDValue) != null)
                {
                    xScope = SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).Scope;
                    if (SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).EmptyWindowHit == 0)
                    {
                        SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).EmptyWindowHit = 1;
                    }

                    cCustomer = (RepositoryFactory.CreateCustomerRepository().GetMatchedCustomerInfo(Convert.ToInt32(customerId),
                                                                                                     SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString.Id).CffCustomerInformation.Customer);
                    xCustomer = new CffCustomerExt(cCustomer.Name, cCustomer.Id, cCustomer.Number);
                    if (xCustomer != null)
                    {
                        SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString = (ICffCustomer)xCustomer;
                    }

                    if (SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CurrentUserID != (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString())
                    {
                        SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CurrentUserID = (System.Web.HttpContext.Current.User as CffPrincipal).CffUser.UserId.ToString();
                    }
                }
            }


            IScopeService scopeService = new ScopeService(this,
                                                          SecurityManagerFactory.Create(Context.User as CffPrincipal, xScope),
                                                          RepositoryFactory.CreateClientRepository(),
                                                          RepositoryFactory.CreateCustomerRepository());

            string jSon = string.Empty;

            if (!string.IsNullOrEmpty(customerId))
            {
                try
                {
                    scopeService.SelectCustomer(int.Parse(customerId));
                    using (MemoryStream stream = new MemoryStream())
                    {
                        serializer.WriteObject(stream, Client);
                        jSon = Encoding.Default.GetString(stream.ToArray());
                    }
                }
                catch (FormatException)
                {
                }
            }

            return(jSon);
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CffPrincipal cPrincipal = (CffPrincipal)Context.User;

            // verify if this user agreed on the CFF Agreement
            if (SessionWrapper.Instance.Get == null)
            {
                if ((cPrincipal.CffUser.UserType == UserType.EmployeeStaffUser) ||
                    (cPrincipal.CffUser.UserType == UserType.EmployeeManagementUser) ||
                    (cPrincipal.CffUser.UserType == UserType.EmployeeAdministratorUser))
                {
                    string viewID = SaferTrader.Core.Common.StringEnum.GenerateUniqueKey(12);
                    SessionWrapper.Instance.GetSession(viewID).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(QueryString.ClientId));
                    SessionWrapper.Instance.GetSession(viewID).UserIdentity          = 1;

                    string rUrl = ResolveClientUrl(Context.Request.Url.AbsolutePath + "?Client=" + QueryString.ClientId.ToString() + "&User="******"&ViewID=" + viewID);

                    string tUrl = this.Context.Request.RawUrl;
                    this.Response.Redirect(rUrl);
                }
                else
                { //redirect to logon page - allow only one window tab instance to open, unless it came from the reports tab etc
                    string rUrl = ResolveClientUrl("~/Logon.aspx");
                    string tUrl = this.Context.Request.RawUrl;
                    this.Response.Redirect(rUrl);
                }
            }

            if ((QueryString.ClientId != cPrincipal.CffUser.ClientId) && (cPrincipal.IsInClientRole || cPrincipal.IsInCustomerRole))
            {
                SessionWrapper.Instance.Get.ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId((int)cPrincipal.CffUser.ClientId);
            }

            if (Page.IsPostBack)
            {
                int ClientId = (this.Client != null) ? this.Client.Id : 0;
                if (ClientId == 0)
                {
                    if (QueryString.ClientId == null)
                    {
                        ClientId = Convert.ToInt32(cPrincipal.CffUser.ClientId.ToString());
                    }
                    else
                    {
                        ClientId = (int)QueryString.ClientId;
                    }
                }

                if (SessionWrapper.Instance.Get != null)
                {
                    if ((SessionWrapper.Instance.Get.ClientFromQueryString.Id != ClientId) &&
                        (!string.IsNullOrEmpty(SessionWrapper.Instance.Get.AccountsIDList)))
                    {
                        SessionWrapper.Instance.Get.ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(ClientId);
                    }

                    else if (SessionWrapper.Instance.Get.ClientFromQueryString.Id != ClientId)
                    {
                        if (cPrincipal.CffUser.UserType == UserType.EmployeeAdministratorUser ||
                            cPrincipal.CffUser.UserType == UserType.EmployeeManagementUser || cPrincipal.CffUser.UserType == UserType.EmployeeStaffUser)
                        {
                            SessionWrapper.Instance.Get.ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(ClientId);
                        }
                        else if (cPrincipal.IsInClientRole || cPrincipal.IsInCustomerRole)
                        {
                            SessionWrapper.Instance.Get.ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(cPrincipal.CffUser.ClientId.ToString()));
                        }
                    }
                }
                else if (!string.IsNullOrEmpty(QueryString.ViewIDValue))
                {
                    if ((SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString.Id != ClientId) &&
                        (!string.IsNullOrEmpty(SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).AccountsIDList)))
                    {
                        SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(ClientId);
                    }

                    else if (SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString.Id != ClientId)
                    {
                        if (cPrincipal.CffUser.UserType == UserType.EmployeeAdministratorUser ||
                            cPrincipal.CffUser.UserType == UserType.EmployeeManagementUser || cPrincipal.CffUser.UserType == UserType.EmployeeStaffUser)
                        {
                            SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(ClientId);
                        }
                        else if (cPrincipal.IsInClientRole || cPrincipal.IsInCustomerRole)
                        {
                            SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString = RepositoryFactory.CreateClientRepository().GetCffClientByClientId(Convert.ToInt32(cPrincipal.CffUser.ClientId.ToString()));
                        }
                    }
                }
            }

            IScopeService scopeService = new ScopeService(this,
                                                          SecurityManagerFactory.Create(Context.User as CffPrincipal, SessionWrapper.Instance.Get.Scope),
                                                          RepositoryFactory.CreateClientRepository(),
                                                          RepositoryFactory.CreateCustomerRepository());

            presenter = new DashboardPresenter(this, scopeService);

            MembershipUser membershipUser = Membership.GetUser(User.Identity.Name);

            if (presenter.IsReadAgreement((Guid)membershipUser.ProviderUserKey) == false)
            {
                RedirectTo("AgreementPage.aspx");
            }
            else
            {
                if (!IsPostBack)
                {
                    presenter.InitialiseView();
                }
                content.InnerHtml = presenter.DashboardMainContent();
            }
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            targetName = "";
            MonthRangePicker.Update += ParameterUpdate;
            ISecurityManager securityManager = SecurityManagerFactory.Create(Context.User as CffPrincipal, this.CurrentScope());

            presenter = new TransactionHistoryPresenter(this, RepositoryFactory.CreateTransactionRepository(), RedirectionService.Create(this, securityManager), securityManager);
            presenter.LockDown();
            presenter.InitializeForScope(this.CurrentScope());
            cffGGV_TransactionGridView.RowCommand += cffGGV_TransactionGridView_RowCommand;

            ChkBoxTransactionInvoices.Checked = false;
            ChkBoxTransactionInvoices.Visible = false; //removed as per marty's request

            if (IsPostBack)
            {
                // start ref:CFF-18
                if (SessionWrapper.Instance.Get == null && QueryString.ViewIDValue != null)
                {
                    targetName = ": " + SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).ClientFromQueryString.Name;
                }
                else if (SessionWrapper.Instance.Get.ClientFromQueryString != null)
                {
                    targetName = ": " + SessionWrapper.Instance.Get.ClientFromQueryString.Name;
                }

                if (SessionWrapper.Instance.Get == null && QueryString.ViewIDValue != null)
                {
                    if (targetName != null || !targetName.Equals(""))
                    {
                        targetName += " / ";
                        targetName  = string.Concat(targetName, SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString.Name);
                    }
                    else
                    {
                        targetName = ": " + SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString.Name;
                    }
                }
                else if (SessionWrapper.Instance.Get.CustomerFromQueryString != null)
                {
                    if (targetName != null || !targetName.Equals(""))
                    {
                        targetName += " / ";
                        targetName  = string.Concat(targetName, SessionWrapper.Instance.Get.CustomerFromQueryString.Name);
                    }
                    else
                    {
                        targetName = ": " + SessionWrapper.Instance.Get.CustomerFromQueryString.Name;
                    }
                }
                // end


                if (SessionWrapper.Instance.Get == null && QueryString.ViewIDValue != null)
                {
                    presenter.LoadTransactionHistory(MonthRangePicker.DateRange, SessionWrapper.Instance.GetSession(QueryString.ViewIDValue).CustomerFromQueryString.Id, ChkBoxTransactionInvoices.Checked);
                }
                else if (SessionWrapper.Instance.Get.IsCustomerSelected)
                {
                    presenter.LoadTransactionHistory(MonthRangePicker.DateRange, SessionWrapper.Instance.Get.CustomerFromQueryString.Id, ChkBoxTransactionInvoices.Checked);
                }
                else
                {
                    if (ViewState["Transactions"] != null)
                    {
                        ShowTransactionHistory(ViewState["Transactions"] as IList <HistoricalTransaction>);
                    }
                }
            }

            SearchLink.HRef = "~/TransactionSearch.aspx" + QueryStringParameters;
            currentTransactionsLink.InnerHtml = "<a href=\"Transactions.aspx" + Server.HtmlDecode(QueryStringParameters) + "\">Current</a>";
            transactionArchiveLink.InnerHtml  = "<a href=\"TransactionArchive.aspx" + Server.HtmlDecode(QueryStringParameters) + "\">Archive</a>";
        }