Ejemplo n.º 1
0
        //public static IList GetUnprintedNotas(IDalSession session)
        //{
        //    List<ICriterion> expressions = new List<ICriterion>();
        //    expressions.Add(Expression.Eq("PrintCount", 0));
        //    return session.GetList(typeof(Nota), expressions);
        //}
        //        public static List<IManagementCompany> GetMgmtCompaniesWithUnprintedNotas(IDalSession session,
        //                                                                                  NotaReturnClass returnClass, int[] managementCompanyIds)
        //        {
        //            string hql = string.Format(@"FROM ManagementCompany M WHERE M IN
        //                                            (SELECT A.AccountOwner FROM CustomerAccount A WHERE A IN
        //                                                (SELECT N.UnderlyingTx.AccountA FROM {0} N WHERE N.PrintCount = 0))",
        //                                       getType(returnClass).Name);
        //            if (managementCompanyIds != null && managementCompanyIds.Length > 0)
        //            {
        //                string idList = "";
        //                for (int i = 0; i < managementCompanyIds.Length; i++)
        //                    idList += (i > 0 ? ", " : "") + managementCompanyIds[i].ToString();
        //                hql += string.Format(" AND M IN ({0})", idList);
        //            }
        //            return NHSession.ToList<IManagementCompany>(session.GetListByHQL(hql, new Hashtable()));
        //        }
        public static int[] GetAccountsIdsWithUnprintedNotas(IDalSession session, int managementCompanyId, NotaReturnClass returnClass)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("ManagementCompanyId", managementCompanyId);
            string underlyingAccObj = "";
            switch (returnClass)
            {
                case NotaReturnClass.NotaTransaction:
                case NotaReturnClass.NotaTransfer:
                case NotaReturnClass.NotaInstrumentConversion:
                    underlyingAccObj = "UnderlyingTx.AccountA";
                    break;
                default:
                    underlyingAccObj = "UnderlyingBooking.Account";
                    break;
            }

            ArrayList accountIds = (ArrayList)session.GetListByHQL(
                string.Format(@"SELECT A.Key FROM CustomerAccount A
                                WHERE A.Key IN (SELECT N.{0}.Key FROM {1} N WHERE N.PrintCount = 0)
                                AND A.AccountOwner.Key = :ManagementCompanyId
                                ORDER BY A.Number",
                                underlyingAccObj,
                                getType(returnClass).Name),
                                parameters);
            return (int[])accountIds.ToArray(typeof(int));
        }
Ejemplo n.º 2
0
 public static DataSet BuildTestDataSet(int accountId, NotaReturnClass notaType)
 {
     IDalSession session = NHSessionFactory.CreateSession();
     try
     {
         return NotaPrintCommand.BuildTestDataSet(session, accountId, notaType);
     }
     finally
     {
         session.Close();
     }
 }
Ejemplo n.º 3
0
 private static Type getType(NotaReturnClass returnClass)
 {
     Type type;
     switch (returnClass)
     {
         case NotaReturnClass.NotaTransaction:
             type = typeof(NotaTransaction);
             break;
         case NotaReturnClass.NotaTransfer:
             type = typeof(NotaTransfer);
             break;
         case NotaReturnClass.NotaFees:
             type = typeof(NotaFees);
             break;
         case NotaReturnClass.NotaDeposit:
             type = typeof(NotaDeposit);
             break;
         case NotaReturnClass.NotaDividend:
             type = typeof(NotaDividend);
             break;
         case NotaReturnClass.NotaInstrumentConversion:
             type = typeof(NotaInstrumentConversion);
             break;
         default:
             type = typeof(Nota);
             break;
     }
     return type;
 }
