Exemplo n.º 1
0
        public IList<Core.Business.PURPOSE> GetAllPURPOSE()
        {
            IList<Core.Business.PURPOSE> pURPOSElist = new List<Core.Business.PURPOSE>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPURPOSEsAll");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PURPOSE pURPOSE = new Core.Business.PURPOSE();

                    if (!reader.IsDBNull(0)) pURPOSE.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) pURPOSE.InstruId = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) pURPOSE.PURPOSEID = reader.GetGuid(2);

                    pURPOSE.MarkOld();
                    pURPOSElist.Add(pURPOSE);
                }
                reader.Close();
            }
            return pURPOSElist;
        }
Exemplo n.º 2
0
        public IList<CY.CSTS.Core.Business.PURPOSE> GetPurposeDynamic(string whereCondition, string orderByExpression)
        {
            if (string.IsNullOrEmpty(whereCondition))
            {
                return this.GetAllPURPOSE();
            }

            IList<Core.Business.PURPOSE> pURPOSElist = new List<Core.Business.PURPOSE>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition);
            sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPURPOSEsDynamic");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.PURPOSE pURPOSE = new Core.Business.PURPOSE();

                    if (!reader.IsDBNull(0)) pURPOSE.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) pURPOSE.InstruId = reader.GetGuid(1);
                    if (!reader.IsDBNull(2)) pURPOSE.PURPOSEID = reader.GetGuid(2);

                    pURPOSE.MarkOld();
                    pURPOSElist.Add(pURPOSE);
                }
                reader.Close();
            }
            return pURPOSElist;
        }
Exemplo n.º 3
0
        public Core.Business.PURPOSE Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectPURPOSE");

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.PURPOSE pURPOSE = new Core.Business.PURPOSE();

                if (!reader.IsDBNull(0)) pURPOSE.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) pURPOSE.InstruId = reader.GetGuid(1);
                if (!reader.IsDBNull(2)) pURPOSE.PURPOSEID = reader.GetGuid(2);

                reader.Close();
                return pURPOSE;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }