public int[] getTotalValuesForAllBudgetItems(String startDate, String endDate) { //Arguments checks if (startDate == null || endDate == null) { return(null); } if ("".Equals(startDate) || "".Equals(endDate)) { return(null); } //Data container object and MySqlCommand creation QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).build(); MySqlCommand getTotalValuesForAllItemsCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalValuesForAllItems, paramContainer); DataTable itemsTotalValuesDataTable = DBConnectionManager.getData(getTotalValuesForAllItemsCommand); //Null and row count check on the resulted DataTable object if (itemsTotalValuesDataTable == null || itemsTotalValuesDataTable.Rows.Count <= 0) { return(null); } //DataTable values conversion to int int expensesTotalValue = itemsTotalValuesDataTable.Rows[0].ItemArray[0] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[0]) : 0; int debtsTotalValue = itemsTotalValuesDataTable.Rows[0].ItemArray[1] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[1]) : 0; int savingsTotalValue = itemsTotalValuesDataTable.Rows[0].ItemArray[2] != DBNull.Value ? Convert.ToInt32(itemsTotalValuesDataTable.Rows[0].ItemArray[2]) : 0; //Creating the array containing the total values for each budget item int[] budgetItemsTotals = new int[] { expensesTotalValue, debtsTotalValue, savingsTotalValue }; return(budgetItemsTotals); }
public int execute(QueryData paramContainer) { //Data retrieval from the container object IncomeSource incomeSource = paramContainer.IncomeSource; int userID = paramContainer.UserID; String expenseName = paramContainer.ItemName; int expenseTypeID = DataInsertionUtils.getID(sqlStatementSelectExpenseTypeID, paramContainer.TypeName); int expenseValue = paramContainer.ItemValue; String expenseDate = paramContainer.ItemCreationDate; int executionResult = -1; MySqlCommand expenseInsertionCommand = null; if (incomeSource == IncomeSource.GENERAL_INCOMES) { expenseInsertionCommand = SQLCommandBuilder.getInsertCommandForMultipleTypeItem(sqlStatementInsertGeneralIncomesExpense, userID, expenseName, expenseTypeID, expenseValue, expenseDate); executionResult = DBConnectionManager.insertData(expenseInsertionCommand);;//Uses the SQL statement that inserts the expense in the expenses table of the DB } else if (incomeSource == IncomeSource.SAVING_ACCOUNT) { expenseInsertionCommand = SQLCommandBuilder.getInsertCommandForMultipleTypeItem(sqlStatementInsertSavingAccountExpense, userID, expenseName, expenseTypeID, expenseValue, expenseDate); executionResult = DBConnectionManager.insertData(expenseInsertionCommand);//Uses SQL statement that inserts the expense in the saving_account_expenses table of the DB } return(executionResult); }
private String sqlStatementGetDebtorID = @"SELECT debtorID FROM debtors WHERE debtorName = @paramTypeName";//Modify the getID method of DataInsertionUtils class to use a more generic record ID retrieval method from the SQLCommandBuilder class public int execute(QueryData paramContainer) { Guard.notNull(paramContainer, "parameter container"); int executionResult = -1; //Retrieving the ID of the selected debtor int debtorID = DataInsertionUtils.getID(sqlStatementGetDebtorID, paramContainer.DebtorName); //Creating a new param container object that contains all the values from the param container received as argument plus the debtor ID(which will be necessary for inserting the new receivable record) QueryData updatedParamContainer = new QueryData.Builder(paramContainer.UserID) .addItemName(paramContainer.ItemName) .addItemValue(paramContainer.ItemValue) .addDebtorName(paramContainer.DebtorName) .addDebtorID(debtorID) .addStartDate(paramContainer.StartDate) .addEndDate(paramContainer.EndDate) .addIncomeSource(paramContainer.IncomeSource) .addPaidAmount(paramContainer.PaidAmount) .build(); MySqlCommand insertReceivableCommand = SQLCommandBuilder.getReceivableInsertionCommand(sqlStatementInsertReceivable, updatedParamContainer); executionResult = DBConnectionManager.insertData(insertReceivableCommand); return(executionResult); }
//Method for getting the right Sql command according to the user selected budget item(general expense, debt saving) private MySqlCommand getCorrectSqlCommand(BudgetItemType itemType, String startDate, String endDate) { MySqlCommand getTotalItemValueCommand = null; QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate).addEndDate(endDate).build(); switch (itemType) { //CHANGE(FROM EXPENSE TO GENERAL EXPENSE)!!! case BudgetItemType.GENERAL_EXPENSE: getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalExpenses, paramContainer); break; case BudgetItemType.DEBT: getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalDebts, paramContainer); break; case BudgetItemType.SAVING: getTotalItemValueCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalSavings, paramContainer); break; default: break; } return(getTotalItemValueCommand); }
private MySqlCommand getCorrectSqlCommandForDataDisplay(QueryType option, QueryData paramContainer) { if (option == QueryType.SINGLE_MONTH) { MySqlCommand singleMonthBudgetPlanCommand = SQLCommandBuilder.getSingleMonthCommand(sqlStatementSelectBudgetPlanForASingleMonth, paramContainer); return(singleMonthBudgetPlanCommand); } else if (option == QueryType.FULL_YEAR) { MySqlCommand fullYearBudgetPlansCommand = SQLCommandBuilder.getFullYearRecordsCommand(sqlStatementSelectBudgetPlansForTheWholeYear, paramContainer); return(fullYearBudgetPlansCommand); } else if (option == QueryType.BUDGET_PLAN_INFO) { //Gets the budget plan info retrieval command by using the getMultipleMonthsCommand method for both single month and multiple months budget plans because in both cases the startDate and endDate are used to identify the plan so there was no point in creating a different SQL statement for each case. //It was also more efficient to reuse the getMultipleMonthsCommand() method which already could handle the userID, startDate and endDate parameters than to create a different method MySqlCommand budgetPlanInfoCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetItemValuesForMultipleMonthsPlan, paramContainer); return(budgetPlanInfoCommand); } return(null); }
public string GetCommand(int entry, float[] prob, string[] text1, string[] text2, Language[] lang, int[][] emDelay, int[][] emEmote) { var builder = new SQLCommandBuilder("npc_text"); builder.AddColumnValue("ID", entry); for (var i = 0; i < 8; i++) { builder.AddColumnValue("text" + i + "_0", text1[i]); builder.AddColumnValue("text" + i + "_1", text2[i]); builder.AddColumnValue("lang" + i, (int)lang[i]); builder.AddColumnValue("prob" + i, prob[i]); var k = 0; for (var j = 0; j < 3; j++) { builder.AddColumnValue("em" + i + "_" + k, emDelay[i][j]); k++; builder.AddColumnValue("em" + i + "_" + k, emEmote[i][j]); k++; } } return builder.BuildInsert(); }
public string GetCommand(string field, uint where, object value) { var builder = new SQLCommandBuilder("gameobject"); builder.AddUpdateValue(field, value); return(builder.BuildUpdate("guid = " + where)); }
private void createPlanButton_Click(object sender, EventArgs e) { //Checks if the total value of the set percentages is equal to 100 int totalPercentageValue = Convert.ToInt32(expensesNumericUpDown.Value) + Convert.ToInt32(debtsNumericUpDown.Value) + Convert.ToInt32(savingsNumericUpDown.Value); if (totalPercentageValue < 100) { MessageBox.Show("The total value of the set percentages must be equal to 100! Please fill in the remaining value by assigning it to one or more elements.", "Budget plan creator", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } //Checks if the plan that the user wants to create has a length smaller or equal to the number of months left from the current year if (!hasMonthsLeftForCurrentSelection(startMonthNumericUpDown, oneMonthCheckBox, sixMonthsCheckBox)) { MessageBox.Show("The selected budget plan cannot be created if the number of remaining months is lower than the selected plan's length!", "Budget plan creator", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } //Checks if a budget plan already exists for the selected period int selectedMonth = Convert.ToInt32(startMonthNumericUpDown.Value); if (hasPlanForCurrenMonthSelection(userID, selectedMonth)) { MessageBox.Show("A budget plan already exists for the selected interval! Please select another interval or modify/delete the existing plan", "Budget plan creator", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); return; } //Asks the user to confirm his intention of creating a new budget plan DialogResult createPlanOption = MessageBox.Show("Are you sure that you want to create a new budget plan using the provided data?", "Budget plan creator", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (createPlanOption == DialogResult.No) { return; } //Asks the uer if he wants to use the default value of the budget item limit percentage NumericUpDown[] budgetItemLimitControls = new NumericUpDown[] { expensesNumericUpDown, debtsNumericUpDown, savingsNumericUpDown }; DialogResult useDefaultValueOption = MessageBox.Show("One or more controls used for setting the budget item limit percentage is/are set to the default value. By using this value you will limit your possibility of entering records for that item. Are you sure that you want to continue?", "Insert data form", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (useDefaultValueOption == DialogResult.No) { return; } QueryData paramContainer = getDataForBudgetPlanCreation(userID); MySqlCommand budgetPlanCreationCommand = SQLCommandBuilder.getBudgetPlanCreationCommand(sqlStatementInsertNewPlanData, paramContainer); int executionResult = DBConnectionManager.insertData(budgetPlanCreationCommand); if (executionResult != -1) { MessageBox.Show("Your new budget plan was successfully created!", "Budget plan creator", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Unable to create the new budget plan! Please try again", "Budget plan creator", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
//Method for inserting a new record in the saving account expenses table public int createSavingAccountExpenseRecord(String recordName, int recordValue, int typeID) { //Creates the SQL command for inserting a new record into the saving account expenses table MySqlCommand createSavingAccountExpenseCommand = SQLCommandBuilder.getInsertCommandForMultipleTypeItem(sqlStatementCreateSavingAccountExpense, userID, recordName, typeID, recordValue, date.ToString("yyyy-MM-dd")); int executionResult = DBConnectionManager.insertData(createSavingAccountExpenseCommand); return(executionResult); }
public string GetCommand(int entry, string pageText, int nextPage) { var cmd = new SQLCommandBuilder("page_text"); cmd.AddColumnValue("entry", entry); cmd.AddColumnValue("text", pageText); cmd.AddColumnValue("next_page", nextPage); return cmd.BuildInsert(); }
public static string GetCommand(Waypoint wp) { var builder = new SQLCommandBuilder("waypoints"); builder.AddColumnValue("entry",wp.NpcEntry); builder.AddColumnValue("pointid", wp.Id); builder.AddColumnValue("position_x", wp.X); builder.AddColumnValue("position_y", wp.Y); builder.AddColumnValue("position_z", wp.Z); return builder.BuildInsert(); }
public string GetCommand(Race race, Class clss, int spellId) { var builder = new SQLCommandBuilder("playercreateinfo_spell"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("Spell", spellId); builder.AddColumnValue("Note", string.Empty); return(builder.BuildInsert()); }
public string GetCommand(Race race, Class clss, int spellId) { var builder = new SQLCommandBuilder("playercreateinfo_spell"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("Spell", spellId); builder.AddColumnValue("Note", string.Empty); return builder.BuildInsert(); }
//Method for inserting a new record in the saving account balance record table public int createBalanceRecord(int recordValue) { String recordName = createRecordName(date); QueryData paramContainer = new QueryData.Builder(userID).addItemName(recordName).addItemValue(recordValue).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build(); MySqlCommand createBalanceRecordCommand = SQLCommandBuilder.getBalanceRecordInsertUpdateCommand(sqlStatementCreateBalanceRecord, paramContainer); int executionResult = DBConnectionManager.insertData(createBalanceRecordCommand); return(executionResult); }
public string GetCommand(Race race, Class clss, int action, int button, ActionButtonType type) { var builder = new SQLCommandBuilder("playercreateinfo_action"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("button", button); builder.AddColumnValue("action", action); builder.AddColumnValue("type", (int)type); return builder.BuildInsert(); }
public string GetCommand(Race race, Class clss, int action, int button, ActionButtonType type) { var builder = new SQLCommandBuilder("playercreateinfo_action"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("button", button); builder.AddColumnValue("action", action); builder.AddColumnValue("type", (int)type); return(builder.BuildInsert()); }
public string GetCommand(uint entry, int itemId, int maxCount, int extendedCost) { var builder = new SQLCommandBuilder("npc_vendor"); builder.AddColumnValue("entry", entry); builder.AddColumnValue("item", itemId); builder.AddColumnValue("maxcount", maxCount); builder.AddColumnValue("incrtime", 0); builder.AddColumnValue("ExtendedCost", extendedCost); return builder.BuildInsert(); }
private bool hasPlanForCurrenMonthSelection(int userID, int month) { int year = DateTime.Now.Year; int day = 1; //Creates a DateTime object representing the first day of the selected month from the current year DateTime startDate = new DateTime(year, month, day); if (oneMonthCheckBox.Checked == true) { //Creates a data container which will be passed to the MySqlCommand builder method(the date is transformed into a string having the format required by the MySql database) QueryData paramContainer = new QueryData.Builder(userID).addStartDate(startDate.ToString("yyyy-MM-dd")).build(); //CHANGE MySqlCommand budgetPlanStartDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainer); //Executes a MySqlCommand for checking the existence of a budget plan for the selected interval DataTable budgetPlanDataTable = DBConnectionManager.getData(budgetPlanStartDateCheckCommand); //The DataTable object is checked to see if it contains any results if (budgetPlanDataTable != null && budgetPlanDataTable.Rows.Count > 0) { return(true); } } else if (sixMonthsCheckBox.Checked == true) { //Gets the last month of the interval int endMonth = month + 6; //Gets the last day of the month int lastDayOfEndMonth = DateTime.DaysInMonth(year, endMonth); DateTime endDate = new DateTime(year, endMonth, lastDayOfEndMonth); //SQL commands are created for the start month and end month of the interval QueryData paramContainerStartDate = new QueryData.Builder(userID).addStartDate(startDate.ToString("yyyy-MM-dd")).build(); //CHANGE MySqlCommand budgetPlanStartDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainerStartDate); QueryData paramContainerEndDate = new QueryData.Builder(userID).addEndDate(endDate.ToString("yyyy-MM-dd")).build();//CHANGE MySqlCommand budgetPlanEndDateCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainerEndDate); //The commands are executed against the DB DataTable budgetPlanDataTableStart = DBConnectionManager.getData(budgetPlanStartDateCheckCommand); DataTable budgetPlanDataTableEnd = DBConnectionManager.getData(budgetPlanEndDateCheckCommand); //If the start month or the end month is present in the interval specified by an existing budget plan then it means that the two plans overlap and the new plan will not be created. if (budgetPlanDataTableStart != null && budgetPlanDataTableStart.Rows.Count > 0 || budgetPlanDataTableEnd != null && budgetPlanDataTableEnd.Rows.Count > 0) { return(true); } } return(false); }
public int execute(QueryData paramContainer) { //Getting the necessary data int userID = paramContainer.UserID; String savingName = paramContainer.ItemName; int savingValue = paramContainer.ItemValue; String savingDate = paramContainer.ItemCreationDate; //Creating command for saving insertion MySqlCommand savingInsertionCommand = SQLCommandBuilder.getSavingInsertionCommand(sqlStatementInsertSaving, userID, savingName, savingValue, savingDate); int executionResult = DBConnectionManager.insertData(savingInsertionCommand); return(executionResult); }
public string GetCommand(Race race, Class clss, int map, int zone, Vector3 pos) { var builder = new SQLCommandBuilder("playercreateinfo"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("map", map); builder.AddColumnValue("zone", zone); builder.AddColumnValue("position_x", pos.X); builder.AddColumnValue("position_y", pos.Y); builder.AddColumnValue("position_z", pos.Z); return builder.BuildInsert(); }
public string GetCommand(uint entry, int spellId, int cost, int reqLevel, int reqSkill, int reqSkLvl) { var builder = new SQLCommandBuilder("npc_trainer"); builder.AddColumnValue("entry", entry); builder.AddColumnValue("spell", spellId); builder.AddColumnValue("spellcost", cost); builder.AddColumnValue("reqskill", reqSkill); builder.AddColumnValue("reqskillvalue", reqSkLvl); builder.AddColumnValue("reqlevel", reqLevel); return builder.BuildInsert(); }
public string GetCommand(Race race, Class clss, int map, int zone, Vector3 pos) { var builder = new SQLCommandBuilder("playercreateinfo"); builder.AddColumnValue("race", (int)race); builder.AddColumnValue("class", (int)clss); builder.AddColumnValue("map", map); builder.AddColumnValue("zone", zone); builder.AddColumnValue("position_x", pos.X); builder.AddColumnValue("position_y", pos.Y); builder.AddColumnValue("position_z", pos.Z); return(builder.BuildInsert()); }
private MySqlCommand getCorrectCommandForDataDisplay(QueryType option, QueryData paramContainer) { //Retrieving data from the Querydata object(container object) int userID = paramContainer.UserID; String tableName = paramContainer.TableName; int selectedMonth = 0; //If single month data is requested then the value of the month from the QueryData object will be retrieved if (option == QueryType.SINGLE_MONTH) { selectedMonth = paramContainer.Month; } int selectedYear = paramContainer.Year; switch (tableName) { //Creates the correct SQL command based on the dateTimePicker selection(single month command/multiple months command) case "Savings": if (option == QueryType.SINGLE_MONTH) { return(SQLCommandBuilder.getSingleMonthCommand(sqlStatementSingleMonthSavings, paramContainer)); } else if (option == QueryType.MULTIPLE_MONTHS) { return(SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementMultipleMonthsSavings, paramContainer)); } else { return(null); } case "Saving accounts expenses": if (option == QueryType.SINGLE_MONTH) { return(SQLCommandBuilder.getSingleMonthCommand(sqlStatementSingleMonthSavingAccountExpenses, paramContainer)); } else if (option == QueryType.MULTIPLE_MONTHS) { return(SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementMultipleMonthsSavingAccountExpenses, paramContainer)); } else { return(null); } default: return(null); } }
//Method that retrieves the budget plan data(if the plan exists) based on the specified currentDate(it is actually the date that the user selects for the new entry which is checked to see if it overlaps any existing budget plan timespan) public DataTable getBudgetPlanData() { QueryData paramContainer = new QueryData.Builder(userID).addStartDate(currentDate).build(); MySqlCommand budgetPlanExistenceCheckCommand = SQLCommandBuilder.getBudgetPlanCheckCommand(sqlStatementCheckBudgetPlanExistence, paramContainer); DataTable budgetPlanDataTable = DBConnectionManager.getData(budgetPlanExistenceCheckCommand); if (budgetPlanDataTable != null && budgetPlanDataTable.Rows.Count == 1) { return(budgetPlanDataTable); } return(null); }
private void Init() { filter_list = new List <string>(); filters = 0; comm = new SqlCommand(); command = new SQLCommandBuilder(); command.EditCommand("SELECT"); command.AddParams("PersonID, FirstName, MiddleName, LastName, Street1, Street2, City, State, Zip, HomePhone, Email, MobilePhone, InstagramURL"); command.EditCommand("FROM", "People"); command.EditCommand("WHERE", "0=0 "); RefreshView(); UpdateFilterString(); }
public int execute(QueryData paramContainer) { //Getting the necessary data int userID = paramContainer.UserID; String debtName = paramContainer.ItemName; int debtValue = paramContainer.ItemValue; int creditorID = DataInsertionUtils.getID(sqlStatementSelectCreditorID, paramContainer.CreditorName); String debtDate = paramContainer.ItemCreationDate; //Creating command for debt insertion MySqlCommand debtInsertionCommand = SQLCommandBuilder.getDebtInsertionCommand(sqlStatementInsertDebt, userID, debtName, debtValue, creditorID, debtDate); int executionResult = DBConnectionManager.insertData(debtInsertionCommand); return(executionResult); }
public int execute(QueryData paramContainer) { //Getting the necessary data int userID = paramContainer.UserID; String incomeName = paramContainer.ItemName; int incomeTypeID = getID(sqlStatementSelectIncomeTypeID, paramContainer.TypeName); //Ia ca argumente fraza SQL si denumirea tipului de venit selectat int incomeValue = Convert.ToInt32(paramContainer.ItemValue); String incomeDate = paramContainer.ItemCreationDate; //Obtinere data sub forma de String //Creating command for income insertion MySqlCommand incomeInsertionCommand = SQLCommandBuilder.getInsertCommandForMultipleTypeItem(sqlStatementInsertIncome, userID, incomeName, incomeTypeID, incomeValue, incomeDate); //Getting the execution command result int executionResult = DBConnectionManager.insertData(incomeInsertionCommand); return(executionResult); }
//Method for retrieving the ID for the selected budget plan type private int getBudgetTypeID(String budgetPlanTypeName) { MySqlCommand getTypeIDCommand = SQLCommandBuilder.getTypeIDForItemCommand(sqlStatementGetBudgetPlanTypeID, budgetPlanTypeName); //CHANGE DataTable typeIDDataTable = DBConnectionManager.getData(getTypeIDCommand); if (typeIDDataTable != null && typeIDDataTable.Rows.Count == 1) { //Null check for the retrieved data(if the element at index 0 of the ItemArray is null then the typeID variable is assigned -1 value) int typeID = typeIDDataTable.Rows[0].ItemArray[0] != DBNull.Value ? Convert.ToInt32(typeIDDataTable.Rows[0].ItemArray[0]) : -1; return(typeID); } return(-1); }
public string GetCommand(int questId, int idx, int objIndex, int mapId, int wmaId, int floorId, int unk3, int unk4) { var builder = new SQLCommandBuilder("quest_poi"); builder.AddColumnValue("questid", questId); builder.AddColumnValue("id", idx); builder.AddColumnValue("objIndex", objIndex); builder.AddColumnValue("mapId", mapId); builder.AddColumnValue("WorldMapAreaId", wmaId); builder.AddColumnValue("FloorId", floorId); builder.AddColumnValue("unk3", unk3); builder.AddColumnValue("unk4", unk4); return(builder.BuildInsert()); }
public string GetCommand(int questId, int idx, int objIndex, int mapId, int wmaId, int floorId, int unk3, int unk4) { var builder = new SQLCommandBuilder("quest_poi"); builder.AddColumnValue("questid", questId); builder.AddColumnValue("id", idx); builder.AddColumnValue("objIndex", objIndex); builder.AddColumnValue("mapId", mapId); builder.AddColumnValue("WorldMapAreaId", wmaId); builder.AddColumnValue("FloorId", floorId); builder.AddColumnValue("unk3", unk3); builder.AddColumnValue("unk4", unk4); return builder.BuildInsert(); }
private void Init() { filter_list = new List <string>(); filters = 0; comm = new SqlCommand(); command = new SQLCommandBuilder(); command.EditCommand("SELECT"); command.AddParams("PersonID, FirstName, MiddleName, LastName, Street1, Street2, City, State, Zip, HomePhone, Email, MobilePhone, InstagramURL"); command.EditCommand("FROM", "People"); command.EditCommand("WHERE", "0=0 "); var result = Program.database.SearchRequest(command.GetSQL(), "parameter", textbox_search.GetText()); dataGridView1.DataSource = result; dataGridView1.DataMember = result.Tables["Search Results"].ToString(); UpdateFilterString(); }
//Method for retrieving the record value from the saving account balance table public int getRecordValue() { int recordValue = -1; QueryData paramContainer = new QueryData.Builder(userID).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build(); MySqlCommand recordRetrievalCommand = SQLCommandBuilder.getSingleMonthCommand(sqlStatementCheckRecordExistence, paramContainer); DataTable resultDataTable = DBConnectionManager.getData(recordRetrievalCommand); if (resultDataTable != null && resultDataTable.Rows.Count == 1) { Object valueObject = resultDataTable.Rows[0].ItemArray[3]; recordValue = valueObject != DBNull.Value ? Convert.ToInt32(valueObject) : -1; } return(recordValue); }
//Method for retrieving the total income value for the specified interval public int getTotalIncomes(String startDate, String endDate) { String sqlFormatStartDate = DateTime.Parse(startDate).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); String sqlFormatEndDate = DateTime.Parse(endDate).ToString("yyyy-MM-dd", CultureInfo.InvariantCulture); QueryData paramContainer = new QueryData.Builder(userID).addStartDate(sqlFormatStartDate).addEndDate(sqlFormatEndDate).build(); MySqlCommand getTotalIncomesCommand = SQLCommandBuilder.getMultipleMonthsCommand(sqlStatementGetTotalIncomes, paramContainer); //The DataTable object that contains the total incomes value for the specified time interval DataTable totalIncomesDataTable = DBConnectionManager.getData(getTotalIncomesCommand); if (totalIncomesDataTable != null && totalIncomesDataTable.Rows.Count == 1) { int totalIncomes = totalIncomesDataTable.Rows[0].ItemArray[0] != DBNull.Value ? Convert.ToInt32(totalIncomesDataTable.Rows[0].ItemArray[0]) : 0; return(totalIncomes); } return(-1); }
//Method for retrieving the total saving amount private int getSavingAccountCurrentBalance(String sqlStatement, QueryData paramContainer) { //Setting the default value for current balance.If data cannot be retrieved for any reason then 0 will be returned since it is not be allowed for the saving account to have negative balance int currentBalance = 0; MySqlCommand getCurrentBalanceCommand = SQLCommandBuilder.getRecordSumValueCommand(sqlStatementGetSavingAccountBalance, paramContainer); //getCurrentBalanceCommand.Parameters.AddWithValue("@paramID", paramContainer.UserID); //getCurrentBalanceCommand.Parameters.AddWithValue("@paramYear", paramContainer.Year); DataTable resultDataTable = DBConnectionManager.getData(getCurrentBalanceCommand); if (resultDataTable != null && resultDataTable.Rows.Count == 1) { Object result = resultDataTable.Rows[0].ItemArray[0]; currentBalance = result != DBNull.Value ? Convert.ToInt32(result) : 0; return(currentBalance); } return(currentBalance); }
//Method that returns the correct SQL command according to the type of selected item private MySqlCommand getCommand(BudgetItemType itemType, String sqlStatement, QueryData paramContainer) { switch (itemType) { case BudgetItemType.INCOME: return(SQLCommandBuilder.getSingleMonthCommand(sqlStatement, paramContainer)); //CHANGE!!!(from EXPENSE TO GENERAL_EXPENSE) case BudgetItemType.GENERAL_EXPENSE: return(SQLCommandBuilder.getSingleMonthCommand(sqlStatement, paramContainer)); case BudgetItemType.DEBT: return(SQLCommandBuilder.getSingleMonthCommand(sqlStatement, paramContainer)); case BudgetItemType.SAVING: return(SQLCommandBuilder.getSingleMonthCommand(sqlStatement, paramContainer)); default: return(null); } }
public string GetCommand(uint entry, uint map, int phaseMask, Vector3 pos, float orient) { var builder = new SQLCommandBuilder("gameobject"); builder.AddColumnValue("id", entry); builder.AddColumnValue("map", map); builder.AddColumnValue("spawnMask", 1); builder.AddColumnValue("phaseMask", phaseMask); builder.AddColumnValue("position_x", pos.X); builder.AddColumnValue("position_y", pos.Y); builder.AddColumnValue("position_z", pos.Z); builder.AddColumnValue("orientation", orient); builder.AddColumnValue("rotation0", 0); builder.AddColumnValue("rotation1", 0); builder.AddColumnValue("rotation2", 0); builder.AddColumnValue("rotation3", 0); builder.AddColumnValue("spawntimesecs", 120); builder.AddColumnValue("animprogress", 0); builder.AddColumnValue("state", 1); return(builder.BuildInsert()); }
public string GetCommand(uint entry, uint map, int phaseMask, Vector3 pos, float orient) { var builder = new SQLCommandBuilder("gameobject"); builder.AddColumnValue("id", entry); builder.AddColumnValue("map", map); builder.AddColumnValue("spawnMask", 1); builder.AddColumnValue("phaseMask", phaseMask); builder.AddColumnValue("position_x", pos.X); builder.AddColumnValue("position_y", pos.Y); builder.AddColumnValue("position_z", pos.Z); builder.AddColumnValue("orientation", orient); builder.AddColumnValue("rotation0", 0); builder.AddColumnValue("rotation1", 0); builder.AddColumnValue("rotation2", 0); builder.AddColumnValue("rotation3", 0); builder.AddColumnValue("spawntimesecs", 120); builder.AddColumnValue("animprogress", 0); builder.AddColumnValue("state", 1); return builder.BuildInsert(); }
public string GetCommand(int entry, GameObjectType type, int dispId, string name, string iconName, string castCaption, string unkStr, int[] data, float size, int[] qItem) { var builder = new SQLCommandBuilder("gameobject_template"); builder.AddColumnValue("entry", entry); builder.AddColumnValue("type", (int)type); builder.AddColumnValue("displayId", dispId); builder.AddColumnValue("name", name); builder.AddColumnValue("castBarCaption", castCaption); builder.AddColumnValue("unk1", unkStr); builder.AddColumnValue("faction", 35); builder.AddColumnValue("flags", 0); builder.AddColumnValue("size", size); for (var i = 0; i < 24; i++) builder.AddColumnValue("data" + i, data[i]); builder.AddColumnValue("ScriptName", string.Empty); return builder.BuildInsert(); }
//Checks if there is any existing record for the specified month and year for the current user public bool hasBalanceRecord() { if (balanceRecordMonth <= 0 || balanceRecordMonth > 12) { return(false); } if (balanceRecordYear <= 0) { return(false); } QueryData paramContainer = new QueryData.Builder(userID).addMonth(balanceRecordMonth).addYear(balanceRecordYear).build(); MySqlCommand recordExistenceCheckCommand = SQLCommandBuilder.getSingleMonthCommand(sqlStatementCheckRecordExistence, paramContainer); DataTable resultDataTable = DBConnectionManager.getData(recordExistenceCheckCommand); if (resultDataTable != null && resultDataTable.Rows.Count == 1) { return(true); } return(false); }
public DataTable getNewData(QueryType option, QueryData paramContainer, SelectedDataSource dataSource) { MySqlCommand command = null; if (option == QueryType.SINGLE_MONTH) { switch (dataSource) { //Grid view data source case SelectedDataSource.DYNAMIC_DATASOURCE_1: command = getCorrectCommandForDataDisplay(option, paramContainer); break; //Column chart data source case SelectedDataSource.DYNAMIC_DATASOURCE_2: command = getCorrectCommandForDataDisplay(option, paramContainer); break; //Current balance field data source case SelectedDataSource.STATIC_DATASOURCE: command = SQLCommandBuilder.getSpecificUserRecordsCommand(sqlStatementSavingAccountCurrentBalance, paramContainer); break; } } else if (option == QueryType.MULTIPLE_MONTHS) { switch (dataSource) { case SelectedDataSource.DYNAMIC_DATASOURCE_1: command = getCorrectCommandForDataDisplay(option, paramContainer); break; case SelectedDataSource.DYNAMIC_DATASOURCE_2: command = getCorrectCommandForDataDisplay(option, paramContainer); break; case SelectedDataSource.STATIC_DATASOURCE: command = SQLCommandBuilder.getSpecificUserRecordsCommand(sqlStatementSavingAccountCurrentBalance, paramContainer); break; } } else if (option == QueryType.MONTHLY_TOTALS) { switch (dataSource) { case SelectedDataSource.DYNAMIC_DATASOURCE_1: //command = getCorrectCommandForDataDisplay(option, paramContainer); break; case SelectedDataSource.DYNAMIC_DATASOURCE_2: //The getCorrectCommandFordataDisplay() method is not used in this case since displaying the monthly balance evolution for the selected year does not require to specify a table from which data will be extracted command = SQLCommandBuilder.getMonthlyTotalsCommand(sqlStatementFullYearBalanceEvolution, paramContainer); break; case SelectedDataSource.STATIC_DATASOURCE: command = SQLCommandBuilder.getSpecificUserRecordsCommand(sqlStatementSavingAccountCurrentBalance, paramContainer); break; //command = SQLCommandBuilder.getFullYearRecordsCommand(sqlStatementFullYearBalanceEvolution, paramContainer); } } else if (option == QueryType.TOTAL_VALUE) { command = SQLCommandBuilder.getSpecificUserRecordsCommand(sqlStatementSavingAccountCurrentBalance, paramContainer);; } return(DBConnectionManager.getData(command)); }
public string GetCommand(string field, uint where, object value) { var builder = new SQLCommandBuilder("creature"); builder.AddUpdateValue(field, value); return builder.BuildUpdate("guid = " + where); }
public string GetCommand(int entry, ItemClass iClass, int subClass, int unk0, string[] name, int dispId, ItemQuality quality, ItemFlag flags, ItemFlagExtra flags2, int buyPrice, int sellPrice, InventoryType invType, ClassMask allowClass, RaceMask allowRace, int itemLvl, int reqLvl, int reqSkill, int reqSkLvl, int reqSpell, int reqHonor, int reqCity, int reqRepFaction, int reqRepValue, int maxCount, int stacks, int contSlots, int statsCount, ItemModType[] statType, int[] statValue, int ssdId, int ssdVal, float[] dmgMin, float[] dmgMax, DamageType[] dmgType, int[] resistance, int delay, AmmoType ammoType, float rangedMod, int[] spellId, ItemSpellTriggerType[] spellTrigger, int[] spellCharges, int[] spellCooldown, int[] spellCategory, int[] spellCatCooldown, ItemBonding binding, string description, int pageText, Language langId, PageMaterial pageMat, int startQuest, int lockId, Material material, SheathType sheath, int randomProp, int randomSuffix, int block, int itemSet, int maxDura, int area, int map, BagFamilyMask bagFamily, TotemCategory totemCat, ItemSocketColor[] color, int[] content, int socketBonus, int gemProps, int reqDisEnchSkill, float armorDmgMod, int duration, int limitCategory, Holiday holidayId) { var builder = new SQLCommandBuilder("item_template"); builder.AddColumnValue("entry", entry); builder.AddColumnValue("class", (int)iClass); builder.AddColumnValue("subclass", subClass); builder.AddColumnValue("unk0", unk0); builder.AddColumnValue("name", name[0]); builder.AddColumnValue("displayid", dispId); builder.AddColumnValue("Quality", (int)quality); builder.AddColumnValue("Flags", (int)flags); builder.AddColumnValue("BuyCount", 1); builder.AddColumnValue("BuyPrice", buyPrice); builder.AddColumnValue("SellPrice", sellPrice); builder.AddColumnValue("InventoryType", (int)invType); builder.AddColumnValue("AllowableClass", (int)allowClass); builder.AddColumnValue("AllowableRace", (int)allowRace); builder.AddColumnValue("ItemLevel", itemLvl); builder.AddColumnValue("RequiredLevel", reqLvl); builder.AddColumnValue("RequiredSkill", reqSkill); builder.AddColumnValue("RequiredSkillRank", reqSkLvl); builder.AddColumnValue("requiredspell", reqSpell); builder.AddColumnValue("requiredhonorrank", reqHonor); builder.AddColumnValue("RequiredCityRank", reqCity); builder.AddColumnValue("RequiredReputationFaction", reqRepFaction); builder.AddColumnValue("RequiredReputationRank", reqRepValue); builder.AddColumnValue("maxcount", maxCount); builder.AddColumnValue("stackable", stacks); builder.AddColumnValue("ContainerSlots", contSlots); builder.AddColumnValue("StatsCount", statsCount); for (var i = 0; i < 10; i++) { int type; int value; if (i > statsCount - 1) { type = 0; value = 0; } else { type = (int)statType[i]; value = statValue[i]; } builder.AddColumnValue("stat_type" + (i + 1), type); builder.AddColumnValue("stat_value" + (i + 1), value); } builder.AddColumnValue("ScalingStatDistribution", ssdId); builder.AddColumnValue("ScalingStatValue", ssdVal); for (var i = 0; i < 2; i++) { builder.AddColumnValue("dmg_min" + (i + 1), dmgMin[i]); builder.AddColumnValue("dmg_max" + (i + 1), dmgMax[i]); builder.AddColumnValue("dmg_type" + (i + 1), (int)dmgType[i]); } builder.AddColumnValue("armor", resistance[0]); builder.AddColumnValue("holy_res", resistance[1]); builder.AddColumnValue("fire_res", resistance[2]); builder.AddColumnValue("nature_res", resistance[3]); builder.AddColumnValue("frost_res", resistance[4]); builder.AddColumnValue("shadow_res", resistance[5]); builder.AddColumnValue("arcane_res", resistance[6]); builder.AddColumnValue("delay", delay); builder.AddColumnValue("ammo_type", (int)ammoType); builder.AddColumnValue("RangedModRange", rangedMod); for (var i = 0; i < 5; i++) { builder.AddColumnValue("spellid_" + (i + 1), spellId[i]); builder.AddColumnValue("spelltrigger_" + (i + 1), (int)spellTrigger[i]); builder.AddColumnValue("spellcharges_" + (i + 1), spellCharges[i]); builder.AddColumnValue("spellppmRate_" + (i + 1), 0); builder.AddColumnValue("spellcooldown_" + (i + 1), spellCooldown[i]); builder.AddColumnValue("spellcategory_" + (i + 1), spellCategory[i]); builder.AddColumnValue("spellcategorycooldown_" + (i + 1), spellCatCooldown[i]); } builder.AddColumnValue("bonding", (int)binding); builder.AddColumnValue("description", description); builder.AddColumnValue("PageText", pageText); builder.AddColumnValue("LanguageID", (int)langId); builder.AddColumnValue("PageMaterial", (int)pageMat); builder.AddColumnValue("startquest", startQuest); builder.AddColumnValue("lockid", lockId); builder.AddColumnValue("Material", (int)material); builder.AddColumnValue("sheath", (int)sheath); builder.AddColumnValue("RandomProperty", randomProp); builder.AddColumnValue("RandomSuffix", randomSuffix); builder.AddColumnValue("block", block); builder.AddColumnValue("itemset", itemSet); builder.AddColumnValue("MaxDurability", maxDura); builder.AddColumnValue("area", area); builder.AddColumnValue("map", map); builder.AddColumnValue("BagFamily", (int)bagFamily); builder.AddColumnValue("TotemCategory", (int)totemCat); for (var i = 0; i < 3; i++) { builder.AddColumnValue("socketColor_" + (i + 1), (int)color[i]); builder.AddColumnValue("socketContent_" + (i + 1), content[i]); } builder.AddColumnValue("socketBonus", socketBonus); builder.AddColumnValue("GemProperties", gemProps); builder.AddColumnValue("RequiredDisenchantSkill", reqDisEnchSkill); builder.AddColumnValue("ArmorDamageModifier", armorDmgMod); builder.AddColumnValue("Duration", duration); builder.AddColumnValue("ItemLimitCategory", limitCategory); builder.AddColumnValue("HolidayID", (int)holidayId); builder.AddColumnValue("ScriptName", string.Empty); builder.AddColumnValue("DisenchantID", 0); builder.AddColumnValue("FoodType", 0); builder.AddColumnValue("minMoneyLoot", 0); builder.AddColumnValue("maxMoneyLoot", 0); builder.AddColumnValue("NonConsumable", 0); return(builder.BuildInsert()); }
public string GetCommand(string field, uint where, object value) { var builder = new SQLCommandBuilder("gameobject_template"); builder.AddUpdateValue(field, value); return builder.BuildUpdate("entry = " + where); }
public string GetCommand(int entry, string name, string subName, string iconName, CreatureTypeFlag typeFlags, CreatureType type, CreatureFamily family, CreatureRank rank, int[] killCredit, int[] dispId, float mod1, float mod2, bool racialLeader, int[] qItem, int moveId) { var builder = new SQLCommandBuilder("creature_template"); builder.AddColumnValue("entry", entry); for (var i = 0; i < 3; i++) builder.AddColumnValue("difficulty_entry_" + (i + 1), 0); for (var i = 0; i < 2; i++) builder.AddColumnValue("KillCredit" + (i + 1), killCredit[i]); for (var i = 0; i < 4; i++) builder.AddColumnValue("modelid" + (i + 1), dispId[i]); builder.AddColumnValue("name", name); builder.AddColumnValue("subname", subName); builder.AddColumnValue("IconName", iconName); builder.AddColumnValue("gossip_menu_id", 0); builder.AddColumnValue("minlevel", 1); builder.AddColumnValue("maxlevel", 1); builder.AddColumnValue("exp", 0); builder.AddColumnValue("faction_A", 35); builder.AddColumnValue("faction_H", 35); builder.AddColumnValue("npcflag", 0); builder.AddColumnValue("speed_walk", 1.0f); builder.AddColumnValue("speed_run", 1.14286f); builder.AddColumnValue("scale", 0.0f); builder.AddColumnValue("rank", (int)rank); builder.AddColumnValue("mindmg", 0); builder.AddColumnValue("maxdmg", 0); builder.AddColumnValue("dmgschool", 0); builder.AddColumnValue("attackpower", 0); builder.AddColumnValue("dmg_multiplier", 1.0f); builder.AddColumnValue("baseattacktime", 0); builder.AddColumnValue("rangeattacktime", 0); builder.AddColumnValue("unit_class", 1); builder.AddColumnValue("unit_flags", 0); builder.AddColumnValue("dynamicflags", 0); builder.AddColumnValue("family", (int)family); builder.AddColumnValue("trainer_type", 0); builder.AddColumnValue("trainer_spell", 0); builder.AddColumnValue("trainer_class", 0); builder.AddColumnValue("trainer_race", 0); builder.AddColumnValue("minrangedmg", 0.0f); builder.AddColumnValue("maxrangedmg", 0.0f); builder.AddColumnValue("rangedattackpower", 0); builder.AddColumnValue("type", (int)type); builder.AddColumnValue("type_flags", (int)typeFlags); builder.AddColumnValue("lootid", 0); builder.AddColumnValue("pickpocketloot", 0); builder.AddColumnValue("skinloot", 0); for (var i = 0; i < 6; i++) builder.AddColumnValue("resistance" + (i + 1), 0); for (var i = 0; i < 8; i++) builder.AddColumnValue("spell" + (i + 1), 0); builder.AddColumnValue("PetSpellDataId", 0); builder.AddColumnValue("VehicleId", 0); builder.AddColumnValue("mingold", 0); builder.AddColumnValue("maxgold", 0); builder.AddColumnValue("AIName", string.Empty); builder.AddColumnValue("MovementType", 0); builder.AddColumnValue("InhabitType", 0); builder.AddColumnValue("Health_mod", mod1); builder.AddColumnValue("Mana_mod", mod2); builder.AddColumnValue("Armor_mod", 1); builder.AddColumnValue("RacialLeader", racialLeader.ToByte()); for (var i = 0; i < 6; i++) builder.AddColumnValue("questItem" + (i + 1), qItem[0]); builder.AddColumnValue("movementId", moveId); builder.AddColumnValue("RegenHealth", 1); builder.AddColumnValue("equipment_id", 0); builder.AddColumnValue("mechanic_immune_mask", 0); builder.AddColumnValue("flags_extra", 0); builder.AddColumnValue("ScriptName", string.Empty); return builder.BuildInsert(); }
public string GetCommand(int entry, ItemClass iClass, int subClass, int unk0, string[] name, int dispId, ItemQuality quality, ItemFlag flags, ItemFlagExtra flags2, int buyPrice, int sellPrice, InventoryType invType, ClassMask allowClass, RaceMask allowRace, int itemLvl, int reqLvl, int reqSkill, int reqSkLvl, int reqSpell, int reqHonor, int reqCity, int reqRepFaction, int reqRepValue, int maxCount, int stacks, int contSlots, int statsCount, ItemModType[] statType, int[] statValue, int ssdId, int ssdVal, float[] dmgMin, float[] dmgMax, DamageType[] dmgType, int[] resistance, int delay, AmmoType ammoType, float rangedMod, int[] spellId, ItemSpellTriggerType[] spellTrigger, int[] spellCharges, int[] spellCooldown, int[] spellCategory, int[] spellCatCooldown, ItemBonding binding, string description, int pageText, Language langId, PageMaterial pageMat, int startQuest, int lockId, Material material, SheathType sheath, int randomProp, int randomSuffix, int block, int itemSet, int maxDura, int area, int map, BagFamilyMask bagFamily, TotemCategory totemCat, ItemSocketColor[] color, int[] content, int socketBonus, int gemProps, int reqDisEnchSkill, float armorDmgMod, int duration, int limitCategory, Holiday holidayId) { // FIXME Gendarme Report: Parameter 'flags2' of type 'WowPacketParser.Enums.ItemFlagExtra' is never used in the method. var builder = new SQLCommandBuilder("item_template"); builder.AddColumnValue("entry", entry); builder.AddColumnValue("class", (int)iClass); builder.AddColumnValue("subclass", subClass); builder.AddColumnValue("unk0", unk0); builder.AddColumnValue("name", name[0]); builder.AddColumnValue("displayid", dispId); builder.AddColumnValue("Quality", (int)quality); builder.AddColumnValue("Flags", (int)flags); builder.AddColumnValue("BuyCount", 1); builder.AddColumnValue("BuyPrice", buyPrice); builder.AddColumnValue("SellPrice", sellPrice); builder.AddColumnValue("InventoryType", (int)invType); builder.AddColumnValue("AllowableClass", (int)allowClass); builder.AddColumnValue("AllowableRace", (int)allowRace); builder.AddColumnValue("ItemLevel", itemLvl); builder.AddColumnValue("RequiredLevel", reqLvl); builder.AddColumnValue("RequiredSkill", reqSkill); builder.AddColumnValue("RequiredSkillRank", reqSkLvl); builder.AddColumnValue("requiredspell", reqSpell); builder.AddColumnValue("requiredhonorrank", reqHonor); builder.AddColumnValue("RequiredCityRank", reqCity); builder.AddColumnValue("RequiredReputationFaction", reqRepFaction); builder.AddColumnValue("RequiredReputationRank", reqRepValue); builder.AddColumnValue("maxcount", maxCount); builder.AddColumnValue("stackable", stacks); builder.AddColumnValue("ContainerSlots", contSlots); builder.AddColumnValue("StatsCount", statsCount); for (var i = 0; i < 10; i++) { int type; int value; if (i > statsCount - 1) { type = 0; value = 0; } else { type = (int)statType[i]; value = statValue[i]; } builder.AddColumnValue("stat_type" + (i + 1), type); builder.AddColumnValue("stat_value" + (i + 1), value); } builder.AddColumnValue("ScalingStatDistribution", ssdId); builder.AddColumnValue("ScalingStatValue", ssdVal); for (var i = 0; i < 2; i++) { builder.AddColumnValue("dmg_min" + (i + 1), dmgMin[i]); builder.AddColumnValue("dmg_max" + (i + 1), dmgMax[i]); builder.AddColumnValue("dmg_type" + (i + 1), (int)dmgType[i]); } builder.AddColumnValue("armor", resistance[0]); builder.AddColumnValue("holy_res", resistance[1]); builder.AddColumnValue("fire_res", resistance[2]); builder.AddColumnValue("nature_res", resistance[3]); builder.AddColumnValue("frost_res", resistance[4]); builder.AddColumnValue("shadow_res", resistance[5]); builder.AddColumnValue("arcane_res", resistance[6]); builder.AddColumnValue("delay", delay); builder.AddColumnValue("ammo_type", (int)ammoType); builder.AddColumnValue("RangedModRange", rangedMod); for (var i = 0; i < 5; i++) { builder.AddColumnValue("spellid_" + (i + 1), spellId[i]); builder.AddColumnValue("spelltrigger_" + (i + 1), (int)spellTrigger[i]); builder.AddColumnValue("spellcharges_" + (i + 1), spellCharges[i]); builder.AddColumnValue("spellppmRate_" + (i + 1), 0); builder.AddColumnValue("spellcooldown_" + (i + 1), spellCooldown[i]); builder.AddColumnValue("spellcategory_" + (i + 1), spellCategory[i]); builder.AddColumnValue("spellcategorycooldown_" + (i + 1), spellCatCooldown[i]); } builder.AddColumnValue("bonding", (int)binding); builder.AddColumnValue("description", description); builder.AddColumnValue("PageText", pageText); builder.AddColumnValue("LanguageID", (int)langId); builder.AddColumnValue("PageMaterial", (int)pageMat); builder.AddColumnValue("startquest", startQuest); builder.AddColumnValue("lockid", lockId); builder.AddColumnValue("Material", (int)material); builder.AddColumnValue("sheath", (int)sheath); builder.AddColumnValue("RandomProperty", randomProp); builder.AddColumnValue("RandomSuffix", randomSuffix); builder.AddColumnValue("block", block); builder.AddColumnValue("itemset", itemSet); builder.AddColumnValue("MaxDurability", maxDura); builder.AddColumnValue("area", area); builder.AddColumnValue("map", map); builder.AddColumnValue("BagFamily", (int)bagFamily); builder.AddColumnValue("TotemCategory", (int)totemCat); for (var i = 0; i < 3; i++) { builder.AddColumnValue("socketColor_" + (i + 1), (int)color[i]); builder.AddColumnValue("socketContent_" + (i + 1), content[i]); } builder.AddColumnValue("socketBonus", socketBonus); builder.AddColumnValue("GemProperties", gemProps); builder.AddColumnValue("RequiredDisenchantSkill", reqDisEnchSkill); builder.AddColumnValue("ArmorDamageModifier", armorDmgMod); builder.AddColumnValue("Duration", duration); builder.AddColumnValue("ItemLimitCategory", limitCategory); builder.AddColumnValue("HolidayID", (int)holidayId); builder.AddColumnValue("ScriptName", string.Empty); builder.AddColumnValue("DisenchantID", 0); builder.AddColumnValue("FoodType", 0); builder.AddColumnValue("minMoneyLoot", 0); builder.AddColumnValue("maxMoneyLoot", 0); builder.AddColumnValue("NonConsumable", 0); return builder.BuildInsert(); }