diff --git a/BeWo/View/HomeView.xaml.cs b/BeWo/View/HomeView.xaml.cs index 6270ef106..aa5dcd69f 100644 --- a/BeWo/View/HomeView.xaml.cs +++ b/BeWo/View/HomeView.xaml.cs @@ -456,15 +456,15 @@ namespace BeWo.View if (!_Code.Equals("")) { - //Login _login = new Login(_kundennummer, _Code, _benutzername, _passwort, _apikey); + var login = new Login(_kundennummer, _Code, _benutzername, _passwort, _apikey); - //var x = _login.AnmeldevorgangDurchFuehren(); + var x = login.AnmeldevorgangDurchFuehren(); - //if (x != null) - //{ - // ServiceChatView = new ChatView(x); - // ServiceChatView.Show(); - //} + if(x != null) + { + ServiceChatView = new ChatView(x); + ServiceChatView.Show(); + } } else { diff --git a/BeWoPlanerMobil/BeWoPlanerMobil.csproj b/BeWoPlanerMobil/BeWoPlanerMobil.csproj index 91692ee14..fa31dee41 100644 --- a/BeWoPlanerMobil/BeWoPlanerMobil.csproj +++ b/BeWoPlanerMobil/BeWoPlanerMobil.csproj @@ -202,7 +202,6 @@ TestWebService.asmx Component - diff --git a/BeWoPlanerMobil/Controllers/MainController.cs b/BeWoPlanerMobil/Controllers/MainController.cs index 5d2a7ad4c..db3739724 100644 --- a/BeWoPlanerMobil/Controllers/MainController.cs +++ b/BeWoPlanerMobil/Controllers/MainController.cs @@ -668,7 +668,15 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } + if (string.IsNullOrEmpty(collection["Datum"]) || Model.NewServiceRecord == null) + { + return View("Main", Model); + } + string doku1; + var distanceInMeters = 0; + var dauer = 0; + var serviceDescOid = 0L; if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) { @@ -678,16 +686,18 @@ namespace BeWoPlanerMobil.Controllers { doku1 = collection["Dokumentation6"]; } - - Log.Info($"CreateServiceRecord: datum:{collection["Datum"]}; start:{collection["Start"]}; ende:{collection["Ende"]}; dauer:{collection["Dauer"]}; doku:{doku1}; aktion:{collection["versteckt"]}"); - - if(string.IsNullOrEmpty(collection["Datum"])) - { - return View("Main", Model); - } + var doku2 = collection["Dokumentation2"]; + var doku3 = collection["Dokumentation3"]; + var doku4 = collection["Dokumentation4"]; + var doku5 = collection["Dokumentation5"]; var distanz = collection["Distanz"]; - var distanceInMeters = 0; + var start = collection["Start"]; + var ende = collection["Ende"]; + var endDateString = collection["Enddatum"]; + + var selectedCostbearerScRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; + var datum = Convert.ToDateTime(collection["Datum"]); if(!string.IsNullOrEmpty(distanz)) { @@ -697,21 +707,15 @@ namespace BeWoPlanerMobil.Controllers } } - var selectedCostbearerScRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; - var datum = Convert.ToDateTime(collection["Datum"]); + Log.Info($"CreateServiceRecord: datum:{collection["Datum"]}; start:{collection["Start"]}; ende:{collection["Ende"]}; dauer:{collection["Dauer"]}; doku:{doku1}; aktion:{collection["versteckt"]}"); var enddatum = datum; - - var endDateString = collection["Enddatum"]; + if(endDateString != null) { enddatum = Convert.ToDateTime(endDateString); } - - var start = collection["Start"]; - var ende = collection["Ende"]; - var dauer = 0; - + if(datum > enddatum) { enddatum = datum; } @@ -721,11 +725,6 @@ namespace BeWoPlanerMobil.Controllers int.TryParse(collection["Dauer"], out dauer); } - var doku2 = collection["Dokumentation2"]; - var doku3 = collection["Dokumentation3"]; - var doku4 = collection["Dokumentation4"]; - var doku5 = collection["Dokumentation5"]; - var zeitenFeld = new DateTime[2]; if(start == string.Empty && ende == string.Empty) @@ -751,17 +750,10 @@ namespace BeWoPlanerMobil.Controllers dauer = (int) (zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; } - if(Model.NewServiceRecord == null) - { - return RedirectToActionPermanent("Main"); - } - Model.NewServiceRecord.IP = Request.UserHostAddress; - Model.NewServiceRecord.Goals = Model.SelectedGoals; Model.NewServiceRecord.Start = zeitenFeld[0]; Model.NewServiceRecord.End = zeitenFeld[1]; - Model.NewServiceRecord.DistanceInMeter = distanceInMeters; if(Model.Employee.EmployeeOid != null) @@ -810,14 +802,7 @@ namespace BeWoPlanerMobil.Controllers Model.NewServiceRecord.Notice3 = string.IsNullOrEmpty(doku3) ? null : doku3; Model.NewServiceRecord.Notice4 = string.IsNullOrEmpty(doku4) ? null : doku4; Model.NewServiceRecord.Notice5 = string.IsNullOrEmpty(doku5) ? null : doku5; - - var serviceDescOid = 0L; - - //if(Model.SelectedServiceDescriptionOid.HasValue) - //{ - // serviceDescOid = Model.SelectedServiceDescriptionOid.Value; - //} - //else + if(!string.IsNullOrEmpty(collection["ServiceDescription"])) { serviceDescOid = Convert.ToInt64(collection["ServiceDescription"]); @@ -864,12 +849,237 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Main"); } + [HttpPost] + [Authorize] + public ActionResult CreateOrUpdateServiceRecord(FormCollection collection) + { + try + { + if(Model == null) + { + return RedirectToActionPermanent("Index", "Login"); + } + + string doku1; + + if(Model.Dokutypes != null && Model.Dokutypes.Length > 1) + { + doku1 = collection["Dokumentation"]; + } + else + { + doku1 = collection["Dokumentation6"]; + } + + Log.Info($"CreateServiceRecord: datum:{collection["Datum"]}; start:{collection["Start"]}; ende:{collection["Ende"]}; dauer:{collection["Dauer"]}; doku:{doku1}; aktion:{(Model.IsInEditingMode ? "Speichern" : "Anlegen")}"); + + if(string.IsNullOrEmpty(collection["Datum"])) + { + return View("Main", Model); + } + + var distanz = collection["Distanz"]; + var distanceInMeters = 0; + + if(!string.IsNullOrEmpty(distanz)) + { + if(int.TryParse(distanz, out var parsedDistance)) + { + distanceInMeters = parsedDistance; + } + } + + var selectedCostbearerSCRelOid = Model.CostBearer2SupportConceptOid < 1 ? null : Model.CostBearer2SupportConceptOid; + var datum = Convert.ToDateTime(collection["Datum"]); + + var enddatum = datum; + + var start = collection["Start"]; + var ende = collection["Ende"]; + var dauer = 0; + + if(datum > enddatum) + { + enddatum = datum; + } + + if(!string.IsNullOrEmpty(collection["Dauer"])) + { + int.TryParse(collection["Dauer"], out dauer); + } + + var doku2 = collection["Dokumentation2"]; + var doku3 = collection["Dokumentation3"]; + var doku4 = collection["Dokumentation4"]; + var doku5 = collection["Dokumentation5"]; + + var zeitenFeld = new DateTime[2]; + + if(start == string.Empty && ende == string.Empty) + { + zeitenFeld[0] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1); + + if(enddatum == datum) + { + zeitenFeld[1] = new DateTime(datum.Year, datum.Month, datum.Day, 0, 0, 1).AddMinutes(dauer); + } + else + { + zeitenFeld[1] = new DateTime(enddatum.Year, enddatum.Month, enddatum.Day, 0, 0, 1).AddMinutes(dauer); + } + } + else + { + zeitenFeld = enddatum == datum ? ConvertRecordTimes(start, ende, datum, dauer) : ConvertRecordTimesWithEndDate(start, ende, datum, enddatum, dauer); + } + + if(dauer == 0 || zeitenFeld[1] != zeitenFeld[0]) + { + dauer = (int)(zeitenFeld[1] - zeitenFeld[0]).TotalMinutes; + } + + if(Model.IsInEditingMode) + { + var selectedRecordOid = Model.SelectedServiceRecordOid ?? Model.SelectedServiceRecord.ServiceRecordOid; + Model.NewServiceRecord = OperationsService.GetServiceRecordById(selectedRecordOid.Value); + } + + if(Model.NewServiceRecord == null) + { + return RedirectToActionPermanent("Main"); + } + + Model.NewServiceRecord.IP = Request.UserHostAddress; + + Model.NewServiceRecord.Goals = Model.SelectedGoals; + Model.NewServiceRecord.Start = zeitenFeld[0]; + Model.NewServiceRecord.End = zeitenFeld[1]; + + Model.NewServiceRecord.DistanceInMeter = distanceInMeters; + + if(Model.Employee.EmployeeOid != null) + { + if(!Model.IsInEditingMode) + { + Model.NewServiceRecord.Employee = Model.SelectedEmployee ?? MobileSessionFacade.LoggedInCompactEmployee; + } + else + { + if(Model.SelectedEmployee != null) + { + Model.NewServiceRecord.Employee = Model.SelectedEmployee; + } + } + + var sc = Model.SupportConcepts.FirstOrDefault(fod => fod.CostBearerRelations.Any(a => a.CostBearer2SupportConceptOid.HasValue && a.CostBearer2SupportConceptOid.Value.Equals(selectedCostbearerSCRelOid))); + + if(sc != null) + { + if(sc.SupportConceptOid != null) + { + Model.NewServiceRecord.SupportConcept = CustomerService.LoadCompactSupportConceptDC(sc.SupportConceptOid.Value, Model.Employee.EmployeeOid); + } + + Model.NewServiceRecord.Customer = sc.Customer; + + var cb2ScRel = sc.CostBearerRelations.First(f => f.CostBearer2SupportConceptOid.HasValue && f.CostBearer2SupportConceptOid.Equals(selectedCostbearerSCRelOid)); + Model.NewServiceRecord.CostBearer = cb2ScRel.CostBearer; + + var intervall = Model.NewServiceRecord.CostBearer.ActualMinuteIntervall; + + if(intervall > 0) + { + Model.NewServiceRecord.RoundedDuration = dauer % intervall != 0 ? dauer + (intervall - dauer % intervall) : dauer; + } + else + { + Model.NewServiceRecord.RoundedDuration = dauer; + } + + Model.NewServiceRecord.CostBearer2SupportConceptOid = selectedCostbearerSCRelOid; + } + else + { + Model.NewServiceRecord.RoundedDuration = dauer; + } + } + + Model.NewServiceRecord.DurationInStunden = ZeiterfassungsDauer.Minuten; + + Model.NewServiceRecord.ServiceRecordFormat = ServiceRecordFormate.OriginaleZeiterfassung; + + Model.NewServiceRecord.Notice = string.IsNullOrEmpty(doku1) ? null : doku1; + + Model.NewServiceRecord.Notice2 = string.IsNullOrEmpty(doku2) ? null : doku2; + Model.NewServiceRecord.Notice3 = string.IsNullOrEmpty(doku3) ? null : doku3; + Model.NewServiceRecord.Notice4 = string.IsNullOrEmpty(doku4) ? null : doku4; + Model.NewServiceRecord.Notice5 = string.IsNullOrEmpty(doku5) ? null : doku5; + + var serviceDescOid = 0L; + + if(!string.IsNullOrEmpty(collection["ServiceDescription"])) + { + serviceDescOid = Convert.ToInt64(collection["ServiceDescription"]); + } + else if(Model.SelectedServiceDescriptionOid.HasValue) + { + serviceDescOid = Model.SelectedServiceDescriptionOid.Value; + } + + if(serviceDescOid > 0) + { + Model.NewServiceRecord.ServiceDescription = OperationsService.GetServiceDescription(serviceDescOid); + } + + if(Model.NewServiceRecord.RoundedDuration == 0) + { + Model.NewServiceRecord.RoundedDuration = dauer; + } + + Model.NewServiceRecord.IP = Request.UserHostAddress; + Model.NewServiceRecord.InsertedOn = DateTime.Now; + Model.NewServiceRecord.InsUser = $"{MobileSessionFacade.LoggedInEmployee.FirstName} {MobileSessionFacade.LoggedInEmployee.LastName}"; + Model.NewServiceRecord.IsCreatedInMobileClient = true; + + if(Model.IsInGroupBookingMode && Model.SelectedSupportConcepts.Count > 1) + { + return Model.NewServiceRecord.ServiceRecordOid.HasValue ? SaveGroupBooking() : UpdateGroupBooking(); + } + + if(!Model.IsInEditingMode) + { + var oidList = OperationsService.InsertNewServiceRecords(new List { Model.NewServiceRecord }); + + Model.ServiceRecordOid = oidList[0]; + } + else + { + OperationsService.UpdateServiceRecords(new List { Model.NewServiceRecord }); + } + + Model.NewServiceRecord = new ServiceRecordDC(); + + if(selectedCostbearerSCRelOid.HasValue) + { + Model.ServiceRecords = OperationsService.FindServiceRecordsForLastDays(selectedCostbearerSCRelOid, Model.Zeitraum, Model.Employee.EmployeeOid).ToList(); + } + } + catch (Exception e) + { + Log.Error(e.Message, e); + } + + return RedirectToActionPermanent("Main"); + } + private ActionResult SaveGroupBooking() { var employeeCount = Model.SelectedEmployees.Count; var personCount = Model.SelectedSupportConcepts.Count; - var cb2ScOids = (from scDc in Model.SelectedSupportConcepts where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid where costBearer2SupportConceptOid != null select costBearer2SupportConceptOid.Value).ToList(); + var cb2ScOids = (from scDc in Model.SelectedSupportConcepts + where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid + where costBearer2SupportConceptOid != null select costBearer2SupportConceptOid.Value).ToList(); var list = CalculateGroupBookingDuration(employeeCount, personCount, cb2ScOids); @@ -918,6 +1128,7 @@ namespace BeWoPlanerMobil.Controllers } } + Model.NewServiceRecord = new ServiceRecordDC(); Model.SelectedSupportConcepts.Clear(); Model.SelectedConceptCostBearerRelations.Clear(); Model.SelectedCostbearerRelOids.Clear(); @@ -1285,7 +1496,7 @@ namespace BeWoPlanerMobil.Controllers LoadGoalTreeItems(); - return RedirectToActionPermanent("Main"); + return ResetEditingMode(null); } private void LoadServiceCategoriesToModel(long? cb2ScOid) @@ -1607,12 +1818,21 @@ namespace BeWoPlanerMobil.Controllers } var mandator = OperationsService.GetMandator(); - var settings = mandator.Settings ?? string.Empty; - var splitSettings = settings.Split(';'); - var maxDaysEditSRsAllowedSetting = splitSettings.ToList().FirstOrDefault(f => f.Contains("MaxDaysEditServiceRecordsAllowed")); - var maxDaysEditSRsAllowed = maxDaysEditSRsAllowedSetting != null ? int.Parse(maxDaysEditSRsAllowedSetting.Split('=')[1]) : 0; - var limitFuerZeiterfassungSetting = splitSettings.ToList().FirstOrDefault(f => f.Contains("AnzTageZeiterfassErfolgt")); - var limitFuerZeiterfassung = limitFuerZeiterfassungSetting != null ? int.Parse(limitFuerZeiterfassungSetting.Split('=')[1]) : 0; + + var maxDaysEditSRsAllowedString = GetSettingValue(mandator.Settings, "MaxDaysEditServiceRecordsAllowed"); + var limitFuerZeiterfassungString = GetSettingValue(mandator.Settings, "AnzTageZeiterfassErfolgt"); + + var isSuccessful1 = int.TryParse(maxDaysEditSRsAllowedString, out var maxDaysEditSRsAllowed); + if (!isSuccessful1) + { + maxDaysEditSRsAllowed = 0; + } + + var isSuccessful2 = int.TryParse(limitFuerZeiterfassungString, out var limitFuerZeiterfassung); + if(!isSuccessful2) + { + limitFuerZeiterfassung = 0; + } if (MobileSessionFacade.CheckForUserRight(UserRightType.ServiceRecord_AllowEditAfterMaxDaysInNextMonth)) { @@ -1855,6 +2075,7 @@ namespace BeWoPlanerMobil.Controllers return _LeerzeichenFuerGetMethoden; } + // Menünavigation public ActionResult RedirectToScheduler() { return RedirectToActionPermanent("Scheduler", "Scheduler"); @@ -1921,6 +2142,9 @@ namespace BeWoPlanerMobil.Controllers Model.ServiceCategories = CreateServiceCategoryModels(OperationsService.GetAllServiceDescriptions()); Model.SelectedEmployees.Add(MobileSessionFacade.LoggedInCompactEmployee); + + Model.IsInEditingMode = false; + Model.SelectedServiceRecord = null; } else { @@ -2160,6 +2384,26 @@ namespace BeWoPlanerMobil.Controllers return RedirectToActionPermanent("Index", "Login"); } + if(Model.SelectedConceptCostBearerRelations.Count == 1) + { + var cb2ScOids = (from scDc in Model.SelectedSupportConcepts + where scDc.CostBearerRelations != null && scDc.CostBearerRelations.Count > 0 + let costBearer2SupportConceptOid = scDc.CostBearerRelations[0].CostBearer2SupportConceptOid + where costBearer2SupportConceptOid != null + select costBearer2SupportConceptOid.Value).ToList(); + + var cb2ScOidsCount = cb2ScOids.Count; + + if (cb2ScOidsCount == 1) + { + Model.CostBearer2SupportConceptOid = cb2ScOids[0]; + } + else + { + return RedirectToActionPermanent("Main"); + } + } + string doku1; if(Model.Dokutypes != null && Model.Dokutypes.Length > 0) diff --git a/BeWoPlanerMobil/Models/MainModel.cs b/BeWoPlanerMobil/Models/MainModel.cs index 161b535ca..c2c9bb5ae 100644 --- a/BeWoPlanerMobil/Models/MainModel.cs +++ b/BeWoPlanerMobil/Models/MainModel.cs @@ -186,34 +186,6 @@ namespace BeWoPlanerMobil.Models public List SelectedConceptCostBearerRelations { get; set; } - public IEnumerable SelectedRelations - { - get - { - var result = new List(); - - foreach(var rel in SelectedConceptCostBearerRelations) - { - - var text1 = $"{rel.SupportConcept.Customer.LastNameFirstName}"; - var text2 = $"{rel.StartDate?.ToShortDateString() ?? string.Empty} - {rel.EndDate?.ToShortDateString()} {rel.CostBearer.Name}"; - var value = rel.CostBearer2SupportConceptOid.ToString(); - - var textColor = rel.SupportConcept.IsAboutToExpire ? - "text-bewo-is-about-to-expire" : - rel.SupportConcept.ExpiresIn3MonthOrLess ? - "text-bewo-expires-in-three-months" : - "text-dark"; - - var listItem = new CustomSelectListItem(text1, text2, value, textColor); - - result.Add(listItem); - } - - return result; - } - } - public GroupBookingSelectionObject GroupBookingSelectionObject => new GroupBookingSelectionObject(SelectedConceptCostBearerRelations, SelectedGroupOfPeopleOids); public IEnumerable SupportConceptListObjectsForGroupBooking @@ -454,6 +426,26 @@ namespace BeWoPlanerMobil.Models } public bool IsZeiterfassungInStdMin { get; set; } + + public string StartDateToEdit => SelectedServiceRecord?.Start?.ToShortDateString() ?? DateTime.Today.ToShortDateString(); + + public string EndDateToEdit => SelectedServiceRecord?.End?.ToShortDateString() ?? DateTime.Today.ToShortDateString(); + + public string StartTimeToEdit => SelectedServiceRecord?.Start?.ToString("HH:mm") ?? string.Empty; + + public string EndTimeToEdit => SelectedServiceRecord?.End?.ToString("HH:mm") ?? string.Empty; + + public string DurationToEdit => SelectedServiceRecord?.RoundedDuration.ToString() ?? string.Empty; + + public string DistanceToEdit => SelectedServiceRecord?.DistanceInMeter.ToString() ?? string.Empty; + + public string NoticeToEdit => SelectedServiceRecord?.NoticeList.FirstOrDefault() ?? string.Empty; + + public List NoticeListToEdit => SelectedServiceRecord != null ? SelectedServiceRecord.NoticeList : new List {string.Empty, string.Empty, string.Empty, string.Empty, string.Empty}; + + public string SubmitButtonValue => IsInEditingMode || IsInGroupBookingMode ? "Speichern" : "Anlegen"; + + public long SelectedServiceRecordsServiceDescriptionOid => SelectedServiceRecord?.ServiceDescription.ServiceDescriptionOid ?? 0L; } public class CustomSelectListItem diff --git a/BeWoPlanerMobil/Scripts/view-scripts/main.js b/BeWoPlanerMobil/Scripts/view-scripts/main.js index ae36c8b9a..dfa364434 100644 --- a/BeWoPlanerMobil/Scripts/view-scripts/main.js +++ b/BeWoPlanerMobil/Scripts/view-scripts/main.js @@ -33,10 +33,28 @@ function loadServiceDescriptions() { serviceDescriptionsSelect.append('"); }); - if (serviceDescriptions[0] !== undefined) { - serviceDescriptionsSelect.val(serviceDescriptions[0].ServiceDescriptionOid); + var serviceDescriptionToEdit = getServiceDescriptionToEdit(); - $.get(getSetServiceDescriptionUrl(), { pServiceDescriptionOid: serviceDescriptions[0].ServiceDescriptionOid }); + var selectedOid = 0; + + if (serviceDescriptionToEdit > 0) { + $("#leistung-select > option").each(function() { + var val = $(this).val(); + + if (serviceDescriptionToEdit == val) { + serviceDescriptionsSelect.val(val); + selectedOid = val; + } + }); + } else { + if(serviceDescriptions[0] !== undefined) { + serviceDescriptionsSelect.val(serviceDescriptions[0].ServiceDescriptionOid); + selectedOid = serviceDescriptions[0].ServiceDescriptionOid; + } + } + + if (selectedOid > 0) { + $.get(getSetServiceDescriptionUrl(), { pServiceDescriptionOid: selectedOid }); } $.get(getLoadTextbausteineForServiceCategoryUrl(), { pServiceCategoryOid: selectedCategoryOid }).done(function(result) { @@ -239,6 +257,16 @@ function resetCreateForm() { $("#serviceRecordCreationForm").trigger("reset"); } +function resetSingleBookingForm() { + $("#singleBookingForm").trigger("reset"); +} + +function submitSingleBookingForm() { + showSpinner(); + + validateForm($("#singleBookingForm")); +} + function submitCreateForm() { showSpinner(); diff --git a/BeWoPlanerMobil/Util/JSONCustomer.cs b/BeWoPlanerMobil/Util/JSONCustomer.cs deleted file mode 100644 index 00411ec60..000000000 --- a/BeWoPlanerMobil/Util/JSONCustomer.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using System.Web; -using BS.Shared; -using BS.Shared.DataContracts; -using BS.Shared.Extensions; - -namespace BeWoPlanerMobil.Util -{ - public class JSONCustomer - { - public string Vorname { get; set; } - public string Nachname { get; set; } - public string Geburtstag { get; set; } - public string Geschlecht { get; set; } - - public string Adresszusatz { get; set; } - public string Strasse { get; set; } - public string Postleitzahl { get; set; } - public string Ort { get; set; } - - public string RechnungsadresseName { get; set; } - public string RechnungsadresseStrasse { get; set; } - public string RechnungsadressePostleitzahl { get; set; } - public string RechnungsadresseOrt { get; set; } - - public string EMail { get; set; } - public string Fax { get; set; } - public string Telefon { get; set; } - public string Handy { get; set; } - public string Kommentar { get; set; } - - public List Umfeldpersonen { get; set; } = new List(); - - public List ReferenceNumbers { get; set; } = new List(); - - public List AbsenceTimes { get; set; } = new List(); - - public string GoogleMapsLink - { - get - { - if(!string.IsNullOrWhiteSpace(Strasse) && !string.IsNullOrWhiteSpace(Postleitzahl) && !string.IsNullOrWhiteSpace(Ort)) - { - var htmlEncodedStreetname = HttpUtility.UrlEncode(Strasse); - var htmlEncodedCityName = HttpUtility.UrlEncode(Ort); - - return $"http://maps.google.de/maps?q={htmlEncodedStreetname},+{Postleitzahl}+{htmlEncodedCityName}&z=17"; - } - - return "#"; - } - } - - public JSONCustomer(CustomerDC init) - { - Vorname = init.FirstName; - Nachname = init.LastName; - Geburtstag = init.DateOfBirth?.ToShortDateString() ?? string.Empty; - - switch (init.Sex) - { - case Sex.Male: - Geschlecht = "Männlich"; - break; - case Sex.Female: - Geschlecht = "Weiblich"; - break; - case Sex.Divers: - Geschlecht = "Divers"; - break; - default: - Geschlecht = string.Empty; - break; - } - - Adresszusatz = init.AddressLine1; - Strasse = init.Street; - Postleitzahl = init.PostalCode; - Ort = init.Town; - - RechnungsadresseName = init.InvoiceAddressLine1; - RechnungsadresseStrasse = init.InvoiceAddressStreet; - RechnungsadressePostleitzahl = init.InvoiceAddressPostalCode; - RechnungsadresseOrt = init.InvoiceAddressTown; - - Kommentar = init.Notice; - - init.CostBearers?.DoForEach(cb => { ReferenceNumbers.AddIfNotIn(new ReferenceNumberWithNotice(cb.ReferenceNumber, cb.Notice, cb.CostBearer.Name)); }); - - foreach (var iContactDC in init.ContactInformations) - { - switch (iContactDC.ContactType) - { - case ContactType.business_Mail: - EMail = iContactDC.ContactValue; - break; - case ContactType.business_Fax: - Fax = iContactDC.ContactValue; - break; - case ContactType.business_Phone: - Telefon = iContactDC.ContactValue; - break; - case ContactType.business_MobilePhone: - Handy = iContactDC.ContactValue; - break; - } - } - - foreach (var rel in init.EnvironmentPersons) - { - Umfeldpersonen.Add(new Umfeldsperson(rel)); - } - - foreach (var absenceTime in init.AbsenceTimes.OrderByDescending(o => o.Start)) - { - AbsenceTimes.Add(new JsonAbsenceTime(absenceTime.Start, absenceTime.End, absenceTime.Notice, absenceTime.Reason)); - } - } - } -} \ No newline at end of file diff --git a/BeWoPlanerMobil/Util/MobileUtils.cs b/BeWoPlanerMobil/Util/MobileUtils.cs index 6c08a76c7..baf3d9540 100644 --- a/BeWoPlanerMobil/Util/MobileUtils.cs +++ b/BeWoPlanerMobil/Util/MobileUtils.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; @@ -220,11 +221,6 @@ namespace BeWoPlanerMobil.Util return null; } - public static JSONCustomer GetJSONCustomer(CustomerDC pCustomer) - { - return new JSONCustomer(pCustomer); - } - public static List CreateServiceCategoryModels(IEnumerable serviceDescriptions) { var catOid2ModelDict = new Dictionary(); @@ -381,6 +377,8 @@ namespace BeWoPlanerMobil.Util public static BeWoLoginState GetLoginState(string tenant) { + Debug.WriteLine($"GetLoginState {DateTime.Now:DD.MM.yyyy HH:mm:sss}"); + var result = new BeWoLoginState(-1, null); const string baseUrl = "https://support.bewoplaner.de/api"; diff --git a/BeWoPlanerMobil/Views/Main/Main.cshtml b/BeWoPlanerMobil/Views/Main/Main.cshtml index 64e78d317..2737fae37 100644 --- a/BeWoPlanerMobil/Views/Main/Main.cshtml +++ b/BeWoPlanerMobil/Views/Main/Main.cshtml @@ -252,6 +252,16 @@ return boolString.toLowerCase() === "true"; } + + function getServiceDescriptionToEdit() { + if (getIsInEditingMode()) { + var floatString = "@Model.SelectedServiceRecordsServiceDescriptionOid"; + + return parseFloat(floatString); + } else { + return 0; + } + }
@@ -297,481 +307,277 @@ @if(!Model.IsInGroupBookingMode) {
-
- @if(Model != null) - { - using(Html.BeginForm("SelectSupportConcept", "Main", FormMethod.Post, new { Id = "selectSupportConceptForm" })) - { - var selectedSuportConceptTimeSpanColorClass = Model.SelectedSupportConceptListObject.IsAboutToExpire ? "text-bewo-is-about-to-expire" : Model.SelectedSupportConceptListObject.ExpiresInThreeMonthsOrLess ? "text-bewo-expires-in-three-months" : "text-dark"; -
-
-
-
-
- -
-
@Model.SelectedSupportConceptListObject.NameAndDateOfBirth
+
- -
+