Пример #1
0
        public DLL.Model.repair GetModelbydefine(String defineId)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select  top 1 id,computerId,defineId,adminId,adminname,ftype,result,addTime from repair ");
            strSql.Append(" where defineId=@id");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.VarChar,500)
            };
            parameters[0].Value = defineId;

            DLL.Model.repair model = new DLL.Model.repair();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["computerId"] != null && ds.Tables[0].Rows[0]["computerId"].ToString() != "")
                {
                    model.computerId = int.Parse(ds.Tables[0].Rows[0]["computerId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["defineId"] != null && ds.Tables[0].Rows[0]["defineId"].ToString() != "")
                {
                    model.defineId = ds.Tables[0].Rows[0]["defineId"].ToString();
                }
                if (ds.Tables[0].Rows[0]["adminId"] != null && ds.Tables[0].Rows[0]["adminId"].ToString() != "")
                {
                    model.adminId = int.Parse(ds.Tables[0].Rows[0]["adminId"].ToString());
                }
                if (ds.Tables[0].Rows[0]["adminname"] != null && ds.Tables[0].Rows[0]["adminname"].ToString() != "")
                {
                    model.adminname = ds.Tables[0].Rows[0]["adminname"].ToString();
                }
                if (ds.Tables[0].Rows[0]["ftype"] != null && ds.Tables[0].Rows[0]["ftype"].ToString() != "")
                {
                    model.ftype = ds.Tables[0].Rows[0]["ftype"].ToString();
                }
                if (ds.Tables[0].Rows[0]["result"] != null && ds.Tables[0].Rows[0]["result"].ToString() != "")
                {
                    model.result = ds.Tables[0].Rows[0]["result"].ToString();
                }
                if (ds.Tables[0].Rows[0]["addTime"] != null && ds.Tables[0].Rows[0]["addTime"].ToString() != "")
                {
                    model.addTime = DateTime.Parse(ds.Tables[0].Rows[0]["addTime"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }
Пример #2
0
 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"]);
 }