Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Eastcom.Model.v_月度考核内容 model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update v_月度考核内容 set ");
            strSql.Append("id=@id,");
            strSql.Append("FK_UserID=@FK_UserID,");
            strSql.Append("月份=@月份,");
            strSql.Append("提交时间=@提交时间,");
            strSql.Append("回答情况=@回答情况,");
            strSql.Append("得分=@得分,");
            strSql.Append("提交情况=@提交情况,");
            strSql.Append("RealName=@RealName,");
            strSql.Append("考务生成时间=@考务生成时间");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",        SqlDbType.Int,        4),
                new SqlParameter("@FK_UserID", SqlDbType.Int,        4),
                new SqlParameter("@月份",        SqlDbType.DateTime),
                new SqlParameter("@提交时间",      SqlDbType.DateTime),
                new SqlParameter("@回答情况",      SqlDbType.VarChar,   50),
                new SqlParameter("@得分",        SqlDbType.Decimal,    9),
                new SqlParameter("@提交情况",      SqlDbType.VarChar,   50),
                new SqlParameter("@RealName",  SqlDbType.VarChar,   50),
                new SqlParameter("@考务生成时间",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.FK_UserID;
            parameters[2].Value = model.月份;
            parameters[3].Value = model.提交时间;
            parameters[4].Value = model.回答情况;
            parameters[5].Value = model.得分;
            parameters[6].Value = model.提交情况;
            parameters[7].Value = model.RealName;
            parameters[8].Value = model.考务生成时间;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Eastcom.Model.v_月度考核内容 DataRowToModel(DataRow row)
 {
     Eastcom.Model.v_月度考核内容 model = new Eastcom.Model.v_月度考核内容();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["FK_UserID"] != null && row["FK_UserID"].ToString() != "")
         {
             model.FK_UserID = int.Parse(row["FK_UserID"].ToString());
         }
         if (row["月份"] != null && row["月份"].ToString() != "")
         {
             model.月份 = DateTime.Parse(row["月份"].ToString());
         }
         if (row["提交时间"] != null && row["提交时间"].ToString() != "")
         {
             model.提交时间 = DateTime.Parse(row["提交时间"].ToString());
         }
         if (row["回答情况"] != null)
         {
             model.回答情况 = row["回答情况"].ToString();
         }
         if (row["得分"] != null && row["得分"].ToString() != "")
         {
             model.得分 = decimal.Parse(row["得分"].ToString());
         }
         if (row["提交情况"] != null)
         {
             model.提交情况 = row["提交情况"].ToString();
         }
         if (row["RealName"] != null)
         {
             model.RealName = row["RealName"].ToString();
         }
         if (row["考务生成时间"] != null && row["考务生成时间"].ToString() != "")
         {
             model.考务生成时间 = DateTime.Parse(row["考务生成时间"].ToString());
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Eastcom.Model.v_月度考核内容 model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into v_月度考核内容(");
            strSql.Append("id,FK_UserID,月份,提交时间,回答情况,得分,提交情况,RealName,考务生成时间)");
            strSql.Append(" values (");
            strSql.Append("@id,@FK_UserID,@月份,@提交时间,@回答情况,@得分,@提交情况,@RealName,@考务生成时间)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id",        SqlDbType.Int,        4),
                new SqlParameter("@FK_UserID", SqlDbType.Int,        4),
                new SqlParameter("@月份",        SqlDbType.DateTime),
                new SqlParameter("@提交时间",      SqlDbType.DateTime),
                new SqlParameter("@回答情况",      SqlDbType.VarChar,   50),
                new SqlParameter("@得分",        SqlDbType.Decimal,    9),
                new SqlParameter("@提交情况",      SqlDbType.VarChar,   50),
                new SqlParameter("@RealName",  SqlDbType.VarChar,   50),
                new SqlParameter("@考务生成时间",    SqlDbType.DateTime)
            };
            parameters[0].Value = model.id;
            parameters[1].Value = model.FK_UserID;
            parameters[2].Value = model.月份;
            parameters[3].Value = model.提交时间;
            parameters[4].Value = model.回答情况;
            parameters[5].Value = model.得分;
            parameters[6].Value = model.提交情况;
            parameters[7].Value = model.RealName;
            parameters[8].Value = model.考务生成时间;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Eastcom.Model.v_月度考核内容 GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,FK_UserID,月份,提交时间,回答情况,得分,提交情况,RealName,考务生成时间 from v_月度考核内容 ");
            strSql.Append(" where id=@id ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Eastcom.Model.v_月度考核内容 model = new Eastcom.Model.v_月度考核内容();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }