public SureDepositManagementModel GetTenantSDDetails(int id, long TenantID) { ShomaRMEntities db = new ShomaRMEntities(); SureDepositManagementModel sddet = new SureDepositManagementModel(); var getSDdata = db.tbl_SureDeposit.Where(p => p.ProspectID == id).FirstOrDefault(); var getAppInfo = db.tbl_TenantOnline.Where(co => co.ParentTOID == TenantID).FirstOrDefault(); if (getAppInfo != null) { sddet.FirstName = getAppInfo.FirstName; sddet.LastName = getAppInfo.LastName; sddet.Email = getAppInfo.Email; sddet.PhoneNo = getAppInfo.Mobile; var getstatename = db.tbl_State.Where(f => f.ID == getAppInfo.State).FirstOrDefault(); sddet.State = getstatename.StateName; sddet.City = getAppInfo.CityHome; sddet.Address1 = getAppInfo.HomeAddress1; sddet.Address2 = getAppInfo.HomeAddress2; sddet.Zip = getAppInfo.ZipHome; if (getSDdata != null) { sddet.SDNumber = getSDdata.SDNumber; sddet.ExpirationDateString = getSDdata.ExpirationDate.HasValue ? getSDdata.ExpirationDate.Value.ToString("MM/dd/yyyy") : ""; sddet.Status = Convert.ToInt32(getSDdata.Status); sddet.BondAmount = getSDdata.BondAmount != null?Convert.ToDecimal(getSDdata.BondAmount) : 0; } } return(sddet); }
public SureDepositManagementModel GetDetails() { SureDepositManagementModel model = new SureDepositManagementModel(); model.SureDepoAppList = GetSureDepoAppList(); return(model); }
public string SaveUpdateSureDeposit(SureDepositManagementModel model) { string msg = ""; ShomaRMEntities db = new ShomaRMEntities(); var getSDdata = db.tbl_SureDeposit.Where(p => p.ProspectID == model.ApplyNowID).FirstOrDefault(); if (getSDdata == null) { var saveSD = new tbl_SureDeposit() { SDNumber = model.SDNumber, ProspectID = model.ApplyNowID, ParentTOID = model.TenantID, UploadDate = DateTime.Now, ExpirationDate = model.ExpirationDate, Status = model.Status, BondAmount = model.BondAmount, }; db.tbl_SureDeposit.Add(saveSD); db.SaveChanges(); msg = "Sure Deposit Saved Successfully"; } else { getSDdata.ParentTOID = model.TenantID; getSDdata.SDNumber = model.SDNumber; getSDdata.UploadDate = DateTime.Now; getSDdata.ExpirationDate = model.ExpirationDate; getSDdata.Status = model.Status; getSDdata.BondAmount = model.BondAmount; db.SaveChanges(); msg = "Sure Deposit Saved Successfully"; } db.Dispose(); return(msg); }