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();
    }
        /*ใช้ในหน้าสรุปซื้อขาย เรียกจาก 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);
        }
Ejemplo n.º 3
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;
    }