Esempio n. 1
0
        public static Specs FindByFilter(String sFilter,Boolean isFull)
        {
            Specs result = new Specs();
            using (IDataReader dr = DataAccess.ExecuteReader(String.Format("select * from DictSpecs where {0}", sFilter)))
            {
                if (dr.Read())
                {
                    result.BarCode = (dr["barcode"]==DBNull.Value)?"":dr["barcode"].ToString();
                    result.ID = Int32.Parse(dr["ID"].ToString());
                    result.Sequence = Int32.Parse(dr["Sequence"].ToString());
                    result.Seciton = dr["Section"].ToString();
                    result.CheckPosition = dr["CheckPosition"].ToString();
                    result.CheckMethod = dr["CheckMethod"].ToString();
                    result.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    dr.Close();
                }
                else
                {

                    return null;
                }
            }
            string sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0}", result.ID);
            if (isFull==false)
                sqlstring = String.Format("select * from DictSpecsItems where DictSpecsID={0} and IsFull<>1", result.ID);
            using (IDataReader dr = DataAccess.ExecuteReader(sqlstring))
            {
                while (dr.Read())
                {
                    SpecsDetail detail = new SpecsDetail();
                    detail.ID=Int32.Parse(dr["id"].ToString());
                    detail.SpecsID=result.ID;
                    detail.SpecifiedSizeHeight=(dr["SpecifiedSizeHeight"] == DBNull.Value) ? "" : dr["SpecifiedSizeHeight"].ToString();
                    detail.CheckDetail=dr["CheckDetail"].ToString();
                    detail.CheckMethod=(dr["CheckMethod"] == DBNull.Value) ? result.CheckMethod : dr["CheckMethod"].ToString();
                    detail.KnockPosition =(dr["KnockPosition"] == DBNull.Value) ? "" : dr["KnockPosition"].ToString();
                    detail.IsFull = (dr["IsFull"] == DBNull.Value) ? false : Boolean.Parse(dr["IsFull"].ToString());
                    result.Items.Add(detail);
                }
            }
            return result;
        }
Esempio n. 2
0
 public FormCheckDetail(SpecsDetail detail)
     : this()
 {
     _detail = detail;
     initView();
 }