public ActionResult Approve(int?id) { if (id == null) { return(RedirectToAction("ManageValidRequests")); } try { // 1- update loan reuest status Request request = RequestServices.Get(id.Value); request.RequestStatus = (int)RequestStatusEnum.Approved; RequestServices.Update(request); // 2- update guarantors status List <Guarantor> Guarantors = GuarantorServices.GetByRefundableProduct(id.Value); for (int i = 0; i < Guarantors.Count; i++) { Guarantor temp = Guarantors[i]; temp.GuarantorStatus = (int)GuarantorStatusEnum.UnderStudy; GuarantorServices.Update(temp); } } catch (Exception ex) { } return(RedirectToAction("ManageValidRequests")); }
// GET: Guarantor/Delete/5 public ActionResult DeleteGuarantorWithStatement(Nullable <int> id, int ProductId) { //ViewBag.ModuleName = moduleName; ViewBag.Title = delete; ViewBag.Delete = delete; ViewBag.Yes = yes; ViewBag.No = no; ViewBag.ConfirmDelete = confirmDelete; ViewBag.Action = delete; ViewBag.TitleGuarantor = TitleGuarantor; if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Db db = new Db(DbServices.ConnectionString); Guarantor guarantor = GuarantorServices.Get(id.Value, db); if (guarantor == null) { return(HttpNotFound()); } ViewBag.ProductId = ProductId; return(PartialView(guarantor)); }
/// <summary> /// 保存担保人信息集合 /// </summary> /// <param name="guarantor"></param> /// <param name="auditId"></param> public IEnumerable <Guarantor> SaveGuarantor(BaseAudit baseAudit, BaseAudit newAudit) { var indList = new List <Guarantor>(); foreach (var model in baseAudit.Guarantors) { #region 担保人信息 var entity = new Guarantor(); entity.ID = Guid.NewGuid().ToString(); entity.BaseAuditID = newAudit.ID; entity.Address = model.Address; entity.ContactNumber = model.ContactNumber; entity.GuarantType = model.GuarantType; entity.IdentityNumber = model.IdentityNumber; entity.IdentityType = model.IdentityType; entity.MarriedInfo = model.MarriedInfo; entity.Name = model.Name; entity.RelationType = model.RelationType; entity.Sequence = model.Sequence; indList.Add(entity); //保存担保人信息 #endregion 担保人信息 } guarantorDAL.AddRange(indList); return(indList); }
public ActionResult Create([Bind(Include = "Id, RefundableProduct, SubNumber, Employee, GuarantorStatus, Notes")] Guarantor guarantor) { Db db = new Db(DbServices.ConnectionString); if (ModelState.IsValid) { try { GuarantorServices.Insert(CurrentUser.Id, guarantor, db); TempData["Success"] = ResourceServices.GetString(Cf.Data.Resources.ResourceBase.Culture, "UI", "InsertConfirmed"); return(RedirectToAction("Index")); } catch (CfException cfex) { TempData["Failure"] = cfex.ErrorDefinition.LocalizedMessage; } catch (Exception ex) { TempData["Failure"] = ex.Message; } } ViewBag.EmployeeList = new SelectList(EmployeeServices.List(db), "Id", "FirstName"); ViewBag.GuarantorStatusList = new SelectList(GuarantorStatusServices.List(db), "Id", "Name"); ViewBag.RefundableProductList = new SelectList(RefundableProductServices.List(db), "Product", "Name"); return(View(guarantor)); }
public static Boolean isGuarantorValidForAddingAndUpdating(Guarantor guarantor) { if (guarantor != null) { if (!guarantor.Name.Equals("")) { if (!guarantor.Address.Equals("")) { return(true); } else { return(false); } } else { return(false); } } else { return(false); } }
public IActionResult Create(GuarantorCreateViewModel model) { if (ModelState.IsValid) { //int maxi = _guarantorRepo.GetGuarantors().Max(e => e.id) + 1; //string uniqueFileName = ProcessPhoto(model); Guarantor Newguarantor = new Guarantor { //id = maxi, EmployeeId = model.studentId, Name = model.Name, Email = model.Email, HomePhone = model.HomePhone, //Photo = uniqueFileName, OfficePhone = model.OfficePhone, CompanyName = model.CompanyName, Position = model.Position, Address = model.Address, }; _guarantorRepo.AddGuarantor(Newguarantor); return(RedirectToAction("index", "home")); } return(View()); }
public CommandResult Handle(CreateLoanCommand request) { try { var user = context.User.SingleOrDefault(us => us.Id == request.UserId); var loan = new Loan(request.Amount, request.MonthlyPay, request.StartDate, request.FinishDate); if (user != null) { var guarantor = new Guarantor(request.GuarantorFirstName, request.GuarantorLastName, request.Phone, request.Relationship); guarantorRepository.Insert(guarantor); loan.Guarantor = guarantor; loan.User = user; loanRepository.Insert(loan); return(new CommandResult(true)); } return(new CommandResult(false, "User not found")); } catch (Exception exception) { return(new CommandResult(false, exception.Message)); } }
public JsonResult Create(AddGuarantorViewModel model) { if (ModelState.IsValid) { Guarantor guarantor = new Guarantor(); guarantor.Name = model.Name; guarantor.StudentId = model.StudentId; guarantor.Phone = model.Phone; guarantor.DocUrl = model.DocUrl; var newGuarantor = _employeeRepository.AddGuarantor(guarantor); StudentGuarantor studentGuarantor = new StudentGuarantor { GuarantorId = newGuarantor.ID, StudentId = model.StudentId }; var savedSG = _db.StudentGuarantor.Add(studentGuarantor); _db.SaveChanges(); if (newGuarantor == null) { return(Json(new { success = false, message = "Error while deletiing" })); } else { return(Json(new { success = true, message = "Object saved", type = "guarantor", id = newGuarantor.StudentId })); } } return(Json(new { success = false, message = "Invalid Submission" })); }
public FinanceDataValidator(DatabaseContext databaseContext) { _documentTypes = databaseContext.Set <GuarantorDocumentType>().ToList(); RuleFor(financeData => financeData.Representative).SetValidator(new RepresentativeValidator()); RuleFor(financeData => financeData.Guarantors).SetCollectionValidator(new GuarantorValidator()); RuleFor(financeData => financeData.PlanId).NotNull().WithName(Resources.Models.FinanceData.PlanId); RuleFor(financeData => financeData.PaymentMethodId).NotNull().WithName(Resources.Models.FinanceData.PaymentMethodId); RuleFor(financeData => financeData.Guarantors).Custom((guarantors, context) => { for (int i = 0; i < guarantors.Count; i++) { Guarantor guarantor = guarantors.ToArray()[i]; foreach (GuarantorDocumentType documentType in _documentTypes) { List <string> errors = Validate(guarantor, documentType); foreach (string error in errors) { context.AddFailure(string.Format("guarantors[{1}].documents.{0}", documentType.Id, i), string.Format(Resources.Shared.RequiredDocumentMessage, documentType.Name)); } } } }); }
public IActionResult AddGuarantor(GuarantorViewModel guarantorModel) { if (ModelState.IsValid) { Guarantor newGuarantor = new Guarantor { Name = guarantorModel.Name, Address = guarantorModel.Address, Number = guarantorModel.Number, Gender = guarantorModel.Gender, Relationship = guarantorModel.Relationship, Occupation = guarantorModel.Occupation, Email = guarantorModel.Email, Nationality = guarantorModel.Nationality }; var model = _guarantorRepository.AddGuarantor(newGuarantor); StudentGuarantor studentGuarantor = new StudentGuarantor { StudentId = guarantorModel.StudentId, GuarantorId = model.Id }; _studentGuarantor.AddStdGtr(studentGuarantor); return(RedirectToAction("studentinfo", "home", new { id = guarantorModel.StudentId })); } return(View(guarantorModel)); }
public Guarantor UpdateGuarantor(Guarantor updateguarantor) { var guarantor = _studentDbContext.Guarantors.Attach(updateguarantor); guarantor.State = Microsoft.EntityFrameworkCore.EntityState.Modified; _studentDbContext.SaveChanges(); return(updateguarantor); }
public AddGuarantorForm(Form pMdiParent, Currency tcode, IApplicationController applicationController) { _mdiParent = pMdiParent; _guarantor = new Guarantor(); _guarantor.Amount = 0; code = tcode; Initialization(); }
public Guarantor FindOne(string id) { var query = Join().Where(q => q.Guarantor.ID == id).FirstOrDefault(); Guarantor guarantor = query.Guarantor; guarantor.Occupant = query.Occupant; return guarantor; }
public AddGuarantorForm(Form pMdiParent, Currency tcode) { _mdiParent = pMdiParent; _guarantor = new Guarantor(); _guarantor.Amount = 0; code = tcode; Initialization(); }
public Guarantor UpdateGuarantor(Guarantor Guarantor_changes) { var guarantor = context.Guarantors.Attach(Guarantor_changes); guarantor.State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); return(Guarantor_changes); }
public ActionResult Create(int customerid) { Customer customer = Db.Customers.Find(customerid); Guarantor guarantor = new Guarantor(); guarantor.Customer = customer; guarantor.CustomerId = customer.Id; return(View(guarantor)); }
public async Task <Guarantor> Add(Guarantor guarantor) { var guarantorFromDb = await _context.Users.Where(x => x.Email == guarantor.GuarantorEmail) .FirstOrDefaultAsync(); var guaranteeFromDb = await _context.Users.Where(x => x.Email == guarantor.GuaranteeEmail) .FirstOrDefaultAsync(); if (guarantorFromDb == null || (!guaranteeFromDb.CanGuarantee) || ((guarantorFromDb != null) && (guarantorFromDb.Email == guarantor.GuaranteeEmail))) { throw new AppException("Guarantor is not found"); } if (guaranteeFromDb == null) { throw new AppException("User is not found"); } if (_context.Guarantors.Any(x => (x.GuaranteeEmail == guarantor.GuaranteeEmail) && x.GuarantorEmail == guarantor.GuarantorEmail)) { throw new AppException("Guarantor has already been added"); } guarantor.Status = "Awaiting approval"; DateTime guarantorLocalTime_Nigeria = new DateTime(); string windowsTimeZone = GetWindowsFromOlson.GetWindowsFromOlsonFunc("Africa/Lagos"); guarantorLocalTime_Nigeria = TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.FindSystemTimeZoneById(windowsTimeZone)); guarantor.DateAdded = guarantorLocalTime_Nigeria; await _context.Guarantors.AddAsync(guarantor); await _context.SaveChangesAsync(); string body = "Dear " + guaranteeFromDb.FirstName + ",<br/><br/>Your request for a guarantee has been sent to " + guarantorFromDb.Email + " .<br/><br/>" + "You will receive an email from us when your guarantor provides a guarantee for you.<br/><br/>" + "Thanks,<br/>The RotatePay Team<br/>"; var message = new Message(new string[] { guaranteeFromDb.Email }, "[RotatePay] Request for Guarantee", body, null); _emailSenderService.SendEmail(message); string body1 = "Dear " + guarantorFromDb.FirstName + ",<br/><br/> " + guaranteeFromDb.FirstName + "(" + guaranteeFromDb.Email + ")" + " has requested that you provide a guarantee for their RotatePay profile.<br/><br/>" + "You can either accept or decline to provide a guarantee.<br/><br/>" + "Before you accept to provide guarantee for anyone, please ensure that you know them very well and that they can easily afford to pay their proposed contribution amount monthly.<br/><br/>" + "To provide a guarantee, please login to your RotatePay profile and check the Gaurantor secction for more information.<br/><br/>" + "Thanks,<br/>The RotatePay Team<br/>"; var message1 = new Message(new string[] { guarantorFromDb.Email }, "[RotatePay] Request for Guarantee", body1, null); _emailSenderService.SendEmail(message1); //await _logService.Create(log); return(guarantor); }
public static void Create(Guarantor guarantor) { database.NewExecute( "INSERT INTO `guarantors` (`user_id`,`loan_id`) VALUES (@userId,@loanId);" , new List <string> { "@userId", "@loanId" } , new List <object> { guarantor.User.Id, guarantor.Loan.Id }); }
public Guarantor DeleteGuarantor(int id) { Guarantor guarantor = context.Guarantors.Find(id); if (guarantor != null) { context.Guarantors.Remove(guarantor); context.SaveChanges(); } return(guarantor); }
public async Task<RentleResponse> Delete(IEnumerable<string> ids) { foreach (string id in ids) { Guarantor guarantor = await _guarantor.FindOneAndDeleteAsync(g => g.ID == id); await _occupant.UpdateOneAsync(o => o.ID == guarantor.ID, Builders<Occupant>.Update.Set(o => o.GuarantorID, null)); } if (ids.Count() == 1) return new RentleResponse("le guarant a �t� supprimer avec succ�s", true); return new RentleResponse("les guarants a �t� supprimer avec succ�s", true); }
public async Task<RentleResponse> Create(Guarantor guarantor) { try { await _guarantor.InsertOneAsync(guarantor); Guarantor guarantorInserted = FindOne(guarantor.ID); return new RentleResponse<Guarantor>("Le guarant a bien été ajouté", true, guarantorInserted); } catch { return new RentleResponse("Une erreur interne est survenue", false); } }
public ActionResult Create(Guarantor guarantor) { try { Db.Guarantors.Add(guarantor); Db.SaveChanges(); return(RedirectToAction("Index")); } catch { ViewBag.ErrorMessage = "Error occured while adding guarantor."; return(View("Error")); } }
public void SetGuarantor(Guarantor guarantor) { if (_creditApp == null) { CreateCreditApp(); //this should never happen } _creditApp.GuarantorFirstName = guarantor.FirstName ?? string.Empty; _creditApp.GuarantorMiddleInitial = guarantor.MiddleInitial ?? string.Empty; _creditApp.GuarantorLastName = guarantor.LastName ?? string.Empty; _creditApp.GuarantorAddress = guarantor.Address ?? string.Empty; _creditApp.GuarantorCity = guarantor.City ?? string.Empty; _creditApp.GuarantorState = guarantor.State ?? string.Empty; _creditApp.GuarantorZip = guarantor.Zip ?? string.Empty; }
public IActionResult Edit(GuarantorEditViewModel guarantorEditViewModel) { if (ModelState.IsValid) { Guarantor guarantor = _employeeRepository.GetGuarantor(guarantorEditViewModel.ID); guarantor.DocUrl = guarantorEditViewModel.DocUrl; guarantor.StudentId = guarantorEditViewModel.StudentId; guarantor.Phone = guarantorEditViewModel.Phone; guarantor.Name = guarantorEditViewModel.Name; _employeeRepository.UpdateGuarantor(guarantor); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Delete(int id, Guarantor guarantor) { try { Guarantor _guarantor = Db.Guarantors.Find(guarantor.Id); Db.Guarantors.Remove(_guarantor); Db.SaveChanges(); return(RedirectToAction("Index")); } catch { ViewBag.ErrorMessage = "Error occured while deleting guarantor"; return(View("Error")); } }
public AddGuarantorForm(Guarantor guarantor, Form pMdiParent, bool isView, Currency tcode) { _mdiParent = pMdiParent; _guarantor = guarantor; code = tcode; Initialization(); InitializeGuarantor(); if (isView) { groupBoxName.Enabled = false; groupBoxAmount.Enabled = false; buttonSave.Enabled = false; } }
public GuarantorModel MapToGuarantorModel(Guarantor guarantor) { GuarantorModel retGuarantor = null; try { retGuarantor = _mapper.Map <GuarantorModel>(guarantor); retGuarantor.FamiliesCount = -1; retGuarantor.OrphansCount = -1; } catch { retGuarantor = null; } return(retGuarantor); }
// GET: Guarantor/Delete/5 public ActionResult Delete(Nullable <int> id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Db db = new Db(DbServices.ConnectionString); Guarantor guarantor = GuarantorServices.Get(id.Value, db); if (guarantor == null) { return(HttpNotFound()); } return(View(guarantor)); }
public ViewResult GuarantorInfo(Guid?Id) { Guarantor guarantor = _guarantorRepository.GetGuarantor(Id.Value); if (guarantor == null) { Response.StatusCode = 404; } GuarantorDetailsViewModel guarantorDetailsViewModel = new GuarantorDetailsViewModel { Guarantor = guarantor, PageTitle = "Guarantor Details" }; return(View(guarantorDetailsViewModel)); }
public IEnumerable <Guarantor> Get(int customerid) { var list = Db.Guarantors.Where(g => g.CustomerId == customerid).ToList(); List <Guarantor> guaranters = new List <Guarantor>(); foreach (var g in list) { Guarantor guarantor = new Guarantor(); guarantor.Id = g.Id; guarantor.GuarantorName = g.GuarantorName; guaranters.Add(guarantor); } guaranters = guaranters.OrderByDescending(g => g.Id).ToList(); return(guaranters); }
protected void Button2_Click(object sender, EventArgs e) { Guarantor _guarantor = new Guarantor(); _guarantor.GuarantorFirstName = MemberFirstNameTextBox.Text; _guarantor.GuarantorLastName = MemberLastNameTextBox.Text; // _guarantor.MemberBranch = MemberBranchTextBox.Text; //_guarantor.Balance.Value.ToString() = BalanceTextBox.Text; if (FileUpload1.HasFile) _guarantor.GuarantorPhoto = FileUpload1.FileBytes; // _guarantor.AccountNumber = AccountTextBox.Text; // _guarantor.AccountNumber = AccountTextBox.Text; _guarantor.OtherName = MemberOtherNameTextBox.Text; _guarantor.DOB = Convert.ToDateTime(MemberDOBNameTextBox.Text); _guarantor.Fax = MemberFaxTextBox0.Text; _guarantor.IdentityNumber = MemberIDNumberTextBox.Text; _guarantor.Mobile = MemberMobileTextBox.Text; _guarantor.ResidentialAddress = MemberResidentialTextBox.Text; _guarantor.Telephone = MemberTelTextBox.Text; // _guarantor.IdentityTypeID = Convert.ToInt32(DropDownList1.SelectedValue); //_guarantor.ContactPerson = MemberContactPersonTextBox.Text; Utils.GetDataContext().Guarantors.InsertOnSubmit(_guarantor); Utils.GetDataContext().SubmitChanges(); //audit Utils.logAction("Insert", _guarantor); }
public static string InsertKunjunganData(Registration reg, Patient pat, List<KeyValuePair<string, string>> RscmKunjunganBaru) { string RscmPatientID = string.Empty; string AdmissionID = string.Empty; List<KeyValuePair<string, string>> Data_Kunjungan_Yang_Akan_dikirim = new List<KeyValuePair<string, string>>(); foreach (var element in RscmKunjunganBaru) { RscmPatientID = element.Key; AdmissionID = element.Value; } if (string.IsNullOrEmpty(AdmissionID)) return string.Empty; Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("admission_dttm", ((DateTime)reg.RegistrationDate).ToString("yyyy-MM-dd") + " " + reg.RegistrationTime + ":00")); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("discharge_dttm", "0000-00-00 00:00:00")); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("admission_org_id", "687")); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("admission_org_nm", "RSCM KENCANA")); MpiPayplanMapping mpm = new MpiPayplanMapping(); mpm.es.Connection.Name = "HIS_INTEROP"; string PayplanId = string.Empty; string PayplanNm = string.Empty; if (mpm.LoadByPrimaryKey(reg.GuarantorID)) { PayplanId = mpm.PayplanId; PayplanNm = mpm.PayplanNm; } Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("payplan_id", PayplanId)); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("payplan_nm", PayplanNm)); Guarantor g = new Guarantor(); if (g.LoadByPrimaryKey(reg.GuarantorID)) Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("guarantor_nm", g.GuarantorName)); if (reg.BedID != null) Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("inpatient_bed_id", reg.BedID)); if (reg.RoomID != null) Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("inpatient_bed_nm", reg.RoomID + "," + reg.BedID)); if (reg.ParamedicID != null) Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("doctor_id1", reg.ParamedicID)); if (reg.SRRegistrationType == "IPR") Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("inpatient_ind", "1")); else Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("inpatient_ind", "0")); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("created_dttm", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); Data_Kunjungan_Yang_Akan_dikirim.Add(new KeyValuePair<string, string>("created_user_id", "9638")); if (Mpi.pasien_kunjungan_update(RscmPatientID, AdmissionID, Data_Kunjungan_Yang_Akan_dikirim)) return AdmissionID; else return string.Empty; }