Example #1
0
        public IList<Core.Business.Lab> GetAllLab()
        {
            IList<Core.Business.Lab> lablist = new List<Core.Business.Lab>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Lab lab = new Core.Business.Lab();

                    if (!reader.IsDBNull(0)) lab.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) lab.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) lab.UnitID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) lab.OtherName1 = reader.GetString(3);
                    if (!reader.IsDBNull(4)) lab.OtherName2 = reader.GetString(4);
                    if (!reader.IsDBNull(5)) lab.Address = reader.GetString(5);
                    if (!reader.IsDBNull(6)) lab.Postalcode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) lab.Tel = reader.GetString(7);
                    if (!reader.IsDBNull(8)) lab.Fax = reader.GetString(8);
                    if (!reader.IsDBNull(9)) lab.Website = reader.GetString(9);
                    if (!reader.IsDBNull(10)) lab.Email = reader.GetString(10);
                    if (!reader.IsDBNull(11)) lab.LabSortID = reader.GetGuid(11);
                    if (!reader.IsDBNull(12)) lab.LabPrincipal = reader.GetString(12);
                    if (!reader.IsDBNull(13)) lab.LinkMan = reader.GetString(13);
                    if (!reader.IsDBNull(14)) lab.IsRecognize = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) lab.RecognizeNumber = reader.GetString(15);
                    if (!reader.IsDBNull(16)) lab.OrganizationCode = reader.GetString(16);
                    if (!reader.IsDBNull(17)) lab.LabLevelID = reader.GetGuid(17);
                    if (!reader.IsDBNull(18)) lab.Synopsis = reader.GetString(18);
                    if (!reader.IsDBNull(19)) lab.Remark = reader.GetString(19);

                    lab.MarkOld();
                    lablist.Add(lab);
                }
                reader.Close();
            }
            return lablist;
        }
Example #2
0
        public IList<Lab> SelectLabsDynamic(string whereCondition, string orderByExpression)
        {
            if (string.IsNullOrEmpty(whereCondition))
            {
                return this.GetAllLab();
            }

            IList<Core.Business.Lab> lablist = new List<Core.Business.Lab>();
            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereCondition);
            sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderByExpression);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Lab lab = new Core.Business.Lab();

                    if (!reader.IsDBNull(0)) lab.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) lab.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) lab.UnitID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) lab.OtherName1 = reader.GetString(3);
                    if (!reader.IsDBNull(4)) lab.OtherName2 = reader.GetString(4);
                    if (!reader.IsDBNull(5)) lab.Address = reader.GetString(5);
                    if (!reader.IsDBNull(6)) lab.Postalcode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) lab.Tel = reader.GetString(7);
                    if (!reader.IsDBNull(8)) lab.Fax = reader.GetString(8);
                    if (!reader.IsDBNull(9)) lab.Website = reader.GetString(9);
                    if (!reader.IsDBNull(10)) lab.Email = reader.GetString(10);
                    if (!reader.IsDBNull(11)) lab.LabSortID = reader.GetGuid(11);
                    if (!reader.IsDBNull(12)) lab.LabPrincipal = reader.GetString(12);
                    if (!reader.IsDBNull(13)) lab.LinkMan = reader.GetString(13);
                    if (!reader.IsDBNull(14)) lab.IsRecognize = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) lab.RecognizeNumber = reader.GetString(15);
                    if (!reader.IsDBNull(16)) lab.OrganizationCode = reader.GetString(16);
                    if (!reader.IsDBNull(17)) lab.LabLevelID = reader.GetGuid(17);
                    if (!reader.IsDBNull(18)) lab.Synopsis = reader.GetString(18);
                    if (!reader.IsDBNull(19)) lab.Remark = reader.GetString(19);

                    lab.MarkOld();
                    lablist.Add(lab);
                }
                reader.Close();
            }
            return lablist;
        }
Example #3
0
        public IList<Lab> SelectLabsByAndUnitID(string sqlwhere, int pagenumber, int pagesize)
        {
            IList<Core.Business.Lab> lablist = new List<Core.Business.Lab>();

            SqlServerUtility sql = new SqlServerUtility();
            sql.AddParameter("@Tables", SqlDbType.VarChar, "Lab");
            sql.AddParameter("@PK", SqlDbType.VarChar, "Id");
            sql.AddParameter("@PageNumber", SqlDbType.Int, pagenumber);
            sql.AddParameter("@PageSize", SqlDbType.Int, pagesize);
            //sql.AddParameter("@LawSortID", SqlDbType.UniqueIdentifier, sortId);
            sql.AddParameter("@Filter", SqlDbType.VarChar, sqlwhere);
            SqlDataReader reader = sql.ExecuteSPReader("Paging_RowCount");

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Lab lab = new Core.Business.Lab();

                    if (!reader.IsDBNull(0)) lab.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) lab.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) lab.UnitID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) lab.OtherName1 = reader.GetString(3);
                    if (!reader.IsDBNull(4)) lab.OtherName2 = reader.GetString(4);
                    if (!reader.IsDBNull(5)) lab.Address = reader.GetString(5);
                    if (!reader.IsDBNull(6)) lab.Postalcode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) lab.Tel = reader.GetString(7);
                    if (!reader.IsDBNull(8)) lab.Fax = reader.GetString(8);
                    if (!reader.IsDBNull(9)) lab.Website = reader.GetString(9);
                    if (!reader.IsDBNull(10)) lab.Email = reader.GetString(10);
                    if (!reader.IsDBNull(11)) lab.LabSortID = reader.GetGuid(11);
                    if (!reader.IsDBNull(12)) lab.LabPrincipal = reader.GetString(12);
                    if (!reader.IsDBNull(13)) lab.LinkMan = reader.GetString(13);
                    if (!reader.IsDBNull(14)) lab.IsRecognize = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) lab.RecognizeNumber = reader.GetString(15);
                    if (!reader.IsDBNull(16)) lab.OrganizationCode = reader.GetString(16);
                    if (!reader.IsDBNull(17)) lab.LabLevelID = reader.GetGuid(17);
                    if (!reader.IsDBNull(18)) lab.Synopsis = reader.GetString(18);
                    if (!reader.IsDBNull(19)) lab.Remark = reader.GetString(19);

                    lab.MarkOld();
                    lablist.Add(lab);
                }
                reader.Close();
            }
            return lablist;
        }
Example #4
0
        public Lab SelectLabsByAndName(string name)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Name", SqlDbType.VarChar, name);
            SqlDataReader reader = sql.ExecuteSPReader("usp_SelectLabsByAndName");

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

                if (!reader.IsDBNull(0)) lab.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) lab.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) lab.UnitID = reader.GetGuid(2);
                if (!reader.IsDBNull(3)) lab.OtherName1 = reader.GetString(3);
                if (!reader.IsDBNull(4)) lab.OtherName2 = reader.GetString(4);
                if (!reader.IsDBNull(5)) lab.Address = reader.GetString(5);
                if (!reader.IsDBNull(6)) lab.Postalcode = reader.GetString(6);
                if (!reader.IsDBNull(7)) lab.Tel = reader.GetString(7);
                if (!reader.IsDBNull(8)) lab.Fax = reader.GetString(8);
                if (!reader.IsDBNull(9)) lab.Website = reader.GetString(9);
                if (!reader.IsDBNull(10)) lab.Email = reader.GetString(10);
                if (!reader.IsDBNull(11)) lab.LabSortID = reader.GetGuid(11);
                if (!reader.IsDBNull(12)) lab.LabPrincipal = reader.GetString(12);
                if (!reader.IsDBNull(13)) lab.LinkMan = reader.GetString(13);
                if (!reader.IsDBNull(14)) lab.IsRecognize = reader.GetInt32(14);
                if (!reader.IsDBNull(15)) lab.RecognizeNumber = reader.GetString(15);
                if (!reader.IsDBNull(16)) lab.OrganizationCode = reader.GetString(16);
                if (!reader.IsDBNull(17)) lab.LabLevelID = reader.GetGuid(17);
                if (!reader.IsDBNull(18)) lab.Synopsis = reader.GetString(18);
                if (!reader.IsDBNull(19)) lab.Remark = reader.GetString(19);

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

                return null;
            }
        }
Example #5
0
        public IList<Lab> SearchLab(string sqlwhere)
        {
            IList<Core.Business.Lab> lablist = new List<Core.Business.Lab>();
            SqlServerUtility db = new SqlServerUtility();
            string sql = "SELECT [Id],[Name],[UnitID],[OtherName1],[OtherName2],[Address],[Postalcode],[Tel],[Fax],[Website],[Email],[LabSortID],[LabPrincipal],[LinkMan],[IsRecognize],[RecognizeNumber],[OrganizationCode],[LabLevelID],[Synopsis],[Remark] FROM [dbo].[Lab] ";
            sql += sqlwhere;
            SqlDataReader reader = db.ExecuteSqlReader(sql);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Lab lab = new Core.Business.Lab();

                    if (!reader.IsDBNull(0)) lab.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) lab.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) lab.UnitID = reader.GetGuid(2);
                    if (!reader.IsDBNull(3)) lab.OtherName1 = reader.GetString(3);
                    if (!reader.IsDBNull(4)) lab.OtherName2 = reader.GetString(4);
                    if (!reader.IsDBNull(5)) lab.Address = reader.GetString(5);
                    if (!reader.IsDBNull(6)) lab.Postalcode = reader.GetString(6);
                    if (!reader.IsDBNull(7)) lab.Tel = reader.GetString(7);
                    if (!reader.IsDBNull(8)) lab.Fax = reader.GetString(8);
                    if (!reader.IsDBNull(9)) lab.Website = reader.GetString(9);
                    if (!reader.IsDBNull(10)) lab.Email = reader.GetString(10);
                    if (!reader.IsDBNull(11)) lab.LabSortID = reader.GetGuid(11);
                    if (!reader.IsDBNull(12)) lab.LabPrincipal = reader.GetString(12);
                    if (!reader.IsDBNull(13)) lab.LinkMan = reader.GetString(13);
                    if (!reader.IsDBNull(14)) lab.IsRecognize = reader.GetInt32(14);
                    if (!reader.IsDBNull(15)) lab.RecognizeNumber = reader.GetString(15);
                    if (!reader.IsDBNull(16)) lab.OrganizationCode = reader.GetString(16);
                    if (!reader.IsDBNull(17)) lab.LabLevelID = reader.GetGuid(17);
                    if (!reader.IsDBNull(18)) lab.Synopsis = reader.GetString(18);
                    if (!reader.IsDBNull(19)) lab.Remark = reader.GetString(19);

                    lab.MarkOld();
                    lablist.Add(lab);
                }
                reader.Close();
            }
            return lablist;
        }