Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(eChartProject.Model.eChart.bankaccounttype model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update bankaccounttype set ");
            strSql.Append("BankName=@BankName,");
            strSql.Append("AccountTypeName=@AccountTypeName,");
            strSql.Append("IsBankAccountTypeView=@IsBankAccountTypeView");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@BankName",              MySqlDbType.VarChar, 50),
                new MySqlParameter("@AccountTypeName",       MySqlDbType.VarChar, 50),
                new MySqlParameter("@IsBankAccountTypeView", MySqlDbType.Int32,    1),
                new MySqlParameter("@ID",                    MySqlDbType.Int32, 11)
            };
            parameters[0].Value = model.BankName;
            parameters[1].Value = model.AccountTypeName;
            parameters[2].Value = model.IsBankAccountTypeView;
            parameters[3].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(eChartProject.Model.eChart.bankaccounttype model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into bankaccounttype(");
            strSql.Append("BankName,AccountTypeName,IsBankAccountTypeView)");
            strSql.Append(" values (");
            strSql.Append("@BankName,@AccountTypeName,@IsBankAccountTypeView)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@BankName",              MySqlDbType.VarChar, 50),
                new MySqlParameter("@AccountTypeName",       MySqlDbType.VarChar, 50),
                new MySqlParameter("@IsBankAccountTypeView", MySqlDbType.Int32, 1)
            };
            parameters[0].Value = model.BankName;
            parameters[1].Value = model.AccountTypeName;
            parameters[2].Value = model.IsBankAccountTypeView;

            DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public eChartProject.Model.eChart.bankaccounttype GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,BankName,AccountTypeName,IsBankAccountTypeView from bankaccounttype ");
            strSql.Append(" where ID=@ID");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@ID", MySqlDbType.Int32)
            };
            parameters[0].Value = ID;

            eChartProject.Model.eChart.bankaccounttype model = new eChartProject.Model.eChart.bankaccounttype();
            DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BankName"] != null && ds.Tables[0].Rows[0]["BankName"].ToString() != "")
                {
                    model.BankName = ds.Tables[0].Rows[0]["BankName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["AccountTypeName"] != null && ds.Tables[0].Rows[0]["AccountTypeName"].ToString() != "")
                {
                    model.AccountTypeName = ds.Tables[0].Rows[0]["AccountTypeName"].ToString();
                }
                if (ds.Tables[0].Rows[0]["IsBankAccountTypeView"] != null && ds.Tables[0].Rows[0]["IsBankAccountTypeView"].ToString() != "")
                {
                    model.IsBankAccountTypeView = int.Parse(ds.Tables[0].Rows[0]["IsBankAccountTypeView"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }