Пример #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCstmr_AppTransLatedName model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCstmr_AppTransLatedName(");
            strSql.Append("s_AppTransLatedName,s_TrustdeedNum,s_AppTransLatedNameUse,n_AppID)");
            strSql.Append(" values (");
            strSql.Append("@s_AppTransLatedName,@s_TrustdeedNum,@s_AppTransLatedNameUse,@n_AppID)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_AppTransLatedName",    SqlDbType.NVarChar, 100),
                new SqlParameter("@s_TrustdeedNum",         SqlDbType.NVarChar, 100),
                new SqlParameter("@s_AppTransLatedNameUse", SqlDbType.NVarChar, 100),
                new SqlParameter("@n_AppID",                SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_AppTransLatedName;
            parameters[1].Value = model.s_TrustdeedNum;
            parameters[2].Value = model.s_AppTransLatedNameUse;
            parameters[3].Value = model.n_AppID;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Пример #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCstmr_AppTransLatedName DataRowToModel(DataRow row)
 {
     IPSP.Model.TCstmr_AppTransLatedName model = new IPSP.Model.TCstmr_AppTransLatedName();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["s_AppTransLatedName"] != null)
         {
             model.s_AppTransLatedName = row["s_AppTransLatedName"].ToString();
         }
         if (row["s_TrustdeedNum"] != null)
         {
             model.s_TrustdeedNum = row["s_TrustdeedNum"].ToString();
         }
         if (row["s_AppTransLatedNameUse"] != null)
         {
             model.s_AppTransLatedNameUse = row["s_AppTransLatedNameUse"].ToString();
         }
         if (row["n_AppID"] != null && row["n_AppID"].ToString() != "")
         {
             model.n_AppID = int.Parse(row["n_AppID"].ToString());
         }
     }
     return(model);
 }
Пример #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCstmr_AppTransLatedName model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCstmr_AppTransLatedName set ");
            strSql.Append("s_AppTransLatedName=@s_AppTransLatedName,");
            strSql.Append("s_TrustdeedNum=@s_TrustdeedNum,");
            strSql.Append("s_AppTransLatedNameUse=@s_AppTransLatedNameUse");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@s_AppTransLatedName",    SqlDbType.NVarChar, 100),
                new SqlParameter("@s_TrustdeedNum",         SqlDbType.NVarChar, 100),
                new SqlParameter("@s_AppTransLatedNameUse", SqlDbType.NVarChar, 100),
                new SqlParameter("@n_ID",                   SqlDbType.Int,        4),
                new SqlParameter("@n_AppID",                SqlDbType.Int, 4)
            };
            parameters[0].Value = model.s_AppTransLatedName;
            parameters[1].Value = model.s_TrustdeedNum;
            parameters[2].Value = model.s_AppTransLatedNameUse;
            parameters[3].Value = model.n_ID;
            parameters[4].Value = model.n_AppID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCstmr_AppTransLatedName GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,s_AppTransLatedName,s_TrustdeedNum,s_AppTransLatedNameUse,n_AppID from TCstmr_AppTransLatedName ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

            IPSP.Model.TCstmr_AppTransLatedName model = new IPSP.Model.TCstmr_AppTransLatedName();
            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.TCstmr_AppTransLatedName model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TCstmr_AppTransLatedName model)
 {
     return(dal.Add(model));
 }