예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <LPWeb.Model.WebAccounts> DataTableToList(DataTable dt)
        {
            List <LPWeb.Model.WebAccounts> modelList = new List <LPWeb.Model.WebAccounts>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                LPWeb.Model.WebAccounts model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new LPWeb.Model.WebAccounts();
                    if (dt.Rows[n]["WebAccountId"].ToString() != "")
                    {
                        model.WebAccountId = int.Parse(dt.Rows[n]["WebAccountId"].ToString());
                    }
                    if (dt.Rows[n]["Enabled"].ToString() != "")
                    {
                        if ((dt.Rows[n]["Enabled"].ToString() == "1") || (dt.Rows[n]["Enabled"].ToString().ToLower() == "true"))
                        {
                            model.Enabled = true;
                        }
                        else
                        {
                            model.Enabled = false;
                        }
                    }
                    if (dt.Rows[n]["LastLogin"].ToString() != "")
                    {
                        model.LastLogin = DateTime.Parse(dt.Rows[n]["LastLogin"].ToString());
                    }
                    model.Password         = dt.Rows[n]["Password"].ToString();
                    model.PasswordQuestion = dt.Rows[n]["PasswordQuestion"].ToString();
                    model.PasswordAnswer   = dt.Rows[n]["PasswordAnswer"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(LPWeb.Model.WebAccounts model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(LPWeb.Model.WebAccounts model)
 {
     return(dal.Add(model));
 }