public FormTaxSettingDlg(ICompany icompany, TaxLevelInfo[] taxTable, double taxStart) { this.icompany = icompany; this.taxTale = taxTable.ToList(); this.taxStart = taxStart; InitializeComponent(); Initialize(); }
private void ReadPageData() { taxStart = (double)nmeStart.Value; taxTale.Clear(); foreach (DataGridViewRow row in DgvTaxTable.Rows) { TaxLevelInfo info = new TaxLevelInfo(); info.Level = Convert.ToInt32(row.Cells[0].Value); info.StartAmount = Convert.ToDouble(row.Cells[1].Value); info.EndAmount = Convert.ToDouble(row.Cells[2].Value); info.TaxRate = Convert.ToDouble(row.Cells[3].Value); info.QuickDeduct = Convert.ToDouble(row.Cells[4].Value); taxTale.Add(info); } }
public int insertTaxLevelInfo(TaxLevelInfo info, string currentUser, SqlTransaction trans) { string sqlStr = dbUtil.getSqlStatement("SQL_COMP_InsertTaxLevelInfo"); SqlParameter[] sqlParams = TaxLevelInfoToParam(info, currentUser, true); try { return (int)DAO.DBAccess.ExecuteNonQuery(trans, CommandType.Text, sqlStr, sqlParams); } catch (Exception ex) { throw new DAOException("E0001", ex); } }
private SqlParameter[] TaxLevelInfoToParam(TaxLevelInfo info, string currentUser, bool isInsertOp) { List<SqlParameter> paras = new List<SqlParameter>(); paras.Add(new SqlParameter("@TaxLevel", SqlDbType.Int)); paras.Add(new SqlParameter("@StartAmount", SqlDbType.Float)); paras.Add(new SqlParameter("@EndAmount", SqlDbType.Float)); paras.Add(new SqlParameter("@TaxRate", SqlDbType.Float)); paras.Add(new SqlParameter("@QuickDeduct", SqlDbType.Float)); paras.Add(new SqlParameter("@UpdateUser", SqlDbType.VarChar, 20)); if (isInsertOp) { paras.Add(new SqlParameter("@CreateUser", SqlDbType.VarChar, 20)); } paras[0].Value = info.Level; paras[1].Value = info.StartAmount; paras[2].Value = info.EndAmount; paras[3].Value = info.TaxRate; paras[4].Value = info.QuickDeduct; paras[5].Value = currentUser; if (isInsertOp) { paras[6].Value = currentUser; } return paras.ToArray(); }
public List<TaxLevelInfo> getAlltaxLevelInfo() { List<TaxLevelInfo> taxTable = new List<TaxLevelInfo>(); string sqlStr = dbUtil.getSqlStatement("SQL_COMP_SearchAllTaxLevelInfo"); DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, null); foreach (DataTable dt in searchResult.Tables) { foreach (DataRow dr in dt.Rows) { TaxLevelInfo tli = new TaxLevelInfo(); tli.Level = Convert.ToInt32(dr["Level"]); tli.StartAmount = Convert.ToDouble(dr["StartAmount"]); tli.EndAmount = Convert.ToDouble(dr["EndAmount"]); tli.TaxRate = Convert.ToDouble(dr["TaxRate"]); tli.QuickDeduct = Convert.ToDouble(dr["QuickDeduct"]); taxTable.Add(tli); } } return taxTable; } catch (Exception ex) { throw new DAOException("E0001", ex); } }