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

            if (rowsCount > 0)
            {
                Hownet.Model.MaterielStructMain model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.MaterielStructMain();
                    if (dt.Rows[n]["MainID"].ToString() != "")
                    {
                        model.MainID = int.Parse(dt.Rows[n]["MainID"].ToString());
                    }
                    else
                    {
                        model.MainID = 0;
                    }
                    model.Ver = dt.Rows[n]["Ver"].ToString();
                    if (dt.Rows[n]["MaterielID"].ToString() != "")
                    {
                        model.MaterielID = int.Parse(dt.Rows[n]["MaterielID"].ToString());
                    }
                    else
                    {
                        model.MaterielID = 0;
                    }
                    if (dt.Rows[n]["DateTime"].ToString() != "")
                    {
                        model.DateTime = DateTime.Parse(dt.Rows[n]["DateTime"].ToString());
                    }
                    else
                    {
                        model.DateTime = DateTime.Parse("1900-1-1");
                    }
                    if (dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    else
                    {
                        model.CompanyID = 0;
                    }
                    if (dt.Rows[n]["TaskID"].ToString() != "")
                    {
                        model.TaskID = int.Parse(dt.Rows[n]["TaskID"].ToString());
                    }
                    else
                    {
                        model.TaskID = 0;
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["IsDefault"].ToString() != "")
                    {
                        if ((dt.Rows[n]["IsDefault"].ToString() == "1") || (dt.Rows[n]["IsDefault"].ToString().ToLower() == "true"))
                        {
                            model.IsDefault = true;
                        }
                        else
                        {
                            model.IsDefault = false;
                        }
                    }
                    if (dt.Rows[n]["IsVerify"].ToString() != "")
                    {
                        model.IsVerify = int.Parse(dt.Rows[n]["IsVerify"].ToString());
                    }
                    else
                    {
                        model.IsVerify = 0;
                    }
                    if (dt.Rows[n]["VerifyManID"].ToString() != "")
                    {
                        model.VerifyManID = int.Parse(dt.Rows[n]["VerifyManID"].ToString());
                    }
                    else
                    {
                        model.VerifyManID = 0;
                    }
                    if (dt.Rows[n]["VerifyDateTime"].ToString() != "")
                    {
                        model.VerifyDateTime = DateTime.Parse(dt.Rows[n]["VerifyDateTime"].ToString());
                    }
                    else
                    {
                        model.VerifyDateTime = DateTime.Parse("1900-1-1");
                    }
                    if (dt.Rows[n]["Executant"].ToString() != "")
                    {
                        model.Executant = int.Parse(dt.Rows[n]["Executant"].ToString());
                    }
                    else
                    {
                        model.Executant = 0;
                    }
                    if (dt.Rows[n]["Money"] != null && dt.Rows[n]["Money"].ToString() != "")
                    {
                        model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString());
                    }
                    if (dt.Rows[n]["WorkingMoney"] != null && dt.Rows[n]["WorkingMoney"].ToString() != "")
                    {
                        model.WorkingMoney = decimal.Parse(dt.Rows[n]["WorkingMoney"].ToString());
                    }
                    if (dt.Rows[n]["OutPrice"] != null && dt.Rows[n]["OutPrice"].ToString() != "")
                    {
                        model.OutPrice = decimal.Parse(dt.Rows[n]["OutPrice"].ToString());
                    }
                    if (dt.Rows[n]["MaterielPro"] != null && dt.Rows[n]["MaterielPro"].ToString() != "")
                    {
                        model.MaterielPro = decimal.Parse(dt.Rows[n]["MaterielPro"].ToString());
                    }
                    if (dt.Rows[n]["GrossProfit"] != null && dt.Rows[n]["GrossProfit"].ToString() != "")
                    {
                        model.GrossProfit = decimal.Parse(dt.Rows[n]["GrossProfit"].ToString());
                    }
                    if (dt.Rows[n]["GrossPro"] != null && dt.Rows[n]["GrossPro"].ToString() != "")
                    {
                        model.GrossPro = decimal.Parse(dt.Rows[n]["GrossPro"].ToString());
                    }
                    if (dt.Rows[n]["CMT"] != null && dt.Rows[n]["CMT"].ToString() != "")
                    {
                        model.CMT = decimal.Parse(dt.Rows[n]["CMT"].ToString());
                    }
                    model.BySizeName   = dt.Rows[n]["BySizeName"].ToString();
                    model.ExSize       = dt.Rows[n]["ExSize"].ToString();
                    model.MaterielLoss = dt.Rows[n]["MaterielLoss"].ToString();
                    model.PackLoss     = dt.Rows[n]["PackLoss"].ToString();
                    if (dt.Rows[n]["FillManID"] != null && dt.Rows[n]["FillManID"].ToString() != "")
                    {
                        model.FillManID = int.Parse(dt.Rows[n]["FillManID"].ToString());
                    }
                    model.FillManName   = dt.Rows[n]["FillManName"].ToString();
                    model.VerifyManName = dt.Rows[n]["VerifyManName"].ToString();
                    model.A             = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }