예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Dianda.Model.Cash_Message> DataTableToList(DataTable dt)
        {
            List <Dianda.Model.Cash_Message> modelList = new List <Dianda.Model.Cash_Message>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Dianda.Model.Cash_Message model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Dianda.Model.Cash_Message();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    model.CardName     = dt.Rows[n]["CardName"].ToString();
                    model.CardholderID = dt.Rows[n]["CardholderID"].ToString();
                    model.DepartmentID = dt.Rows[n]["DepartmentID"].ToString();
                    if (dt.Rows[n]["ProjectID"].ToString() != "")
                    {
                        model.ProjectID = int.Parse(dt.Rows[n]["ProjectID"].ToString());
                    }
                    if (dt.Rows[n]["LimitNums"].ToString() != "")
                    {
                        model.LimitNums = decimal.Parse(dt.Rows[n]["LimitNums"].ToString());
                    }
                    model.ApproverIDs = dt.Rows[n]["ApproverIDs"].ToString();
                    if (dt.Rows[n]["DATETIME"].ToString() != "")
                    {
                        model.DATETIME = DateTime.Parse(dt.Rows[n]["DATETIME"].ToString());
                    }
                    model.SendUserID = dt.Rows[n]["SendUserID"].ToString();
                    model.Notes      = dt.Rows[n]["Notes"].ToString();
                    if (dt.Rows[n]["IsRead"].ToString() != "")
                    {
                        model.IsRead = int.Parse(dt.Rows[n]["IsRead"].ToString());
                    }
                    if (dt.Rows[n]["ReadTime"].ToString() != "")
                    {
                        model.ReadTime = DateTime.Parse(dt.Rows[n]["ReadTime"].ToString());
                    }
                    model.DoNotes  = dt.Rows[n]["DoNotes"].ToString();
                    model.DoUserID = dt.Rows[n]["DoUserID"].ToString();
                    if (dt.Rows[n]["Status"].ToString() != "")
                    {
                        model.Status = int.Parse(dt.Rows[n]["Status"].ToString());
                    }
                    if (dt.Rows[n]["SFOrderID"].ToString() != "")
                    {
                        model.SFOrderID = int.Parse(dt.Rows[n]["SFOrderID"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Dianda.Model.Cash_Message model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Dianda.Model.Cash_Message model)
 {
     return(dal.Add(model));
 }