/// <summary>
        /// Lay danh sach ung dung
        /// </summary>
        /// <returns></returns>
        public ApplicationCollection GetAllApplications()
        {
            try
            {
                ApplicationCollection appCollection = new ApplicationCollection();

                appCollection.Clear();

                using (IDataReader dr = Database.ExecuteReader("UspGetAllApplications", CommandType.StoredProcedure))
                {
                    while (dr.Read())
                    {
                        Application app = Populate(dr);

                        appCollection.Add(app);
                    }
                }

                return(appCollection);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="strUserName"></param>
        /// <returns></returns>
        public ApplicationCollection GetApplicationByUser(string strUserName)
        {
            try
            {
                ApplicationCollection appCollection = new ApplicationCollection();
                appCollection.Clear();

                // create sql parameters
                SqlParameter prmUsername = new SqlParameter("@Username", SqlDbType.VarChar, 128);
                prmUsername.Direction = ParameterDirection.Input;
                prmUsername.Value     = strUserName;

                using (IDataReader dr = Database.ExecuteReader("UspGetApplicationByUser", CommandType.StoredProcedure, prmUsername))
                {
                    while (dr.Read())
                    {
                        Application app = Populate(dr);

                        appCollection.Add(app);
                    }
                }

                return(appCollection);
            }
            catch (Exception ex)
            { throw ex; }
        }
Пример #3
0
        /*
         *
         * Collection fill callbacks and event handlers.
         *
         */
        public void FillApplicationCollection(ApplicationOrganizationItem[] applicationArray)
        {
            ApplicationCollection.Clear();
            foreach (ApplicationOrganizationItem item in applicationArray)
            {
                ApplicationCollection.Add(new ApplicationOrganizationVMItem(item));
            }

            SelectedApplication = ApplicationCollection.Count() > 0 ? ApplicationCollection[0] : null;
        }