예제 #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.SampleColorAmount model)
 {
     return(dal.Add(model));
 }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.SampleColorAmount model)
 {
     return(dal.Update(model));
 }
예제 #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.SampleColorAmount> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.SampleColorAmount> modelList = new List <Hownet.Model.SampleColorAmount>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.SampleColorAmount model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.SampleColorAmount();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["MainID"] != null && dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    if (dt.Rows[n]["ColorID"] != null && dt.Rows[n]["ColorID"].ToString() != "")
                    {
                        model.ColorID = int.Parse(dt.Rows[n]["ColorID"].ToString());
                    }
                    model.ColorName   = dt.Rows[n]["ColorName"].ToString();
                    model.PantoneName = dt.Rows[n]["PantoneName"].ToString();
                    model.CupName     = dt.Rows[n]["CupName"].ToString();
                    if (dt.Rows[n]["Size1ID"] != null && dt.Rows[n]["Size1ID"].ToString() != "")
                    {
                        model.Size1ID = int.Parse(dt.Rows[n]["Size1ID"].ToString());
                    }
                    model.Size1Name = dt.Rows[n]["Size1Name"].ToString();
                    if (dt.Rows[n]["Size1Amount"] != null && dt.Rows[n]["Size1Amount"].ToString() != "")
                    {
                        model.Size1Amount = int.Parse(dt.Rows[n]["Size1Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size2ID"] != null && dt.Rows[n]["Size2ID"].ToString() != "")
                    {
                        model.Size2ID = int.Parse(dt.Rows[n]["Size2ID"].ToString());
                    }
                    model.Size2Name = dt.Rows[n]["Size2Name"].ToString();
                    if (dt.Rows[n]["Size2Amount"] != null && dt.Rows[n]["Size2Amount"].ToString() != "")
                    {
                        model.Size2Amount = int.Parse(dt.Rows[n]["Size2Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size3ID"] != null && dt.Rows[n]["Size3ID"].ToString() != "")
                    {
                        model.Size3ID = int.Parse(dt.Rows[n]["Size3ID"].ToString());
                    }
                    model.Size3Name = dt.Rows[n]["Size3Name"].ToString();
                    if (dt.Rows[n]["Size3Amount"] != null && dt.Rows[n]["Size3Amount"].ToString() != "")
                    {
                        model.Size3Amount = int.Parse(dt.Rows[n]["Size3Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size4ID"] != null && dt.Rows[n]["Size4ID"].ToString() != "")
                    {
                        model.Size4ID = int.Parse(dt.Rows[n]["Size4ID"].ToString());
                    }
                    model.Size4Name = dt.Rows[n]["Size4Name"].ToString();
                    if (dt.Rows[n]["Size4Amount"] != null && dt.Rows[n]["Size4Amount"].ToString() != "")
                    {
                        model.Size4Amount = int.Parse(dt.Rows[n]["Size4Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size5ID"] != null && dt.Rows[n]["Size5ID"].ToString() != "")
                    {
                        model.Size5ID = int.Parse(dt.Rows[n]["Size5ID"].ToString());
                    }
                    model.Size5Name = dt.Rows[n]["Size5Name"].ToString();
                    if (dt.Rows[n]["Size5Amount"] != null && dt.Rows[n]["Size5Amount"].ToString() != "")
                    {
                        model.Size5Amount = int.Parse(dt.Rows[n]["Size5Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size6ID"] != null && dt.Rows[n]["Size6ID"].ToString() != "")
                    {
                        model.Size6ID = int.Parse(dt.Rows[n]["Size6ID"].ToString());
                    }
                    model.Size6Name = dt.Rows[n]["Size6Name"].ToString();
                    if (dt.Rows[n]["Size6Amount"] != null && dt.Rows[n]["Size6Amount"].ToString() != "")
                    {
                        model.Size6Amount = int.Parse(dt.Rows[n]["Size6Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size7ID"] != null && dt.Rows[n]["Size7ID"].ToString() != "")
                    {
                        model.Size7ID = int.Parse(dt.Rows[n]["Size7ID"].ToString());
                    }
                    model.Size7Name = dt.Rows[n]["Size7Name"].ToString();
                    if (dt.Rows[n]["Size7Amount"] != null && dt.Rows[n]["Size7Amount"].ToString() != "")
                    {
                        model.Size7Amount = int.Parse(dt.Rows[n]["Size7Amount"].ToString());
                    }
                    if (dt.Rows[n]["Size8ID"] != null && dt.Rows[n]["Size8ID"].ToString() != "")
                    {
                        model.Size8ID = int.Parse(dt.Rows[n]["Size8ID"].ToString());
                    }
                    model.Size8Name = dt.Rows[n]["Size8Name"].ToString();
                    if (dt.Rows[n]["Size8Amount"] != null && dt.Rows[n]["Size8Amount"].ToString() != "")
                    {
                        model.Size8Amount = int.Parse(dt.Rows[n]["Size8Amount"].ToString());
                    }
                    if (dt.Rows[n]["Amount"] != null && dt.Rows[n]["Amount"].ToString() != "")
                    {
                        model.Amount = int.Parse(dt.Rows[n]["Amount"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }