Exemplo n.º 1
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_DRenewalFee DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_DRenewalFee model = new IPSP.Model.TCode_DRenewalFee();
     if (row != null)
     {
         if (row["n_ID"] != null && row["n_ID"].ToString() != "")
         {
             model.n_ID = int.Parse(row["n_ID"].ToString());
         }
         if (row["n_RegCountry"] != null && row["n_RegCountry"].ToString() != "")
         {
             model.n_RegCountry = int.Parse(row["n_RegCountry"].ToString());
         }
         if (row["n_OfficialFee"] != null && row["n_OfficialFee"].ToString() != "")
         {
             model.n_OfficialFee = decimal.Parse(row["n_OfficialFee"].ToString());
         }
         if (row["n_OfficialCurrency"] != null && row["n_OfficialCurrency"].ToString() != "")
         {
             model.n_OfficialCurrency = int.Parse(row["n_OfficialCurrency"].ToString());
         }
         if (row["s_UnitPrice"] != null)
         {
             model.s_UnitPrice = row["s_UnitPrice"].ToString();
         }
         if (row["s_Unit"] != null)
         {
             model.s_Unit = row["s_Unit"].ToString();
         }
         if (row["n_ExceedUnit"] != null && row["n_ExceedUnit"].ToString() != "")
         {
             model.n_ExceedUnit = int.Parse(row["n_ExceedUnit"].ToString());
         }
         if (row["n_ExceedUnitFee"] != null && row["n_ExceedUnitFee"].ToString() != "")
         {
             model.n_ExceedUnitFee = decimal.Parse(row["n_ExceedUnitFee"].ToString());
         }
         if (row["s_InitialDateType"] != null)
         {
             model.s_InitialDateType = row["s_InitialDateType"].ToString();
         }
         if (row["n_RenewalYear"] != null && row["n_RenewalYear"].ToString() != "")
         {
             model.n_RenewalYear = int.Parse(row["n_RenewalYear"].ToString());
         }
         if (row["s_Notes"] != null)
         {
             model.s_Notes = row["s_Notes"].ToString();
         }
         if (row["dt_CreateDate"] != null && row["dt_CreateDate"].ToString() != "")
         {
             model.dt_CreateDate = DateTime.Parse(row["dt_CreateDate"].ToString());
         }
         if (row["dt_EditDate"] != null && row["dt_EditDate"].ToString() != "")
         {
             model.dt_EditDate = DateTime.Parse(row["dt_EditDate"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_DRenewalFee model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_DRenewalFee set ");
            strSql.Append("n_RegCountry=@n_RegCountry,");
            strSql.Append("n_OfficialFee=@n_OfficialFee,");
            strSql.Append("n_OfficialCurrency=@n_OfficialCurrency,");
            strSql.Append("s_UnitPrice=@s_UnitPrice,");
            strSql.Append("s_Unit=@s_Unit,");
            strSql.Append("n_ExceedUnit=@n_ExceedUnit,");
            strSql.Append("n_ExceedUnitFee=@n_ExceedUnitFee,");
            strSql.Append("s_InitialDateType=@s_InitialDateType,");
            strSql.Append("n_RenewalYear=@n_RenewalYear,");
            strSql.Append("s_Notes=@s_Notes,");
            strSql.Append("dt_CreateDate=@dt_CreateDate,");
            strSql.Append("dt_EditDate=@dt_EditDate");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_RegCountry",       SqlDbType.Int,         4),
                new SqlParameter("@n_OfficialFee",      SqlDbType.Decimal,     9),
                new SqlParameter("@n_OfficialCurrency", SqlDbType.Int,         4),
                new SqlParameter("@s_UnitPrice",        SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Unit",             SqlDbType.NVarChar,   50),
                new SqlParameter("@n_ExceedUnit",       SqlDbType.Int,         4),
                new SqlParameter("@n_ExceedUnitFee",    SqlDbType.Decimal,     9),
                new SqlParameter("@s_InitialDateType",  SqlDbType.NVarChar,    1),
                new SqlParameter("@n_RenewalYear",      SqlDbType.Int,         4),
                new SqlParameter("@s_Notes",            SqlDbType.NVarChar,  800),
                new SqlParameter("@dt_CreateDate",      SqlDbType.DateTime),
                new SqlParameter("@dt_EditDate",        SqlDbType.DateTime),
                new SqlParameter("@n_ID",               SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.n_RegCountry;
            parameters[1].Value  = model.n_OfficialFee;
            parameters[2].Value  = model.n_OfficialCurrency;
            parameters[3].Value  = model.s_UnitPrice;
            parameters[4].Value  = model.s_Unit;
            parameters[5].Value  = model.n_ExceedUnit;
            parameters[6].Value  = model.n_ExceedUnitFee;
            parameters[7].Value  = model.s_InitialDateType;
            parameters[8].Value  = model.n_RenewalYear;
            parameters[9].Value  = model.s_Notes;
            parameters[10].Value = model.dt_CreateDate;
            parameters[11].Value = model.dt_EditDate;
            parameters[12].Value = model.n_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(IPSP.Model.TCode_DRenewalFee model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TCode_DRenewalFee(");
            strSql.Append("n_RegCountry,n_OfficialFee,n_OfficialCurrency,s_UnitPrice,s_Unit,n_ExceedUnit,n_ExceedUnitFee,s_InitialDateType,n_RenewalYear,s_Notes,dt_CreateDate,dt_EditDate)");
            strSql.Append(" values (");
            strSql.Append("@n_RegCountry,@n_OfficialFee,@n_OfficialCurrency,@s_UnitPrice,@s_Unit,@n_ExceedUnit,@n_ExceedUnitFee,@s_InitialDateType,@n_RenewalYear,@s_Notes,@dt_CreateDate,@dt_EditDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_RegCountry",       SqlDbType.Int,         4),
                new SqlParameter("@n_OfficialFee",      SqlDbType.Decimal,     9),
                new SqlParameter("@n_OfficialCurrency", SqlDbType.Int,         4),
                new SqlParameter("@s_UnitPrice",        SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Unit",             SqlDbType.NVarChar,   50),
                new SqlParameter("@n_ExceedUnit",       SqlDbType.Int,         4),
                new SqlParameter("@n_ExceedUnitFee",    SqlDbType.Decimal,     9),
                new SqlParameter("@s_InitialDateType",  SqlDbType.NVarChar,    1),
                new SqlParameter("@n_RenewalYear",      SqlDbType.Int,         4),
                new SqlParameter("@s_Notes",            SqlDbType.NVarChar,  800),
                new SqlParameter("@dt_CreateDate",      SqlDbType.DateTime),
                new SqlParameter("@dt_EditDate",        SqlDbType.DateTime)
            };
            parameters[0].Value  = model.n_RegCountry;
            parameters[1].Value  = model.n_OfficialFee;
            parameters[2].Value  = model.n_OfficialCurrency;
            parameters[3].Value  = model.s_UnitPrice;
            parameters[4].Value  = model.s_Unit;
            parameters[5].Value  = model.n_ExceedUnit;
            parameters[6].Value  = model.n_ExceedUnitFee;
            parameters[7].Value  = model.s_InitialDateType;
            parameters[8].Value  = model.n_RenewalYear;
            parameters[9].Value  = model.s_Notes;
            parameters[10].Value = model.dt_CreateDate;
            parameters[11].Value = model.dt_EditDate;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.TCode_DRenewalFee GetModel(int n_ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_ID,n_RegCountry,n_OfficialFee,n_OfficialCurrency,s_UnitPrice,s_Unit,n_ExceedUnit,n_ExceedUnitFee,s_InitialDateType,n_RenewalYear,s_Notes,dt_CreateDate,dt_EditDate from TCode_DRenewalFee ");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_ID;

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