Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(CZB.Model.FX_PolicyInsurePara model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FX_PolicyInsurePara(");
            strSql.Append("PolicyID,InsureCode,BusinessTotal,BusinessCommission,BusinessCommissionLevel1,BusinessCommissionLevel2,BusinessTax,CompulsoryTotal,CompulsoryCommission,CompulsoryCommissionLelve1,CompulsoryCommissionLelve2,CompulsoryTax,CreateTime)");
            strSql.Append(" values (");
            strSql.Append("@PolicyID,@InsureCode,@BusinessTotal,@BusinessCommission,@BusinessCommissionLevel1,@BusinessCommissionLevel2,@BusinessTax,@CompulsoryTotal,@CompulsoryCommission,@CompulsoryCommissionLelve1,@CompulsoryCommissionLelve2,@CompulsoryTax,@CreateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PolicyID",                   SqlDbType.Int,       4),
                new SqlParameter("@InsureCode",                 SqlDbType.NVarChar, 50),
                new SqlParameter("@BusinessTotal",              SqlDbType.Decimal,   9),
                new SqlParameter("@BusinessCommission",         SqlDbType.Decimal,   9),
                new SqlParameter("@BusinessCommissionLevel1",   SqlDbType.Decimal,   9),
                new SqlParameter("@BusinessCommissionLevel2",   SqlDbType.Decimal,   9),
                new SqlParameter("@BusinessTax",                SqlDbType.Decimal,   9),
                new SqlParameter("@CompulsoryTotal",            SqlDbType.Decimal,   9),
                new SqlParameter("@CompulsoryCommission",       SqlDbType.Decimal,   9),
                new SqlParameter("@CompulsoryCommissionLelve1", SqlDbType.Decimal,   9),
                new SqlParameter("@CompulsoryCommissionLelve2", SqlDbType.Decimal,   9),
                new SqlParameter("@CompulsoryTax",              SqlDbType.Decimal,   9),
                new SqlParameter("@CreateTime",                 SqlDbType.DateTime)
            };
            parameters[0].Value  = model.PolicyID;
            parameters[1].Value  = model.InsureCode;
            parameters[2].Value  = model.BusinessTotal;
            parameters[3].Value  = model.BusinessCommission;
            parameters[4].Value  = model.BusinessCommissionLevel1;
            parameters[5].Value  = model.BusinessCommissionLevel2;
            parameters[6].Value  = model.BusinessTax;
            parameters[7].Value  = model.CompulsoryTotal;
            parameters[8].Value  = model.CompulsoryCommission;
            parameters[9].Value  = model.CompulsoryCommissionLelve1;
            parameters[10].Value = model.CompulsoryCommissionLelve2;
            parameters[11].Value = model.CompulsoryTax;
            parameters[12].Value = model.CreateTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(CZB.Model.FX_PolicyInsurePara model)
 {
     return(dal.Update(model));
 }
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(CZB.Model.FX_PolicyInsurePara model)
 {
     return(dal.Add(model));
 }
Example #4
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(CZB.Model.FX_PolicyInsurePara model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FX_PolicyInsurePara set ");
            strSql.Append("PolicyID=@PolicyID,");
            strSql.Append("InsureCode=@InsureCode,");
            strSql.Append("BusinessTotal=@BusinessTotal,");
            strSql.Append("BusinessCommission=@BusinessCommission,");
            strSql.Append("BusinessCommissionLevel1=@BusinessCommissionLevel1,");
            strSql.Append("BusinessCommissionLevel2=@BusinessCommissionLevel2,");
            strSql.Append("BusinessTax=@BusinessTax,");
            strSql.Append("CompulsoryTotal=@CompulsoryTotal,");
            strSql.Append("CompulsoryCommission=@CompulsoryCommission,");
            strSql.Append("CompulsoryCommissionLelve1=@CompulsoryCommissionLelve1,");
            strSql.Append("CompulsoryCommissionLelve2=@CompulsoryCommissionLelve2,");
            strSql.Append("CompulsoryTax=@CompulsoryTax,");
            strSql.Append("CreateTime=@CreateTime");
            strSql.Append(" where FX_PolicyInsureMoneyParaID=@FX_PolicyInsureMoneyParaID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PolicyID",                   SqlDbType.Int,        4),
                new SqlParameter("@InsureCode",                 SqlDbType.NVarChar,  50),
                new SqlParameter("@BusinessTotal",              SqlDbType.Decimal,    9),
                new SqlParameter("@BusinessCommission",         SqlDbType.Decimal,    9),
                new SqlParameter("@BusinessCommissionLevel1",   SqlDbType.Decimal,    9),
                new SqlParameter("@BusinessCommissionLevel2",   SqlDbType.Decimal,    9),
                new SqlParameter("@BusinessTax",                SqlDbType.Decimal,    9),
                new SqlParameter("@CompulsoryTotal",            SqlDbType.Decimal,    9),
                new SqlParameter("@CompulsoryCommission",       SqlDbType.Decimal,    9),
                new SqlParameter("@CompulsoryCommissionLelve1", SqlDbType.Decimal,    9),
                new SqlParameter("@CompulsoryCommissionLelve2", SqlDbType.Decimal,    9),
                new SqlParameter("@CompulsoryTax",              SqlDbType.Decimal,    9),
                new SqlParameter("@CreateTime",                 SqlDbType.DateTime),
                new SqlParameter("@FX_PolicyInsureMoneyParaID", SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PolicyID;
            parameters[1].Value  = model.InsureCode;
            parameters[2].Value  = model.BusinessTotal;
            parameters[3].Value  = model.BusinessCommission;
            parameters[4].Value  = model.BusinessCommissionLevel1;
            parameters[5].Value  = model.BusinessCommissionLevel2;
            parameters[6].Value  = model.BusinessTax;
            parameters[7].Value  = model.CompulsoryTotal;
            parameters[8].Value  = model.CompulsoryCommission;
            parameters[9].Value  = model.CompulsoryCommissionLelve1;
            parameters[10].Value = model.CompulsoryCommissionLelve2;
            parameters[11].Value = model.CompulsoryTax;
            parameters[12].Value = model.CreateTime;
            parameters[13].Value = model.FX_PolicyInsureMoneyParaID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }