Пример #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <DNSABC.Model.DNSABC_Transaction> DataTableToList(DataTable dt)
        {
            List <DNSABC.Model.DNSABC_Transaction> modelList = new List <DNSABC.Model.DNSABC_Transaction>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                DNSABC.Model.DNSABC_Transaction model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new DNSABC.Model.DNSABC_Transaction();
                    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]["TradeType"] != null && dt.Rows[n]["TradeType"].ToString() != "")
                    {
                        model.TradeType = int.Parse(dt.Rows[n]["TradeType"].ToString());
                    }
                    if (dt.Rows[n]["Price"] != null && dt.Rows[n]["Price"].ToString() != "")
                    {
                        model.Price = int.Parse(dt.Rows[n]["Price"].ToString());
                    }
                    if (dt.Rows[n]["AccountBalance"] != null && dt.Rows[n]["AccountBalance"].ToString() != "")
                    {
                        model.AccountBalance = int.Parse(dt.Rows[n]["AccountBalance"].ToString());
                    }
                    if (dt.Rows[n]["PayentMethord"] != null && dt.Rows[n]["PayentMethord"].ToString() != "")
                    {
                        model.PayentMethord = dt.Rows[n]["PayentMethord"].ToString();
                    }
                    if (dt.Rows[n]["TradeExplaining"] != null && dt.Rows[n]["TradeExplaining"].ToString() != "")
                    {
                        model.TradeExplaining = dt.Rows[n]["TradeExplaining"].ToString();
                    }
                    if (dt.Rows[n]["PaymentLogo"] != null && dt.Rows[n]["PaymentLogo"].ToString() != "")
                    {
                        model.PaymentLogo = dt.Rows[n]["PaymentLogo"].ToString();
                    }
                    if (dt.Rows[n]["Remark"] != null && dt.Rows[n]["Remark"].ToString() != "")
                    {
                        model.Remark = dt.Rows[n]["Remark"].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_Transaction model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(DNSABC.Model.DNSABC_Transaction model)
 {
     return(dal.Add(model));
 }