Exemplo n.º 1
0
        public void CreateLoan2(Loans2 l)
        {
            Loans1C c = new Loans1C();

            l.Id = c.FindLoan1ByClient(l.ClientId).Id.ToString();
            InquiriesC inq = new InquiriesC();

            foreach (var v in l.InqList)
            {
                v.LoansId = l.Id;
                inq.CreateInq(v);
            }
            CAccountC cacc = new CAccountC();

            foreach (var v in l.CAccList)
            {
                cacc.CreateCAcc(v);
            }

            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();

            string       query = "INSERT INTO Loans2 (Id,OpenCC,OpenRC,OpenRELoans,OpenILoans,TotalOpenAcc,AcceverLate,CollectionAcc,AvgAccAge,OldestAcc,CRDebt,REDebt,ILDebt,CollectionDebt,TDebt,PublicRecords,Experian,Equifax,TransUnio,Fico2,Fico3,Fico8,Comment,ClientId,Close,Source) VALUES (@Id,@OpenCC,@OpenRC,@OpenRELoans,@OpenILoans,@TotalOpenAcc,@AcceverLate,@CollectionAcc,@AvgAccAge,@OldestAcc,@CRDebt,@REDebt,@ILDebt,@CollectionDebt,@TDebt,@PublicRecords,@Experian,@Equifax,@TransUnio,@Fico2,@Fico3,@Fico8,@Comment,@ClientId,@Close,@Source)";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", l.Id);
            cmd.Parameters.AddWithValue("@OpenCC", l.OpenCC);
            cmd.Parameters.AddWithValue("@OpenRC", l.OpenRC);
            cmd.Parameters.AddWithValue("@OpenRELoans", l.OpenRELoans);
            cmd.Parameters.AddWithValue("@OpenILoans", l.OpenILoans);
            cmd.Parameters.AddWithValue("@TotalOpenAcc", l.TotalOpenAcc);
            cmd.Parameters.AddWithValue("@AcceverLate", l.AcceverLate);
            cmd.Parameters.AddWithValue("@CollectionAcc", l.CollectionAcc);
            cmd.Parameters.AddWithValue("@AvgAccAge", l.AvgAccAge);
            cmd.Parameters.AddWithValue("@OldestAcc", l.OldestAcc);
            cmd.Parameters.AddWithValue("@CRDebt", l.CRDebt);
            cmd.Parameters.AddWithValue("@REDebt", l.REDebt);
            cmd.Parameters.AddWithValue("@ILDebt", l.ILDebt);
            cmd.Parameters.AddWithValue("@CollectionDebt", l.CollectionDebt);
            cmd.Parameters.AddWithValue("@TDebt", l.TDebt);
            cmd.Parameters.AddWithValue("@PublicRecords", l.PublicRecords);
            cmd.Parameters.AddWithValue("@Experian", l.Experian);
            cmd.Parameters.AddWithValue("@Equifax", l.Equifax);
            cmd.Parameters.AddWithValue("@Comment", l.Comment);
            cmd.Parameters.AddWithValue("@TransUnio", l.TransUnio);
            cmd.Parameters.AddWithValue("@Fico2", l.Fico2);
            cmd.Parameters.AddWithValue("@Fico3", l.Fico3);
            cmd.Parameters.AddWithValue("@Fico8", l.Fico8);
            cmd.Parameters.AddWithValue("@ClientId", l.ClientId);
            cmd.Parameters.AddWithValue("@Close", Convert.ToInt32(l.Close).ToString());
            cmd.Parameters.AddWithValue("@Source", Convert.ToInt32(l.Source).ToString());

            cmd.ExecuteNonQuery();
            con.Close();
        }
Exemplo n.º 2
0
        public void UpdateLoan2(Loans2 l)
        {
            InquiriesC inq = new InquiriesC();

            inq.RemoveAllInqByLoan(l.Id.ToString());
            CAccountC cacc = new CAccountC();

            cacc.RemoveAllCAccByLoan(l.Id.ToString());
            foreach (var v in l.InqList)
            {
                inq.CreateInq(v);
            }
            foreach (var v in l.CAccList)
            {
                cacc.CreateCAcc(v);
            }

            //change
            while (con.State == ConnectionState.Open)
            {
                System.Threading.Thread.Sleep(500);
            }
            con.Open();
            string       query = "UPDATE Loans2 SET OpenCC=@OpenCC,Source=@Source,OpenRC=@OpenRC,OpenRELoans=@OpenRELoans,OpenILoans=@OpenILoans,TotalOpenAcc=@TotalOpenAcc,AcceverLate=@AcceverLate,CollectionAcc=@CollectionAcc,AvgAccAge=@AvgAccAge,OldestAcc=@OldestAcc,CRDebt=@CRDebt,REDebt=@REDebt,ILDebt=@ILDebt,CollectionDebt=@CollectionDebt,TDebt=@TDebt,PublicRecords=@PublicRecords,Experian=@Experian,Equifax=@Equifax,TransUnio=@TransUnio,Fico2=@Fico2,Fico3=@Fico3,Fico8=@Fico8,Comment=@Comment,ClientId=@ClientId,Close=@Close WHERE Id=@id";
            MySqlCommand cmd   = new MySqlCommand(query, con);

            cmd.Parameters.AddWithValue("@Id", l.Id);
            cmd.Parameters.AddWithValue("@OpenCC", l.OpenCC);
            cmd.Parameters.AddWithValue("@OpenRC", l.OpenRC);
            cmd.Parameters.AddWithValue("@OpenRELoans", l.OpenRELoans);
            cmd.Parameters.AddWithValue("@OpenILoans", l.OpenILoans);
            cmd.Parameters.AddWithValue("@TotalOpenAcc", l.TotalOpenAcc);
            cmd.Parameters.AddWithValue("@AcceverLate", l.AcceverLate);
            cmd.Parameters.AddWithValue("@CollectionAcc", l.CollectionAcc);
            cmd.Parameters.AddWithValue("@AvgAccAge", l.AvgAccAge);
            cmd.Parameters.AddWithValue("@OldestAcc", l.OldestAcc);
            cmd.Parameters.AddWithValue("@CRDebt", l.CRDebt);
            cmd.Parameters.AddWithValue("@REDebt", l.REDebt);
            cmd.Parameters.AddWithValue("@ILDebt", l.ILDebt);
            cmd.Parameters.AddWithValue("@CollectionDebt", l.CollectionDebt);
            cmd.Parameters.AddWithValue("@TDebt", l.TDebt);
            cmd.Parameters.AddWithValue("@PublicRecords", l.PublicRecords);
            cmd.Parameters.AddWithValue("@Experian", l.Experian);
            cmd.Parameters.AddWithValue("@Equifax", l.Equifax);
            cmd.Parameters.AddWithValue("@Comment", l.Comment);
            cmd.Parameters.AddWithValue("@TransUnio", l.TransUnio);
            cmd.Parameters.AddWithValue("@ClientId", l.ClientId);
            cmd.Parameters.AddWithValue("@Fico2", l.Fico2);
            cmd.Parameters.AddWithValue("@Fico3", l.Fico3);
            cmd.Parameters.AddWithValue("@Fico8", l.Fico8);
            cmd.Parameters.AddWithValue("@Close", Convert.ToInt32(l.Close).ToString());
            cmd.Parameters.AddWithValue("@Source", Convert.ToInt32(l.Source).ToString());
            cmd.ExecuteNonQuery();
            con.Close();
        }