Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Finance.Transferscheme model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update transferscheme set ");
            strSql.Append("schemename=@schemename,");
            strSql.Append("minamtlimitofeach=@minamtlimitofeach,");
            strSql.Append("maxamtlimitofeach=@maxamtlimitofeach,");
            strSql.Append("dailymaxtimes=@dailymaxtimes,");
            strSql.Append("dailymaxamt=@dailymaxamt,");
            strSql.Append("monthmaxtimes=@monthmaxtimes,");
            strSql.Append("monthmaxamt=@monthmaxamt,");
            strSql.Append("chargerate=@chargerate,");
            strSql.Append("chargeleastofeach=@chargeleastofeach,");
            strSql.Append("chargemostofeach=@chargemostofeach,");
            strSql.Append("isdefault=@isdefault");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@schemename",        SqlDbType.NVarChar, 50),
                new SqlParameter("@minamtlimitofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@maxamtlimitofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@dailymaxtimes",     SqlDbType.Int,       4),
                new SqlParameter("@dailymaxamt",       SqlDbType.Decimal,   9),
                new SqlParameter("@monthmaxtimes",     SqlDbType.Int,       4),
                new SqlParameter("@monthmaxamt",       SqlDbType.Decimal,   9),
                new SqlParameter("@chargerate",        SqlDbType.Decimal,   9),
                new SqlParameter("@chargeleastofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@chargemostofeach",  SqlDbType.Decimal,   9),
                new SqlParameter("@isdefault",         SqlDbType.TinyInt,   1),
                new SqlParameter("@id",                SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.schemename;
            parameters[1].Value  = model.minamtlimitofeach;
            parameters[2].Value  = model.maxamtlimitofeach;
            parameters[3].Value  = model.dailymaxtimes;
            parameters[4].Value  = model.dailymaxamt;
            parameters[5].Value  = model.monthmaxtimes;
            parameters[6].Value  = model.monthmaxamt;
            parameters[7].Value  = model.chargerate;
            parameters[8].Value  = model.chargeleastofeach;
            parameters[9].Value  = model.chargemostofeach;
            parameters[10].Value = model.isdefault;
            parameters[11].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.Finance.Transferscheme DataRowToModel(DataRow row)
 {
     Model.Finance.Transferscheme model = new Model.Finance.Transferscheme();
     if (row != null)
     {
         if (row["id"] != null && row["id"].ToString() != "")
         {
             model.id = int.Parse(row["id"].ToString());
         }
         if (row["schemename"] != null)
         {
             model.schemename = row["schemename"].ToString();
         }
         if (row["minamtlimitofeach"] != null && row["minamtlimitofeach"].ToString() != "")
         {
             model.minamtlimitofeach = decimal.Parse(row["minamtlimitofeach"].ToString());
         }
         if (row["maxamtlimitofeach"] != null && row["maxamtlimitofeach"].ToString() != "")
         {
             model.maxamtlimitofeach = decimal.Parse(row["maxamtlimitofeach"].ToString());
         }
         if (row["dailymaxtimes"] != null && row["dailymaxtimes"].ToString() != "")
         {
             model.dailymaxtimes = int.Parse(row["dailymaxtimes"].ToString());
         }
         if (row["dailymaxamt"] != null && row["dailymaxamt"].ToString() != "")
         {
             model.dailymaxamt = decimal.Parse(row["dailymaxamt"].ToString());
         }
         if (row["monthmaxtimes"] != null && row["monthmaxtimes"].ToString() != "")
         {
             model.monthmaxtimes = int.Parse(row["monthmaxtimes"].ToString());
         }
         if (row["monthmaxamt"] != null && row["monthmaxamt"].ToString() != "")
         {
             model.monthmaxamt = decimal.Parse(row["monthmaxamt"].ToString());
         }
         if (row["chargerate"] != null && row["chargerate"].ToString() != "")
         {
             model.chargerate = decimal.Parse(row["chargerate"].ToString());
         }
         if (row["chargeleastofeach"] != null && row["chargeleastofeach"].ToString() != "")
         {
             model.chargeleastofeach = decimal.Parse(row["chargeleastofeach"].ToString());
         }
         if (row["chargemostofeach"] != null && row["chargemostofeach"].ToString() != "")
         {
             model.chargemostofeach = decimal.Parse(row["chargemostofeach"].ToString());
         }
         if (row["isdefault"] != null && row["isdefault"].ToString() != "")
         {
             model.isdefault = int.Parse(row["isdefault"].ToString());
         }
     }
     return(model);
 }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.Finance.Transferscheme model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into transferscheme(");
            strSql.Append("schemename,minamtlimitofeach,maxamtlimitofeach,dailymaxtimes,dailymaxamt,monthmaxtimes,monthmaxamt,chargerate,chargeleastofeach,chargemostofeach,isdefault)");
            strSql.Append(" values (");
            strSql.Append("@schemename,@minamtlimitofeach,@maxamtlimitofeach,@dailymaxtimes,@dailymaxamt,@monthmaxtimes,@monthmaxamt,@chargerate,@chargeleastofeach,@chargemostofeach,@isdefault)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@schemename",        SqlDbType.NVarChar, 50),
                new SqlParameter("@minamtlimitofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@maxamtlimitofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@dailymaxtimes",     SqlDbType.Int,       4),
                new SqlParameter("@dailymaxamt",       SqlDbType.Decimal,   9),
                new SqlParameter("@monthmaxtimes",     SqlDbType.Int,       4),
                new SqlParameter("@monthmaxamt",       SqlDbType.Decimal,   9),
                new SqlParameter("@chargerate",        SqlDbType.Decimal,   9),
                new SqlParameter("@chargeleastofeach", SqlDbType.Decimal,   9),
                new SqlParameter("@chargemostofeach",  SqlDbType.Decimal,   9),
                new SqlParameter("@isdefault",         SqlDbType.TinyInt, 1)
            };
            parameters[0].Value  = model.schemename;
            parameters[1].Value  = model.minamtlimitofeach;
            parameters[2].Value  = model.maxamtlimitofeach;
            parameters[3].Value  = model.dailymaxtimes;
            parameters[4].Value  = model.dailymaxamt;
            parameters[5].Value  = model.monthmaxtimes;
            parameters[6].Value  = model.monthmaxamt;
            parameters[7].Value  = model.chargerate;
            parameters[8].Value  = model.chargeleastofeach;
            parameters[9].Value  = model.chargemostofeach;
            parameters[10].Value = model.isdefault;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemple #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.Finance.Transferscheme GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,schemename,minamtlimitofeach,maxamtlimitofeach,dailymaxtimes,dailymaxamt,monthmaxtimes,monthmaxamt,chargerate,chargeleastofeach,chargemostofeach,isdefault from transferscheme ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

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

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