public IList<Core.Business.StimulationCheck> GetAllStimulationCheck()
        {
            IList<Core.Business.StimulationCheck> stimulationChecklist = new List<Core.Business.StimulationCheck>();
            SqlServerUtility sql = new SqlServerUtility();

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StimulationCheck stimulationCheck = new Core.Business.StimulationCheck();

                    if (!reader.IsDBNull(0)) stimulationCheck.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) stimulationCheck.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) stimulationCheck.State = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) stimulationCheck.AddData = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) stimulationCheck.Content = reader.GetString(4);
                    if (!reader.IsDBNull(5)) stimulationCheck.StartDate = reader.GetDateTime(5);
                    if (!reader.IsDBNull(6)) stimulationCheck.EndDate = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) stimulationCheck.Starter = reader.GetString(7);
                    if (!reader.IsDBNull(8)) stimulationCheck.Ender = reader.GetString(8);
                    if (!reader.IsDBNull(9)) stimulationCheck.AddPerson = reader.GetString(9);

                    stimulationCheck.MarkOld();
                    stimulationChecklist.Add(stimulationCheck);
                }
                reader.Close();
            }
            return stimulationChecklist;
        }
        public List<StimulationCheck> SelectStimulationChecksDynamic(string whereConditon, string orderExperssion)
        {
            List<Core.Business.StimulationCheck> stimulationChecklist = new List<Core.Business.StimulationCheck>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@WhereCondition", SqlDbType.NVarChar, whereConditon);

            sql.AddParameter("@OrderByExpression", SqlDbType.NVarChar, orderExperssion);

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

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.StimulationCheck stimulationCheck = new Core.Business.StimulationCheck();

                    if (!reader.IsDBNull(0)) stimulationCheck.Id = reader.GetGuid(0);
                    if (!reader.IsDBNull(1)) stimulationCheck.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) stimulationCheck.State = reader.GetInt32(2);
                    if (!reader.IsDBNull(3)) stimulationCheck.AddData = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) stimulationCheck.Content = reader.GetString(4);
                    if (!reader.IsDBNull(5)) stimulationCheck.StartDate = reader.GetDateTime(5);
                    if (!reader.IsDBNull(6)) stimulationCheck.EndDate = reader.GetDateTime(6);
                    if (!reader.IsDBNull(7)) stimulationCheck.Starter = reader.GetString(7);
                    if (!reader.IsDBNull(8)) stimulationCheck.Ender = reader.GetString(8);
                    if (!reader.IsDBNull(9)) stimulationCheck.AddPerson = reader.GetString(9);

                    stimulationCheck.MarkOld();
                    stimulationChecklist.Add(stimulationCheck);
                }
                reader.Close();
            }
            return stimulationChecklist;
        }
        public Core.Business.StimulationCheck Select(Guid id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) stimulationCheck.Id = reader.GetGuid(0);
                if (!reader.IsDBNull(1)) stimulationCheck.Name = reader.GetString(1);
                if (!reader.IsDBNull(2)) stimulationCheck.State = reader.GetInt32(2);
                if (!reader.IsDBNull(3)) stimulationCheck.AddData = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) stimulationCheck.Content = reader.GetString(4);
                if (!reader.IsDBNull(5)) stimulationCheck.StartDate = reader.GetDateTime(5);
                if (!reader.IsDBNull(6)) stimulationCheck.EndDate = reader.GetDateTime(6);
                if (!reader.IsDBNull(7)) stimulationCheck.Starter = reader.GetString(7);
                if (!reader.IsDBNull(8)) stimulationCheck.Ender = reader.GetString(8);
                if (!reader.IsDBNull(9)) stimulationCheck.AddPerson = reader.GetString(9);

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

                return null;
            }
        }
        public List<StimulationCheck> GetPhasesByJsonNPagingInfo(DateTime? startdate, DateTime? enddate, string starter, string ender, int state, string adder, string name, DateTime? adddate, int pagenum, int pagesize)
        {
            List<Core.Business.StimulationCheck> stimulationChecklist = new List<Core.Business.StimulationCheck>();
            try
            {

                System.Text.StringBuilder sbFilter = new StringBuilder();

                sbFilter.Append("1=1");

                if (startdate.HasValue)
                {
                    sbFilter.Append(" and StartDate >='");
                    sbFilter.Append(startdate);
                    sbFilter.Append("'");
                }

                if (enddate.HasValue)
                {
                    sbFilter.Append(" and EndDate >=");
                    sbFilter.Append(enddate);
                    sbFilter.Append("'");
                }

                if (!string.IsNullOrEmpty(starter))
                {
                    sbFilter.Append(" and Starter like '%");
                    sbFilter.Append(starter.Replace("'", "").Replace("\"", ""));
                    sbFilter.Append("%'");
                }

                if (!string.IsNullOrEmpty(ender))
                {
                    sbFilter.Append(" and Ender like '%");
                    sbFilter.Append(ender.Replace("'", "").Replace("\"", ""));
                    sbFilter.Append("%'");
                }

                if (state > 0)
                {
                    sbFilter.Append(" and State =");
                    sbFilter.Append(state);
                }

                if (!string.IsNullOrEmpty(adder))
                {
                    sbFilter.Append(" and AddPerson like '%");
                    sbFilter.Append(adder.Replace("'", "").Replace("\"", ""));
                    sbFilter.Append("%'");
                }

                if (!string.IsNullOrEmpty(name))
                {
                    sbFilter.Append(" and Name like '%");
                    sbFilter.Append(name.Replace("'", "").Replace("\"", ""));
                    sbFilter.Append("'");
                }

                if (adddate.HasValue)
                {
                    sbFilter.Append(" and AddDate >='");
                    sbFilter.Append(adddate);
                }

                string table = "StimulationCheck";
                string pk = "Id";
                int PageNum = default(int);
                int PageSize = default(int);
                if (pagenum > 0)
                {
                    PageNum = pagenum;
                }
                else
                {
                    PageNum = CY.Utility.Common.CodeInterface.PageingInfo.CurrentPage;
                }

                if (pagesize > 0)
                {
                    PageSize = pagesize;
                }
                else
                {
                    PageSize = CY.Utility.Common.CodeInterface.PageingInfo.PageSize;
                }

                SqlServerUtility sql = new SqlServerUtility();

                sql.AddParameter("@Tables", SqlDbType.VarChar, table);

                sql.AddParameter("@PK", SqlDbType.VarChar, pk);

                sql.AddParameter("@PageNumber", SqlDbType.Int, PageNum);

                sql.AddParameter("@PageSize", SqlDbType.Int, PageSize);

                sql.AddParameter("@Filter", SqlDbType.VarChar, sbFilter.ToString());

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

                if (reader != null)
                {
                    while (reader.Read())
                    {
                        Core.Business.StimulationCheck stimulationCheck = new Core.Business.StimulationCheck();

                        if (!reader.IsDBNull(0)) stimulationCheck.Id = reader.GetGuid(0);
                        if (!reader.IsDBNull(1)) stimulationCheck.Name = reader.GetString(1);
                        if (!reader.IsDBNull(2)) stimulationCheck.State = reader.GetInt32(2);
                        if (!reader.IsDBNull(3)) stimulationCheck.AddData = reader.GetDateTime(3);
                        if (!reader.IsDBNull(4)) stimulationCheck.Content = reader.GetString(4);
                        if (!reader.IsDBNull(5)) stimulationCheck.StartDate = reader.GetDateTime(5);
                        if (!reader.IsDBNull(6)) stimulationCheck.EndDate = reader.GetDateTime(6);
                        if (!reader.IsDBNull(7)) stimulationCheck.Starter = reader.GetString(7);
                        if (!reader.IsDBNull(8)) stimulationCheck.Ender = reader.GetString(8);
                        if (!reader.IsDBNull(9)) stimulationCheck.AddPerson = reader.GetString(9);

                        stimulationCheck.MarkOld();
                        stimulationChecklist.Add(stimulationCheck);
                    }
                    reader.Close();
                }
                return stimulationChecklist;
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {

            }
        }