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

            strSql.Append("insert into TCode_AnnualFee(");
            strSql.Append("n_RegCountry,n_PatentType,n_YearNo,n_OfficialFee,n_OfficialCurrency,s_UnitPrice,s_Unit,n_ExceedUnit,n_ExceedUnitFee,s_InitialDateType,s_Notes,dt_CreateDate,dt_EditDate,n_Months)");
            strSql.Append(" values (");
            strSql.Append("@n_RegCountry,@n_PatentType,@n_YearNo,@n_OfficialFee,@n_OfficialCurrency,@s_UnitPrice,@s_Unit,@n_ExceedUnit,@n_ExceedUnitFee,@s_InitialDateType,@s_Notes,@dt_CreateDate,@dt_EditDate,@n_Months)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_RegCountry",       SqlDbType.Int,         4),
                new SqlParameter("@n_PatentType",       SqlDbType.Int,         4),
                new SqlParameter("@n_YearNo",           SqlDbType.Decimal,     9),
                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("@s_Notes",            SqlDbType.NVarChar,  800),
                new SqlParameter("@dt_CreateDate",      SqlDbType.DateTime),
                new SqlParameter("@dt_EditDate",        SqlDbType.DateTime),
                new SqlParameter("@n_Months",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.n_RegCountry;
            parameters[1].Value  = model.n_PatentType;
            parameters[2].Value  = model.n_YearNo;
            parameters[3].Value  = model.n_OfficialFee;
            parameters[4].Value  = model.n_OfficialCurrency;
            parameters[5].Value  = model.s_UnitPrice;
            parameters[6].Value  = model.s_Unit;
            parameters[7].Value  = model.n_ExceedUnit;
            parameters[8].Value  = model.n_ExceedUnitFee;
            parameters[9].Value  = model.s_InitialDateType;
            parameters[10].Value = model.s_Notes;
            parameters[11].Value = model.dt_CreateDate;
            parameters[12].Value = model.dt_EditDate;
            parameters[13].Value = model.n_Months;

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

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

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

            IPSP.Model.TCode_AnnualFee model = new IPSP.Model.TCode_AnnualFee();
            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.º 3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.TCode_AnnualFee DataRowToModel(DataRow row)
 {
     IPSP.Model.TCode_AnnualFee model = new IPSP.Model.TCode_AnnualFee();
     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_PatentType"] != null && row["n_PatentType"].ToString() != "")
         {
             model.n_PatentType = int.Parse(row["n_PatentType"].ToString());
         }
         if (row["n_YearNo"] != null && row["n_YearNo"].ToString() != "")
         {
             model.n_YearNo = decimal.Parse(row["n_YearNo"].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["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());
         }
         if (row["n_Months"] != null && row["n_Months"].ToString() != "")
         {
             model.n_Months = int.Parse(row["n_Months"].ToString());
         }
     }
     return(model);
 }
Exemplo n.º 4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(IPSP.Model.TCode_AnnualFee model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TCode_AnnualFee set ");
            strSql.Append("n_RegCountry=@n_RegCountry,");
            strSql.Append("n_PatentType=@n_PatentType,");
            strSql.Append("n_YearNo=@n_YearNo,");
            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("s_Notes=@s_Notes,");
            strSql.Append("dt_CreateDate=@dt_CreateDate,");
            strSql.Append("dt_EditDate=@dt_EditDate,");
            strSql.Append("n_Months=@n_Months");
            strSql.Append(" where n_ID=@n_ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_RegCountry",       SqlDbType.Int,         4),
                new SqlParameter("@n_PatentType",       SqlDbType.Int,         4),
                new SqlParameter("@n_YearNo",           SqlDbType.Decimal,     9),
                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("@s_Notes",            SqlDbType.NVarChar,  800),
                new SqlParameter("@dt_CreateDate",      SqlDbType.DateTime),
                new SqlParameter("@dt_EditDate",        SqlDbType.DateTime),
                new SqlParameter("@n_Months",           SqlDbType.Int,         4),
                new SqlParameter("@n_ID",               SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.n_RegCountry;
            parameters[1].Value  = model.n_PatentType;
            parameters[2].Value  = model.n_YearNo;
            parameters[3].Value  = model.n_OfficialFee;
            parameters[4].Value  = model.n_OfficialCurrency;
            parameters[5].Value  = model.s_UnitPrice;
            parameters[6].Value  = model.s_Unit;
            parameters[7].Value  = model.n_ExceedUnit;
            parameters[8].Value  = model.n_ExceedUnitFee;
            parameters[9].Value  = model.s_InitialDateType;
            parameters[10].Value = model.s_Notes;
            parameters[11].Value = model.dt_CreateDate;
            parameters[12].Value = model.dt_EditDate;
            parameters[13].Value = model.n_Months;
            parameters[14].Value = model.n_ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.TCode_AnnualFee model)
 {
     return(dal.Update(model));
 }
Exemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(IPSP.Model.TCode_AnnualFee model)
 {
     return(dal.Add(model));
 }