Exemplo n.º 1
0
        public IList<Core.Business.SubsidyForEmployee> GetAllSubsidyForEmployee()
        {
            IList<Core.Business.SubsidyForEmployee> subsidyForEmployeelist = new List<Core.Business.SubsidyForEmployee>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllSubsidyForEmployee);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.SubsidyForEmployee subsidyForEmployee = new Core.Business.SubsidyForEmployee();

                    if (!reader.IsDBNull(0)) subsidyForEmployee.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) subsidyForEmployee.SubsidyCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) subsidyForEmployee.SubsidyName = reader.GetString(2);
                    if (!reader.IsDBNull(3)) subsidyForEmployee.SubsidyDescription = reader.GetString(3);
                    if (!reader.IsDBNull(4)) subsidyForEmployee.BeginDate = reader.GetDateTime(4);

                    subsidyForEmployee.MarkOld();
                    subsidyForEmployeelist.Add(subsidyForEmployee);
                }
                reader.Close();
            }
            return subsidyForEmployeelist;
        }
Exemplo n.º 2
0
        public IList<SubsidyForEmployee> IsExists(int id, string name)
        {
            IList<Core.Business.SubsidyForEmployee> subsidyForEmployeelist = new List<Core.Business.SubsidyForEmployee>();
            SqlServerUtility sql = new SqlServerUtility();
            SqlDataReader reader;
            if(id>0)
            {
                sql.AddParameter("@Id",SqlDbType.Int,id);
                sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, name);
                reader = sql.ExecuteSqlReader(SqlUpdateIsExists);
            }
            else
            {
                sql.AddParameter("@SubsidyName", SqlDbType.NVarChar, name);
                reader = sql.ExecuteSqlReader(SqlAddIsExists);
            }

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.SubsidyForEmployee subsidyForEmployee = new Core.Business.SubsidyForEmployee();

                    if (!reader.IsDBNull(0)) subsidyForEmployee.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) subsidyForEmployee.SubsidyCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) subsidyForEmployee.SubsidyName = reader.GetString(2);
                    if (!reader.IsDBNull(3)) subsidyForEmployee.SubsidyDescription = reader.GetString(3);
                    if (!reader.IsDBNull(4)) subsidyForEmployee.BeginDate = reader.GetDateTime(4);

                    subsidyForEmployee.MarkOld();
                    subsidyForEmployeelist.Add(subsidyForEmployee);
                }
                reader.Close();
            }
            return subsidyForEmployeelist;
        }
Exemplo n.º 3
0
        public Core.Business.SubsidyForEmployee Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectSubsidyForEmployee);

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

                if (!reader.IsDBNull(0)) subsidyForEmployee.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) subsidyForEmployee.SubsidyCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) subsidyForEmployee.SubsidyName = reader.GetString(2);
                if (!reader.IsDBNull(3)) subsidyForEmployee.SubsidyDescription = reader.GetString(3);
                if (!reader.IsDBNull(4)) subsidyForEmployee.BeginDate = reader.GetDateTime(4);
                reader.Close();
                return subsidyForEmployee;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }