Exemplo n.º 1
0
        public static List <VOPassword> List(imSabayaContext context, int userId)
        {
            List <VOPassword> list = new List <VOPassword>();

            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                if (objConn.State == ConnectionState.Closed)
                {
                    objConn.Open();
                }
                IDbCommand objComm = objConn.CreateCommand();
                objComm.CommandText = @"select passwordId, EncryptedPassword, userId, effectiveFrom, effectiveTo from Password where userId = " + userId;
                IDataReader reader = objComm.ExecuteReader();

                while (reader.Read())                //all row
                {
                    VOPassword vo = new VOPassword();
                    vo.PasswordId    = (int)reader["passwordId"];
                    vo.Password      = (String)reader["EncryptedPassword"];
                    vo.UserId        = (int)reader["userId"];
                    vo.EffectiveFrom = (DateTime)reader["effectiveFrom"];
                    vo.EffectiveTo   = (DateTime)reader["effectiveTo"];
                    list.Add(vo);
                }
                reader.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(list);
        }
Exemplo n.º 2
0
        public void Save(imSabayaContext context)
        {
            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                if (objConn.State == ConnectionState.Closed)
                {
                    objConn.Open();
                }
                IDbCommand objComm = objConn.CreateCommand();
                objComm.CommandText = @"INSERT INTO [imSabaya].[dbo].[Password]
                                           ([password]
                                           ,[UserID]
                                           ,[EffectiveFrom]
                                           ,[EffectiveTo])
                                     VALUES(";

                objComm.CommandText += "'" + this.Password + "',";
                objComm.CommandText += this.UserId + ",";
                objComm.CommandText += "'" + this.EffectiveFrom.ToString("yyyy-MM-dd HH:mm:ss") + "',";
                objComm.CommandText += "'" + this.EffectiveTo.ToString("yyyy-MM-dd HH:mm:ss") + "')";

                int rowUpdated = objComm.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
        public void Update(imSabayaContext context)
        {
            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                if (objConn.State == ConnectionState.Closed)
                {
                    objConn.Open();
                }
                IDbCommand objComm = objConn.CreateCommand();
                objComm.CommandText = @"     UPDATE    Password
                                                    SET              password = @password, EffectiveFrom = @EffectiveFrom, EffectiveTo = @EffectiveTo
                                                    WHERE     (passwordId = @passwordId)";

                SqlParameterCollection Parms = (SqlParameterCollection)objComm.Parameters;
                Parms.AddWithValue("@passwordId", this.PasswordId);
                Parms.AddWithValue("@password", this.Password);
                Parms.AddWithValue("@EffectiveFrom", this.EffectiveFrom);
                Parms.AddWithValue("@EffectiveTo", this.EffectiveTo);
                int rowUpdated = objComm.ExecuteNonQuery();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get List VOWSRole By RoleId
        /// </summary>
        /// <param name="connectionString"></param>
        /// <param name="xRoleId"></param>
        /// <returns></returns>
        public static VOWSRole Get(imSabayaContext context, int roleId)
        {
            Role role = Role.Find(context, roleId);

            if (role == null)
            {
                return(null);
            }
            return(new VOWSRole(role));
        }
 public NodePopupControlLite(imSabayaContext context, String rootCode, String nodeCode)
 {
     if (String.IsNullOrEmpty(rootCode))
     {
         this.RootNode = iSabaya.TreeListNode.FindRootByCode(context, nodeCode);
     }
     else
     {
         this.RootNode = iSabaya.TreeListNode.FindByCode(context, rootCode, null, nodeCode);
     }
 }
Exemplo n.º 6
0
        public static IList <VOWSRole> List(imSabayaContext context)
        {
            IList <VOWSRole> RoleList = new List <VOWSRole>();

            foreach (Role r in Role.List(context))
            {
                VOWSRole objRole = new VOWSRole(r);
                RoleList.Add(objRole);
            }
            return(RoleList);
        }
Exemplo n.º 7
0
        public static List <VORoleMenu> List(imSabayaContext context)
        {
            List <VORoleMenu> list = new List <VORoleMenu>();

            foreach (RoleMenu rm in RoleMenu.List(context))
            {
                VORoleMenu objRoleMenu = new VORoleMenu(rm);
                list.Add(objRoleMenu);
            }
            return(list);
        }
Exemplo n.º 8
0
        public static IList <VOVestingItem> findItem(imSabayaContext context, int groupID)
        {
            VestingGroup          group = context.PersistencySession.Get <VestingGroup>(groupID);
            IList <VOVestingItem> vos   = new List <VOVestingItem>();

            foreach (VestingItem item in group.Items)
            {
                vos.Add(new VOVestingItem(context, item));
            }
            ArrayList.Adapter((IList)vos).Sort();
            return(vos);
        }
Exemplo n.º 9
0
        public static IList <VOVestingGroup> findGroup(imSabayaContext context, int planID)
        {
            VestingPlan            plan = context.PersistencySession.Get <VestingPlan>(planID);
            IList <VOVestingGroup> vos  = new List <VOVestingGroup>();

            foreach (VestingGroup item in plan.Groups)
            {
                vos.Add(new VOVestingGroup(context, item));
            }
            ArrayList.Adapter((IList)vos).Sort();
            return(vos);
        }
Exemplo n.º 10
0
        public static IList <VORoleMenu> List(imSabayaContext context, int roleId)
        {
            //return value
            List <VORoleMenu> list = new List <VORoleMenu>();

            foreach (RoleMenu rm in RoleMenu.List(context, roleId))
            {
                VORoleMenu objRoleMenu = new VORoleMenu(rm);
                list.Add(objRoleMenu);
            }
            return(list);
        }
Exemplo n.º 11
0
        public static List <VORoleMenu> ListByParentId(imSabayaContext context, int menuParentId)
        {
            List <VORoleMenu> list = new List <VORoleMenu>();

            foreach (RoleMenu rm in RoleMenu.List(context))
            {
                if (rm.Menu.Parent.Id != menuParentId)
                {
                    continue;
                }
                VORoleMenu objRoleMenu = new VORoleMenu(rm);
                list.Add(objRoleMenu);
            }
            return(list);

            //            try
            //            {
            //                using (SqlConnection objConn = new SqlConnection(xConnectionString))
            //                {
            //                    //Open DataBase
            //                    objConn.Open();

            //                    //¶èÒ·ʹ Command Class ÁÒ¨Ò¡ Connection ·Õèà»Ô´äÇé
            //                    SqlCommand objComm = objConn.CreateCommand();
            //                    objComm.CommandText = @"    select MenuId, Code, ParentId, LinkURL, PageCode
            //                                                from menu
            //                                                where ParentId = @ParentId
            //                                                and MenuId not in (select menuid from view_rolemenu where parentid = @ParentId)";
            //                    objComm.Parameters.Add("@ParentId", SqlDbType.Int).Value = xParentId;
            //                    SqlDataReader objReader = objComm.ExecuteReader();

            //                    while (objReader.Read())
            //                    {
            //            VORoleMenu objRoleMenu = new VORoleMenu();

            //            objRoleMenu.MenuId = (int)objReader["MenuId"];
            //            objRoleMenu.Code = (string)objReader["Code"];
            //            objRoleMenu.ParentId = objReader["ParentId"] == DBNull.Value ? 0 : (int)objReader["ParentId"];
            //            objRoleMenu.LinkURL = (string)objReader["LinkURL"];
            //            objRoleMenu.PageCode = objReader["PageCode"] == DBNull.Value ? "" : (string)objReader["PageCode"];
            //            list.Add(objRoleMenu);
            //        }
            //    }
            //}
            //catch (Exception)
            //{

            //}
            //return list;
        }
Exemplo n.º 12
0
        public static IList <VOTransactionSelect_GridPayment> FindPayments(imSabayaContext context, Int64 transactionId)
        {
            ICriteria     crit        = context.PersistencySession.CreateCriteria(typeof(imSabaya.TransactionPayment));
            MFTransaction transaction = MFTransaction.Find(context, transactionId);

            crit.Add(Expression.Eq("Transaction", (FundTransaction)transaction));
            IList <imSabaya.TransactionPayment>     tpayments = crit.List <imSabaya.TransactionPayment>();
            IList <VOTransactionSelect_GridPayment> vos       = new List <VOTransactionSelect_GridPayment>();

            foreach (imSabaya.TransactionPayment tp in tpayments)
            {
                vos.Add(new VOTransactionSelect_GridPayment(context, tp.Payment, tp.Amount));
            }

            return(vos);
        }
        /*ใช้ในหน้าสรุปซื้อขาย เรียกจาก 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);
        }
Exemplo n.º 14
0
        public int Insert(imSabayaContext context)
        {
            int affected = 0;

            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                objConn.Open();
                IDbCommand objComm = objConn.CreateCommand();
                objComm.CommandText = String.Format(@"INSERT INTO [imSabaya].[dbo].[RoleMenu]([RoleId],[MenuId])VALUES({0},{1})",
                                                    this.RoleId, this.MenuId);
                affected = objComm.ExecuteNonQuery();
            }
            catch (Exception)
            {
                affected = 0;   //not remove
            }
            return(affected);   //success remove
        }
Exemplo n.º 15
0
        public static List <VOUserRole> List(imSabayaContext context, int userId)
        {
            List <VOUserRole> list = new List <VOUserRole>();

            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                if (objConn.State == ConnectionState.Closed)
                {
                    objConn.Open();
                }
                IDbCommand command = objConn.CreateCommand();
                command.CommandText = @"select * 
										from UserRole
										inner join role on UserRole.roleid = role.roleid
										where userId = "                                         + userId.ToString();

                IDataReader reader = command.ExecuteReader();

                while (reader.Read())
                {
                    VOUserRole objVORolePeriod = new VOUserRole();

                    objVORolePeriod.UserID        = (int)reader["UserID"];
                    objVORolePeriod.RoleId        = (int)reader["RoleId"];
                    objVORolePeriod.EffectiveFrom = (DateTime)reader["EffectiveFrom"];
                    objVORolePeriod.EffectiveTo   = (DateTime)reader["EffectiveTo"];
                    objVORolePeriod.Code          = (string)reader["Code"];
                    objVORolePeriod.Description   = (string)reader["Description"];
                    list.Add(objVORolePeriod);
                }
                reader.Close();
            }
            catch (Exception)
            {
            }
            return(list);
        }
Exemplo n.º 16
0
        public int Remove(imSabayaContext context)
        {
            if (this.isDeleted)
            {
                return(0);
            }
            int affected = 0;

            try
            {
                IDbConnection objConn = context.PersistencySession.Connection;
                objConn.Open();
                IDbCommand objComm = objConn.CreateCommand();
                objComm.CommandText = String.Format(@"DELETE FROM RoleMenu WHERE RoleId = {0} AND MenuId = {1}",
                                                    this.RoleId, this.MenuId);
                affected       = objComm.ExecuteNonQuery();
                this.isDeleted = true;
            }
            catch (Exception)
            {
                affected = 0;   //not remove
            }
            return(affected);   //success remove
        }
Exemplo n.º 17
0
 public VOIPControl(imSabayaContext context, InvestmentPlanner instance)
 {
     this.instance = instance;
     this.context  = context;
 }
Exemplo n.º 18
0
 public VOCalMMFees(imSabayaContext context, PFTransaction instance)
 {
     this.instance = instance;
     this.context  = context;
 }
Exemplo n.º 19
0
 public VOChangeMoney(imSabayaContext context, FundTransaction instance)
 {
     this.instance = instance;
     this.context  = context;
     this.pfTran   = PFTransaction.FindByTransactionNo(this.context, this.instance.TransactionNo);
 }
Exemplo n.º 20
0
 public PaymentTemplate(imSabayaContext context)
 {
     this.context = context;
 }
Exemplo n.º 21
0
 public VOEmployer(imSabayaContext context, Employer instance)
 {
     this.instance = instance;
     this.context  = context;
     this.langCode = context.CurrentLanguage.Code;//default
 }
Exemplo n.º 22
0
 public VOFundBankAccount(imSabayaContext context, PartyBankAccount instance)
 {
     this.instance = instance;
     this.context  = context;
 }
Exemplo n.º 23
0
 public VOVestingItem(imSabayaContext context, VestingItem instance)
 {
     this.context  = context;
     this.instance = instance;
 }
 public VOTransactionSelect_GridTransaction(imSabayaContext context, MFTransaction mftransaction)
 {
     this.mftransaction = mftransaction;
     this.context       = context;
 }
 public VOTransactionSelect_GridMain(imSabayaContext context)
 {
     this.context = context;
 }
Exemplo n.º 26
0
 public VOPricePerUnit(imSabayaContext context, NAV instance)
 {
     this.instance = instance;
     this.context  = context;
 }
Exemplo n.º 27
0
 public VOVestingPlan(imSabayaContext context)
 {
     this.context = context;
 }
Exemplo n.º 28
0
 public VOTransactionSelect_GridPayment(imSabayaContext context, Payment payment, Money transactionPaymentAmount)
 {
     this.payment = payment;
     this.transactionPaymentAmount = transactionPaymentAmount;
     this.context = context;
 }
Exemplo n.º 29
0
 public VONAV(imSabayaContext context, NAV instance)
 {
     this.instance = instance;
     this.context  = context;
 }
Exemplo n.º 30
0
 public VOVestingGroup(imSabayaContext context, VestingGroup instance)
 {
     this.context  = context;
     this.instance = instance;
 }