public FobManagementModel GetApplicantData(long ApplicantId) { FobManagementModel model = new FobManagementModel(); ShomaRMEntities db = new ShomaRMEntities(); var getApplicantData = db.tbl_Applicant.Where(co => co.ApplicantID == ApplicantId).FirstOrDefault(); if (getApplicantData != null) { string SSN = String.Empty; if (getApplicantData.Type == "Primary Applicant") { var getSSN = db.tbl_TenantOnline.Where(co => co.ProspectID == getApplicantData.TenantID).FirstOrDefault(); SSN = new EncryptDecrypt().DecryptText(getSSN.SSN); } else { SSN = "None"; } model.ApplicantID = getApplicantData.ApplicantID; model.FullName = getApplicantData.FirstName + " " + getApplicantData.LastName; model.DateOfBirthTxt = getApplicantData.DateOfBirth.HasValue ? getApplicantData.DateOfBirth.Value.ToString("MM/dd/yyyy") : ""; model.Email = !string.IsNullOrWhiteSpace(getApplicantData.Email) ? getApplicantData.Email : ""; model.Gender = getApplicantData.Gender; model.SSNstring = SSN; model.Type = getApplicantData.Type; model.MoveInPercentage = getApplicantData.MoveInPercentage.HasValue ? getApplicantData.MoveInPercentage.Value.ToString() : "0.00"; model.MoveInCharges = getApplicantData.MoveInCharge.HasValue ? getApplicantData.MoveInCharge.Value.ToString() : "0.00"; model.MonthlyPercentage = getApplicantData.MonthlyPercentage.HasValue ? getApplicantData.MonthlyPercentage.Value.ToString() : "0.00"; model.MonthlyCharges = getApplicantData.MonthlyPayment.HasValue ? getApplicantData.MonthlyPayment.Value.ToString() : "0.00"; } db.Dispose(); return(model); }
public FobManagementModel GetDetails() { FobManagementModel model = new FobManagementModel(); model.ApprovedApplicantList = GetApprovedApplicantList(); return(model); }
public FobManagementModel GetDetailsForAddEdit(long TenantID) { FobManagementModel model = new FobManagementModel(); model.AllApplicantList = GetAllApplicantList(TenantID); model.LeaseTermList = GetLeaseTermData(TenantID); model.MoveInDataList = GetAllApplicantMovingCharges(TenantID); return(model); }
public List <FobManagementModel> FillPreMovingSearchGrid(FobManagementModel model) { ShomaRMEntities db = new ShomaRMEntities(); List <FobManagementModel> lstPreMoving = new List <FobManagementModel>(); try { DataTable dtTable = new DataTable(); using (var cmd = db.Database.Connection.CreateCommand()) { db.Database.Connection.Open(); cmd.CommandText = "usp_GetPreMovingPaginationAndSearchData"; cmd.CommandType = CommandType.StoredProcedure; //DbParameter param0 = cmd.CreateParameter(); //param0.ParameterName = "FromDate"; //param0.Value = model.FromDate; //cmd.Parameters.Add(param0); //DbParameter param1 = cmd.CreateParameter(); //param1.ParameterName = "ToDate"; //param1.Value = model.ToDate; //cmd.Parameters.Add(param1); DbParameter param3 = cmd.CreateParameter(); param3.ParameterName = "PageNumber"; param3.Value = model.PageNumber; cmd.Parameters.Add(param3); DbParameter param4 = cmd.CreateParameter(); param4.ParameterName = "NumberOfRows"; param4.Value = model.NumberOfRows; cmd.Parameters.Add(param4); DbParameter paramSortBy = cmd.CreateParameter(); paramSortBy.ParameterName = "SortBy"; paramSortBy.Value = model.SortBy; cmd.Parameters.Add(paramSortBy); DbParameter paramOrderBy = cmd.CreateParameter(); paramOrderBy.ParameterName = "OrderBy"; paramOrderBy.Value = model.OrderBy; cmd.Parameters.Add(paramOrderBy); DbDataAdapter da = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateDataAdapter(); da.SelectCommand = cmd; da.Fill(dtTable); db.Database.Connection.Close(); } foreach (DataRow dr in dtTable.Rows) { FobManagementModel searchmodel = new FobManagementModel(); searchmodel.ApplyNowID = Convert.ToInt64(dr["ApplyNowID"].ToString()); searchmodel.PropertyID = Convert.ToInt64(dr["PropertyID"].ToString()); searchmodel.FirstName = dr["FirstName"].ToString(); searchmodel.LastName = dr["LastName"].ToString(); searchmodel.FullName = dr["FullName"].ToString(); searchmodel.Email = dr["Email"].ToString(); searchmodel.PhoneNo = dr["PhoneNo"].ToString(); searchmodel.UnitNo = dr["UnitNo"].ToString(); searchmodel.Building = dr["Building"].ToString(); searchmodel.Bedrooms = dr["Bedroom"].ToString(); searchmodel.CreatedDateString = dr["CreatedByDate"].ToString(); lstPreMoving.Add(searchmodel); } db.Dispose(); return(lstPreMoving.ToList()); } catch (Exception ex) { db.Database.Connection.Close(); throw ex; } }
public int BuildPaganationPreMoving(FobManagementModel model) { int NOP = 0; ShomaRMEntities db = new ShomaRMEntities(); try { DataTable dtTable = new DataTable(); using (var cmd = db.Database.Connection.CreateCommand()) { db.Database.Connection.Open(); cmd.CommandText = "usp_GetPreMovingPaginationAndSearchData"; cmd.CommandType = CommandType.StoredProcedure; //DbParameter param0 = cmd.CreateParameter(); //param0.ParameterName = "FromDate"; //param0.Value = model.FromDate; //cmd.Parameters.Add(param0); //DbParameter param1 = cmd.CreateParameter(); //param1.ParameterName = "ToDate"; //param1.Value = model.ToDate; //cmd.Parameters.Add(param1); DbParameter param3 = cmd.CreateParameter(); param3.ParameterName = "PageNumber"; param3.Value = model.PageNumber; cmd.Parameters.Add(param3); DbParameter param4 = cmd.CreateParameter(); param4.ParameterName = "NumberOfRows"; param4.Value = model.NumberOfRows; cmd.Parameters.Add(param4); DbParameter paramSortBy = cmd.CreateParameter(); paramSortBy.ParameterName = "SortBy"; paramSortBy.Value = model.SortBy; cmd.Parameters.Add(paramSortBy); DbParameter paramOrderBy = cmd.CreateParameter(); paramOrderBy.ParameterName = "OrderBy"; paramOrderBy.Value = model.OrderBy; cmd.Parameters.Add(paramOrderBy); DbDataAdapter da = DbProviderFactories.GetFactory("System.Data.SqlClient").CreateDataAdapter(); da.SelectCommand = cmd; da.Fill(dtTable); db.Database.Connection.Close(); } if (dtTable.Rows.Count > 0) { NOP = int.Parse(dtTable.Rows[0]["NumberOfPages"].ToString()); } db.Dispose(); return(NOP); } catch (Exception ex) { db.Database.Connection.Close(); throw ex; } }
public FobManagementModel GetTenantFobData(long ApplicantId, long TenantID) { FobManagementModel model = new FobManagementModel(); ShomaRMEntities db = new ShomaRMEntities(); var checkAlreadyExist = db.tbl_TenantFob.Where(co => co.ApplicantID == ApplicantId && co.Status == 1).FirstOrDefault(); var getPropId = db.tbl_ApplyNow.Where(co => co.ID == TenantID).FirstOrDefault(); var getBed = db.tbl_PropertyUnits.Where(co => co.UID == getPropId.PropertyId).FirstOrDefault(); string Relationshi = ""; string UnitN = ""; if (checkAlreadyExist == null) { var getApplicant = db.tbl_Applicant.Where(co => co.ApplicantID == ApplicantId).FirstOrDefault(); if (getApplicant != null) { if (getApplicant.Type == "Primary Applicant") { Relationshi = getApplicant.Relationship == "1" ? "Self" : ""; } else if (getApplicant.Type == "Co-Applicant") { Relationshi = getApplicant.Relationship == "1" ? "Spouse" : getApplicant.Relationship == "2" ? "Partner" : getApplicant.Relationship == "3" ? "Adult Child" : getApplicant.Relationship == "1" ? "Friend/Roommate" : ""; } else if (getApplicant.Type == "Minor") { Relationshi = getApplicant.Relationship == "1" ? "Family Member" : getApplicant.Relationship == "2" ? "Child" : ""; } var getPropertyId = db.tbl_ApplyNow.Where(co => co.ID == getApplicant.TenantID).FirstOrDefault(); if (getPropertyId != null) { var getUnitNo = db.tbl_PropertyUnits.Where(co => co.UID == getPropertyId.PropertyId).FirstOrDefault(); if (getUnitNo != null) { UnitN = getUnitNo.UnitNo; } } model.UnitNo = UnitN; model.Type = getApplicant.Type; model.FullName = getApplicant.FirstName + " " + getApplicant.LastName; model.Relationship = Relationshi; } else { if (ApplicantId == -1) { var getPId = db.tbl_ApplyNow.Where(co => co.ID == TenantID).FirstOrDefault(); if (getPId != null) { var getUnitNo = db.tbl_PropertyUnits.Where(co => co.UID == getPId.PropertyId).FirstOrDefault(); if (getUnitNo != null) { var getOtherId = db.tbl_TenantFob.Where(co => co.TenantID == TenantID && co.ApplicantID == 0).OrderByDescending(co => co.OtherId).FirstOrDefault(); model.OtherId = getOtherId == null ? 1 : getOtherId.OtherId == null ? 1 : getOtherId.OtherId + 1; model.UnitNo = !string.IsNullOrWhiteSpace(getUnitNo.UnitNo) ? getUnitNo.UnitNo : ""; model.Type = "Other"; model.FullName = ""; model.Relationship = "Other"; } else { model.UnitNo = ""; model.Type = ""; model.FullName = ""; model.Relationship = ""; } } else { model.UnitNo = ""; model.Type = ""; model.FullName = ""; model.Relationship = ""; model.StatusString = "InvalidId"; } } else { model.UnitNo = ""; model.Type = ""; model.FullName = ""; model.Relationship = ""; model.StatusString = "InvalidId"; } } } else { model.StatusString = "Already Activated"; model.UnitNo = ""; model.Type = ""; model.FullName = ""; model.Relationship = ""; } return(model); }