Example #1
0
        override public void update(CaseListDataSet.CaseListTableDataTable table)
        {
            try
            {
                if (connection.State == ConnectionState.Closed)
                {
                    connection.Open();
                }

                adapter.Update(table);

                if (table.HasErrors)
                {
                    CaseListDataSet.CaseListTableRow[] rows = (CaseListDataSet.CaseListTableRow[])table.GetErrors();
                    foreach (CaseListDataSet.CaseListTableRow row in rows)
                    {
                        if (row.RowState == DataRowState.Added && row.RowError.Contains("duplicate"))
                        {
                            UpdateCaseFields(row);
                        }
                        else
                        {
                            base.logger.PrintInfoLine(row.RowError);
                        }
                    }
                }
            }
            catch (DbException ex)
            {
                //duplicate row being inserted error
                if (ex.ErrorCode == -2146232060)
                {
                    CaseListDataSet.CaseListTableRow[] rows = (CaseListDataSet.CaseListTableRow[])table.GetErrors();

                    foreach (CaseListDataSet.CaseListTableRow row in rows)
                    {
                        if (row.RowState == DataRowState.Added)
                        {
                            UpdateCaseFields(row);
                        }
                    }
                }
                else
                {
                    throw;
                }
            }
            catch
            {
                throw;
            }
        }