/// <summary> /// 增加一条数据 /// </summary> public void Add(eChartProject.Model.eChart.fundbankaccount model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into fundbankaccount("); strSql.Append("FundID,BankAccountTypeID,FundBankAccountBSB,FundBankAccountNo,IsClientAdded,IsClientView,FundBankAccountName)"); strSql.Append(" values ("); strSql.Append("@FundID,@BankAccountTypeID,@FundBankAccountBSB,@FundBankAccountNo,@IsClientAdded,@IsClientView,@FundBankAccountName)"); MySqlParameter[] parameters = { new MySqlParameter("@FundID", MySqlDbType.Int32, 11), new MySqlParameter("@BankAccountTypeID", MySqlDbType.Int32, 11), new MySqlParameter("@FundBankAccountBSB", MySqlDbType.VarChar, 6), new MySqlParameter("@FundBankAccountNo", MySqlDbType.VarChar, 50), new MySqlParameter("@IsClientAdded", MySqlDbType.Int32, 1), new MySqlParameter("@IsClientView", MySqlDbType.Int32, 1), new MySqlParameter("@FundBankAccountName", MySqlDbType.VarChar, 100) }; parameters[0].Value = model.FundID; parameters[1].Value = model.BankAccountTypeID; parameters[2].Value = model.FundBankAccountBSB; parameters[3].Value = model.FundBankAccountNo; parameters[4].Value = model.IsClientAdded; parameters[5].Value = model.IsClientView; parameters[6].Value = model.FundBankAccountName; DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); }
/// <summary> /// 得到一个对象实体 /// </summary> public eChartProject.Model.eChart.fundbankaccount GetModel(int ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select ID,FundID,BankAccountTypeID,FundBankAccountBSB,FundBankAccountNo,IsClientAdded,IsClientView,FundBankAccountName from fundbankaccount "); strSql.Append(" where ID=@ID"); MySqlParameter[] parameters = { new MySqlParameter("@ID", MySqlDbType.Int32) }; parameters[0].Value = ID; eChartProject.Model.eChart.fundbankaccount model = new eChartProject.Model.eChart.fundbankaccount(); 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]["FundID"] != null && ds.Tables[0].Rows[0]["FundID"].ToString() != "") { model.FundID = int.Parse(ds.Tables[0].Rows[0]["FundID"].ToString()); } if (ds.Tables[0].Rows[0]["BankAccountTypeID"] != null && ds.Tables[0].Rows[0]["BankAccountTypeID"].ToString() != "") { model.BankAccountTypeID = int.Parse(ds.Tables[0].Rows[0]["BankAccountTypeID"].ToString()); } if (ds.Tables[0].Rows[0]["FundBankAccountBSB"] != null && ds.Tables[0].Rows[0]["FundBankAccountBSB"].ToString() != "") { model.FundBankAccountBSB = ds.Tables[0].Rows[0]["FundBankAccountBSB"].ToString(); } if (ds.Tables[0].Rows[0]["FundBankAccountNo"] != null && ds.Tables[0].Rows[0]["FundBankAccountNo"].ToString() != "") { model.FundBankAccountNo = ds.Tables[0].Rows[0]["FundBankAccountNo"].ToString(); } if (ds.Tables[0].Rows[0]["IsClientAdded"] != null && ds.Tables[0].Rows[0]["IsClientAdded"].ToString() != "") { model.IsClientAdded = ds.Tables[0].Rows[0]["IsClientAdded"].ToString() == "TRUE" ? 1 : 0; } if (ds.Tables[0].Rows[0]["IsClientView"] != null && ds.Tables[0].Rows[0]["IsClientView"].ToString() != "") { model.IsClientView = ds.Tables[0].Rows[0]["IsClientView"].ToString() == "TRUE" ? 1 : 0; } if (ds.Tables[0].Rows[0]["FundBankAccountName"] != null && ds.Tables[0].Rows[0]["FundBankAccountName"].ToString() != "") { model.FundBankAccountName = ds.Tables[0].Rows[0]["FundBankAccountName"].ToString(); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(eChartProject.Model.eChart.fundbankaccount model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update fundbankaccount set "); strSql.Append("FundID=@FundID,"); strSql.Append("BankAccountTypeID=@BankAccountTypeID,"); strSql.Append("FundBankAccountBSB=@FundBankAccountBSB,"); strSql.Append("FundBankAccountNo=@FundBankAccountNo,"); strSql.Append("IsClientAdded=@IsClientAdded,"); strSql.Append("IsClientView=@IsClientView,"); strSql.Append("FundBankAccountName=@FundBankAccountName"); strSql.Append(" where ID=@ID"); MySqlParameter[] parameters = { new MySqlParameter("@FundID", MySqlDbType.Int32, 11), new MySqlParameter("@BankAccountTypeID", MySqlDbType.Int32, 11), new MySqlParameter("@FundBankAccountBSB", MySqlDbType.VarChar, 6), new MySqlParameter("@FundBankAccountNo", MySqlDbType.VarChar, 50), new MySqlParameter("@IsClientAdded", MySqlDbType.Int32, 1), new MySqlParameter("@IsClientView", MySqlDbType.Int32, 1), new MySqlParameter("@FundBankAccountName", MySqlDbType.VarChar, 100), new MySqlParameter("@ID", MySqlDbType.Int32, 11) }; parameters[0].Value = model.FundID; parameters[1].Value = model.BankAccountTypeID; parameters[2].Value = model.FundBankAccountBSB; parameters[3].Value = model.FundBankAccountNo; parameters[4].Value = model.IsClientAdded; parameters[5].Value = model.IsClientView; parameters[6].Value = model.FundBankAccountName; parameters[7].Value = model.ID; int rows = DbHelperMySQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }