Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(university.Model.CCOM.Form_review model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Form_review set ");
            strSql.Append("User_id=@User_id,");
            strSql.Append("Form_type_id=@Form_type_id,");
            strSql.Append("Review_result=@Review_result");
            strSql.Append(" where Form_review_id=@Form_review_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@User_id",        SqlDbType.BigInt, 8),
                new SqlParameter("@Form_type_id",   SqlDbType.Int,    4),
                new SqlParameter("@Review_result",  SqlDbType.Int,    4),
                new SqlParameter("@Form_review_id", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = model.User_id;
            parameters[1].Value = model.Form_type_id;
            parameters[2].Value = model.Review_result;
            parameters[3].Value = model.Form_review_id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(university.Model.CCOM.Form_review model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Form_review(");
            strSql.Append("User_id,Form_type_id,Review_result)");
            strSql.Append(" values (");
            strSql.Append("@User_id,@Form_type_id,@Review_result)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@User_id",       SqlDbType.BigInt, 8),
                new SqlParameter("@Form_type_id",  SqlDbType.Int,    4),
                new SqlParameter("@Review_result", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.User_id;
            parameters[1].Value = model.Form_type_id;
            parameters[2].Value = model.Review_result;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Form_review GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Form_review_id,User_id,Form_type_id,Review_result  ");
            strSql.Append("  from Form_review ");
            strSql.Append(" where " + strWhere);


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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Form_review_id"] != null && ds.Tables[0].Rows[0]["Form_review_id"].ToString() != "")
                {
                    model.Form_review_id = long.Parse(ds.Tables[0].Rows[0]["Form_review_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["User_id"] != null && 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]["Form_type_id"] != null && ds.Tables[0].Rows[0]["Form_type_id"].ToString() != "")
                {
                    model.Form_type_id = int.Parse(ds.Tables[0].Rows[0]["Form_type_id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Review_result"] != null && ds.Tables[0].Rows[0]["Review_result"].ToString() != "")
                {
                    model.Review_result = int.Parse(ds.Tables[0].Rows[0]["Review_result"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public university.Model.CCOM.Form_review DataRowToModel(DataRow row)
 {
     university.Model.CCOM.Form_review model = new university.Model.CCOM.Form_review();
     if (row != null)
     {
         if (row["Form_review_id"] != null && row["Form_review_id"].ToString() != "")
         {
             model.Form_review_id = long.Parse(row["Form_review_id"].ToString());
         }
         if (row["User_id"] != null && row["User_id"].ToString() != "")
         {
             model.User_id = long.Parse(row["User_id"].ToString());
         }
         if (row["Form_type_id"] != null && row["Form_type_id"].ToString() != "")
         {
             model.Form_type_id = int.Parse(row["Form_type_id"].ToString());
         }
         if (row["Review_result"] != null && row["Review_result"].ToString() != "")
         {
             model.Review_result = int.Parse(row["Review_result"].ToString());
         }
     }
     return(model);
 }
Esempio n. 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public university.Model.CCOM.Form_review GetModel(long Form_review_id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Form_review_id,User_id,Form_type_id,Review_result from Form_review ");
            strSql.Append(" where Form_review_id=@Form_review_id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Form_review_id", SqlDbType.BigInt)
            };
            parameters[0].Value = Form_review_id;

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

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