Exemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Dianda.Model.Budget> DataTableToList(DataTable dt)
        {
            List <Dianda.Model.Budget> modelList = new List <Dianda.Model.Budget>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Dianda.Model.Budget model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Dianda.Model.Budget();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.BudgetName = dt.Rows[n]["BudgetName"].ToString();
                    if (dt.Rows[n]["Balance"].ToString() != "")
                    {
                        model.Balance = decimal.Parse(dt.Rows[n]["Balance"].ToString());
                    }
                    model.DepartmentIDs = dt.Rows[n]["DepartmentIDs"].ToString();
                    model.ApproverIDs   = dt.Rows[n]["ApproverIDs"].ToString();
                    model.BudgetType    = int.Parse(dt.Rows[n]["BudgetType"].ToString());
                    if (dt.Rows[n]["YEBalance"].ToString() != "")
                    {
                        model.YEBalance = decimal.Parse(dt.Rows[n]["YEBalance"].ToString());
                    }
                    if (dt.Rows[n]["LimitNums"].ToString() != "")
                    {
                        model.LimitNums = decimal.Parse(dt.Rows[n]["LimitNums"].ToString());
                    }
                    if (dt.Rows[n]["Statas"].ToString() != "")
                    {
                        model.Statas = int.Parse(dt.Rows[n]["Statas"].ToString());
                    }
                    if (dt.Rows[n]["DATETIME"].ToString() != "")
                    {
                        model.DATETIME = DateTime.Parse(dt.Rows[n]["DATETIME"].ToString());
                    }
                    model.DoUserID = dt.Rows[n]["DoUserID"].ToString();
                    if (dt.Rows[n]["StartTime"].ToString() != "")
                    {
                        model.EndTime = DateTime.Parse(dt.Rows[n]["StartTime"].ToString());
                    }
                    if (dt.Rows[n]["EndTime"].ToString() != "")
                    {
                        model.EndTime = DateTime.Parse(dt.Rows[n]["EndTime"].ToString());
                    }
                    model.TEMP0 = dt.Rows[n]["TEMP0"].ToString();
                    model.TEMP1 = dt.Rows[n]["TEMP1"].ToString();
                    model.TEMP2 = dt.Rows[n]["TEMP2"].ToString();
                    model.TEMP3 = dt.Rows[n]["TEMP3"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Dianda.Model.Budget model)
 {
     dal.Update(model);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Dianda.Model.Budget model)
 {
     return(dal.Add(model));
 }