예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCase_BaseCases_T_MainFilesFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCase_BaseCases_T_MainFilesFiles(");
            strSql.Append("Files,Cases,OptimisticLockField)");
            strSql.Append(" values (");
            strSql.Append("@Files,@Cases,@OptimisticLockField)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Files",               SqlDbType.Int, 4),
                new SqlParameter("@Cases",               SqlDbType.Int, 4),
                new SqlParameter("@OptimisticLockField", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.Files;
            parameters[1].Value = model.Cases;
            parameters[2].Value = model.OptimisticLockField;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
예제 #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCase_BaseCases_T_MainFilesFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCase_BaseCases_T_MainFilesFiles set ");
            strSql.Append("OptimisticLockField=@OptimisticLockField");
            strSql.Append(" where OID=@OID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OptimisticLockField", SqlDbType.Int, 4),
                new SqlParameter("@Files",               SqlDbType.Int, 4),
                new SqlParameter("@Cases",               SqlDbType.Int, 4),
                new SqlParameter("@OID",                 SqlDbType.Int, 4)
            };
            parameters[0].Value = model.OptimisticLockField;
            parameters[1].Value = model.Files;
            parameters[2].Value = model.Cases;
            parameters[3].Value = model.OID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCase_BaseCases_T_MainFilesFiles DataRowToModel(DataRow row)
 {
     IPSP.Model.TCase_BaseCases_T_MainFilesFiles model = new IPSP.Model.TCase_BaseCases_T_MainFilesFiles();
     if (row != null)
     {
         if (row["Files"] != null && row["Files"].ToString() != "")
         {
             model.Files = int.Parse(row["Files"].ToString());
         }
         if (row["Cases"] != null && row["Cases"].ToString() != "")
         {
             model.Cases = int.Parse(row["Cases"].ToString());
         }
         if (row["OID"] != null && row["OID"].ToString() != "")
         {
             model.OID = int.Parse(row["OID"].ToString());
         }
         if (row["OptimisticLockField"] != null && row["OptimisticLockField"].ToString() != "")
         {
             model.OptimisticLockField = int.Parse(row["OptimisticLockField"].ToString());
         }
     }
     return(model);
 }
예제 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCase_BaseCases_T_MainFilesFiles GetModel(int OID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 Files,Cases,OID,OptimisticLockField from TCase_BaseCases_T_MainFilesFiles ");
            strSql.Append(" where OID=@OID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OID", SqlDbType.Int, 4)
            };
            parameters[0].Value = OID;

            IPSP.Model.TCase_BaseCases_T_MainFilesFiles model = new IPSP.Model.TCase_BaseCases_T_MainFilesFiles();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TCase_BaseCases_T_MainFilesFiles model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TCase_BaseCases_T_MainFilesFiles model)
 {
     return(dal.Add(model));
 }