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(); }
public void RemoveLoan2(string Id) { InquiriesC inq = new InquiriesC(); inq.RemoveAllInqByLoan(Id); CAccountC cacc = new CAccountC(); cacc.RemoveAllCAccByLoan(Id); //delete from DataBase while (con.State == ConnectionState.Open) { System.Threading.Thread.Sleep(500); } con.Open(); MySqlCommand cmd = new MySqlCommand("DELETE FROM Loans2 WHERE Id = @id", con); cmd.Parameters.AddWithValue("@id", Id); cmd.ExecuteNonQuery(); con.Close(); }