Esempio n. 1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Model.User.SettlementAccount model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into userspaybank(");
            strSql.Append("userid,accoutType,pmode,account,payeeName,BankCode,payeeBank,provinceCode,bankProvince,cityCode,bankCity,bankAddress,status,AddTime,updateTime)");
            strSql.Append(" values (");
            strSql.Append("@userid,@accoutType,@pmode,@account,@payeeName,@BankCode,@payeeBank,@provinceCode,@bankProvince,@cityCode,@bankCity,@bankAddress,@status,@AddTime,@updateTime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userid",       SqlDbType.Int,         4),
                new SqlParameter("@accoutType",   SqlDbType.TinyInt,     1),
                new SqlParameter("@pmode",        SqlDbType.TinyInt,     1),
                new SqlParameter("@account",      SqlDbType.VarChar,    50),
                new SqlParameter("@payeeName",    SqlDbType.VarChar,    50),
                new SqlParameter("@BankCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@payeeBank",    SqlDbType.VarChar,    50),
                new SqlParameter("@provinceCode", SqlDbType.VarChar,    50),
                new SqlParameter("@bankProvince", SqlDbType.VarChar,    50),
                new SqlParameter("@cityCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@bankCity",     SqlDbType.VarChar,    50),
                new SqlParameter("@bankAddress",  SqlDbType.VarChar,   100),
                new SqlParameter("@status",       SqlDbType.TinyInt,     1),
                new SqlParameter("@AddTime",      SqlDbType.DateTime),
                new SqlParameter("@updateTime",   SqlDbType.DateTime)
            };
            parameters[0].Value  = model.Userid;
            parameters[1].Value  = model.AccoutType;
            parameters[2].Value  = model.Pmode;
            parameters[3].Value  = model.Account;
            parameters[4].Value  = model.PayeeName;
            parameters[5].Value  = model.BankCode;
            parameters[6].Value  = model.PayeeBank;
            parameters[7].Value  = model.ProvinceCode;
            parameters[8].Value  = model.BankProvince;
            parameters[9].Value  = model.CityCode;
            parameters[10].Value = model.BankCity;
            parameters[11].Value = model.BankAddress;
            parameters[12].Value = model.Status;
            parameters[13].Value = model.AddTime;
            parameters[14].Value = model.UpdateTime;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Esempio n. 2
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.User.SettlementAccount GetModel(int userid)
        {
            var strSql = new StringBuilder();

            strSql.Append(
                "select  top 1 id,userid,accoutType,pmode,account,payeeName,BankCode,payeeBank,provinceCode,bankProvince,cityCode,bankCity,bankAddress,status,AddTime,updateTime from userspaybank ");
            strSql.Append(" where userid=@userid");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userid", SqlDbType.Int, 4)
            };
            parameters[0].Value = userid;

            var     model = new Model.User.SettlementAccount();
            DataSet ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.User.SettlementAccount model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update userspaybank set ");
            strSql.Append("userid=@userid,");
            strSql.Append("accoutType=@accoutType,");
            strSql.Append("pmode=@pmode,");
            strSql.Append("account=@account,");
            strSql.Append("payeeName=@payeeName,");
            strSql.Append("BankCode=@BankCode,");
            strSql.Append("payeeBank=@payeeBank,");
            strSql.Append("provinceCode=@provinceCode,");
            strSql.Append("bankProvince=@bankProvince,");
            strSql.Append("cityCode=@cityCode,");
            strSql.Append("bankCity=@bankCity,");
            strSql.Append("bankAddress=@bankAddress,");
            strSql.Append("status=@status,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("updateTime=@updateTime");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@userid",       SqlDbType.Int,         4),
                new SqlParameter("@accoutType",   SqlDbType.TinyInt,     1),
                new SqlParameter("@pmode",        SqlDbType.TinyInt,     1),
                new SqlParameter("@account",      SqlDbType.VarChar,    50),
                new SqlParameter("@payeeName",    SqlDbType.VarChar,    50),
                new SqlParameter("@BankCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@payeeBank",    SqlDbType.VarChar,    50),
                new SqlParameter("@provinceCode", SqlDbType.VarChar,    50),
                new SqlParameter("@bankProvince", SqlDbType.VarChar,    50),
                new SqlParameter("@cityCode",     SqlDbType.VarChar,    50),
                new SqlParameter("@bankCity",     SqlDbType.VarChar,    50),
                new SqlParameter("@bankAddress",  SqlDbType.VarChar,   100),
                new SqlParameter("@status",       SqlDbType.TinyInt,     1),
                new SqlParameter("@AddTime",      SqlDbType.DateTime),
                new SqlParameter("@updateTime",   SqlDbType.DateTime),
                new SqlParameter("@id",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Userid;
            parameters[1].Value  = model.AccoutType;
            parameters[2].Value  = model.Pmode;
            parameters[3].Value  = model.Account;
            parameters[4].Value  = model.PayeeName;
            parameters[5].Value  = model.BankCode;
            parameters[6].Value  = model.PayeeBank;
            parameters[7].Value  = model.ProvinceCode;
            parameters[8].Value  = model.BankProvince;
            parameters[9].Value  = model.CityCode;
            parameters[10].Value = model.BankCity;
            parameters[11].Value = model.BankAddress;
            parameters[12].Value = model.Status;
            parameters[13].Value = model.AddTime;
            parameters[14].Value = model.UpdateTime;
            parameters[15].Value = model.id;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///     得到一个对象实体
        /// </summary>
        public Model.User.SettlementAccount DataRowToModel(DataRow row)
        {
            var model = new Model.User.SettlementAccount();

            if (row != null)
            {
                if (row["id"] != null && row["id"].ToString() != "")
                {
                    model.id = int.Parse(row["id"].ToString());
                }
                if (row["userid"] != null && row["userid"].ToString() != "")
                {
                    model.Userid = int.Parse(row["userid"].ToString());
                }
                if (row["accoutType"] != null && row["accoutType"].ToString() != "")
                {
                    model.AccoutType = int.Parse(row["accoutType"].ToString());
                }
                if (row["pmode"] != null && row["pmode"].ToString() != "")
                {
                    model.Pmode = int.Parse(row["pmode"].ToString());
                }
                if (row["account"] != null)
                {
                    model.Account = row["account"].ToString();
                }
                if (row["payeeName"] != null)
                {
                    model.PayeeName = row["payeeName"].ToString();
                }
                if (row["BankCode"] != null)
                {
                    model.BankCode = row["BankCode"].ToString();
                }
                if (row["payeeBank"] != null)
                {
                    model.PayeeBank = row["payeeBank"].ToString();
                }
                if (row["provinceCode"] != null)
                {
                    model.ProvinceCode = row["provinceCode"].ToString();
                }
                if (row["bankProvince"] != null)
                {
                    model.BankProvince = row["bankProvince"].ToString();
                }
                if (row["cityCode"] != null)
                {
                    model.CityCode = row["cityCode"].ToString();
                }
                if (row["bankCity"] != null)
                {
                    model.BankCity = row["bankCity"].ToString();
                }
                if (row["bankAddress"] != null)
                {
                    model.BankAddress = row["bankAddress"].ToString();
                }
                if (row["status"] != null && row["status"].ToString() != "")
                {
                    model.Status = int.Parse(row["status"].ToString());
                }
                if (row["AddTime"] != null && row["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(row["AddTime"].ToString());
                }
                if (row["updateTime"] != null && row["updateTime"].ToString() != "")
                {
                    model.UpdateTime = DateTime.Parse(row["updateTime"].ToString());
                }
            }
            return(model);
        }