コード例 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DNSABC.Model.DNSABC_Payment> DataTableToList(DataTable dt)
        {
            List <DNSABC.Model.DNSABC_Payment> modelList = new List <DNSABC.Model.DNSABC_Payment>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DNSABC.Model.DNSABC_Payment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DNSABC.Model.DNSABC_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(DNSABC.Model.DNSABC_Payment model)
 {
     return(dal.Update(model));
 }
コード例 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(DNSABC.Model.DNSABC_Payment model)
 {
     return(dal.Add(model));
 }