예제 #1
0
        public List <Chain.Model.GoodsAllot> DataTableToList(DataTable dt)
        {
            List <Chain.Model.GoodsAllot> modelList = new List <Chain.Model.GoodsAllot>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                for (int i = 0; i < rowsCount; i++)
                {
                    Chain.Model.GoodsAllot model = new Chain.Model.GoodsAllot();
                    if (dt.Rows[i]["AllotID"] != null && dt.Rows[i]["AllotID"].ToString() != "")
                    {
                        model.AllotID = int.Parse(dt.Rows[i]["AllotID"].ToString());
                    }
                    if (dt.Rows[i]["AllotAccount"] != null && dt.Rows[i]["AllotAccount"].ToString() != "")
                    {
                        model.AllotAccount = dt.Rows[i]["AllotAccount"].ToString();
                    }
                    if (dt.Rows[i]["AllotOutShopID"] != null && dt.Rows[i]["AllotOutShopID"].ToString() != "")
                    {
                        model.AllotOutShopID = int.Parse(dt.Rows[i]["AllotOutShopID"].ToString());
                    }
                    if (dt.Rows[i]["AllotInShopID"] != null && dt.Rows[i]["AllotInShopID"].ToString() != "")
                    {
                        model.AllotInShopID = int.Parse(dt.Rows[i]["AllotInShopID"].ToString());
                    }
                    if (dt.Rows[i]["AllotCreateTime"] != null && dt.Rows[i]["AllotCreateTime"].ToString() != "")
                    {
                        model.AllotCreateTime = DateTime.Parse(dt.Rows[i]["AllotCreateTime"].ToString());
                    }
                    if (dt.Rows[i]["AllotTotalNumber"] != null && dt.Rows[i]["AllotTotalNumber"].ToString() != "")
                    {
                        model.AllotTotalNumber = decimal.Parse(dt.Rows[i]["AllotTotalNumber"].ToString());
                    }
                    if (dt.Rows[i]["AllotUserID"] != null && dt.Rows[i]["AllotUserID"].ToString() != "")
                    {
                        model.AllotUserID = int.Parse(dt.Rows[i]["AllotUserID"].ToString());
                    }
                    if (dt.Rows[i]["AllotRemark"] != null && dt.Rows[i]["AllotRemark"].ToString() != "")
                    {
                        model.AllotRemark = dt.Rows[i]["AllotRemark"].ToString();
                    }
                    if (dt.Rows[i]["AllotState"] != null && dt.Rows[i]["AllotState"].ToString() != "")
                    {
                        model.Allotstate = int.Parse(dt.Rows[i]["AllotState"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 public bool Update(Chain.Model.GoodsAllot model)
 {
     return(this.dal.Update(model));
 }
예제 #3
0
 public int Add(Chain.Model.GoodsAllot model)
 {
     return(this.dal.Add(model));
 }