Ejemplo n.º 1
0
        public ActionResult doTestStanderdInfo(int _teststanderdId, int _sampleId)
        {
            tb_TestStandard model = new tb_TestStandard();

            model.temp1 = _sampleId.ToString();
            if (_teststanderdId > 0)
            {
                model = _teststandardbll.GetModel(_teststanderdId);
            }
            return(View(model));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(tb_TestStandard model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_TestStandard set ");
            strSql.Append("projectName=@projectName,");
            strSql.Append("projectId=@projectId,");
            strSql.Append("remark=@remark,");
            strSql.Append("standard=@standard,");
            strSql.Append("createUser=@createUser,");
            strSql.Append("createDate=@createDate,");
            strSql.Append("updateUser=@updateUser,");
            strSql.Append("updateDate=@updateDate,");
            strSql.Append("temp1=@temp1,");
            strSql.Append("temp2=@temp2");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@projectName", SqlDbType.NVarChar,  -1),
                new SqlParameter("@projectId",   SqlDbType.Int,        4),
                new SqlParameter("@remark",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@standard",    SqlDbType.NVarChar,  -1),
                new SqlParameter("@createUser",  SqlDbType.Int,        4),
                new SqlParameter("@createDate",  SqlDbType.DateTime),
                new SqlParameter("@updateUser",  SqlDbType.Int,        4),
                new SqlParameter("@updateDate",  SqlDbType.DateTime),
                new SqlParameter("@temp1",       SqlDbType.NVarChar,  -1),
                new SqlParameter("@temp2",       SqlDbType.NVarChar,  -1),
                new SqlParameter("@id",          SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.projectName;
            parameters[1].Value  = model.projectId;
            parameters[2].Value  = model.remark;
            parameters[3].Value  = model.standard;
            parameters[4].Value  = model.createUser;
            parameters[5].Value  = model.createDate;
            parameters[6].Value  = model.updateUser;
            parameters[7].Value  = model.updateDate;
            parameters[8].Value  = model.temp1;
            parameters[9].Value  = model.temp2;
            parameters[10].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public tb_TestStandard DataRowToModel(DataRow row)
        {
            tb_TestStandard model = new tb_TestStandard();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["projectName"] != null)
                {
                    model.projectName = row["projectName"].ToString();
                }
                if (row["projectId"] != null && row["projectId"].ToString() != "")
                {
                    model.projectId = int.Parse(row["projectId"].ToString());
                }
                if (row["remark"] != null)
                {
                    model.remark = row["remark"].ToString();
                }
                if (row["standard"] != null)
                {
                    model.standard = row["standard"].ToString();
                }
                if (row["createUser"] != null && row["createUser"].ToString() != "")
                {
                    model.createUser = int.Parse(row["createUser"].ToString());
                }
                if (row["createDate"] != null && row["createDate"].ToString() != "")
                {
                    model.createDate = DateTime.Parse(row["createDate"].ToString());
                }
                if (row["updateUser"] != null && row["updateUser"].ToString() != "")
                {
                    model.updateUser = int.Parse(row["updateUser"].ToString());
                }
                if (row["updateDate"] != null && row["updateDate"].ToString() != "")
                {
                    model.updateDate = DateTime.Parse(row["updateDate"].ToString());
                }
                if (row["temp1"] != null)
                {
                    model.temp1 = row["temp1"].ToString();
                }
                if (row["temp2"] != null)
                {
                    model.temp2 = row["temp2"].ToString();
                }
            }
            return(model);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(tb_TestStandard model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_TestStandard(");
            strSql.Append("projectName,projectId,remark,standard,createUser,createDate,updateUser,updateDate,temp1,temp2)");
            strSql.Append(" values (");
            strSql.Append("@projectName,@projectId,@remark,@standard,@createUser,@createDate,@updateUser,@updateDate,@temp1,@temp2)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@projectName", SqlDbType.NVarChar,  -1),
                new SqlParameter("@projectId",   SqlDbType.Int,        4),
                new SqlParameter("@remark",      SqlDbType.NVarChar,  -1),
                new SqlParameter("@standard",    SqlDbType.NVarChar,  -1),
                new SqlParameter("@createUser",  SqlDbType.Int,        4),
                new SqlParameter("@createDate",  SqlDbType.DateTime),
                new SqlParameter("@updateUser",  SqlDbType.Int,        4),
                new SqlParameter("@updateDate",  SqlDbType.DateTime),
                new SqlParameter("@temp1",       SqlDbType.NVarChar,  -1),
                new SqlParameter("@temp2",       SqlDbType.NVarChar, -1)
            };
            parameters[0].Value = model.projectName;
            parameters[1].Value = model.projectId;
            parameters[2].Value = model.remark;
            parameters[3].Value = model.standard;
            parameters[4].Value = model.createUser;
            parameters[5].Value = model.createDate;
            parameters[6].Value = model.updateUser;
            parameters[7].Value = model.updateDate;
            parameters[8].Value = model.temp1;
            parameters[9].Value = model.temp2;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public tb_TestStandard GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,projectName,projectId,remark,standard,createUser,createDate,updateUser,updateDate,temp1,temp2 from tb_TestStandard ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            tb_TestStandard model = new tb_TestStandard();
            DataSet         ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        public string SaveTestStanderdInfo(tb_TestStandard _testStandard)
        {
            _testStandard.updateDate = DateTime.Now;
            _testStandard.updateUser = CurrentUserInfo.PersonnelID;
            string flag = "0";

            if (_testStandard.id > 0)
            {
                if (_teststandardbll.Update(_testStandard))
                {
                    flag = "1";
                }
            }
            else
            {
                _testStandard.createDate = DateTime.Now;
                _testStandard.createUser = CurrentUserInfo.PersonnelID;
                if (_teststandardbll.Add(_testStandard) > 0)
                {
                    flag = "1";
                }
            }
            return(flag);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(tb_TestStandard model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 8
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(tb_TestStandard model)
 {
     return(dal.Add(model));
 }