예제 #1
0
        public IList<GradeInfo> GetGradesBySeries(string family)
        {
            try
            {
                IList<GradeInfo> ret = null;

                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        Hp_Grade cond = new Hp_Grade();
                        cond.family = family;
                        sqlCtx = FuncNew.GetConditionedSelect<Hp_Grade>(tk, null, null, new ConditionCollection<Hp_Grade>(new EqualCondition<Hp_Grade>(cond)), Hp_Grade.fn_id);
                    }
                }
                sqlCtx.Param(Hp_Grade.fn_family).Value = family;

                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_PAK, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params))
                {
                    ret = FuncNew.SetFieldFromColumn<Hp_Grade, GradeInfo, GradeInfo>(ret, sqlR, sqlCtx);
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #2
0
        public void DeleteSelectedGrade(int id)
        {
            try
            {
                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        Hp_Grade cond = new Hp_Grade();
                        cond.id = id;
                        sqlCtx = FuncNew.GetConditionedDelete<Hp_Grade>(tk, new ConditionCollection<Hp_Grade>(new EqualCondition<Hp_Grade>(cond)));
                    }
                }
                sqlCtx.Param(Hp_Grade.fn_id).Value = id;

                _Schema.SqlHelper.ExecuteNonQuery(_Schema.SqlHelper.ConnectionString_PAK, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params);
            }
            catch (Exception)
            {
                throw;
            }
        }