コード例 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCode_AnnualFeeItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_AnnualFeeItem(");
            strSql.Append("n_AnnualFeeCodeID,n_ChargeCurrency,n_ChargeOFee,n_ChargeUnitFee,n_ChargeAFee)");
            strSql.Append(" values (");
            strSql.Append("@n_AnnualFeeCodeID,@n_ChargeCurrency,@n_ChargeOFee,@n_ChargeUnitFee,@n_ChargeAFee)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_AnnualFeeCodeID", SqlDbType.Int,     4),
                new SqlParameter("@n_ChargeCurrency",  SqlDbType.Int,     4),
                new SqlParameter("@n_ChargeOFee",      SqlDbType.Decimal, 9),
                new SqlParameter("@n_ChargeUnitFee",   SqlDbType.Decimal, 9),
                new SqlParameter("@n_ChargeAFee",      SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.n_AnnualFeeCodeID;
            parameters[1].Value = model.n_ChargeCurrency;
            parameters[2].Value = model.n_ChargeOFee;
            parameters[3].Value = model.n_ChargeUnitFee;
            parameters[4].Value = model.n_ChargeAFee;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
コード例 #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_AnnualFeeItem DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_AnnualFeeItem model = new IPSP.Model.TCode_AnnualFeeItem();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_AnnualFeeCodeID"] != null && row["n_AnnualFeeCodeID"].ToString() != "")
         {
             model.n_AnnualFeeCodeID = int.Parse(row["n_AnnualFeeCodeID"].ToString());
         }
         if (row["n_ChargeCurrency"] != null && row["n_ChargeCurrency"].ToString() != "")
         {
             model.n_ChargeCurrency = int.Parse(row["n_ChargeCurrency"].ToString());
         }
         if (row["n_ChargeOFee"] != null && row["n_ChargeOFee"].ToString() != "")
         {
             model.n_ChargeOFee = decimal.Parse(row["n_ChargeOFee"].ToString());
         }
         if (row["n_ChargeUnitFee"] != null && row["n_ChargeUnitFee"].ToString() != "")
         {
             model.n_ChargeUnitFee = decimal.Parse(row["n_ChargeUnitFee"].ToString());
         }
         if (row["n_ChargeAFee"] != null && row["n_ChargeAFee"].ToString() != "")
         {
             model.n_ChargeAFee = decimal.Parse(row["n_ChargeAFee"].ToString());
         }
     }
     return(model);
 }
コード例 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_AnnualFeeItem model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_AnnualFeeItem set ");
            strSql.Append("n_ChargeCurrency=@n_ChargeCurrency,");
            strSql.Append("n_ChargeOFee=@n_ChargeOFee,");
            strSql.Append("n_ChargeUnitFee=@n_ChargeUnitFee,");
            strSql.Append("n_ChargeAFee=@n_ChargeAFee");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ChargeCurrency",  SqlDbType.Int,     4),
                new SqlParameter("@n_ChargeOFee",      SqlDbType.Decimal, 9),
                new SqlParameter("@n_ChargeUnitFee",   SqlDbType.Decimal, 9),
                new SqlParameter("@n_ChargeAFee",      SqlDbType.Decimal, 9),
                new SqlParameter("@n_ID",              SqlDbType.Int,     4),
                new SqlParameter("@n_AnnualFeeCodeID", SqlDbType.Int, 4)
            };
            parameters[0].Value = model.n_ChargeCurrency;
            parameters[1].Value = model.n_ChargeOFee;
            parameters[2].Value = model.n_ChargeUnitFee;
            parameters[3].Value = model.n_ChargeAFee;
            parameters[4].Value = model.n_ID;
            parameters[5].Value = model.n_AnnualFeeCodeID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_AnnualFeeItem GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_AnnualFeeCodeID,n_ChargeCurrency,n_ChargeOFee,n_ChargeUnitFee,n_ChargeAFee from TCode_AnnualFeeItem ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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

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