public void SaveSubmission(List <dtoSubmissionValueField> fields, DateTime clickDt, bool forsubmit = false) { //Attenzione! //Senza questo controllo, allo scadere della sessione l'utente legittimo si ritrova con la propria //sottomissione associata ad "anonimo", il che implica che: //l'utente non puo' più accedere, //gli amministratori si trovano con un bando sottomesso da ignoti. if (!View.isAnonymousSubmission & UserContext.isAnonymous) { View.DisplayCallUnavailableForPublic(); //View.DisplaySessionTimeout(); return; } UserSubmission submission = Service.GetUserSubmission(View.IdSubmission); if (forsubmit) { if (submission == null || submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { Boolean tryToComplete = View.TryToComplete; submission = SaveUserSubmission(fields); } return; } if (submission == null || submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { Boolean tryToComplete = View.TryToComplete; submission = SaveUserSubmission(fields); if (submission != null) { LoadSections(submission.Call, submission.Type.Id, submission.Id, View.IdRevision, (tryToComplete) ? Service.GetSubmissionFieldErrors(submission, View.IdRevision) : null, (tryToComplete) ? Service.GetSubmissionRequiredFileErrors(submission) : null); } } else if (submission != null) { View.GoToUrl(CallStandardAction.None, RootObject.ViewSubmission(submission.Call.Type, submission.Call.Id, submission.Id, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0)); } else { View.GoToUrl(CallStandardAction.List, RootObject.ViewCalls(View.IdCall, CallForPaperType.CallForBids, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionClosed)); } }
public void RemoveFieldFile(long idSubmittedField, List <dtoSubmissionValueField> fields, DateTime clickDt) { UserSubmission submission = Service.GetUserSubmission(View.IdSubmission); if (submission == null) { View.GoToUrl(CallStandardAction.List, RootObject.ViewCalls(View.IdCall, CallForPaperType.RequestForMembership, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionClosed)); } else if (submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { try { Service.RemoveFieldFileValue(idSubmittedField); View.SendUserAction(View.IdCallCommunity, View.IdCallModule, submission.Id, ModuleRequestForMembership.ActionType.VirtualDeleteSubmittedFile); } catch (Exception ex) { } this.SaveSubmission(fields, clickDt); } else { View.GoToUrl(RootObject.ViewSubmission(submission.Call.Type, submission.Call.Id, submission.Id, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0)); } }
public void VirtualDeleteSubmission(DateTime clickDt) { UserSubmission submission = Service.GetUserSubmission(View.IdSubmission); if (submission == null) { View.GoToUrl(CallStandardAction.List, RootObject.ViewCalls(View.IdCall, CallForPaperType.RequestForMembership, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionClosed)); } else if (submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { Service.VirtualDeleteSubmission(View.IdSubmission, true); View.SendUserAction(View.IdCallCommunity, View.IdCallModule, submission.Id, ModuleRequestForMembership.ActionType.VirtualDeleteSubmission); View.GoToUrl(RootObject.ViewCalls(View.IdCall, CallForPaperType.RequestForMembership, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionOpened)); } else { View.GoToUrl(RootObject.ViewSubmission(submission.Call.Type, submission.Call.Id, submission.Id, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0)); } }
public void SaveSubmission(List <dtoSubmissionValueField> fields, DateTime clickDt) { UserSubmission submission = Service.GetUserSubmission(View.IdSubmission); if (submission == null || submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { Boolean tryToComplete = View.TryToComplete; submission = SaveUserSubmission(fields); if (submission != null) { LoadSections(submission.Call, submission.Type.Id, submission.Id, View.IdRevision, (tryToComplete) ? Service.GetSubmissionFieldErrors(submission, View.IdRevision) : null); } } else if (submission != null) { View.GoToUrl(CallStandardAction.None, RootObject.ViewSubmission(submission.Call.Type, submission.Call.Id, submission.Id, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0)); } else { View.GoToUrl(CallStandardAction.List, RootObject.ViewCalls(View.IdCall, CallForPaperType.RequestForMembership, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionClosed)); } }
public void SaveCompleteSubmission(List <dtoSubmissionValueField> fields, lm.Comol.Core.MailCommons.Domain.Configurations.SmtpServiceConfig smtpConfig, String websiteUrl, Dictionary <SubmissionTranslations, string> translations, String BaseFilePath, String translationFileName, DateTime clickDt) { long idSubmission = this.View.IdSubmission; long idCall = View.IdCall; UserSubmission submission = Service.GetUserSubmission(View.IdSubmission); if (submission == null || submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { submission = SaveUserSubmission(fields); if (submission != null || submission.AllowEditSubmission(View.InitSubmissionTime, clickDt)) { idSubmission = submission.Id; //View.IdSubmission = idSubmission; View.TryToComplete = true; Revision revision = Service.GetRevision(View.IdRevision); try { Int32 idUser = UserContext.CurrentUserID; litePerson person = GetCurrentUser(ref idUser); if (submission.Owner.Id == idUser) { if (fields.Any(f => f.Field.Type == FieldType.FileInput && (f.Value == null || f.Value.IdLink == 0))) { List <SubmissionFieldFileValue> fValues = (from f in CurrentManager.GetIQ <SubmissionFieldFileValue>() where f.Submission == submission && f.Deleted == BaseStatusDeleted.None && f.Revision.Id == revision.Id select f).ToList(); if (fValues.Any()) { foreach (dtoSubmissionValueField field in fields.Where(f => f.Field.Type == FieldType.FileInput && (f.Value == null || f.Value.IdLink == 0))) { field.Value.IdLink = fValues.Where(f => f.Field.Id == field.IdField).Select(f => f.Link.Id).FirstOrDefault(); } } } Service.UserCompleteSubmission(submission, revision, View.InitSubmissionTime, idUser, BaseFilePath, fields, smtpConfig, websiteUrl, translations, translationFileName, clickDt); View.AllowCompleteSubmission = false; View.AllowDeleteSubmission = false; View.AllowSave = false; View.SendUserAction(View.IdCallCommunity, View.IdCallModule, submission.Id, ModuleRequestForMembership.ActionType.ConfirmSubmission); View.GoToUrl(RootObject.FinalMessage(CallForPaperType.RequestForMembership, idCall, idSubmission, View.IdRevision, submission.UserCode, View.isAnonymousSubmission, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity)); } else if (!View.isAnonymousSubmission && UserContext.isAnonymous) { View.DisplayCallUnavailableForPublic(); } else { View.DisplaySessionTimeout(); } } catch (SubmissionStatusChange ex) { View.AllowDeleteSubmission = (submission != null && submission.Deleted == BaseStatusDeleted.None && submission.Status == SubmissionStatus.draft); View.LoadError(SubmissionErrorView.SubmissionValueSaving, View.IdCallCommunity, idCall, CallStatusForSubmitters.SubmissionOpened); } catch (SubmissionItemsEmpty ex) { Dictionary <long, FieldError> errors = Service.GetSubmissionFieldErrors(submission, revision); View.AllowDeleteSubmission = (submission != null && submission.Deleted == BaseStatusDeleted.None && submission.Status == SubmissionStatus.draft); View.LoadError((errors.ToList().Where(er => er.Value != FieldError.Mandatory).Any()) ? SubmissionErrorView.InvalidFields : SubmissionErrorView.RequiredItems, View.IdCallCommunity, idCall, CallStatusForSubmitters.SubmissionOpened); LoadSections(submission.Call, submission.Type.Id, idSubmission, View.IdRevision, errors); } catch (SubmissionTimeExpired ex) { View.LoadError(SubmissionErrorView.SubmissionValueSaving, View.IdCallCommunity, idCall, CallStatusForSubmitters.SubmissionClosed); } //View.InitSubmissionTime = DateTime.Now; } } else if (submission != null) { View.GoToUrl(CallStandardAction.None, RootObject.ViewSubmission(CallForPaperType.RequestForMembership, idCall, idSubmission, View.FromPublicList, CallStatusForSubmitters.Submitted, View.PreloadIdOtherCommunity, 0)); } else { View.GoToUrl(CallStandardAction.List, RootObject.ViewCalls(idCall, CallForPaperType.RequestForMembership, CallStandardAction.List, View.IdCallCommunity, CallStatusForSubmitters.SubmissionClosed)); } }