public SurveysController() { Regions = Database.Session.Query <Region>().ToList(); Districts = Database.Session.Query <District>().ToList(); Staffs = Database.Session.Query <Staff>().ToList(); SurveyorDrop = new SurveyorDrop(); DropVs = new DropVs(); }
public ActionResult SurveyProfile(SurveyProfileInfo data, string prevBtn, string nextBtn) { var points = new DropVs(); //var surveyTypes = new SurveyorDrop(); SurveyWizard obj = GetSurvey(); ViewBag.Village = obj.GeoSurvey.Village; if (prevBtn != null) { //var regions = Database.Session.Query<Region>().ToList(); //ViewBag.RegionList1 = new SelectList(regions, "Id", "Name"); //var selectList = new SelectList(regions, "Id", "Name"); //ViewBag.RegionList1 = SetSelectedValue(selectList, obj.Client.Region.Name); //ViewBag.RegionList2 = SetSelectedValue(selectList, obj.GeoSurvey.Region.Name); //ViewBag.district = GetDistrictList(Convert.ToInt32(obj.GeoSurvey.Region.Name)); //SurveysNew sn = new SurveysNew(); //sn.Client.Name = obj.Client.Name; //sn.Client.Address = obj.Client.Address; //sn.Client.Region = obj.Client.Region; //sn.Client.Phone = obj.Client.Phone; //sn.Client.Email = obj.Client.Phone; //sn.Region = obj.GeoSurvey.Region; //sn.District = obj.GeoSurvey.District.Name; //sn.SurveyorType = obj.GeoSurvey.SurveyType; //sn.Cost = obj.GeoSurvey.Cost; //sn.SurveyorName = obj.GeoSurvey.Staff.Name; //sn.StartDate = obj.GeoSurvey.StartDate; //sn.EndDate = obj.GeoSurvey.EndDate; return(PartialView("ClientSurvey")); } if (nextBtn != null) { ViewBag.VesPoints = new SelectList(DropVs.VsPoints.ToList(), "Id", "Number"); ViewBag.SurveyTypes = new SelectList(SurveyorDrop.surveyorTypes.ToList(), "Id", "Name"); if (ModelState.IsValid) { var surveyProfile1 = new SurveyProfile(); var surveyProfile2 = new SurveyProfile(); var surveyProfile3 = new SurveyProfile(); int surveyMethod1 = Convert.ToInt32(data.ProfileEditor1.SurveyMethod); int surveyMethod2 = Convert.ToInt32(data.ProfileEditor2.SurveyMethod); int surveyMethod3 = Convert.ToInt32(data.ProfileEditor3.SurveyMethod); surveyProfile1.VesPoint = Convert.ToInt32(data.ProfileEditor1.VESPoints); surveyProfile1.Northing = data.ProfileEditor1.Northing; surveyProfile1.Easting = data.ProfileEditor1.Easting; surveyProfile1.Elevation = data.ProfileEditor1.Elevation; surveyProfile1.SurveyMethod = SurveyTypeName(surveyMethod1); surveyProfile1.Recommend = data.ProfileEditor1.Recommend; surveyProfile2.VesPoint = Convert.ToInt32(data.ProfileEditor2.VESPoints); surveyProfile2.Northing = data.ProfileEditor2.Northing; surveyProfile2.Easting = data.ProfileEditor2.Easting; surveyProfile2.Elevation = data.ProfileEditor2.Elevation; surveyProfile2.SurveyMethod = SurveyTypeName(surveyMethod2); surveyProfile2.Recommend = data.ProfileEditor2.Recommend; surveyProfile3.VesPoint = Convert.ToInt32(data.ProfileEditor3.VESPoints); surveyProfile3.Northing = data.ProfileEditor3.Northing; surveyProfile3.Easting = data.ProfileEditor3.Easting; surveyProfile3.Elevation = data.ProfileEditor3.Elevation; surveyProfile3.SurveyMethod = SurveyTypeName(surveyMethod3); surveyProfile3.Recommend = data.ProfileEditor3.Recommend; obj.GeoSurvey.SiteRecommendation = data.ProfileEditor1.SiteRecommendation; var client = obj.Client; var geosurvey = obj.GeoSurvey; client.AddDate = DateTime.UtcNow; Database.Session.Save(client); geosurvey.Client = client; Database.Session.Save(geosurvey); surveyProfile1.Resistivity = "123"; surveyProfile1.GeoSurvey = geosurvey; Database.Session.Save(surveyProfile1); surveyProfile2.Resistivity = "123"; surveyProfile2.GeoSurvey = geosurvey; Database.Session.Save(surveyProfile2); surveyProfile3.Resistivity = "123"; surveyProfile3.GeoSurvey = geosurvey; Database.Session.Save(surveyProfile3); ViewBag.ActionMethod = "New"; RemoveSurvey(); return(PartialView("Success")); } } return(PartialView()); }