コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan> DataTableToList(DataTable dt)
        {
            List <MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan> modelList = new List <MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan();
                    if (dt.Rows[n]["InfoId"].ToString() != "")
                    {
                        model.InfoId = int.Parse(dt.Rows[n]["InfoId"].ToString());
                    }
                    if (dt.Rows[n]["Tb_WorkFlow_FlowSort_InfoId"].ToString() != "")
                    {
                        model.Tb_WorkFlow_FlowSort_InfoId = int.Parse(dt.Rows[n]["Tb_WorkFlow_FlowSort_InfoId"].ToString());
                    }
                    model.UserCode = dt.Rows[n]["UserCode"].ToString();
                    model.Title    = dt.Rows[n]["Title"].ToString();
                    model.DepCode  = dt.Rows[n]["DepCode"].ToString();
                    if (dt.Rows[n]["BuyPlanDate"].ToString() != "")
                    {
                        model.BuyPlanDate = DateTime.Parse(dt.Rows[n]["BuyPlanDate"].ToString());
                    }
                    if (dt.Rows[n]["BuyPlanMoney"].ToString() != "")
                    {
                        model.BuyPlanMoney = decimal.Parse(dt.Rows[n]["BuyPlanMoney"].ToString());
                    }
                    if (dt.Rows[n]["NeedDate"].ToString() != "")
                    {
                        model.NeedDate = DateTime.Parse(dt.Rows[n]["NeedDate"].ToString());
                    }
                    model.BuyPlanReadMe = dt.Rows[n]["BuyPlanReadMe"].ToString();
                    model.DocumentUrl   = dt.Rows[n]["DocumentUrl"].ToString();
                    if (dt.Rows[n]["WorkStartDate"].ToString() != "")
                    {
                        model.WorkStartDate = DateTime.Parse(dt.Rows[n]["WorkStartDate"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan model)
 {
     dal.Update(model);
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(MobileSoft.Model.OAPublicWork.Tb_OAPublicWork_MaterialBuyPlan model)
 {
     return(dal.Add(model));
 }