Ejemplo n.º 1
0
        private void obtenirInfoXML()
        {
            //es crida una funció d'importació per a cada fitxer XML a importar
            importarProvincies();
            importarMunicipis();
            importarClients();
            importarArticles();

            try
            {
                tableAdatpterMan.UpdateAll(ds);//es guarden els cambis del dataset(importancions)

                //es comprova si és el primer cop i en cas contrari es mostra un missatge de notificació de que la importació s'ha realitzat correctament
                if (!primerCop)
                {
                    MessageBox.Show("LES DADES S'HAN IMPORTAT CORRECTAMENT!");
                }
                else
                {
                    primerCop = false;
                }
            }
            catch (DBConcurrencyException dbcex)//capturo l'excepcio i llanço un missatge de notificació de l'error
            {
                MessageBox.Show("error en la simultanietat de dades! Torni a importar les dades des del menú");
                primerCop = false;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        public async Task CastVotesAsync(int ballotId, IEnumerable <VoteModel> votes, DateTime castedAt)
        {
            await Task.CompletedTask;

            using (var dataSet = new StudentElectionDataSet())
            {
                using (var manager = new TableAdapterManager())
                {
                    manager.VoteTableAdapter   = new VoteTableAdapter();
                    manager.BallotTableAdapter = new BallotTableAdapter();

                    foreach (var vote in votes)
                    {
                        var newRow = dataSet.Vote.NewVoteRow();
                        newRow.BallotId    = ballotId;
                        newRow.CandidateId = vote.CandidateId;

                        dataSet.Vote.AddVoteRow(newRow);
                    }

                    manager.BallotTableAdapter.FillBallotsById(dataSet.Ballot, ballotId);
                    var ballot = dataSet.Ballot.FindByID(ballotId);
                    ballot.CastedAt = castedAt;

                    manager.UpdateAll(dataSet);
                }
            }
        }
Ejemplo n.º 3
0
        protected bool Save()
        {
            try
            {
                BindingSource.EndEdit();
                TableAdapterManager.UpdateAll(DbDataSet);

                AddNewButton.Enabled = true;

                return(true);
            }
            catch (SqlException e)
            {
                if (e.Message.StartsWith("The DELETE statement conflicted with the REFERENCE constraint"))
                {
                    MessageBox.Show("You have removed an item which is referenced by other items.\r\nThis action jeopardizes data itegrity, so your changes will be reverted.", "An error has occured.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    LoadData();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "An error has occured.", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }

            return(false);
        }
Ejemplo n.º 4
0
        public async Task InsertVotersAsync(IEnumerable <VoterModel> voters)
        {
            await Task.CompletedTask;

            using (var dataSet = new StudentElectionDataSet())
            {
                using (var manager = new TableAdapterManager())
                {
                    manager.VoterTableAdapter = new VoterTableAdapter();

                    var id = -1;
                    foreach (var voter in voters)
                    {
                        var newRow = dataSet.Voter.NewVoterRow();
                        _mapper.Map(voter, newRow);

                        newRow.ID = id;
                        if (voter.Birthdate == null)
                        {
                            newRow.SetBirthdateNull();
                        }

                        dataSet.Voter.AddVoterRow(newRow);

                        id--;
                    }

                    manager.UpdateAll(dataSet);
                }
            }
        }
Ejemplo n.º 5
0
        public async Task InsertCandidatesAsync(IEnumerable <CandidateModel> candidates)
        {
            await Task.CompletedTask;

            using (var dataSet = new StudentElectionDataSet())
            {
                using (var manager = new TableAdapterManager())
                {
                    manager.CandidateTableAdapter = new CandidateTableAdapter();

                    var id = -1;
                    foreach (var candidate in candidates)
                    {
                        var newRow = dataSet.Candidate.NewCandidateRow();
                        _mapper.Map(candidate, newRow);

                        newRow.ID = id;
                        if (candidate.Birthdate == null)
                        {
                            newRow.SetBirthdateNull();
                        }

                        dataSet.Candidate.AddCandidateRow(newRow);

                        id--;
                    }

                    manager.UpdateAll(dataSet);
                }
            }
        }
Ejemplo n.º 6
0
        public void OnSaveCommandExecute(object obj)
        {
            if (orgData.HasErrors)
            {
                Microsoft.Windows.Controls.MessageBox.Show("Please correct the errors first", "Save command", MessageBoxButton.OK, MessageBoxImage.Error);

                //System.Data.DataRow[] rows  = orgData.organization.GetErrors();
                //foreach (object obj in rows)
                //{
                //    MessageBox.Show(obj.ToString());
                //}
            }
            else
            {
                if (orgData.HasChanges())
                {
                    try
                    {
                        if (taManager.UpdateAll(orgData) > 0)
                        {
                            Microsoft.Windows.Controls.MessageBox.Show("Saved", "Save command", MessageBoxButton.OK, MessageBoxImage.Information);
                        }
                    }
                    catch (Exception e)
                    {
                        Microsoft.Windows.Controls.MessageBox.Show("Unable to save changes.", "Save command", MessageBoxButton.OK, MessageBoxImage.Error);
                        orgData.RejectChanges();
                    }
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Call this function to ensure the user has the ability to save
        /// unsaved changes to the dataset. It will open a message box and
        /// asks if the user wants to save those changes.
        /// NOTE: Currently this function simple saves all the updates made!
        /// </summary>
        private void LastChanceSaving()
        {
            if (_DataSet.HasChanges())
            {
                MessageBoxResult res;
                //res = MessageBox.Show("You've made some changes that are not yet saved! Do you wish to save them?",
                //    "Prevent data loss?",
                //    MessageBoxButton.YesNoCancel,
                //    MessageBoxImage.Question,
                //    MessageBoxResult.Yes
                //);

                //if (res == MessageBoxResult.Yes)
                //{
                try
                {
                    _TAM.UpdateAll(_DataSet);
                    _DataSet.AcceptChanges();
                }
                catch (Exception e)
                {
                    res = MessageBox.Show(e.Message, "An unhandled exception occured!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
                //}
            }
        }
Ejemplo n.º 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            TableAdapterManager temp = new TableAdapterManager();

            temp.Connection = new SqlConnection("Data Source=DESKTOP-PA5M2I4\\SQLEXPRESS;Initial Catalog=KRBD_Restaraunt;Integrated Security=True");
            this.dishTableAdapter.Adapter.Update(this.kRBD_RestarauntDataSet.Rabotniki);
            this.Validate();
            this.dishBindingSource.EndEdit();
            temp.UpdateAll(kRBD_RestarauntDataSet);
        }
Ejemplo n.º 9
0
 public static void updateAll()
 {
     try
     {
         TableAdapterManager.UpdateAll(QLVT_CN_DataSet);
     }
     catch (SqlException e)
     {
         MessageBox.Show(SqlMessageResolver.SqlMessageResolve(e));
     }
     catch (ArgumentException e)
     {
         MessageBox.Show(e.Message);
     }
 }
Ejemplo n.º 10
0
        private void button1_Click(object sender, EventArgs e)
        {
            aptekaTableAdapter  Tableadapter1 = new БанкиTableAdapter();
            TableAdapterManager Manager1      = new TableAdapterManager();

            Tableadapter1.Insert(textBox1.Text, textBox3.Text, int.Parse(textBox2.Text));
            try
            {
                MessageBox.Show("Банк успешно добавлен");
            }
            catch (SqlException)
            {
                MessageBox.Show("Не удалось сделать заполнение");
            }
            Manager1.UpdateAll(this.Dataset1);
            Manager1.Connection.Close();
        }
Ejemplo n.º 11
0
        private void btnCatsFillLocal_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            string connectionPrefix = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=";
            string client           = new Uri(dmc.origUrl).Host;
            string filename         = client + ".mdb";
            string app_data         = Path.GetDirectoryName(Application.ExecutablePath) + @"\App_data\";
            string dest             = app_data + filename;

            if (!File.Exists(dest))
            {
                File.Copy(app_data + "LocalCats.mdb", dest);
            }
            string connection = connectionPrefix + dest;

            using (TableAdapterManager tam = new TableAdapterManager())
            {
                OleDbConnection myConn = new OleDbConnection(connection);
                tam.Connection           = myConn;
                tam.CategoryTableAdapter = new CategoryTableAdapter(myConn);
                tam.CategoryTableAdapter.ClearBeforeFill = true;
                tam.clientTableAdapter = new clientTableAdapter(myConn);
                tam.clientTableAdapter.ClearBeforeFill = true;
                LocalCats myCats = new LocalCats();
                tam.clientTableAdapter.Fill(myCats.client);
                tam.CategoryTableAdapter.Fill(myCats.Category);
                if (myCats.client == null || myCats.client.Rows.Count == 0)
                {
                    DataRow dr = myCats.client.NewRow();
                    dr["cmsurl"] = client;
                    myCats.client.Rows.Add(dr);
                }
                DataTableReader dtr = myCats.CreateDataReader(cats);
                myCats.Load(dtr, LoadOption.Upsert, myCats.Category, myCats.client);
                tam.UpdateAll(myCats);
            }
            Cursor.Current = Cursors.Default;
            return;
        }
        public async Task InsertElectionAsync(ElectionModel model)
        {
            await Task.CompletedTask;

            using (var dataSet = new StudentElectionDataSet())
            {
                using (var manager = new TableAdapterManager())
                {
                    manager.ElectionTableAdapter = new ElectionTableAdapter();

                    var newRow = dataSet.Election.NewElectionRow();
                    _mapper.Map(model, newRow);
                    newRow.ID = -1;
                    newRow.SetCandidatesFinalizedAtNull();
                    newRow.SetClosedAtNull();

                    dataSet.Election.AddElectionRow(newRow);

                    manager.UpdateAll(dataSet);
                }
            }
        }
Ejemplo n.º 13
0
        protected string SaveInvestorPermRecord(int invAppId)
        {
            StringBuilder validationErrorSB       = new StringBuilder();
            bool          IsOtherApplicantPresent = false;


            InvestorDS ds = new InvestorDS();

            InvestorDS.InvestorApplicationsDataTable invAppDT = ds.InvestorApplications;
            InvestorDS.InvestorDataTable             invDT    = ds.Investor;



            InvestorApplicationsTableAdapter invAppTA = new DataUtils.InvestorDSTableAdapters.InvestorApplicationsTableAdapter();

            try
            {
                invAppTA.FillById(invAppDT, invAppId);
                //GetDataById(invAppId);
            }
            catch (System.Data.ConstraintException constrExc)
            {
                System.Data.DataRow[] rowsErr = invAppDT.GetErrors();
                for (int i = 0; i < rowsErr.Length; i++)
                {
                    if (rowsErr[i].HasErrors)
                    {
                        string err = rowsErr[i].RowError;
                        if (!String.IsNullOrWhiteSpace(err))
                        {
                            validationErrorSB.AppendLine(err);
                            return(validationErrorSB.ToString());
                        }
                    }
                }
            }


            if (invAppDT.Rows.Count != 1)
            {
                throw new ArgumentException(String.Concat("InvestorApplication with Id ", invAppId, " could not be found."), "InvestorApplication.Id");
            }

            DataUtils.InvestorDS.InvestorApplicationsRow currentInvAppRow = invAppDT.Rows[0] as InvestorDS.InvestorApplicationsRow;

            InvestorDS.InvestorRow invRow    = invDT.NewInvestorRow();
            InvestorDS.InvestorRow othinvRow = null;

            InvestorTableAdapter invTA  = new InvestorTableAdapter();
            PropertyTableAdapter prtyTA = new PropertyTableAdapter();


            TableAdapterManager tam = new TableAdapterManager();

            //tam.InvestorApplicationsTableAdapter = ;
            tam.PropertyTableAdapter = prtyTA;
            tam.InvestorTableAdapter = invTA;

            tam.UpdateOrder = TableAdapterManager.UpdateOrderOption.InsertUpdateDelete;


            //InvestorTableAdapter invTA = new InvestorTableAdapter();

            //if (currentInvAppRow.IsPrimary_FirstNameNull() || String.IsNullOrEmpty(currentInvAppRow.Primary_FirstName))
            //{
            //    validationErrorSB.AppendLine("Primary Applicant's First name is empty");
            //}

            invRow.InvestorApplicationId = currentInvAppRow.Id;
            if (!currentInvAppRow.IsOther_LastNameNull() && !String.IsNullOrWhiteSpace(currentInvAppRow.Other_LastName))
            {
                IsOtherApplicantPresent = true;
            }

            #region PrimaryInvestor
            //invRow.Id = -1;

            if (currentInvAppRow.IsPrimary_FirstNameNull())
            {
                invRow.FirstName = null;
            }
            else
            {
                invRow.FirstName = currentInvAppRow.Primary_FirstName.Trim();
            }


            if (currentInvAppRow.IsPrimary_OtherNamesNull())
            {
                invRow.OtherNames = null;
            }
            else
            {
                invRow.OtherNames = currentInvAppRow.Primary_OtherNames.Trim();
            }

            if (currentInvAppRow.IsPrimary_LastNameNull() || String.IsNullOrEmpty(currentInvAppRow.Primary_LastName))
            {
                validationErrorSB.AppendLine("Primary Applicant's Last name is empty");
            }
            else
            {
                invRow.LastName = currentInvAppRow.Primary_LastName.Trim();
            }

            if (currentInvAppRow.IsPrimary_DOBNull() || currentInvAppRow.Primary_DOB < DateTime.Today.AddYears(-100))
            {
                validationErrorSB.AppendLine("Primary Applicant's DOB is empty or invalid");
            }
            else
            {
                invRow.DOB = currentInvAppRow.Primary_DOB;
            }


            if (currentInvAppRow.IsPrimary_LastNameNull())
            {
                validationErrorSB.AppendLine("Primary Applicant's Last Name is empty or invalid");
            }
            else
            {
                invRow.LastName = currentInvAppRow.Primary_LastName.Trim();
            }

            if (currentInvAppRow.IsEmailNull() || String.IsNullOrWhiteSpace(currentInvAppRow.Email))
            {
                validationErrorSB.AppendLine("Primary Applicant's Email address is empty or invalid");
            }
            else
            {
                invRow.Email = currentInvAppRow.Email;
            }


            currentInvAppRow.Other_Email = null;

            //invRow.Gender =
            if (String.IsNullOrWhiteSpace(currentInvAppRow.Primary_Gender))
            {
                validationErrorSB.AppendLine("");
            }
            else
            {
                string gender = currentInvAppRow.Primary_Gender.Trim();

                if (gender.StartsWith("m", StringComparison.InvariantCultureIgnoreCase))
                {
                    invRow.Gender = 'M';
                }
                else if (gender.StartsWith("f", StringComparison.InvariantCultureIgnoreCase))
                {
                    invRow.Gender = 'F';
                }
                else
                {
                    invRow.Gender = 'O';
                }
            }


            if (currentInvAppRow.IsPrimary_Res_Street1Null() || String.IsNullOrWhiteSpace(currentInvAppRow.Primary_Res_Street1))
            {
                validationErrorSB.AppendLine("Primary Applicant's Street address is empty or invalid");
            }
            else
            {
                string unitKeyword    = "unit";
                string street1        = currentInvAppRow.Primary_Res_Street1;
                int    unitKeywdIndex = new CultureInfo("EN-AU").CompareInfo.IndexOf(street1, unitKeyword, CompareOptions.IgnoreCase);
                if (unitKeywdIndex > 0)
                {
                    string unitNo      = street1.Substring(unitKeywdIndex + unitKeyword.Length).TrimStart();
                    int    endOfUnitNo = unitNo.Length - unitNo.IndexOf(" ", StringComparison.InvariantCultureIgnoreCase);
                    unitNo = unitNo.Substring(0, endOfUnitNo);
                    if (!String.IsNullOrWhiteSpace(unitNo))
                    {
                        invRow.Res_UnitNum = unitNo;
                        invRow.Res_Street1 = street1.Substring(unitKeywdIndex + endOfUnitNo);
                    }
                    else
                    {
                        invRow.Res_Street1 = street1;
                    }
                }
                else
                {
                    invRow.Res_Street1 = currentInvAppRow.Primary_Res_Street1.Trim();
                }
            }

            if (String.IsNullOrWhiteSpace(currentInvAppRow.Primary_Res_Street2))
            {
                invRow.Res_Street2 = null;
            }
            else
            {
                invRow.Res_Street2 = currentInvAppRow.Primary_Res_Street2.Trim();
            }

            if (currentInvAppRow.IsPrimary_Res_PostCodeNull())
            {
                invRow.Res_Postcode = -1;
            }
            else
            {
                invRow.Res_Postcode = currentInvAppRow.Primary_Res_PostCode;
            }

            //  invRow.Res_Suburb = currentInvAppRow.Primary_Res

            if (currentInvAppRow.IsPrimary_Res_SuburbNull())
            {
                validationErrorSB.AppendLine("Primary current residence Suburb cannot be empty.");
                //invRow.Res_Suburb = null;
            }
            else
            {
                invRow.Res_Suburb = currentInvAppRow.Primary_Res_Suburb.Trim();
            }

            invRow.Res_City = null;

            if (currentInvAppRow.IsPrimary_Res_StateNull())
            {
                invRow.Res_State = null;
            }
            else
            {
                invRow.Res_State = currentInvAppRow.Primary_Res_State;
            }

            if (String.IsNullOrWhiteSpace(currentInvAppRow.Primary_Res_Country))
            {
                invRow.Res_Country = "Australia";
            }
            else
            {
                invRow.Res_Country = currentInvAppRow.Primary_Res_Country;
            }

            invRow.Res_Street3 = null;
            invRow.Res_Street4 = null;
            invRow.Res_Street5 = null;

            if (String.IsNullOrWhiteSpace(currentInvAppRow.Mobile))
            {
                invRow.PhoneMobile = null;
            }
            else
            {
                invRow.PhoneMobile = currentInvAppRow.Mobile.Trim();
            }


            if (currentInvAppRow.IsPrimary_HomePhoneNull())
            {
                invRow.PhoneHome = null;
            }
            else
            {
                invRow.PhoneHome = currentInvAppRow.Primary_HomePhone.Trim();
            }

            invRow.PhoneWork  = null;
            invRow.PhoneOther = null;

            invRow.Bill_Street1 = null;
            invRow.Bill_Street2 = null;
            invRow.Bill_Street3 = null;
            invRow.Bill_Street4 = null;
            invRow.Bill_Street5 = null;

            invRow.AssquireStatus = "New";
            invRow.AppliedDate    = currentInvAppRow.EntryDate;
            invRow.Created        = DateTime.Now;
            invRow.CreatedBy      = "pdvorak";

            invDT.AddInvestorRow(invRow);

            #endregion PrimaryInvestor

            #region PrimaryInvestorProperty

            // We will create property only if the details are provided and it must be confirmed
            //TODO
            bool hasProperty = true; //this.chckPrptyValFeePaid.Checked;
            InvestorDS.PropertyRow prptyNewR = null;
            // validate if property is included

            if (hasProperty)
            {
                //                InvestorDS.PropertyDataTable prptyDT = new InvestorDS.PropertyDataTable();

                AddPermPropertyFromInvAppRow(ds, currentInvAppRow, invRow);
            }

            #endregion PrimaryInvestorProperty

            #region OtherApplicant
            if (IsOtherApplicantPresent)
            {
                othinvRow = invDT.NewInvestorRow();


                othinvRow.PrimaryInvestorID = invRow.Id;
                //othinvRow.PrimaryInvestorID = invRow.Id;

                othinvRow.LastName = currentInvAppRow.Other_LastName;

                if (currentInvAppRow.IsOther_FirstNameNull())
                {
                    othinvRow = null;
                }
                else
                {
                    othinvRow.FirstName = currentInvAppRow.Other_FirstName;
                }

                if (currentInvAppRow.IsOther_OtherNamesNull())
                {
                    othinvRow.OtherNames = null;
                }
                else
                {
                    othinvRow.OtherNames = currentInvAppRow.Other_OtherNames.Trim();
                }


                if (currentInvAppRow.IsOther_DOBNull() || (currentInvAppRow.Other_DOB <= DateTime.Today.AddYears(-100)))
                {
                    validationErrorSB.AppendLine("Other Investor DOB cannot be null");
                }
                else
                {
                    othinvRow.DOB = currentInvAppRow.Other_DOB;
                }


                if (currentInvAppRow.IsOther_Res_Street1Null() || String.IsNullOrWhiteSpace(currentInvAppRow.Other_Res_Street1))
                {
                    validationErrorSB.AppendLine("Other Applicant's Street address is empty or invalid");
                }
                else
                {
                    string unitKeyword    = "unit";
                    string street1        = currentInvAppRow.Other_Res_Street1;
                    int    unitKeywdIndex = new CultureInfo("EN-AU").CompareInfo.IndexOf(street1, unitKeyword, CompareOptions.IgnoreCase);
                    if (unitKeywdIndex > 0)
                    {
                        string unitNo      = street1.Substring(unitKeywdIndex + unitKeyword.Length).TrimStart();
                        int    endOfUnitNo = unitNo.Length - unitNo.IndexOf(" ", StringComparison.InvariantCultureIgnoreCase);
                        unitNo = unitNo.Substring(0, endOfUnitNo);
                        if (!String.IsNullOrWhiteSpace(unitNo))
                        {
                            othinvRow.Res_UnitNum = unitNo;
                            othinvRow.Res_Street1 = street1.Substring(unitKeywdIndex + endOfUnitNo);
                        }
                        else
                        {
                            othinvRow.Res_Street1 = street1;
                        }
                    }
                    else
                    {
                        othinvRow.Res_Street1 = currentInvAppRow.Other_Res_Street1.Trim();
                    }
                }

                if (String.IsNullOrWhiteSpace(currentInvAppRow.Other_Res_Street2))
                {
                    othinvRow.Res_Street2 = null;
                }
                else
                {
                    othinvRow.Res_Street2 = currentInvAppRow.Other_Res_Street2.Trim();
                }

                if (currentInvAppRow.IsOther_Res_PostCodeNull())
                {
                    othinvRow.Res_Postcode = -1;
                }
                else
                {
                    othinvRow.Res_Postcode = currentInvAppRow.Other_Res_PostCode;
                }

                //  othinvRow.Res_Suburb = currentInvAppRow.Other_Res

                if (currentInvAppRow.IsOther_Res_SuburbNull())
                {
                    othinvRow.Res_Suburb = null;
                }
                else
                {
                    othinvRow.Res_Suburb = currentInvAppRow.Other_Res_Suburb.Trim();
                }

                othinvRow.Res_City = null;

                if (currentInvAppRow.IsOther_Res_StateNull())
                {
                    othinvRow.Res_State = null;
                }
                else
                {
                    othinvRow.Res_State = currentInvAppRow.Other_Res_State;
                }

                if (String.IsNullOrWhiteSpace(currentInvAppRow.Other_Res_Country))
                {
                    othinvRow.Res_Country = "Australia";
                }
                else
                {
                    othinvRow.Res_Country = currentInvAppRow.Other_Res_Country;
                }

                othinvRow.Res_Street3 = null;
                othinvRow.Res_Street4 = null;
                othinvRow.Res_Street5 = null;

                if (String.IsNullOrWhiteSpace(currentInvAppRow.Mobile))
                {
                    othinvRow.PhoneMobile = null;
                }
                else
                {
                    othinvRow.PhoneMobile = currentInvAppRow.Mobile.Trim();
                }


                if (currentInvAppRow.IsPrimary_HomePhoneNull())
                {
                    othinvRow.PhoneHome = null;
                }
                else
                {
                    othinvRow.PhoneHome = currentInvAppRow.Other_HomePhone.Trim();
                }

                othinvRow.PhoneWork  = null;
                othinvRow.PhoneOther = null;

                othinvRow.Bill_Street1 = null;
                othinvRow.Bill_Street2 = null;
                othinvRow.Bill_Street3 = null;
                othinvRow.Bill_Street4 = null;
                othinvRow.Bill_Street5 = null;

                othinvRow.InvestorApplicationId = currentInvAppRow.Id;

                othinvRow.AssquireStatus = "New";
                othinvRow.AppliedDate    = currentInvAppRow.EntryDate;
                othinvRow.Created        = DateTime.Now;
                othinvRow.CreatedBy      = "pdvorak";

                invDT.AddInvestorRow(othinvRow);
            }
            #endregion OtherApplicant


            if (validationErrorSB.Length > 0)
            {
                return(validationErrorSB.ToString());
            }
            else
            {
                //this.lblValidationErrorsTxtBoxLabel.Visible = false;
                //this.txtValidationErrors.Visible = false;
                //this.txtValidationErrors.Text = String.Empty();


                try
                {
                    //invTA.Update(invRow);
                    //invTA.Update(othinvRow);
                    //prtyTA.Update(prptyNewR);

                    //Inserts
                    tam.UpdateAll(ds);


                    //update relationships
                    bool refUpdate = false;
                    if (IsOtherApplicantPresent)
                    {
                        othinvRow.PrimaryInvestorID = invRow.Id;
                        refUpdate = true;
                    }

                    if (hasProperty)
                    {
                        //updates references
                        prptyNewR.PrimaryInvestorId = invRow.Id;
                        refUpdate = true;
                    }

                    if (refUpdate)
                    {
                        tam.UpdateAll(ds);
                    }
                }
                catch (SqlException se)
                {
                    return("Error adding new Investor(s): " + se.Message);
                }
            }

            return(null);
        }
Ejemplo n.º 14
0
 public override void execute()
 {
     bs.EndEdit();
     ta.UpdateAll(this.ds);
 }
 public void UpdateAllTest()
 {
     TableAdapterManager target = new TableAdapterManager(); // TODO: Initialize to an appropriate value
     taxi_managementDataSet dataSet = null; // TODO: Initialize to an appropriate value
     int expected = 0; // TODO: Initialize to an appropriate value
     int actual;
     actual = target.UpdateAll(dataSet);
     Assert.AreEqual(expected, actual);
     Assert.Inconclusive("Verify the correctness of this test method.");
 }