Exemple #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <eChartProject.Model.eChart.accounts_users> DataTableToList(DataTable dt)
        {
            List <eChartProject.Model.eChart.accounts_users> modelList = new List <eChartProject.Model.eChart.accounts_users>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                eChartProject.Model.eChart.accounts_users model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new eChartProject.Model.eChart.accounts_users();
                    if (dt.Rows[n]["UserID"] != null && dt.Rows[n]["UserID"].ToString() != "")
                    {
                        model.UserID = int.Parse(dt.Rows[n]["UserID"].ToString());
                    }
                    if (dt.Rows[n]["FundID"] != null && dt.Rows[n]["FundID"].ToString() != "")
                    {
                        model.FundID = int.Parse(dt.Rows[n]["FundID"].ToString());
                    }
                    if (dt.Rows[n]["Username"] != null && dt.Rows[n]["Username"].ToString() != "")
                    {
                        model.Username = dt.Rows[n]["Username"].ToString();
                    }
                    if (dt.Rows[n]["Password"] != null && dt.Rows[n]["Password"].ToString() != "")
                    {
                        model.Password = dt.Rows[n]["Password"].ToString();
                    }
                    if (dt.Rows[n]["Age"] != null && dt.Rows[n]["Age"].ToString() != "")
                    {
                        model.Age = int.Parse(dt.Rows[n]["Age"].ToString());
                    }
                    if (dt.Rows[n]["City"] != null && dt.Rows[n]["City"].ToString() != "")
                    {
                        model.City = dt.Rows[n]["City"].ToString();
                    }
                    if (dt.Rows[n]["Country"] != null && dt.Rows[n]["Country"].ToString() != "")
                    {
                        model.Country = dt.Rows[n]["Country"].ToString();
                    }
                    if (dt.Rows[n]["Email"] != null && dt.Rows[n]["Email"].ToString() != "")
                    {
                        model.Email = dt.Rows[n]["Email"].ToString();
                    }
                    if (dt.Rows[n]["Gender"] != null && dt.Rows[n]["Gender"].ToString() != "")
                    {
                        model.Gender = int.Parse(dt.Rows[n]["Gender"].ToString());
                    }
                    if (dt.Rows[n]["UserStatus"] != null && dt.Rows[n]["UserStatus"].ToString() != "")
                    {
                        model.UserStatus = int.Parse(dt.Rows[n]["UserStatus"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Exemple #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(eChartProject.Model.eChart.accounts_users model)
 {
     return(dal.Update(model));
 }
Exemple #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(eChartProject.Model.eChart.accounts_users model)
 {
     dal.Add(model);
 }