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

            if (rowsCount > 0)
            {
                LPWeb.Model.ProspectTasks model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.ProspectTasks();
                    if (dt.Rows[n]["ProspectTaskId"].ToString() != "")
                    {
                        model.ProspectTaskId = int.Parse(dt.Rows[n]["ProspectTaskId"].ToString());
                    }
                    if (dt.Rows[n]["ContactId"].ToString() != "")
                    {
                        model.ContactId = int.Parse(dt.Rows[n]["ContactId"].ToString());
                    }
                    model.TaskName = dt.Rows[n]["TaskName"].ToString();
                    model.Desc     = dt.Rows[n]["Desc"].ToString();
                    if (dt.Rows[n]["OwnerId"].ToString() != "")
                    {
                        model.OwnerId = int.Parse(dt.Rows[n]["OwnerId"].ToString());
                    }
                    if (dt.Rows[n]["Due"].ToString() != "")
                    {
                        model.Due = DateTime.Parse(dt.Rows[n]["Due"].ToString());
                    }
                    if (dt.Rows[n]["WarningEmailTemplId"].ToString() != "")
                    {
                        model.WarningEmailTemplId = int.Parse(dt.Rows[n]["WarningEmailTemplId"].ToString());
                    }
                    if (dt.Rows[n]["OverdueEmailTemplId"].ToString() != "")
                    {
                        model.OverdueEmailTemplId = int.Parse(dt.Rows[n]["OverdueEmailTemplId"].ToString());
                    }
                    if (dt.Rows[n]["CompletionEmailTemplid"].ToString() != "")
                    {
                        model.CompletionEmailTemplid = int.Parse(dt.Rows[n]["CompletionEmailTemplid"].ToString());
                    }
                    if (dt.Rows[n]["Completed"].ToString() != "")
                    {
                        model.Completed = DateTime.Parse(dt.Rows[n]["Completed"].ToString());
                    }
                    if (dt.Rows[n]["CompletedBy"].ToString() != "")
                    {
                        model.CompletedBy = int.Parse(dt.Rows[n]["CompletedBy"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(LPWeb.Model.ProspectTasks model)
 {
     return(dal.Update(model));
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(LPWeb.Model.ProspectTasks model)
 {
     return(dal.Add(model));
 }