public DataTable GetMFAccountLists()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_ID));
        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_NO));
        dt.Columns.Add(new DataColumn(DKEY_ACCOUNT_NAME));

        IList <MFAccount> accountLists = null;

        if (0 != this.investmentPlannerID)
        {
            accountLists = MFAccount.List(iSabayaContext, InvestmentPlanner.Find(iSabayaContext, this.investmentPlannerID));
        }
        else
        {
            accountLists = MFAccount.List(iSabayaContext);
        }

        foreach (MFAccount item in accountLists)
        {
            if (item.EffectivePeriod.Includes(DateTime.Now))
            {
                DataRow dr = dt.NewRow();
                dr[DKEY_ACCOUNT_ID]   = item.AccountID;
                dr[DKEY_ACCOUNT_NO]   = item.AccountNo;
                dr[DKEY_ACCOUNT_NAME] = item.Name.ToString(LanguageCode);
                dt.Rows.Add(dr);
            }
        }
        return(dt);
    }
    protected void cbSendAcc_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        String    code     = e.Parameter;
        MFAccount customer = MFAccount.FindByAccountNo(iSabayaContext, code);

        if (customer != null)
        {
            e.Result = customer.Name.ToString(this.LanguageCode);
        }
    }
Пример #3
0
    protected void cbSelectedIndexChnage_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {//var rowIndex = gridPassword.GetFocusedRowIndex();
        if (e.Parameter.Length != 0)
        {
            int       index   = int.Parse(e.Parameter);
            MFAccount account = (MFAccount)gridAccountOutput.GetRow(index);

            Session[this.ID + "SelectedAccount"] = account;
        }
    }
Пример #4
0
    protected void cbpGridAccountOutput_Callback(object source, DevExpress.Web.ASPxClasses.CallbackEventArgsBase e)
    {
        MFCustomer        customer        = this.MFCustomer;
        String            currentLanguage = (String)Session["CurrentLanguage"];
        IList <MFAccount> accounts        = MFAccount.FindByMFCustomer(iSabayaContext, customer);

        gridAccountOutput.DataSource = accounts;
        gridAccountOutput.DataBind();
        Session[this.ID + "cbpGridAccountOutput"] = accounts;
    }
    protected void cbBankAccount_Callback(object sender, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        Int32     accountID          = Convert.ToInt32(e.Parameter);
        MFAccount m                  = MFAccount.Find(iSabayaContext, accountID);
        IList <PartyBankAccount> pba = m.AssociatedBankAccounts;

        if (pba == null)
        {
            throw new ApplicationException("ไม่พบบัญชีธนาคาร");
        }
        Session[this.ClientID + "FundBankAccountLists"] = pba;
        this.BindCombo();
    }
    private List <VOPayment> FindPaymentsOfPayee(MFAccount account)
    {
        ISession  session = PersistenceLayer.WebSessionManager.PersistenceSession;
        ICriteria crit    = session.CreateCriteria <Payment>()
                            .Add(Expression.Eq("Payee", account))
                            .Add(Expression.IsNull("Reference"));
        List <VOPayment> voList = new List <VOPayment>();

        foreach (Payment item in crit.List <Payment>())
        {
            VOPayment vo = new VOPayment(item);
            voList.Add(vo);
        }
        return(voList);
    }
        /*ใช้ในหน้าสรุปซื้อขาย เรียกจาก ObjectDatasource*/
        public static IList <VOTransactionSelect_GridTransaction> List(
            imSabayaContext context,
            int fundId,
            int accountId,
            DateTime date,
            int transactionTypeId,
            int sellingAgentId,
            int orgUnitId
            )
        {
            ICriteria crit = context.PersistencySession.CreateCriteria(typeof(MFTransaction));

            crit.Add(Expression.Eq("Fund", (Fund)MutualFund.Find(context, fundId)))
            //.Add(Expression.Eq("RollbackStatus", (byte)0))
            .CreateAlias("CurrentState", "currentState")
            .CreateAlias("CurrentState.State", "state")
            .Add(Expression.Eq("state.Code", "Released"));

            if (accountId != 0)
            {
                crit.Add(Expression.Eq("Portfolio", MFAccount.Find(context, accountId)));
            }

            if (transactionTypeId != 0)
            {
                crit.Add(Expression.Eq("Type", InvestmentTransactionType.Find(context, transactionTypeId)));
            }
            if (date != DateTime.MinValue)
            {
                DateTime minOfToday = date.Date;
                DateTime maxOfToday = date.Date.AddDays(1).Date.AddMilliseconds(-1);
                crit.Add(Expression.Between("TransactionTS", minOfToday, maxOfToday));
            }
            if (sellingAgentId != 0)
            {
                crit.Add(Expression.Eq("SellingAgent", Organization.Find(context, sellingAgentId)));
            }
            IList <MFTransaction> list = crit.List <MFTransaction>();

            IList <VOTransactionSelect_GridTransaction> vos = new List <VOTransactionSelect_GridTransaction>();

            foreach (MFTransaction tran in list)
            {
                vos.Add(new VOTransactionSelect_GridTransaction(context, tran));
            }
            return(vos);
        }
