/// <summary> /// Inserts categories to the root tree to create first level nodes /// </summary> /// <param name="documentCategoryType">DocumentCategoryType enumeration object</param> /// <returns>RadTreeViewItem for specific DocumentCategoryType</returns> private RadTreeViewItem InsertTreeViewItem_Category(DocumentCategoryType documentCategoryType) { RadTreeViewItem item = new RadTreeViewItem(); Grid headerGrid = new Grid(); headerGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto }); headerGrid.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(1, GridUnitType.Star) }); #region Category Name TextBlock headerCategoryName = new TextBlock() { Text = EnumUtils.GetDescriptionFromEnumValue <DocumentCategoryType>(documentCategoryType), VerticalAlignment = System.Windows.VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, FontWeight = FontWeights.Bold, Style = (Style)(this.Resources["TextBlockStyle"]) }; headerCategoryName.SetValue(Grid.ColumnProperty, 0); #endregion #region Category Updation Notification TextBlock headerUpdateNotification = new TextBlock() { Text = "*NEW*", Margin = new Thickness(2, 0, 0, 0), Foreground = new SolidColorBrush(Colors.Red), VerticalAlignment = System.Windows.VerticalAlignment.Center, TextWrapping = TextWrapping.Wrap, Visibility = Visibility.Collapsed, FontWeight = FontWeights.Bold, Style = (Style)(this.Resources["TextBlockStyle"]) }; #endregion updateInfo.Add(new UpdationData() { UpdationTag = UpdationTags.CATEGORY_NAME, UpdationInfo = documentCategoryType, UpdationElement = headerUpdateNotification }); headerUpdateNotification.SetValue(Grid.ColumnProperty, 1); headerGrid.Children.Add(headerCategoryName); headerGrid.Children.Add(headerUpdateNotification); item.Header = headerGrid; return(item); }
public string UploadBuildingDocument(DocumentCategoryType documentType, DateTime fileDate, int buildingId, string description, string filePath, string emailAddress) { using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); return(UploadBuildingDocument(documentType, fileDate, buildingId, description, Path.GetFileName(filePath), buffer, emailAddress)); } }
public string UploadUnitDocument(DocumentCategoryType documentType, DateTime fileDate, int buildingId, string accountNumber, string filename, string title, byte[] data, string emailAddress) { if (string.IsNullOrWhiteSpace(title)) { title = "Correspondence "; } filename = Path.GetFileName(filename); filename = filename.Replace(" ", ""); //return a URL to the uploaded document Guid documentId = System.Guid.NewGuid(); if (title.Length > MAX_TITLE_LENGTH) { title = title.Substring(0, MAX_TITLE_LENGTH); } if (filename.Length > MAX_FILENAME_LENGTH) { filename = Path.GetFileNameWithoutExtension(filename).Substring(0, MAX_FILENAME_LENGTH - 4) + "." + Path.GetExtension(filename); } string script = ReadSQLScript("UploadUnitDocument.sql"); var parameters = new List <System.Data.SqlClient.SqlParameter>() { new System.Data.SqlClient.SqlParameter("@DocumentType", (int)documentType), new System.Data.SqlClient.SqlParameter("@BuildingId", buildingId), new System.Data.SqlClient.SqlParameter("@AccountNumber", accountNumber), new System.Data.SqlClient.SqlParameter("@Filename", filename), new System.Data.SqlClient.SqlParameter("@Description", title), new System.Data.SqlClient.SqlParameter("@FileDate", fileDate), new System.Data.SqlClient.SqlParameter("@DocumentId", documentId), new System.Data.SqlClient.SqlParameter("@Data", data), }; var result = SQLUtilities.FetchData(_ClientProtalConnection, script, parameters); documentId = (Guid)result.Tables[0].Rows[0]["Id"]; return(GetUnitDocumentLink(documentId, emailAddress)); }
public string UploadBuildingDocument(DocumentCategoryType documentType, DateTime fileDate, int buildingId, string description, string filename, byte[] fileData, string emailAddress) { filename = Path.GetFileName(filename); //return a URL to the uploaded document if (description.Length > MAX_TITLE_LENGTH) { description = description.Substring(0, MAX_TITLE_LENGTH); } if (filename.Length > MAX_FILENAME_LENGTH) { filename = Path.GetFileNameWithoutExtension(filename).Substring(0, MAX_FILENAME_LENGTH - 4) + "." + Path.GetExtension(filename); } Guid documentId = System.Guid.NewGuid(); string script = ReadSQLScript("UploadBuildingDocument.sql"); var parameters = new List <System.Data.SqlClient.SqlParameter>() { new System.Data.SqlClient.SqlParameter("@DocumentType", (int)documentType), new System.Data.SqlClient.SqlParameter("@BuildingId", buildingId), new System.Data.SqlClient.SqlParameter("@Filename", filename), new System.Data.SqlClient.SqlParameter("@Description", description), new System.Data.SqlClient.SqlParameter("@FileDate", fileDate), new System.Data.SqlClient.SqlParameter("@DocumentId", documentId), new System.Data.SqlClient.SqlParameter("@Data", fileData), }; var result = SQLUtilities.FetchData(_ClientProtalConnection, script, parameters); documentId = (Guid)result.Tables[0].Rows[0]["Id"]; return(GetBuildingDocumentLink(documentId, emailAddress)); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentType" /> class. /// </summary> /// <param name="id">Document Type Identifier. (required).</param> /// <param name="categoryType">categoryType (required).</param> /// <param name="subCategoryType">subCategoryType (required).</param> /// <param name="name">Document Type Name. eg: Driving License. (required).</param> /// <param name="slug">Document Type Unique Slug. eg: \"in.gov.gj.transport.dl\". (required).</param> /// <param name="description">Document Type description. eg: Gujarat State Driving License..</param> /// <param name="logoUrl">Logo URL of document type. (required).</param> /// <param name="searchServiceName">Document search repository service name..</param> /// <param name="repositoryServiceName">Document repository service name..</param> /// <param name="supportedEntityTypes">Supported entity types. eg: Individual, Organization. (required).</param> /// <param name="addedBy">Name of the document type creator. (required).</param> /// <param name="payableAmount">Payable amount if document is chargeable. eg: 10.25..</param> /// <param name="payableAmountCurrency">Payable amount currency. eg: INR, USD etc.,..</param> /// <param name="approvedAtUtc">DateTime of approval in UTC timezone..</param> /// <param name="approved">Document type approval status. (required).</param> public DocumentType(Guid id = default(Guid), DocumentCategoryType categoryType = default(DocumentCategoryType), DocumentSubCategoryType subCategoryType = default(DocumentSubCategoryType), string name = default(string), string slug = default(string), string?description = default(string?), string logoUrl = default(string), string?searchServiceName = default(string?), string?repositoryServiceName = default(string?), List <SupportedEntityType> supportedEntityTypes = default(List <SupportedEntityType>), string addedBy = default(string), double?payableAmount = default(double?), string?payableAmountCurrency = default(string?), DateTime?approvedAtUtc = default(DateTime?), bool approved = default(bool)) { this.Id = id; this.CategoryType = categoryType; this.SubCategoryType = subCategoryType; this.Name = name; this.Slug = slug; this.LogoUrl = logoUrl; // to ensure "supportedEntityTypes" is required (not null) if (supportedEntityTypes == null) { throw new ArgumentNullException("supportedEntityTypes is a required property for DocumentType and cannot be null"); } this.SupportedEntityTypes = supportedEntityTypes; this.AddedBy = addedBy; this.Approved = approved; this.Description = description; this.SearchServiceName = searchServiceName; this.RepositoryServiceName = repositoryServiceName; this.PayableAmount = payableAmount; this.PayableAmountCurrency = payableAmountCurrency; this.ApprovedAtUtc = approvedAtUtc; }
/// <summary> /// Updates data on user interface /// </summary> private void UpdateNotification() { foreach (UpdationData item in updateInfo) { switch (item.UpdationTag) { case UpdationTags.CATEGORY_NAME: if (item.UpdationInfo is DocumentCategoryType) { DocumentCategoryType documentCategoryType = (DocumentCategoryType)item.UpdationInfo; Boolean categoryRequiresNotification = false; foreach (DocumentCategoricalData categoricalData in documentCategoricalInfo.Where(record => record.DocumentCategoryType == documentCategoryType)) { if (documentCategoryType == DocumentCategoryType.BLOG) { foreach (CommentDetails comment in categoricalData.CommentDetails) { if (comment.CommentOn >= DateTime.Now.AddHours(-72)) { categoryRequiresNotification = true; } } } if (categoricalData.DocumentCatalogData != null) { if (categoricalData.DocumentCatalogData.FileUploadedOn >= DateTime.Now.AddHours(-72)) { categoryRequiresNotification = true; break; } } } item.UpdationElement.Visibility = categoryRequiresNotification ? Visibility.Visible : Visibility.Collapsed; } break; case UpdationTags.DOCUMENT_NAME: if (item.UpdationInfo is DocumentCategoricalData) { DocumentCategoricalData documentCategoricalData = (DocumentCategoricalData)item.UpdationInfo; Boolean documentRequiresNotification = false; if (documentCategoricalData.DocumentCatalogData != null) { if (documentCategoricalData.DocumentCatalogData.FileUploadedOn >= DateTime.Now.AddHours(-72)) { documentRequiresNotification = true; } } item.UpdationElement.Visibility = documentRequiresNotification ? Visibility.Visible : Visibility.Collapsed; } break; case UpdationTags.COMPANY_NAME: if (item.UpdationInfo is DocumentCategoricalData) { DocumentCategoricalData blogCategoricalData = (DocumentCategoricalData)item.UpdationInfo; Boolean blogRequiresNotification = false; if (blogCategoricalData.CommentDetails != null) { foreach (CommentDetails comment in blogCategoricalData.CommentDetails) { if (comment.CommentOn >= DateTime.Now.AddHours(-72)) { blogRequiresNotification = true; } } } item.UpdationElement.Visibility = blogRequiresNotification ? Visibility.Visible : Visibility.Collapsed; } break; default: break; } } }