public void UpdateSetting(Client c, string cid, string password) { if (c.Mail == "") { throw new Exception("The Email Filed Is Empty"); } if (c.Fname == "") { throw new Exception("The First Name Filed Is Empty"); } if (c.Lname == "") { throw new Exception("The Last Name Filed Is Empty"); } if (c.Address == "") { throw new Exception("The Billing Address Filed Is Empty"); } if (c.Suite == "") { throw new Exception("The Suite Field Is Empty"); } if (c.City == "") { throw new Exception("The Unit City Filed Is Empty"); } if (c.Zip == "") { throw new Exception("The Zip Code Filed Is Empty"); } if (c.MobileNum == "") { throw new Exception("The Mobile Phone Filed Is Empty"); } UserC u = new UserC(); User user = u.FindUser(c.Id); if (password != "") { user.Password = password; } user.Mail = c.Mail; user.MobileNum = c.MobileNum; user.Fname = c.Fname; user.Lname = c.Lname; u.UpdateUser(user); c.Id = cid; ClientGlobal global = new ClientGlobal(); c.SalesRep = global.FindClient(c.Id).SalesRep; global.UpdateClient(c); throw new Exception("The Update Was Successful"); }
public void Submit(Loans1 l, string status, string uid) { if (status == "Client") { ClientC interc = new ClientC(); if (interc.FindIfClientHasLoan(l.ClientId)) { //ClientGlobal global = new ClientGlobal(); UpdateLoan1(FindLoan1ByClient(l.ClientId)); throw new Exception("The First Stage Has Been Successfully Updated"); } else { Loans1 l1 = new Loans1(FindLoan1ByClient(l.ClientId)); l.Id = l1.Id; CreatLoans1(l); UserC u = new UserC(); SendEmailC send = new SendEmailC(); ClientC c = new ClientC(); Client c1 = c.FindClient(uid); string message = "Client: " + c1.Mail + " " + c1.MobileNum + " " + c1.Fname + " " + c1.Lname + "Want a loan"; send.SendEmailF(u.FindNeedEmail("Manager", uid), "Ask For Loan" + c1.Fname + " " + c1.Lname, message); } } else { //status will be the employee id UpdateLoan1(FindLoan1ByClient(l.ClientId)); ClientGlobal global = new ClientGlobal(); Client c = global.FindClient(l.ClientId); if (c.MiddleProcess == "1") { c.MiddleProcess = "1app"; global.UpdateClient(c); } SendEmailC send = new SendEmailC(); ClientC clientC = new ClientC(); Client c1 = clientC.FindClient(uid); string message = "Hello " + c1.Fname + " " + c1.Lname + "We wanted to let you know that the application approved"; send.SendEmailF(c1.Mail, "Approved Application", message); } }