Example #1
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public long Add(lgk.Model.tb_leaveMsg model)
 {
     return(dal.Add(model));
 }
Example #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(lgk.Model.tb_leaveMsg model)
 {
     return(dal.Update(model));
 }
Example #3
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <lgk.Model.tb_leaveMsg> DataTableToList(DataTable dt)
        {
            List <lgk.Model.tb_leaveMsg> modelList = new List <lgk.Model.tb_leaveMsg>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                lgk.Model.tb_leaveMsg model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new lgk.Model.tb_leaveMsg();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = long.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["MsgTitle"] != null && dt.Rows[n]["MsgTitle"].ToString() != "")
                    {
                        model.MsgTitle = dt.Rows[n]["MsgTitle"].ToString();
                    }
                    if (dt.Rows[n]["MsgContent"] != null && dt.Rows[n]["MsgContent"].ToString() != "")
                    {
                        model.MsgContent = dt.Rows[n]["MsgContent"].ToString();
                    }
                    if (dt.Rows[n]["LeaveTime"] != null && dt.Rows[n]["LeaveTime"].ToString() != "")
                    {
                        model.LeaveTime = DateTime.Parse(dt.Rows[n]["LeaveTime"].ToString());
                    }
                    if (dt.Rows[n]["IsRead"] != null && dt.Rows[n]["IsRead"].ToString() != "")
                    {
                        model.IsRead = int.Parse(dt.Rows[n]["IsRead"].ToString());
                    }
                    if (dt.Rows[n]["IsReply"] != null && dt.Rows[n]["IsReply"].ToString() != "")
                    {
                        model.IsReply = int.Parse(dt.Rows[n]["IsReply"].ToString());
                    }
                    if (dt.Rows[n]["FromUserType"] != null && dt.Rows[n]["FromUserType"].ToString() != "")
                    {
                        model.FromUserType = int.Parse(dt.Rows[n]["FromUserType"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = long.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["UserCode"] != null && dt.Rows[n]["UserCode"].ToString() != "")
                    {
                        model.UserCode = dt.Rows[n]["UserCode"].ToString();
                    }
                    if (dt.Rows[n]["FromIDIsDel"] != null && dt.Rows[n]["FromIDIsDel"].ToString() != "")
                    {
                        model.FromIDIsDel = int.Parse(dt.Rows[n]["FromIDIsDel"].ToString());
                    }
                    if (dt.Rows[n]["ToUserType"] != null && dt.Rows[n]["ToUserType"].ToString() != "")
                    {
                        model.ToUserType = int.Parse(dt.Rows[n]["ToUserType"].ToString());
                    }
                    if (dt.Rows[n]["ToUserID"] != null && dt.Rows[n]["ToUserID"].ToString() != "")
                    {
                        model.ToUserID = long.Parse(dt.Rows[n]["ToUserID"].ToString());
                    }
                    if (dt.Rows[n]["ToUserCode"] != null && dt.Rows[n]["ToUserCode"].ToString() != "")
                    {
                        model.ToUserCode = dt.Rows[n]["ToUserCode"].ToString();
                    }
                    if (dt.Rows[n]["ToIDIsDel"] != null && dt.Rows[n]["ToIDIsDel"].ToString() != "")
                    {
                        model.ToIDIsDel = int.Parse(dt.Rows[n]["ToIDIsDel"].ToString());
                    }
                    if (dt.Rows[n]["MsgType"] != null && dt.Rows[n]["MsgType"].ToString() != "")
                    {
                        model.MsgType = int.Parse(dt.Rows[n]["MsgType"].ToString());
                    }
                    if (dt.Rows[n]["Pic"] != null && dt.Rows[n]["Pic"].ToString() != "")
                    {
                        model.Pic = dt.Rows[n]["Pic"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }