public byte[] PrepareReport(int id) { _boreDrillMethod = Database.Session.Load <BoreDrillMethod>(id); _boreStrata = Database.Session.Query <BoreStrata>().Where(b => b.Borehole.Id == _boreDrillMethod.Borehole.Id).ToList <BoreStrata>(); _borehole = Database.Session.Load <Models.Borehole>(_boreDrillMethod.Borehole.Id); _survey = Database.Session.Load <GeoSurvey>(_boreDrillMethod.GeoSurvey.Id); _drillingType = Database.Session.Query <DrillingType>().Where(b => b.BoreDrillMethod.Id == _boreDrillMethod.Id).SingleOrDefault <DrillingType>(); #region Report _document = new Document(PageSize.A4, 0f, 0f, 0f, 0f); _document.SetPageSize(PageSize.A4); _document.SetMargins(20f, 20f, 20f, 20f); _pdfTable.WidthPercentage = 100; _pdfTable.HorizontalAlignment = Element.ALIGN_LEFT; _fontStyle = FontFactory.GetFont("Tahoma", 8f, 1); PdfWriter.GetInstance(_document, _memoryStream); _document.Open(); _pdfTable.SetWidths(new float[] { 20f, 150f, 100f }); #endregion this.ReportHeader(); this.ReportBody(); this.ReportFooter(); _document.Add(_pdfTable); _document.Close(); return(_memoryStream.ToArray()); }
public ActionResult ClientSurvey(SurveysNew data, string prevBtn, string nextBtn) { //var regions = Database.Session.Query<Region>().ToList(); ViewBag.RegionList1 = new SelectList(Regions, "Id", "Name"); ViewBag.RegionList2 = new SelectList(Regions, "Id", "Name"); //data.SurveyorType = "DDCA"; //var points = new DropVs(); //var surveyTypes = new SurveyorDrop(); if (nextBtn != null) { if (ModelState.IsValid) { ViewBag.VesPoints = new SelectList(DropVs.VsPoints.ToList(), "Id", "Number"); ViewBag.SurveyTypes = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name"); ViewBag.Village = data.Village; SurveyWizard obj = GetSurvey(); //var regionClient = new Region(); //var regionGeosurvey = new Region(); //var geosurveyDistrict = new District(); var client = new Client(); var geosurvey = new GeoSurvey(); //var geosurveyStaff = new Staff(); int regionClientId = Convert.ToInt32(data.Client.Region); int regionGeosurveyId = Convert.ToInt32(data.Region); int geosurveyDistrictId = Convert.ToInt32(data.District); //geosurveyDistrict.Region = regionGeosurvey; int geosurveyStaffId = Convert.ToInt32(data.SurveyorName); if (geosurveyStaffId == 0) { geosurveyStaffId = 5; } client.Name = data.Client.Name; client.Address = data.Client.Address; client.Region = Regions.Where(x => x.Id == regionClientId).FirstOrDefault <Region>(); client.Phone = data.Client.Phone; client.Email = data.Client.Email; geosurvey.Region = Regions.Where(x => x.Id == regionGeosurveyId).FirstOrDefault <Region>(); geosurvey.District = Districts.Where(x => x.Id == geosurveyDistrictId).FirstOrDefault <District>(); geosurvey.Village = data.Village; geosurvey.SurveyType = data.SurveyorType; geosurvey.Cost = data.Cost; geosurvey.Staff = Staffs.Where(x => x.Id == geosurveyStaffId).FirstOrDefault <Staff>(); geosurvey.StartDate = data.StartDate; geosurvey.EndDate = data.EndDate; geosurvey.Status = "U"; obj.Client = client; obj.GeoSurvey = geosurvey; return(PartialView("SurveyProfile")); } } return(PartialView()); }
public ActionResult EditSurveyClient(SurveyEdit data, string prevBtn, string nextBtn) { //var geosurvey = Database.Session.Load<GeoSurvey>(Id); //List<SurveyProfile> surveyProfile = new List<SurveyProfile>(); var surveyProfile = Database.Session.Query <SurveyProfile>().Where(x => x.GeoSurvey.Id == data.surveyId).ToList <SurveyProfile>(); ViewBag.SurveyTypes1 = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name", SurveyTypeId(surveyProfile[0].SurveyMethod)); ViewBag.SurveyTypes2 = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name", SurveyTypeId(surveyProfile[1].SurveyMethod)); ViewBag.SurveyTypes3 = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name", SurveyTypeId(surveyProfile[2].SurveyMethod)); var model = new SurveyProfileEdit(); model.SurveyId = data.surveyId; model.ProfileEditor1.Id = surveyProfile[0].Id; model.ProfileEditor1.VESPoints = surveyProfile[0].VesPoint.ToString(); model.ProfileEditor1.Northing = surveyProfile[0].Northing; model.ProfileEditor1.Easting = surveyProfile[0].Easting; model.ProfileEditor1.Elevation = surveyProfile[0].Elevation; //model.profileeditor1.surveymethod = surveyprofile[0].surveymethod; model.ProfileEditor1.Recommend = surveyProfile[0].Recommend; model.ProfileEditor1.SiteRecommendation = data.SiteRecommendation; model.ProfileEditor2.Id = surveyProfile[1].Id; model.ProfileEditor2.VESPoints = surveyProfile[1].VesPoint.ToString(); model.ProfileEditor2.Northing = surveyProfile[1].Northing; model.ProfileEditor2.Easting = surveyProfile[1].Easting; model.ProfileEditor2.Elevation = surveyProfile[1].Elevation; //model.profileeditor1.surveymethod = surveyprofile[0].surveymethod; model.ProfileEditor2.Recommend = surveyProfile[1].Recommend; model.ProfileEditor3.Id = surveyProfile[2].Id; model.ProfileEditor3.VESPoints = surveyProfile[2].VesPoint.ToString(); model.ProfileEditor3.Northing = surveyProfile[2].Northing; model.ProfileEditor3.Easting = surveyProfile[2].Easting; model.ProfileEditor3.Elevation = surveyProfile[2].Elevation; //model.profileeditor1.surveymethod = surveyprofile[0].surveymethod; model.ProfileEditor3.Recommend = surveyProfile[2].Recommend; SurveyWizard obj = GetSurvey(); if (nextBtn != null) { ViewBag.VesPoints = new SelectList(DropVs.VsPoints.ToList(), "Id", "Number"); ViewBag.SurveyTypes = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name"); ViewBag.Village = data.Village; var client = new Client(); var geosurvey = new GeoSurvey(); int regionClientId = Convert.ToInt32(data.Client.Region); int regionGeosurveyId = Convert.ToInt32(data.Region); int geosurveyDistrictId = Convert.ToInt32(data.District); int geosurveyStaffId = Convert.ToInt32(data.SurveyorName); if (geosurveyStaffId == 0) { geosurveyStaffId = 5; } client.Name = data.Client.Name; client.Address = data.Client.Address; client.Region = Regions.Where(x => x.Id == regionClientId).FirstOrDefault <Region>(); client.Phone = data.Client.Phone; client.Email = data.Client.Email; geosurvey.Region = Regions.Where(x => x.Id == regionGeosurveyId).FirstOrDefault <Region>(); geosurvey.District = Districts.Where(x => x.Id == geosurveyDistrictId).FirstOrDefault <District>(); geosurvey.Village = data.Village; geosurvey.SurveyType = data.SurveyorType; geosurvey.Cost = data.Cost; geosurvey.Staff = Staffs.Where(x => x.Id == geosurveyStaffId).FirstOrDefault <Staff>(); geosurvey.StartDate = data.StartDate; geosurvey.EndDate = data.EndDate; obj.Client = client; obj.GeoSurvey = geosurvey; return(PartialView("SurveyProfileEdit", model)); } return(PartialView()); }