Exemple #1
0
        public DescTypeInfo FindBOMDescrById(int id)
        {
            try
            {
                DescTypeInfo ret = null;

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

                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_GetData, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params))
                {
                    ret = FuncNew.SetFieldFromColumn<DescType, DescTypeInfo>(ret, sqlR, sqlCtx);
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #2
0
        public IList<string> GetDescriptionOfDescTypeListByTpAndCode(string tp, string code)
        {
            try
            {
                IList<string> ret = null;

                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        DescType cond = new DescType();
                        cond.tp = tp;
                        cond.code = code;
                        sqlCtx = FuncNew.GetConditionedSelect<DescType>(tk, "DISTINCT", new string[] { DescType.fn_description }, new ConditionCollection<DescType>(new EqualCondition<DescType>(cond)), DescType.fn_description);
                    }
                }
                sqlCtx.Param(DescType.fn_tp).Value = tp;
                sqlCtx.Param(DescType.fn_code).Value = code;

                using (SqlDataReader sqlR = _Schema.SqlHelper.ExecuteReader(_Schema.SqlHelper.ConnectionString_GetData, CommandType.Text, sqlCtx.Sentence, sqlCtx.Params))
                {
                    if (sqlR != null)
                    {
                        ret = new List<string>();

                        while (sqlR.Read())
                        {
                            string item = g.GetValue_Str(sqlR, sqlCtx.Indexes(DescType.fn_description));
                            ret.Add(item);
                        }
                    }
                }
                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        public void DeleteBOMDescrById(int id)
        {
            try
            {
                MethodBase mthObj = MethodBase.GetCurrentMethod();
                int tk = mthObj.MetadataToken;
                SQLContextNew sqlCtx = null;
                lock (mthObj)
                {
                    if (!SQLCache.PeerTheSQL(tk, out sqlCtx))
                    {
                        DescType cond = new DescType();
                        cond.id = id;
                        sqlCtx = FuncNew.GetConditionedDelete<DescType>(tk, new ConditionCollection<DescType>(new EqualCondition<DescType>(cond)));
                    }
                }
                sqlCtx.Param(DescType.fn_id).Value = id;

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