Example #1
0
        private void DataSubmitted(object sender, EventArgs e)
        {
            if (status == rowStatus.ADD)
            {
                ArrayList tmp = new ArrayList();
                tmp = form.ValuesToSubmit;
                for (int i = 0; i < tmp.Count; i++)
                {
                    if (columnNames[i].StartsWith("Ид ") && columnNames[i].Length > 2)
                    {
                        tmp[i] = columnReferencesTableNameKeys[columnNames[i]][(tmp[i] as string)];
                    }
                }
                try
                {
                    dataBase.InsertRow(form.CurrentTable, tmp);
                    form.UpdateTable();
                    form.SetData(dataBase.GetTableData(form.CurrentTable), columnReferencesTableKeyNames);

                    var ar = new ArrayList();
                    for (int i = 0; i < numberOfColumns; i++)
                    {
                        ar.Add("");
                    }
                    form.ValuesToSubmit = ar;
                }
                catch (Exception)
                {
                    form.ShowSQLInjectionError();
                }
            }
            else
            {
                ArrayList tmp = new ArrayList();
                tmp = form.ValuesToSubmit;
                for (int i = 0; i < tmp.Count; i++)
                {
                    if (columnNames[i].StartsWith("Ид ") && columnNames[i].Length > 2)
                    {
                        tmp[i] = columnReferencesTableNameKeys[columnNames[i]][(tmp[i] as string)];
                    }
                }
                try
                {
                    dataBase.UpdateRow(form.CurrentTable, tmp, columnNames);
                    form.UpdateTable();
                    form.SetData(dataBase.GetTableData(form.CurrentTable), columnReferencesTableKeyNames);

                    var ar = new ArrayList();
                    for (int i = 0; i < numberOfColumns; i++)
                    {
                        ar.Add("");
                    }
                    form.ValuesToSubmit = ar;
                }
                catch (Exception)
                {
                    form.ShowSQLInjectionError();
                }
            }
        }