Пример #1
0
        public void AddBase()
        {
            Hownet.Model.Measure modMT = new Hownet.Model.Measure();
            modMT.Name          = "件";
            modMT.Sn            = "01";
            modMT.IsEnd         = 0;
            modMT.IsUse         = true;
            modMT.MeasureTypeID = 1;
            Add(modMT);

            modMT.Name          = "包";
            modMT.Sn            = "02";
            modMT.IsEnd         = 0;
            modMT.IsUse         = true;
            modMT.MeasureTypeID = 1;
            Add(modMT);
        }
Пример #2
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.Measure> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.Measure> modelList = new List <Hownet.Model.Measure>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.Measure model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Measure();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["IsUse"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsUse"].ToString() == "1") || (dt.Rows[n]["IsUse"].ToString().ToLower() == "true"))
                        {
                            model.IsUse = true;
                        }
                        else
                        {
                            model.IsUse = false;
                        }
                    }
                    model.Sn = dt.Rows[n]["Sn"].ToString();
                    if (dt.Rows[n]["MeasureTypeID"].ToString() != "")
                    {
                        model.MeasureTypeID = int.Parse(dt.Rows[n]["MeasureTypeID"].ToString());
                    }
                    if (dt.Rows[n]["IsEnd"].ToString() != "")
                    {
                        model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString());
                    }
                    if (dt.Rows[n]["Conversion"] != null && dt.Rows[n]["Conversion"].ToString() != "")
                    {
                        model.Conversion = decimal.Parse(dt.Rows[n]["Conversion"].ToString());
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Пример #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Measure model)
 {
     dal.Update(model);
 }
Пример #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Measure model)
 {
     return(dal.Add(model));
 }