示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <ROYcms.Sys.Model.ROYcms_Payment> DataTableToList(DataTable dt)
        {
            List <ROYcms.Sys.Model.ROYcms_Payment> modelList = new List <ROYcms.Sys.Model.ROYcms_Payment>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                ROYcms.Sys.Model.ROYcms_Payment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new ROYcms.Sys.Model.ROYcms_Payment();
                    if (dt.Rows[n]["Id"] != null && dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["PaymentType"] != null && dt.Rows[n]["PaymentType"].ToString() != "")
                    {
                        model.PaymentType = dt.Rows[n]["PaymentType"].ToString();
                    }
                    if (dt.Rows[n]["PaymentName"] != null && dt.Rows[n]["PaymentName"].ToString() != "")
                    {
                        model.PaymentName = dt.Rows[n]["PaymentName"].ToString();
                    }
                    if (dt.Rows[n]["PaymentAmount"] != null && dt.Rows[n]["PaymentAmount"].ToString() != "")
                    {
                        model.PaymentAmount = int.Parse(dt.Rows[n]["PaymentAmount"].ToString());
                    }
                    if (dt.Rows[n]["PaymentNum"] != null && dt.Rows[n]["PaymentNum"].ToString() != "")
                    {
                        model.PaymentNum = dt.Rows[n]["PaymentNum"].ToString();
                    }
                    if (dt.Rows[n]["UpdateTime"] != null && dt.Rows[n]["UpdateTime"].ToString() != "")
                    {
                        model.UpdateTime = DateTime.Parse(dt.Rows[n]["UpdateTime"].ToString());
                    }
                    if (dt.Rows[n]["CreateTime"] != null && dt.Rows[n]["CreateTime"].ToString() != "")
                    {
                        model.CreateTime = DateTime.Parse(dt.Rows[n]["CreateTime"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(ROYcms.Sys.Model.ROYcms_Payment model)
 {
     return(dal.Update(model));
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(ROYcms.Sys.Model.ROYcms_Payment model)
 {
     return(dal.Add(model));
 }