public async Task <CommentDto> EditComment(CommentDto comment, AuthorType authorType, int userId) { var result = await this._commentRepository.GetCommentById(comment.Id); if (result == null) { result = new Comment() { State = CommentState.Cancelled }; } else { this._commentStateService.CalculateState(result, userId, ActiontType.Edit, authorType); if (result.State == CommentState.Accepted) { result.Message = comment.Message; this._commentRepository.Update(result); var action = new CommentActions() { CommentId = result.Id, Action = ActiontType.Edit, UserId = userId }; this._commentActionsRepository.Add(action); } } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(result))); }
public async Task <bool> DeleteComment(CommentDto comment, AuthorType authorType, int userId) { var operationResult = true; var result = await this._commentRepository.GetCommentById(comment.Id); if (result == null) { result = new Comment() { State = CommentState.Cancelled }; operationResult = false; } else { this._commentStateService.CalculateState(result, userId, ActiontType.Delete, authorType); if (result.State == CommentState.Accepted) { this._commentRepository.Delete(result); var action = new CommentActions() { CommentId = comment.Id, Action = ActiontType.Delete, UserId = userId }; this._commentActionsRepository.Add(action); } } return(await Task.FromResult <bool>(operationResult)); }
public IHttpActionResult DeleteAuthorType(AuthorType _obj) { string status = string.Empty; try { AuthorType _authorType = _CommonListService.GetAllAuthorTypeList().Where(a => a.Id == _obj.Id).FirstOrDefault(); _authorType.Deactivate = "Y"; _authorType.DeactivateBy = _obj.EnteredBy; _authorType.DeactivateDate = DateTime.Now; _CommonListService.UpdateAuthorType(_authorType); status = _localizationService.GetResource("Master.API.Success.Message"); } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "DeleteAuthorType", ex); status = ex.InnerException.Message; } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "DeleteAuthorType", ex); status = ex.InnerException.Message; } return(Json(status)); }
public IHttpActionResult getAuthorTypeMasterById(int Id) { try { AuthorType _authorType = _CommonListService.GetAllAuthorTypeList().Where(a => a.Id == Id).FirstOrDefault(); var _Master = new { Id = _authorType.Id, AuthorTypeName = _authorType.AuthorTypeName }; return(Json(_Master)); } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "getAuthorTypeMasterById", ex); return(Json(ex.InnerException)); } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "getAuthorTypeMasterById", ex); return(Json(ex.InnerException)); } return(null); }
/// <summary> /// This sample populates only the mandatory sections / entries /// </summary> public XmlDocument MinPopulatedAdvanceCareInformation(string fileName, AuthorType authorType) { XmlDocument xmlDoc = null; var advanceCareInformation = PopulatedAdvanceCareInformation(true, authorType); try { CDAGenerator.NarrativeGenerator = new CDANarrativeGenerator(); //Pass the Event Summary model into the GenerateAdvanceCareInformation method xmlDoc = CDAGenerator.GenerateAdvanceCareInformation(advanceCareInformation); using (var writer = XmlWriter.Create(OutputFolderPath + @"\" + fileName, new XmlWriterSettings { Indent = true })) { if (!fileName.IsNullOrEmptyWhitespace()) { xmlDoc.Save(writer); } } } catch (ValidationException ex) { //Catch any validation exceptions var validationMessages = ex.GetMessagesString(); //Handle any validation errors as appropriate. throw; } return(xmlDoc); }
public static string GetAuthorAsSting(AuthorType author) { var sb = new StringBuilder(); if ((author.FirstName != null) && !string.IsNullOrEmpty(author.FirstName.Text)) { sb.AppendFormat("{0} ", author.FirstName.Text); } if ((author.MiddleName != null) && !string.IsNullOrEmpty(author.MiddleName.Text)) { sb.AppendFormat("{0} ", author.MiddleName.Text); } if ((author.LastName != null) && !string.IsNullOrEmpty(author.LastName.Text)) { sb.AppendFormat("{0} ", author.LastName.Text); } if ((author.NickName != null) && !string.IsNullOrEmpty(author.NickName.Text)) { sb.AppendFormat(sb.Length == 0 ? "{0} " : "({0}) ", author.NickName.Text); } if ((author.UID != null) && !string.IsNullOrEmpty(author.UID.Text)) { sb.AppendFormat(": {0}", author.UID.Text); } return(sb.ToString()); }
public async Task <CommentDto> ReplyToComment(CommentDto comment, AuthorType authorType, int parentId, int userId) { var commentFromDto = TypeAdapterHelper.Adapt <Comment>(comment); var result = await this._commentRepository.GetCommentById(parentId); if (result == null) { commentFromDto = new Comment() { State = CommentState.Cancelled }; } else { this._commentStateService.CalculateState(commentFromDto, userId, ActiontType.Add, authorType); if (commentFromDto.State == CommentState.Accepted) { this._commentRepository.Add(commentFromDto); var action = new CommentActions() { CommentId = commentFromDto.Id, Action = ActiontType.Add, UserId = userId }; this._commentActionsRepository.Add(action); var relatedComment = new RelatedComments() { CommentId = parentId, RelatedCommentId = commentFromDto.Id }; this._relatedCommentsRepository.Add(relatedComment); } } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(commentFromDto))); }
public ActionResult DeleteConfirmed(Guid id) { AuthorType authorType = db.AuthorTypes.Find(id); db.AuthorTypes.Remove(authorType); db.SaveChanges(); return(RedirectToAction("Index")); }
public FormAuthor(AuthorType type, Action <UserInfo> CallBack) { InitializeComponent(); authorType = type; tm.Interval = 1000; tm.Tick += Tm_Tick; callbackAction = CallBack; }
public static string GenerateAuthorString(AuthorType author, IEPubConversionSettings commonSettings) { var processor = new ProcessAuthorFormat { Format = commonSettings.AuthorFormat }; return(processor.GenerateAuthorString(author)); }
public virtual ICommentActionStrategy GetRequestStateStrategy(AuthorType authorType) { if (!this.availableStrategies.ContainsKey(authorType)) { throw new ArgumentException($"Request type not supported: {authorType}"); } return(this.availableStrategies[authorType]); }
public Author(Guid id, AuthorType type, string name, string desc, string shortDesc) : base(id) { Id = id; Type = type; Name = name; Desc = desc; ShortDesc = shortDesc; }
public AuthorType AddAuthor(AuthorType author) { using (var context = new AuthorDALFactory().Data) { var res = context.Add(author); context.Save(); return(new AuthorType(res)); } }
public void InsertAuthorType(AuthorType _obj) { _obj.Deactivate = "N"; _obj.EntryDate = DateTime.Now; _obj.ModifiedBy = null; _obj.ModifiedDate = null; _obj.DeactivateBy = null; _obj.DeactivateDate = null; _AuthorType.Insert(_obj); }
internal static string ToAuthorString(this AuthorType type) { if (type == AuthorType.SeniorTranslator) { return("senior translator"); } else { return(type.ToString().ToLowerInvariant()); } }
public void AddAuthorToBook(Id authorId, Id bookId, AuthorType authorType) { var rel = new BookAuthor { AuthorId = authorId, BookId = bookId, AuthorType = authorType, }; m_DBService.InsertOrUpdate(rel); }
public void AddAuthorToVolume(Id authorId, Id volumeId, AuthorType authorType) { var rel = new VolumeAuthor { AuthorId = authorId, VolumeId = volumeId, AuthorType = authorType, }; m_DBService.InsertOrUpdate(rel); }
public void AddAuthorToSeries(Id authorId, Id seriesId, AuthorType authorType) { var rel = new SeriesAuthor { AuthorId = authorId, SeriesId = seriesId, AuthorType = authorType, }; m_DBService.InsertOrUpdate(rel); }
private AuthorWithType GetAuthorWithType(Author author, Id itemId, AuthorType authorType) { return(new AuthorWithType { Id = author.Id, Born = author.Born, Dead = author.Dead, Name = author.Name, Notes = author.Notes, AuthorType = authorType, ItemId = itemId, }); }
public IHttpActionResult InsertAuthorType(AuthorType _obj) { string status = ""; try { if (_obj.Id == 0) { var check = _CommonListService.GetAllAuthorTypeList().Where(a => a.AuthorTypeName == _obj.AuthorTypeName).FirstOrDefault(); if (check == null) { _CommonListService.InsertAuthorType(_obj); status = _localizationService.GetResource("Master.API.Success.Message"); } else { status = "Duplicate"; } } else { var check = _CommonListService.GetAllAuthorTypeList().Where(x => x.AuthorTypeName == _obj.AuthorTypeName && x.Deactivate == "N" && (_obj.Id != 0 ? x.Id : 0) != (_obj.Id != 0 ? _obj.Id : 1)).FirstOrDefault(); if (check == null) { AuthorType _authorType = _CommonListService.GetAllAuthorTypeList().Where(a => a.Id == _obj.Id).FirstOrDefault(); _authorType.AuthorTypeName = _obj.AuthorTypeName; _authorType.ModifiedBy = _obj.EnteredBy; _authorType.ModifiedDate = DateTime.Now; _CommonListService.UpdateAuthorType(_authorType); status = _localizationService.GetResource("Master.API.Success.Message"); } else { status = "Duplicate"; } } } catch (ACSException ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "InsertStatusMaster", ex); status = ex.InnerException.Message; } catch (Exception ex) { _ILog.LogException("", Severity.ProcessingError, "AuthorTypeMasterController.cs", "InsertStatusMaster", ex); status = ex.InnerException.Message; } return(Json(status)); }
// GET: AuthorTypes/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } AuthorType authorType = db.AuthorTypes.Find(id); if (authorType == null) { return(HttpNotFound()); } return(View(authorType)); }
private void CreateBook(Guid id, BookType bookType, string name, AuthorType authorType) { var book = new Book() { Id = id, Name = name, Authors = new List <AuthorBook>() }; var authorBook = new AuthorBook { Author = Authors[authorType], Book = book }; book.Authors.Add(authorBook); Authors[authorType].Books.Add(authorBook); Books.Add(bookType, book); }
public static Author FromDCT(this AuthorType a) { if (a == null) { return(null); } return(new Author { AuthorID = a.AuthorID, Birthday = a.Birthday, MiddleName = a.MiddleName, Name = a.Name, Surname = a.Surname, Authors_Books = a.Authors_Books.Select(FromDCT).ToList(), }); }
public ActionResult Edit([Bind(Include = "AuthorTypeID,Name,Description")] AuthorTypeViewModel authorTypeViewModel) { if (ModelState.IsValid) { AuthorType model = db.AuthorTypes.Find(authorTypeViewModel.AuthorTypeID); model.Name = authorTypeViewModel.Name; model.Description = authorTypeViewModel.Description; model.DateModified = DateTime.Now; model.UserModifiedID = Guid.Parse(User.Identity.GetUserId()); db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(authorTypeViewModel)); }
public async Task <CommentDto> AddComment(CommentDto comment, AuthorType authorType, int userId) { var commentFromDto = TypeAdapterHelper.Adapt <Comment>(comment); this._commentStateService.CalculateState(commentFromDto, userId, ActiontType.Add, authorType); if (commentFromDto.State == CommentState.Accepted) { this._commentRepository.Add(commentFromDto); var action = new CommentActions() { CommentId = commentFromDto.Id, Action = ActiontType.Add, UserId = userId }; this._commentActionsRepository.Add(action); } return(await Task.FromResult <CommentDto>(TypeAdapterHelper.Adapt <CommentDto>(commentFromDto))); }
public string GenerateAuthorString(AuthorType author) { if (string.IsNullOrEmpty(Format)) // in case format set to empty just return title { return(""); // need to change to default ? } string newFirstName = ParseTemplate("f", (author.FirstName == null)? string.Empty :author.FirstName.Text); string newMiddleName = ParseTemplate("m", (author.MiddleName == null) ? string.Empty : author.MiddleName.Text); string newLastName = ParseTemplate("l", (author.LastName == null) ? string.Empty : author.LastName.Text); string newNick = ParseTemplate("n", (author.NickName == null) ? string.Empty : author.NickName.Text); String rc = Format.Replace("$f$", newFirstName.Trim()); rc = rc.Replace("$m$", newMiddleName.Trim()); rc = rc.Replace("$l$", newLastName.Trim()); rc = rc.Replace("$n$", newNick.Trim()); return(rc.Trim()); }
public ActionResult Create([Bind(Include = "Name,Description")] AuthorType authorType) { if (ModelState.IsValid) { authorType.AuthorTypeID = Guid.NewGuid(); authorType.DateCreated = DateTime.Now; authorType.DateModified = authorType.DateCreated; authorType.UserCreatedID = Guid.Parse(User.Identity.GetUserId()); authorType.UserModifiedID = authorType.UserCreatedID; db.AuthorTypes.Add(authorType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(authorType)); }
public void CalculateState(Comment comment, int currentUserId, ActiontType actionType, AuthorType authorType) { this._commentActionStrategyFactory.GetRequestStateStrategy(authorType).CalculateSate(comment, currentUserId, actionType); }
private DataTable GetDataTableFromRepeater() { DataTable table = new DataTable(); table.Columns.Add("FieldName"); table.Columns.Add("FieldValue"); table.Columns.Add("FieldType"); table.Columns.Add("FieldLevel"); foreach (RepeaterItem item in this.RepContentForm.Items) { FieldControl control = (FieldControl)item.FindControl("Field"); DataRow row = table.NewRow(); switch (control.ControlType) { case FieldType.PictureType: { PictureType type2 = (PictureType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type2.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); if ((control.Settings.Count > 7) && DataConverter.CBoolean(control.Settings[7])) { DataRow row2 = table.NewRow(); row2["FieldName"] = "UploadFiles"; row2["FieldValue"] = type2.UploadFiles; row2["FieldType"] = FieldType.TextType; row2["FieldLevel"] = 0; table.Rows.Add(row2); } continue; } case FieldType.FileType: { FileType type3 = (FileType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type3.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); if (DataConverter.CBoolean(control.Settings[3])) { DataRow row3 = table.NewRow(); row3["FieldName"] = control.Settings[4]; row3["FieldValue"] = type3.FileSize; row3["FieldType"] = FieldType.TextType; row3["FieldLevel"] = control.FieldLevel; table.Rows.Add(row3); } continue; } case FieldType.NodeType: { EasyOne.WebSite.Controls.FieldControl.NodeType type7 = (EasyOne.WebSite.Controls.FieldControl.NodeType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type7.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); DataRow row4 = table.NewRow(); row4["FieldName"] = "infoid"; row4["FieldValue"] = type7.InfoNodeId; row4["FieldType"] = FieldType.InfoType; row4["FieldLevel"] = control.FieldLevel; table.Rows.Add(row4); continue; } case FieldType.AuthorType: { AuthorType type8 = (AuthorType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(type8.FieldValue); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.SourceType: { SourceType type6 = (SourceType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(type6.FieldValue); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.KeywordType: { KeywordType type5 = (KeywordType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = this.ReplaceQutoChar(StringHelper.ReplaceChar(type5.FieldValue, ' ', '|')); row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.ContentType: { ContentType type = (ContentType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type.Content; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } case FieldType.MultiplePhotoType: { MultiplePhotoType type4 = (MultiplePhotoType)control.FindControl("EasyOne2007"); row["FieldName"] = control.FieldName; row["FieldValue"] = type4.FieldValue; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); continue; } } row["FieldName"] = control.FieldName; row["FieldValue"] = control.Value; row["FieldType"] = control.ControlType; row["FieldLevel"] = control.FieldLevel; table.Rows.Add(row); } DataRow row5 = table.NewRow(); row5["FieldName"] = "Inputer"; row5["FieldValue"] = PEContext.Current.User.UserName; row5["FieldType"] = FieldType.TextType; row5["FieldLevel"] = 0; table.Rows.Add(row5); return(table); }
/// <summary> /// This sample populates both the mandatory and optional Sections / Entries depending on the /// mandatorySectionsOnly Boolean /// </summary> internal static AdvanceCareInformation PopulatedAdvanceCareInformation(Boolean mandatorySectionsOnly, AuthorType authorType) { var advanceCareInformation = AdvanceCareInformation.CreateAdvanceCareInformation(); // Include Logo advanceCareInformation.IncludeLogo = true; advanceCareInformation.LogoPath = OutputFolderPath; // Set Creation Time advanceCareInformation.DocumentCreationTime = new ISO8601DateTime(DateTime.Now); #region Setup and populate the CDA context model // Setup and populate the CDA context model var cdaContext = AdvanceCareInformation.CreateCDAContext(); // Document Id cdaContext.DocumentId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateOid()); // Set Id cdaContext.SetId = BaseCDAModel.CreateIdentifier(BaseCDAModel.CreateGuid()); // CDA Context Version cdaContext.Version = "1"; // Custodian cdaContext.Custodian = BaseCDAModel.CreateCustodian(); GenericObjectReuseSample.HydrateCustodian(cdaContext.Custodian, "Organisation Name", mandatorySectionsOnly); // Legal Authenticator cdaContext.LegalAuthenticator = BaseCDAModel.CreateLegalAuthenticator(); GenericObjectReuseSample.HydrateAuthenticator(cdaContext.LegalAuthenticator, mandatorySectionsOnly); advanceCareInformation.CDAContext = cdaContext; #endregion #region Setup and Populate the SCS Context model // Setup and Populate the SCS Context model advanceCareInformation.SCSContext = AdvanceCareInformation.CreateSCSContext(); // Switch on the author enumerator. switch (authorType) { case AuthorType.AuthorHealthcareProvider: // Create Author Healthcare Provider var authorHealthcareProvider = BaseCDAModel.CreateAuthorHealthcareProvider(); GenericObjectReuseSample.HydrateAuthorHealthcareProvider(authorHealthcareProvider, "Organisation Name", mandatorySectionsOnly); advanceCareInformation.SCSContext.Author = authorHealthcareProvider; break; case AuthorType.AuthorNonHealthcareProvider: // Create Author Non Healthcare Provider var authorNonHealthcareProvider = BaseCDAModel.CreateAuthorPerson(); GenericObjectReuseSample.HydrateAuthorNonHealthcareProvider(authorNonHealthcareProvider, mandatorySectionsOnly); advanceCareInformation.SCSContext.Author = authorNonHealthcareProvider; break; } advanceCareInformation.SCSContext.SubjectOfCare = BaseCDAModel.CreateSubjectOfCare(); GenericObjectReuseSample.HydrateSubjectofCare(advanceCareInformation.SCSContext.SubjectOfCare, mandatorySectionsOnly); // REMOVE THESE FIELDS AS NOT ALLOWED IN ACI advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.DateOfDeath = null; advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.DateOfDeathAccuracyIndicator = null; advanceCareInformation.SCSContext.SubjectOfCare.Participant.Person.SourceOfDeathNotification = null; #endregion #region Setup and populate the SCS Content model // Setup and populate the SCS Content model advanceCareInformation.SCSContent = AdvanceCareInformation.CreateSCSContent(); // Related Information advanceCareInformation.SCSContent.DocumentDetails = CreateRelatedDocument(mandatorySectionsOnly); #endregion return(advanceCareInformation); }