Exemplo n.º 1
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<DLL.Model.admin> DataTableToList(DataTable dt)
 {
     List<DLL.Model.admin> modelList = new List<DLL.Model.admin>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         DLL.Model.admin model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new DLL.Model.admin();
             if (dt.Rows[n]["id"] != null && dt.Rows[n]["id"].ToString() != "")
             {
                 model.id = int.Parse(dt.Rows[n]["id"].ToString());
             }
             if (dt.Rows[n]["username"] != null && dt.Rows[n]["username"].ToString() != "")
             {
                 model.username = dt.Rows[n]["username"].ToString();
             }
             if (dt.Rows[n]["tel"] != null && dt.Rows[n]["tel"].ToString() != "")
             {
                 model.tel = dt.Rows[n]["tel"].ToString();
             }
             if (dt.Rows[n]["userId"] != null && dt.Rows[n]["userId"].ToString() != "")
             {
                 model.userId = dt.Rows[n]["userId"].ToString();
             }
             if (dt.Rows[n]["password"] != null && dt.Rows[n]["password"].ToString() != "")
             {
                 model.password = dt.Rows[n]["password"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
Exemplo n.º 2
0
 protected void saveImageButton_Click(object sender, EventArgs e)
 {
     DLL.Model.loginfo loginfo = new DLL.Model.loginfo();
     DLL.Model.admin admin = new DLL.Model.admin();
     admin.userId = loginTextBox.Text.ToString().Trim();
     admin.password = psyTextBox.Text.ToString().Trim();
     admin.username = userTextBox.Text.ToString().Trim();
     admin.tel = telTextBox.Text.ToString().Trim();
     new DLL.BLL.admin().Add(admin);
     Response.Redirect("List_admin.aspx");
 }