/// <summary> /// 获得数据列表 /// </summary> public List <TFXK.Model.Customers> DataTableToList(DataTable dt) { List <TFXK.Model.Customers> modelList = new List <TFXK.Model.Customers>(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { TFXK.Model.Customers model; for (int n = 0; n < rowsCount; n++) { model = new TFXK.Model.Customers(); if (dt.Rows[n]["id"].ToString() != "") { model.id = int.Parse(dt.Rows[n]["id"].ToString()); } model.loginName = dt.Rows[n]["loginName"].ToString(); model.loginPass = dt.Rows[n]["loginPass"].ToString(); model.email = dt.Rows[n]["email"].ToString(); model.phone = dt.Rows[n]["phone"].ToString(); if (dt.Rows[n]["regDate"].ToString() != "") { model.regDate = DateTime.Parse(dt.Rows[n]["regDate"].ToString()); } model.trueName = dt.Rows[n]["trueName"].ToString(); if (dt.Rows[n]["userSex"].ToString() != "") { model.userSex = int.Parse(dt.Rows[n]["userSex"].ToString()); } model.tel = dt.Rows[n]["tel"].ToString(); model.address = dt.Rows[n]["address"].ToString(); model.cardID = dt.Rows[n]["cardID"].ToString(); model.birsday = dt.Rows[n]["birsday"].ToString(); if (dt.Rows[n]["stateID"].ToString() != "") { model.stateID = int.Parse(dt.Rows[n]["stateID"].ToString()); } if (dt.Rows[n]["orderEmail"].ToString() != "") { model.orderEmail = int.Parse(dt.Rows[n]["orderEmail"].ToString()); } model.validateEmail = dt.Rows[n]["validateEmail"].ToString(); modelList.Add(model); } } return(modelList); }
/// <summary> /// 更新一条数据 /// </summary> public void Update(TFXK.Model.Customers model) { dal.Update(model); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(TFXK.Model.Customers model) { model.loginPass = Security.EncryptPassword(model.loginPass, "MD5"); return(dal.Add(model)); }