Ejemplo n.º 4
0
        public static List<INota> GetUnprintedNotasByAccount(IDalSession session, int accountId, NotaReturnClass returnClass)
        {
            Hashtable parameters = new Hashtable();
            parameters.Add("AccountId", accountId);
            string underlyingAccObj = "";
            string underlyingDateObj = "";
            switch (returnClass)
            {
                case NotaReturnClass.NotaTransaction:
                case NotaReturnClass.NotaTransfer:
                case NotaReturnClass.NotaInstrumentConversion:
                    underlyingAccObj = "UnderlyingTx.AccountA";
                    underlyingDateObj = "UnderlyingTx.TransactionDate";
                    break;
                default:
                    underlyingAccObj = "UnderlyingBooking.Account";
                    underlyingDateObj = "UnderlyingBooking.GeneralOpsJournalEntry.TransactionDate";
                    break;
            }

            return NHSession.ToList<INota>(session.GetListByHQL(
                string.Format(@"FROM {0} N WHERE N.{1}.Key = :AccountId AND N.PrintCount = 0
                                ORDER BY N.{2}, N.NotaNumber",
                            getType(returnClass).Name,
                            underlyingAccObj,
                            underlyingDateObj),
                            parameters));
        }
Ejemplo n.º 5
0
 //        public static IList GetNotas(IDalSession session, NotaReturnClass returnClass,
 //                                     IAccountTypeInternal account, DateTime startDate, DateTime endDate)
 //        {
 //            Hashtable parameters = new Hashtable();
 //            parameters.Add("Account", account);
 //            parameters.Add("StartDate", startDate);
 //            parameters.Add("EndDate", endDate);
 //            return session.GetListByHQL(string.Format(@"FROM {0} N WHERE N.UnderlyingTx.AccountA = :Account
 //                                                                     AND N.UnderlyingTx.TransactionDate >= :StartDate
 //                                                                     AND N.UnderlyingTx.TransactionDate <= :EndDate
 //                                                        ORDER BY N.UnderlyingTx.TransactionDate, N.NotaNumber",
 //                                                      getType(returnClass).Name),
 //                                        parameters);
 //        }
 public static IList GetNotas(IDalSession session, NotaReturnClass returnClass)
 {
     List<ICriterion> expressions = new List<ICriterion>();
     return session.GetList(getType(returnClass), expressions);
 }
Ejemplo n.º 6
0
 public static void PrintNotas(BatchExecutionResults results, int managementCompanyId, NotaReturnClass notaType)
 {
     NotaPrintCommand.PrintNotas(results, notaType, managementCompanyId);
 }
Ejemplo n.º 7
0
        public static void PrintNotas(BatchExecutionResults results, int managementCompanyId)
        {
            NotaReturnClass[] notaTypes = new NotaReturnClass[] {
                NotaReturnClass.NotaTransaction,
                NotaReturnClass.NotaDeposit,
                NotaReturnClass.NotaFees,
                NotaReturnClass.NotaDividend,
                NotaReturnClass.NotaTransfer,
                NotaReturnClass.NotaInstrumentConversion
            };

            foreach (NotaReturnClass notaType in notaTypes)
                NotaPrintCommand.PrintNotas(results, notaType, managementCompanyId);
        }
Ejemplo n.º 8
0
 public static NotaPrintCommand CreateNew(NotaReturnClass notaType)
 {
     switch (notaType)
     {
         case NotaReturnClass.NotaTransaction:
             return new NotaTransactionPrintCommand();
         case NotaReturnClass.NotaDeposit:
             return new NotaDepositPrintCommand();
         case NotaReturnClass.NotaDividend:
             return new NotaDividendPrintCommand();
         case NotaReturnClass.NotaTransfer:
             return new NotaTransferPrintCommand();
         case NotaReturnClass.NotaFees:
             return new NotaFeesPrintCommand();
         case NotaReturnClass.NotaInstrumentConversion:
             return new NotaCorporateActionPrintCommand();
         default:
             throw new ApplicationException(string.Format("NotaPrintCommand of type {0} cannot be created.", notaType));
     }
 }
Ejemplo n.º 9
0
 // Used for dumping data into an XML file, for testing with the Report Designer
 public static DataSet BuildTestDataSet(IDalSession session, int accountId, NotaReturnClass notaType)
 {
     return NotaPrintCommand.CreateNew(notaType).buildTestDataSet(session, accountId);
 }