/// <summary> /// 得到一个对象实体 /// </summary> public DLL.Model.loginfo DataRowToModel(DataRow row) { DLL.Model.loginfo model = new DLL.Model.loginfo(); if (row != null) { if (row["id"] != null && row["id"].ToString() != "") { model.id = int.Parse(row["id"].ToString()); } if (row["addTime"] != null && row["addTime"].ToString() != "") { model.addTime = DateTime.Parse(row["addTime"].ToString()); } if (row["adminname"] != null) { model.adminname = row["adminname"].ToString(); } if (row["action"] != null) { model.action = row["action"].ToString(); } if (row["objectname"] != null) { model.objectname = row["objectname"].ToString(); } } return model; }
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"); }
public Boolean deleteAll() { Boolean flag = dal.deleteAll(); if ( flag==true) { DLL.Model.loginfo loginfo = new DLL.Model.loginfo(); loginfo.adminname = System.Web.HttpContext.Current.Session["Username"].ToString(); loginfo.action = "删除"; loginfo.objectname = "所有日志"; new DLL.BLL.loginfo().Add(loginfo); } return flag; }
protected void saveImageButton_Click(object sender, EventArgs e) { DLL.Model.computer computer2 = new DLL.BLL.computer().GetModel(int.Parse(Request.QueryString["parameter"])); DLL.Model.loginfo loginfo = new DLL.Model.loginfo(); DLL.Model.repair repair = new DLL.Model.repair(); repair.computerId =computer2.id; repair.defineId = computer2.defineId; repair.ftype = ftypeTextBox.Text.ToString().Trim(); repair.result = resultTextBox.Text.ToString().Trim(); repair.adminId = int.Parse(Session["Userid"].ToString()); repair.adminname = Session["Username"].ToString(); new DLL.BLL.repair().Add(repair); Response.Redirect("thisrepair.aspx?parameter=" + Request.QueryString["parameter"]); }
/// <summary> /// 得到一个对象实体 /// </summary> public DLL.Model.loginfo GetModel(int id) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 id,addTime,adminname,action,objectname from loginfo "); strSql.Append(" where id=@id"); SqlParameter[] parameters = { new SqlParameter("@id", SqlDbType.Int,4) }; parameters[0].Value = id; DLL.Model.loginfo model = new DLL.Model.loginfo(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }