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

            strSql.Append("insert into XPObjectType(");
            strSql.Append("TypeName,AssemblyName)");
            strSql.Append(" values (");
            strSql.Append("@TypeName,@AssemblyName)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TypeName",     SqlDbType.NVarChar, 254),
                new SqlParameter("@AssemblyName", SqlDbType.NVarChar, 254)
            };
            parameters[0].Value = model.TypeName;
            parameters[1].Value = model.AssemblyName;

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

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

            strSql.Append("update XPObjectType set ");
            strSql.Append("AssemblyName=@AssemblyName");
            strSql.Append(" where OID=@OID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AssemblyName", SqlDbType.NVarChar, 254),
                new SqlParameter("@OID",          SqlDbType.Int,        4),
                new SqlParameter("@TypeName",     SqlDbType.NVarChar, 254)
            };
            parameters[0].Value = model.AssemblyName;
            parameters[1].Value = model.OID;
            parameters[2].Value = model.TypeName;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.XPObjectType DataRowToModel(DataRow row)
 {
     IPSP.Model.XPObjectType model = new IPSP.Model.XPObjectType();
     if (row != null)
     {
         if (row["OID"] != null && row["OID"].ToString() != "")
         {
             model.OID = int.Parse(row["OID"].ToString());
         }
         if (row["TypeName"] != null)
         {
             model.TypeName = row["TypeName"].ToString();
         }
         if (row["AssemblyName"] != null)
         {
             model.AssemblyName = row["AssemblyName"].ToString();
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.XPObjectType GetModel(int OID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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