public void Save(Loans2 l)//only save not change your status { Loans2C loans2C = new Loans2C(); if (loans2C.checkIfExist(l.ClientId)) { loans2C.UpdateLoan2(l); } else { loans2C.CreateLoan2(l); } }
public void Submit(Loans2 l)//save (update) and change the status and let the employee knows { try { if (Convert.ToInt32(l.OpenCC) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Open Credit Cards@1"); } try { if (Convert.ToInt32(l.OpenRC) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Open Retail Cards@1"); } try { if (Convert.ToInt32(l.OpenRELoans) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Open Real Estate Loans@1"); } try { if (Convert.ToInt32(l.OpenILoans) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Open Installment Loans@1"); } try { if (Convert.ToInt32(l.TotalOpenAcc) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Total Open Account@1"); } try { if (Convert.ToInt32(l.AcceverLate) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Account Ever Late@1"); } try { if (Convert.ToInt32(l.CollectionAcc) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Collection Account@1"); } try { if (Convert.ToInt32(l.AvgAccAge.Split('/')[0]) < 1 || Convert.ToInt32(l.AvgAccAge.Split('/')[0]) > 12) { throw new Exception(); } } catch { throw new Exception("Unavailable Month Of Average Account Age @1"); } try { if (Convert.ToInt32(l.AvgAccAge.Split('/')[1]) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Year Of Average Account Age @1"); } try { if (Convert.ToInt32(l.OldestAcc.Split('/')[0]) < 1 || Convert.ToInt32(l.AvgAccAge.Split('/')[0]) > 12) { throw new Exception(); } } catch { throw new Exception("Unavailable Month Of Oldest Account @1"); } try { if (Convert.ToInt32(l.OldestAcc.Split('/')[1]) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Year Of Oldest Account @1"); } try { if (Convert.ToInt32(l.CRDebt.Replace(",", "")) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Credit And Retail Card Debt@1"); } try { if (Convert.ToInt32(l.REDebt.Replace(",", "")) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Real Estate Debt@1"); } try { if (Convert.ToInt32(l.ILDebt.Replace(",", "")) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Installment Loans Debt@1"); } try { if (Convert.ToInt32(l.CollectionDebt.Replace(",", "")) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Collections Debt@1"); } try { if (Convert.ToInt32(l.TDebt.Replace(",", "")) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Total Debt@1"); } foreach (var v in l.CAccList) { AddAccount(v); } foreach (var v in l.InqList) { AddInquiries(v); } try { if (Convert.ToInt32(l.Experian) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Experian @5"); } try { if (Convert.ToInt32(l.Equifax) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Equifax@5"); } try { if (Convert.ToInt32(l.TransUnio) < 0) { throw new Exception(); } } catch { throw new Exception("Unavailable Trans Unio @5"); } Loans2C loans2C = new Loans2C(); string message = ""; ClientC c = new ClientC(); Client c1 = c.FindClient(l.ClientId); if (loans2C.checkIfExist(l.ClientId)) { loans2C.UpdateLoan2(l); message = c1.Fname + " " + c1.Lname + " " + c1.Mail + " " + c1.MobileNum + " " + "Change the report"; } else { loans2C.CreateLoan2(l); message = c1.Fname + " " + c1.Lname + " " + c1.Mail + " " + c1.MobileNum + " " + "Send report"; } c1.MiddleProcess = "2"; c.UpdateClient(c1); SendEmailC send = new SendEmailC(); UserC u = new UserC(); send.SendEmailF(u.FindNeedEmail("Manager", l.ClientId), "Report Of " + c1.Fname + " " + c1.Lname, message); }