Ejemplo n.º 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(university.Model.CCOM.Exam_firstin_subject_score model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Exam_firstin_subject_score(");
            strSql.Append("Efs_id,User_id,Efss_score,Efss_sequence");
            strSql.Append(") values (");
            strSql.Append("@Efs_id,@User_id,@Efss_score,@Efss_sequence");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Efs_id",        SqlDbType.Int,    4),
                new SqlParameter("@User_id",       SqlDbType.BigInt, 8),
                new SqlParameter("@Efss_score",    SqlDbType.Float,  8),
                new SqlParameter("@Efss_sequence", SqlDbType.Float, 8)
            };

            parameters[0].Value = model.Efs_id;
            parameters[1].Value = model.User_id;
            parameters[2].Value = model.Efss_score;
            parameters[3].Value = model.Efss_sequence;

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

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

            strSql.Append("select Efss_id, Efs_id, User_id, Efss_score, Efss_sequence  ");
            strSql.Append("  from Exam_firstin_subject_score ");
            strSql.Append(" where Efss_id=@Efss_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Efss_id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Efss_id;


            university.Model.CCOM.Exam_firstin_subject_score model = new university.Model.CCOM.Exam_firstin_subject_score();
            DataSet ds = DBSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Efss_id"].ToString() != "")
                {
                    model.Efss_id = int.Parse(ds.Tables[0].Rows[0]["Efss_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efs_id"].ToString() != "")
                {
                    model.Efs_id = int.Parse(ds.Tables[0].Rows[0]["Efs_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                {
                    model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efss_score"].ToString() != "")
                {
                    model.Efss_score = decimal.Parse(ds.Tables[0].Rows[0]["Efss_score"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efss_sequence"].ToString() != "")
                {
                    model.Efss_sequence = decimal.Parse(ds.Tables[0].Rows[0]["Efss_sequence"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Exam_firstin_subject_score GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Efss_id, Efs_id, User_id, Efss_score, Efss_sequence  ");
            strSql.Append("  from Exam_firstin_subject_score ");
            strSql.Append(" where " + strWhere);


            university.Model.CCOM.Exam_firstin_subject_score model = new university.Model.CCOM.Exam_firstin_subject_score();
            DataSet ds = DBSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Efss_id"].ToString() != "")
                {
                    model.Efss_id = int.Parse(ds.Tables[0].Rows[0]["Efss_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efs_id"].ToString() != "")
                {
                    model.Efs_id = int.Parse(ds.Tables[0].Rows[0]["Efs_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["User_id"].ToString() != "")
                {
                    model.User_id = long.Parse(ds.Tables[0].Rows[0]["User_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efss_score"].ToString() != "")
                {
                    model.Efss_score = decimal.Parse(ds.Tables[0].Rows[0]["Efss_score"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Efss_sequence"].ToString() != "")
                {
                    model.Efss_sequence = decimal.Parse(ds.Tables[0].Rows[0]["Efss_sequence"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.Exam_firstin_subject_score model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Exam_firstin_subject_score set ");

            strSql.Append(" Efs_id = @Efs_id , ");
            strSql.Append(" User_id = @User_id , ");
            strSql.Append(" Efss_score = @Efss_score , ");
            strSql.Append(" Efss_sequence = @Efss_sequence  ");
            strSql.Append(" where Efss_id=@Efss_id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Efss_id",       SqlDbType.Int,    4),
                new SqlParameter("@Efs_id",        SqlDbType.Int,    4),
                new SqlParameter("@User_id",       SqlDbType.BigInt, 8),
                new SqlParameter("@Efss_score",    SqlDbType.Float,  8),
                new SqlParameter("@Efss_sequence", SqlDbType.Float, 8)
            };

            parameters[0].Value = model.Efss_id;
            parameters[1].Value = model.Efs_id;
            parameters[2].Value = model.User_id;
            parameters[3].Value = model.Efss_score;
            parameters[4].Value = model.Efss_sequence;
            int rows = DBSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }