public CountryCasesView(NotificationDocument document) { Country = document.CountryName; Infections = document.Infections; Recovered = document.Recovered; Deaths = document.Deaths; Total = document.Total; }
public long SaveNotificationDocumentUpdateDepot(DocumentObject document) { try { if (document == null) { return(-2); } var documentEntity = ModelMapper.Map <DocumentObject, Document>(document); if (documentEntity == null || string.IsNullOrEmpty(documentEntity.DocumentPath)) { return(-2); } using (var db = new ImportPermitEntities()) { var ntDoc = db.Documents.Add(documentEntity); db.SaveChanges(); var notifications = db.Notifications.Where(x => x.Id == document.NotificationId).ToList(); if (!notifications.Any()) { return(-2); } var app = new NotificationDocument { DocumentId = ntDoc.DocumentId, NotificationId = document.NotificationId, DateAttached = document.DateUploaded, Comment = document.Comment }; var dx = db.NotificationDocuments.Add(app); db.SaveChanges(); if (dx.Id < 1) { db.Documents.Remove(ntDoc); return(0); } var notification = notifications[0]; notification.DischargeDepotId = document.DepotId; db.Entry(notification).State = EntityState.Modified; db.SaveChanges(); return(ntDoc.DocumentId); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public long AddFormM(FormMDetailObject formM) { try { if (formM == null) { return(-2); } var formMEntity = ModelMapper.Map <FormMDetailObject, FormMDetail>(formM); if (formMEntity == null) { return(-2); } using (var db = new ImportPermitEntities()) { var documentEntity = ModelMapper.Map <DocumentObject, Document>(formM.DocumentObject); if (string.IsNullOrEmpty(documentEntity.DocumentPath)) { return(-2); } var ntDoc = db.Documents.Add(documentEntity); db.SaveChanges(); var app = new NotificationDocument { DocumentId = ntDoc.DocumentId, NotificationId = formM.DocumentObject.NotificationId, DateAttached = formM.DocumentObject.DateUploaded, Comment = formM.DocumentObject.Comment }; db.NotificationDocuments.Add(app); db.SaveChanges(); formMEntity.AttachedDocumentId = ntDoc.DocumentId; var imApp = db.FormMDetails.Add(formMEntity); db.SaveChanges(); return(imApp.Id); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
public List <NotificationDocument> Documents(SearchDocument obj) { List <NotificationDocument> DocumentList = new List <NotificationDocument>(); TranslatorDataService objTDS = new TranslatorDataService(); DataSet ds = objTDS.GetDocumentList(obj); if (ds != null) { int tblIndex = -1; tblIndex++; if (ds.Tables.Count > tblIndex) { using (DataTable dt = ds.Tables[tblIndex]) { foreach (DataRow dr in dt.Rows) { NotificationDocument objND = new NotificationDocument(); objND.NotificationId = Convert.ToInt64(dr["NotificationId"]); objND.NotificationDocumentId = Convert.ToInt64(dr["NotificationDocumentId"]); objND.NotificationNumber = Convert.ToString(dr["NotificationNumber"]); objND.SendToTranslaterOn = Convert.ToString(dr["SendToTranslaterOn"]); objND.TranslationDueBy = Convert.ToString(dr["TranslationDueBy"]); EditAttachment objE = new EditAttachment(); if (Convert.ToString(dr["NotificationDocumentName"]) != "") { objE.DisplayName = Convert.ToString(dr["NotificationDocumentName"]); objE.FileName = Convert.ToString(dr["NotificationDocument"]); objE.Path = "/Attachments/NotificationDocument/" + Convert.ToInt64(dr["NotificationDocumentId"]) + "_" + Convert.ToString(dr["NotificationDocument"]); objND.UntranslatedDocument = objE; } objE = new EditAttachment(); if (Convert.ToString(dr["TranslatedDocumentName"]) != "") { objE.DisplayName = Convert.ToString(dr["TranslatedDocumentName"]); objE.FileName = Convert.ToString(dr["TranslatedDocument"]); objE.Path = "/Attachments/NotificationDocument_Translated/" + Convert.ToInt64(dr["NotificationDocumentId"]) + "_" + Convert.ToString(dr["TranslatedDocument"]); objND.TranslatedDocument = objE; } DocumentList.Add(objND); } } } } return(DocumentList); }
public long AddNotificationDocument(DocumentObject document) { try { if (document == null) { return(-2); } var documentEntity = ModelMapper.Map <DocumentObject, Document>(document); if (documentEntity == null || string.IsNullOrEmpty(documentEntity.DocumentPath)) { return(-2); } using (var db = new ImportPermitEntities()) { var ntDoc = db.Documents.Add(documentEntity); db.SaveChanges(); var app = new NotificationDocument { DocumentId = ntDoc.DocumentId, NotificationId = document.NotificationId, DateAttached = document.DateUploaded, Comment = document.Comment }; var dx = db.NotificationDocuments.Add(app); db.SaveChanges(); if (dx.Id < 1) { db.Documents.Remove(ntDoc); return(0); } return(ntDoc.DocumentId); } } catch (Exception ex) { ErrorLogger.LoggError(ex.StackTrace, ex.Source, ex.Message); return(0); } }
/// <summary> /// Inserts one document into collection /// </summary> /// <param name="document"></param> /// <returns></returns> public async Task CreateNotificationAsync(NotificationDocument document) => await _ctx.Notifications.InsertOneAsync(document);
/// <remarks/> public void CreateNotificationAsync(NotificationDocument notificationDocument, object userState) { if ((this.CreateNotificationOperationCompleted == null)) { this.CreateNotificationOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCreateNotificationOperationCompleted); } this.InvokeAsync("CreateNotification", new object[] { notificationDocument}, this.CreateNotificationOperationCompleted, userState); }
/// <remarks/> public void CreateNotificationAsync(NotificationDocument notificationDocument) { this.CreateNotificationAsync(notificationDocument, null); }