Пример #8
0
    protected void cbLoadFund_Callback(object source, DevExpress.Web.ASPxCallback.CallbackEventArgs e)
    {
        int               MFAccountID = Convert.ToInt32(e.Parameter);
        MFAccount         Account     = MFAccount.Find(iSabayaContext, MFAccountID);
        List <MutualFund> tempLists   = (List <MutualFund>)Session[this.ClientID + "tempLists"];
        List <MutualFund> fundLists   = new List <MutualFund>();

        foreach (MFInvestment item in MFInvestment.Find(iSabayaContext, null, Account))
        {
            if (tempLists.Contains(item.Fund))
            {
                fundLists.Add(item.Fund);
            }
        }
        if (fundLists.Count > 0)
        {
            fundLists.Sort((x, y) => string.Compare(x.Code, y.Code));
        }
        Session[this.ClientID + "FundLists"] = fundLists;
    }
 public MFAccount_MFAccountControl_Vo(String languageCode, MFAccount account)
 {
     this.account      = account;
     this.LanguageCode = languageCode;
 }
Пример #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack == false)
        {
            cboAccountNo.SetValidation(ValidationGroup, IsRequiredField);
            lblMFCustomerName.ClientInstanceName = (lblAccountDetail != null ? lblAccountDetail : lblMFCustomerName.ClientID);
            Session[this.GetType().ToString() + "GridMFAccount"]  = null;
            Session[this.GetType().ToString() + "MFAccountLists"] = null;

            //game
            lblMFCustomerName.Cursor = "pointer";
        }

        if (Session[this.GetType().ToString() + "GridMFAccount"] != null)
        {
            IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"];

            GridCustomer.DataSource = vos;
            GridCustomer.DataBind();

            cboAccountNo.DataSource = Session[this.GetType().ToString() + "MFAccountLists"];
            cboAccountNo.DataBind();
        }
        else
        {
            if (IsPostBack == false)
            {
                IList <MFAccount> mfaccounts   = MFAccount.List(iSabayaContext);
                List <MFAccount>  resultCanSee = new List <MFAccount>();
                this.User.Person.FilterPortfolios(iSabayaContext, mfaccounts, resultCanSee);

                if (Session["ctrls_MFAccountControlNew_mfaccounts"] == null)
                {
                    JsonObjectCollection json = new JsonObjectCollection();
                    foreach (MFAccount account in resultCanSee)
                    {
                        json.Add(new JsonStringValue(account.AccountID + "", account.Name.ToString()));
                    }
                    Session["ctrls_MFAccountControlNew_mfaccounts"] = json.ToString();
                }

                IList <MFAccount_MFAccountControl_Vo> vos = new List <MFAccount_MFAccountControl_Vo>();
                foreach (MFAccount a in resultCanSee)
                {
                    vos.Add(new MFAccount_MFAccountControl_Vo(this.LanguageCode, a));
                }
                Session[this.GetType().ToString() + "GridMFAccount"] = vos;
                GridCustomer.DataSource = vos;
                GridCustomer.DataBind();

                Session[this.GetType().ToString() + "MFAccountLists"] = GetMFAccountLists();
                cboAccountNo.DataSource = GetMFAccountLists();
                //cboAccountNo.ValueField = "AccountID";
                //cboAccountNo.TextField = "AccountNo";
                cboAccountNo.DataBind();
            }
        }

        if (!Page.IsCallback)
        {
            cbTest.ClientSideEvents.CallbackComplete = @"function(s, e) {
                this.MyResult=e.result;
	            "     + cbpTxtMFAccountNo.ClientInstanceName + @".PerformCallback();
            }";
            CallbacklikeCustomerName.ClientSideEvents.CallbackComplete = @"function(s, e) {
                this.MyResult=e.result;
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            btnFindName.ClientSideEvents.Click = @"function(s, e) {
                var a = " + txtFirstName.ClientInstanceName + @".GetText();
                if(a != '')
                    " + CallbacklikeCustomerName.ClientInstanceName + @".SendCallback();
            }";

            if (cboAccountNo.Buttons[0] != null)
            {
                cboAccountNo.ClientSideEvents.ButtonClick =
                    @"function(s,e)
                {
                    if(e.buttonIndex == 0)
                    {
                        var win = " + popupAccount.ClientInstanceName + @".GetWindow(0);
                        " + popupAccount.ClientInstanceName + @".ShowWindow(win);
                    }
                }";
            }
            ;
            IList <MFAccount_MFAccountControl_Vo> vos = (IList <MFAccount_MFAccountControl_Vo>)Session[this.GetType().ToString() + "GridMFAccount"];

            GridCustomer.ClientSideEvents.CustomButtonClick = @"function(s,e)
            {
                var buttonID = e.buttonID;
                var visibleIndex = parseInt(e.visibleIndex);
                  if(buttonID = 'buttonSelect')
                  {
                     " + GridCustomer.ClientInstanceName + @".GetRowValues(visibleIndex,'AccountID;AccountNo',
                           function (values)
                            {
                                " + lblMFCustomerName.ClientInstanceName + @".SetText(document.mfaccountMap[values[0]]);
                               for(var i = 0;i<" + vos.Count + @";i++){
                                    var id = " + cboAccountNo.ClientInstanceName + @".GetItem(i).value;
                                    if(parseInt(id)==parseInt(values[0])){
                                        " + cboAccountNo.ClientInstanceName + @".SetSelectedIndex(i);
                                         break;
                                    }
                                }
                                " + popupAccount.ClientInstanceName + @".Hide();
                            }
                        );
                  }
            }";
            btnViewSignature.Visible = this.showOwnerSignature;
            //game
            popupViewSignature.PopupElementID = btnViewSignature.ClientID;
            string ifPageForTransaction = "";
            if (isTransaction)
            {
                ifPageForTransaction = cbCheckOwner.ClientInstanceName + @".SendCallback();";
            }

            //game
            cbCheckOwner.ClientSideEvents.CallbackComplete = @"function(s, e){
                var a = e.result;
                if(a != ''){
                    //alert( a );
                    document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = '';
                }else{
                    document.getElementById('" + tdIsEmployee.ClientID + @"').style.display = 'none';
                }
            }";

            cboAccountNo.ClientSideEvents.SelectedIndexChanged = @"function(s,e)
            {
                var value = s.GetValue();
                var str = document.mfaccountMap[s.GetValue()];
                " + lblMFCustomerName.ClientInstanceName + @".SetText(str);
                if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined')
                {
                    " + btnViewSignature.ClientInstanceName + @".SetVisible(str != '');
                    " + cbpViewSignature.ClientInstanceName + @".PerformCallback();
                }
                if(typeof(oncompleteLoadMFAccount) != 'undefined'){
                   oncompleteLoadMFAccount();
                }
                if(typeof(loadMFAccountFund) != 'undefined'){
                   loadMFAccountFund(" + cboAccountNo.ClientInstanceName + @".GetValue());
                }
                if(typeof(loadMFAccountBankAccount) != 'undefined'){
                   loadMFAccountBankAccount(" + cboAccountNo.ClientInstanceName + @".GetValue());
                }"
                                                                 + ifPageForTransaction
                                                                 + @"var name = str;
                " + ClientSideEvents.AfterSelectedChanged + @"
                //document.getElementById('trComboAccount').style.display = 'none';
                //document.getElementById('trCustomerName').style.display = '';
            }";

            lblMFCustomerName.ClientSideEvents.Click = @"function(s, e){
                //document.getElementById('trComboAccount').style.display = '';
                //document.getElementById('trCustomerName').style.display = 'none';
            }";

            cbTest.ClientSideEvents.CallbackComplete = @"function(s,e)
            {
                " + GridCustomer.ClientInstanceName + @".PerformCallback();
            }";

            String mfaccountMap = (String)Session["ctrls_MFAccountControlNew_mfaccounts"];
            cboAccountNo.ClientSideEvents.Init = @"function(s,e)
            {
                if(" + cboAccountNo.ClientInstanceName + @".GetItemCount()<=0){
                    " + cbTest.ClientInstanceName + @".SendCallback();
                }
                document.mfaccountMap = eval(" + mfaccountMap + @");
            }";

            btnViewSignature.ClientSideEvents.Init         = @"function(s,e)
            {
                document.getElementById('" + divBiewSignature.ClientID + @"').style.visibility = 'visible';
                if(typeof(" + btnViewSignature.ClientInstanceName + @") != 'undefined')
                    " + btnViewSignature.ClientInstanceName + @".SetVisible(" + lblMFCustomerName.ClientInstanceName + @".GetText() != '');
            }";
            btnViewSignature.ClientSideEvents.Click        = @"function(s,e)
            {
                " + popupViewSignature.ClientInstanceName + @".Show();
            }";
            cbpTxtMFAccountNo.ClientSideEvents.EndCallback = @"function(s,e)
            {
                if(typeof(s.cpResult) != 'undefined' && s.cpResult)
                {
                    " + lblMFCustomerName.ClientInstanceName + @".SetText('');
                    s.cpResult = null;
                }
            }";
        }
    }
Пример #11
0
 public VOMFAccount(MFAccount instance)
 {
     this.instance = instance;
 }