Exemple #1
0
        /// <summary> 
        /// 将Web控件导出 
        /// </summary> 
        /// <param name="source">控件实例</param> 
        /// <param name="type">类型:Excel或Word</param> 
        public static void ExpertControl(Control source, string filename, DocumentType type)
        {
            //设置Http的头信息,编码格式 
            if (type == DocumentType.Excel)
            {
                //Excel 
                HttpContext.Current.Response.AppendHeader("Content-Disposition",
                                                          "attachment;filename=" + filename + ".xls");
                HttpContext.Current.Response.ContentType = "application/ms-excel";
            }
            else if (type == DocumentType.Word)
            {
                //Word 
                HttpContext.Current.Response.AppendHeader("Content-Disposition",
                                                          "attachment;filename=" + filename + ".doc");
                HttpContext.Current.Response.ContentType = "application/ms-word";
            }
            HttpContext.Current.Response.Charset = "UTF-8";
            HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;

            //关闭控件的视图状态 
            source.Page.EnableViewState = false;

            //初始化HtmlWriter 
            var writer = new StringWriter();
            var htmlWriter = new HtmlTextWriter(writer);
            source.RenderControl(htmlWriter);

            //输出 
            HttpContext.Current.Response.Write(writer.ToString());
            HttpContext.Current.Response.End();
        }
Exemple #2
0
 public DocumentFile(DocumentType documentType, Func<DocumentFile, DocumentContent> contentFactory, int startCaretPosition = 0)
 {
     this.DocumentType = documentType;
     this.contentFactory = contentFactory;
     this.content = new Lazy<DocumentContent>(LoadContent);
     this.StartCaretPosition = startCaretPosition;
 }
        public void Write(string @namespace, Case classCase, Case propertyCase, TextWriter writer, bool skipNamespace, DocumentType documentType)
        {
            WriteHeader(writer, documentType);

            if (!skipNamespace)
            {
                WriteUsings(writer, documentType);
                writer.WriteLine();
                writer.WriteLine("namespace {0}", @namespace);
                writer.WriteLine("{");
            }

            var usedClasses = _repository.GetUsedClasses().ToList();

            if (usedClasses.Count == 0)
            {
                writer.WriteLine("/* No used classes found! */");
            }

            writer.WriteLine(
                string.Join(
                    "\r\n\r\n",
                    _repository.GetUsedClasses().Select(x => x.GenerateCSharpCode(classCase, propertyCase, documentType))));

            if (!skipNamespace)
            {
                writer.WriteLine("}");
            }
        }
        public BasicDocument[] GetDocumentsForForeignObject(DocumentType documentType, int foreignId)
        {
            List<BasicDocument> result = new List<BasicDocument>();

            using (DbConnection connection = GetMySqlDbConnection())
            {
                connection.Open();

                DbCommand command =
                    GetDbCommand(
                        "SELECT Documents.DocumentId,Documents.ServerFileName,Documents.ClientFileName,Documents.Description,DocumentTypes.Name AS DocumentType,Documents.ForeignId,Documents.FileSize,Documents.UploadedByPersonId,Documents.UploadedDateTime From Documents,DocumentTypes " +
                        "WHERE Documents.DocumentTypeId=DocumentTypes.DocumentTypeId AND " +
                        "Documents.ForeignId = " + foreignId + " AND " +
                        "DocumentTypes.Name = '" + documentType.ToString() + "';", connection);

                using (DbDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        result.Add(ReadDocumentFromDataReader(reader));
                    }

                    return result.ToArray();
                }
            }
        }
Exemple #5
0
        public static void Print(string address, DocumentType docType)
        {
            switch (docType)
            {
                case DocumentType.BADGE:
                    PrintImage(address, docType);
                    break;
                case DocumentType.ORDER:
                  //  PrintWord(address);
                    break;
                default:
                    break;
            }

            //ProcessStartInfo info = new ProcessStartInfo();
            //info.Verb = "print";
            //info.FileName = address;
            //info.CreateNoWindow = true;
            //info.WindowStyle = ProcessWindowStyle.Hidden;

            //Process p = new Process();
            //p.StartInfo = info;
            //p.Start();

            //p.WaitForInputIdle();
            //System.Threading.Thread.Sleep(3000);
            //if (false == p.CloseMainWindow())
            //    p.Kill();
        }
        public String EditDocumentType(DocumentType documentType)
        {
            db.Entry(documentType).State = EntityState.Modified;
            db.SaveChanges();

            return "Success";
        }
        public String DeleteDocumentType(DocumentType documentType)
        {
            db.DocumentTypes.Remove(documentType);
            db.SaveChanges();

            return "Success";
        }
        public String CreateDocumentType(DocumentType documentType)
        {
            db.DocumentTypes.Add(documentType);
            db.SaveChanges();

            return "Success";
        }
        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            if (documentType != DocumentType.Xml)
            {
                return base.GeneratePropertyCode(propertyName, classCase, attributes, documentType);
            }

            var sb = new StringBuilder();

            sb.AppendFormat(
                @"[XmlIgnore]
            public {0} {1} {{ get; set; }}", TypeAlias, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0} == null ? null : {0}{1};
            }}
            set
            {{
            {0} = string.IsNullOrEmpty(value) ? null : ({2}){3};
            }}
            }}", propertyName, _toString, TypeAlias, _parse);

            return sb.ToString();
        }
        /// <summary>
        /// Gets and returns files of a specific document type
        /// </summary>
        /// <param name="directory">Directory Path</param>
        /// <param name="documentType">Document Type</param>
        /// <returns>String array containing file paths</returns>
        public static string[] GetFiles(string directory, DocumentType documentType)
        {
            // get all files using Directory.GetFiles approach
            string[] files = Directory.GetFiles(directory, "*.*");

            // return empty array if directory is empty
            if (files.Length == 0)
            {
                return new string[0];
            }

            List<string> result = new List<string>();

            foreach (string path in files)
            {
                using (FileFormatChecker fileFormatChecker = new FileFormatChecker(path))
                {
                    if (fileFormatChecker.VerifyFormat(documentType))
                    {
                        result.Add(path);
                    }
                }
            }

            return result.ToArray();
        }
Exemple #11
0
        public Navigation( DocumentType docType, IEnumerable<NavigatorUrl> urls )
        {
            DocumentType = docType;
            Uris = urls.ToArrayList();

            UrisHashCode = CreateUrisHashCode();
        }
        /// <summary>
        /// Gets and returns files of a specific document type
        /// </summary>
        /// <param name="directory">Directory Path</param>
        /// <param name="documentType">Document Type</param>
        /// <returns>File info array</returns>
        public static FileInfo[] GetFiles(this DirectoryInfo directoryInfo, DocumentType documentType)
        {
            FileInfo[] files = directoryInfo.GetFiles();

            // return empty array if directory is empty
            if (files.Length == 0)
            {
                return new FileInfo[0];
            }

            List<FileInfo> result = new List<FileInfo>();

            foreach (FileInfo fileInfo in files)
            {
                using (FileFormatChecker fileFormatChecker = new FileFormatChecker(fileInfo.FullName))
                {
                    if (fileFormatChecker.VerifyFormat(documentType))
                    {
                        result.Add(fileInfo);
                    }
                }
            }

            return result.ToArray();
        }
Exemple #13
0
 public void Print(ClientHelper clientHelper, DocumentType documentType)
 {
     if (documentType == DocumentType.Service)
         PrintServiceDocumentString(clientHelper);
     else
         PrintFiscalDocumentString(clientHelper);
 }
Exemple #14
0
        public void When_requesting_Create_values_are_set_correctly()
        {
            //Given
            var user = new UserForAuditing()
                           {
                               Id = Guid.NewGuid()
                           };


            var createAccidentRecordParams = new AccidentRecord()
                                                 {
                                                     CompanyId = 1L,
                                                     Title = "title",
                                                     Reference = "reference",
                                                     CreatedBy = user,
                                                     CreatedOn = _now,
                                                     Deleted = false
                                                 };

            DocumentType docType = new DocumentType() {Name = "Accident Record Doc", Id = 17};

            //When
            var result = AccidentRecordDocument.Create("description", "Filename.ext", 1L, docType, createAccidentRecordParams, user);

            //Then
            Assert.That(result.ClientId, Is.EqualTo(1L));
            Assert.That(result.DocumentLibraryId, Is.EqualTo(1L));
            Assert.That(result.Description, Is.EqualTo("description"));
            Assert.That(result.Title, Is.EqualTo("Filename.ext"));
            Assert.That(result.Filename, Is.EqualTo("Filename.ext"));
            Assert.That(result.CreatedBy, Is.EqualTo(createAccidentRecordParams.CreatedBy));
        }
Exemple #15
0
 public void StartImport(UploadingProgress progress, DocumentType type, string filePath, string userID)
 {
     try
     {
         switch (type)
         {
             case DocumentType.AdministrativePractice:
                 ImportAdministrativePractice(progress, filePath, userID);
                 break;
             case DocumentType.TemporaryResidencePermit:
                 break;
             case DocumentType.Residence:
                 break;
             case DocumentType.Citizenship:
                 ImportСitizenship(progress, filePath, userID);
                 break;
             default:
                 break;
         }
     }
     catch (Exception ex)
     {
         progress.HasErrors = true;
         progress.ExceptionMessage = ex.Message;
         throw;
     }
     finally
     {
         progress.IsCompleted = true;
         progress.EndDate = DateTime.Now;
         _db.SaveChanges();
     }
 }
Exemple #16
0
        public string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            string typeName;

            var userDefinedClass = _class as UserDefinedClass;
            if (userDefinedClass != null)
            {
                typeName =
                    string.IsNullOrEmpty(userDefinedClass.CustomName)
                        ? userDefinedClass.TypeName.FormatAs(classCase)
                        : userDefinedClass.CustomName;
            }
            else
            {
                typeName = ((IBclClass)_class).TypeAlias;
            }

            var sb = new StringBuilder();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(string.Format("{0}", attribute.ToCode()));
            }

            sb.AppendFormat("public List<{0}> {1} {{ get; set; }}", typeName, propertyName);

            return sb.ToString();
        }
 public void ViewDocument(Guid documentId, DocumentType docType)
 {
     _vm.DocumentId = documentId;
     _vm.DocumentType = docType;
     _vm.SetUp();
     this.Show();
 }
        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            var sb = new StringBuilder();

            var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]";

            sb.AppendFormat(
                @"{0}
            public DateTime {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0}.ToString(""{1}"", new CultureInfo(""en-US""));
            }}
            set
            {{
            {0} = DateTime.ParseExact(value, ""{1}"", new CultureInfo(""en-US""));
            }}
            }}", propertyName, Format);

            return sb.ToString();
        }
        public static string GetText(DocumentType helpType, Section section)
        {
            IList<ParameterDescription> list = Read();
            if (list == null){
                return null;
            }
            list = list.Where(x => x.Section.Name == section.Name).ToList();

            StringBuilder builder = new StringBuilder();
            if (helpType == DocumentType.Rtf){
                builder.Append("{\rtf1\ansi");
            }
            foreach (ParameterDescription descripition in list){
                switch (helpType){
                    case DocumentType.Html:
                        descripition.ToHtml(builder);
                        break;
                    case DocumentType.PlainText:
                        descripition.ToPlainText(builder);
                        break;
                    case DocumentType.Rtf:
                        descripition.ToRichText(builder);
                        break;
                }
            }
            if (helpType == DocumentType.Rtf){
                builder.Append("}");
            }

            return builder.ToString();
        }
		public TimeTrackDocumentType(string name, string shortName, int code, DocumentType documentType = DocumentType.Presence)
		{
			Name = name;
			ShortName = shortName;
			Code = code;
			DocumentType = documentType;
		}
        private void LoadDocuments()
        {
            try
            {

                DocumentType docType = new DocumentType { DocClass = new DocumentClass { DocClassID = SDocClass.Shipping } };

                //Load the Base Documents (Pendig pero sin fecha de referencia)
                DateTime refDate = DateTime.Today; //DateTime.Parse("2017-04-12"); //

                DateTime month = refDate.AddMonths(1);
                DateTime week = refDate.AddDays(7);
                DateTime today = refDate; 

                View.Model.MonthList = service.GetPendingDocument(new Document { DocType = docType, Company = App.curCompany },0,0).Where(f => f.Date1 >= today && f.Date1 <= month).ToList();
                View.Model.WeekList = View.Model.MonthList.Where(f => f.Date1 >= today && f.Date1 <= week).ToList();
                View.Model.TodayList = View.Model.WeekList.Where(f => f.Date1 == today).ToList();
                View.Model.OrderByPicker = new List<Document>();


            }
            catch (Exception ex)
            {
                Util.ShowError(ex.Message);
            }
        }
        internal static void ParseChannelQueryString(HttpRequest request, out string channelName, out string userName, out DocumentType outputType)
        {
            string outputTypeQs = request.QueryString["outputtype"];
            if (!string.IsNullOrEmpty(outputTypeQs))
            {
                try
                {
                    outputType = (DocumentType)Enum.Parse(typeof(DocumentType), outputTypeQs, true);
                }
                catch (ArgumentException)
                {
                    outputType = DocumentType.Rss;
                }
            }
            else
            {
                outputType = DocumentType.Rss;
            }

            string ticket = request.QueryString["t"];
            if (string.IsNullOrEmpty(ticket)) 
            {
                userName = string.Empty;
                //// optional unencrypted channel name
                channelName = request.QueryString["c"];
            }
            else
            {
                //// encrypted user name and channel name
                FormsAuthenticationTicket t = FormsAuthentication.Decrypt(ticket);
                userName = t.Name.Substring(1); //// remove extra prepended '.'
                channelName = t.UserData;
            }
        }
        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable<AttributeProxy> attributes, DocumentType documentType)
        {
            var sb = new StringBuilder();

            var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]";

            sb.AppendFormat(
                @"{0}
            public bool {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
            {{
            get
            {{
            return {0} ? ""True"" : ""False"";
            }}
            set
            {{
            {0} = bool.Parse(value);
            }}
            }}", propertyName);

            return sb.ToString();
        }
 private TransactionType GetTransactionType(DocumentType documentType, OrderType orderType)
 {
    if(documentType==DocumentType.Order)
    {
         if (orderType == OrderType.DistributorPOS)
         {
              return TransactionType.DistributorPOS;
         }
         if(orderType==OrderType.OutletToDistributor)
         {
             return TransactionType.OutletToDistributor;
         }
                
    }
    if(documentType==DocumentType.Invoice)
    {
        return TransactionType.Invoice;
    }
    if(documentType==DocumentType.Receipt)
    {
        return TransactionType.Receipt;
    }
            
     return TransactionType.Unknown;
 }
Exemple #25
0
        public static AvaTaxResult GetTax(string URL, DocumentType DocType,
                                            string Account, string License,
                                            string CompanyCode, string UserName, string Password,
                                            string OrderIdentifier, BaseAddress OriginationAddress,
                                            BaseAddress DestinationAddress, List<Line> items,
                                            string CustomerCode)
        {

            BVSoftware.Avalara.AvaTaxResult result = new AvaTaxResult();

            avt.TaxService.GetTaxRequest gtr = new avt.TaxService.GetTaxRequest();
            gtr.OriginAddress = ConvertBaseAddress(OriginationAddress);
            gtr.DestinationAddress = ConvertBaseAddress(DestinationAddress);
            
            
            //' Origin and Destination addresses
            //OriginationAddress.AddressCode = "O"
            //DestinationAddress.AddressCode = "D"
            //gtr.Addresses = New BaseAddress(2) {}
            //gtr.Addresses(0) = OriginationAddress
            //gtr.Addresses(1) = DestinationAddress
            //Document Level Origin and Destination Addresses - see AddressCode field.
            //gtr.OriginCode = gtr.Addresses(0).AddressCode
            //gtr.DestinationCode = gtr.Addresses(1).AddressCode

            gtr.CompanyCode = CompanyCode;
            gtr.CustomerCode = CustomerCode;
            gtr.DetailLevel = avt.TaxService.DetailLevel.Document;
            gtr.DocCode = OrderIdentifier;
            gtr.DocType = ConvertDocType(DocType);
            gtr.DocDate = DateTime.Now;
            
            foreach (Line l in items)
            {
                avt.TaxService.Line nl = ConvertLine(l);
                gtr.Lines.Add(nl);
            }            
            
            avt.TaxService.TaxSvc svc = GetTaxServiceProxy(URL, Account, License, UserName, Password);
            avt.TaxService.GetTaxResult gtres = svc.GetTax(gtr);


            if (gtres.ResultCode != avt.SeverityLevel.Success)
            {
                result.Success = false;
                result.Messages.Add("GetTax Failed");
                ApplyMessagesToResult(result, gtres.Messages);
            }
            else
            {
                result.Success = true;
            }

            result.DocId = gtres.DocId;
            result.TotalAmount = gtres.TotalAmount;
            result.TotalTax = gtres.TotalTax;

            return result;                      
        }
 public StateEngineConfiguration(IEnumerable<Lazy<IStateStepConfiguration, IStateStepConfigurationMetadata>> stateStepConfigurations, DocumentType documentType)
 {
     // here, we'll filter according to the rules we are looking for.  the incorportation of rules is another reason
     // consider the filtering process to be injected and atomically testable
     //
     // and we'll be as lazy as possible
     _stateSteps = new Lazy<IEnumerable<Lazy<IStateStepConfiguration, IStateStepConfigurationMetadata>>>( () => from p in stateStepConfigurations where p.Metadata.DocumentTypes.Contains(documentType) select p );
 }
 public SolidEdgeDocumentAttribute(DocumentType documentType, string classId, string progId, string description, string defaultExtension)
 {
     _documentType = documentType;
     _classId = Guid.Parse(classId);
     _progId = progId;
     _description = description;
     _defaultExtension = defaultExtension;
 }
Exemple #28
0
        public SessionDocument(string path, DocumentType type)
        {
            if (string.IsNullOrEmpty(path))
            throw new ArgumentNullException("path");

              this.Path = path;
              this.Type = type;
        }
Exemple #29
0
 public ImmutableList<FileModel> GetModels(DocumentType? type)
 {
     if (type == null)
     {
         return Models;
     }
     return (from m in Models where m.Type == type select m).ToImmutableList();
 }
 public static Quickpay.documentType ConvertDocumentType(DocumentType c)
 {
     switch (c)
     {
         default:
             return Quickpay.documentType.RUT;
     }
 }
Exemple #31
0
 public TaxDocument(string number, DocumentType documentType) : this(number)
 {
     DocumentType = documentType;
 }
Exemple #32
0
        public void ImportDocumentData(DateTime?fromDate)
        {
            this.Db.ReadOnly = false;

            if (fromDate == null)
            {
                try { fromDate = this.Db.Context.Documents.Max(m => m.ModifiedOn); }
                catch { fromDate = null; }
            }

            if (fromDate < DateTime.Today.AddDays(-365))
            {
                fromDate = null;
            }

            // load all documents
            var import = this.GetDocuments(fromDate).Where(d => d.Id != null && d.TypeCode != null).ToList();

            if (import.Count == 0)
            {
                return;
            }

            var documentTypesLookup = Db.Context.DocumentTypes.ToDictionary(d => d.DocumentTypeId);

            // Add any document types
            foreach (var daikinDocument in import)
            {
                DocumentType type;

                if (documentTypesLookup.TryGetValue(daikinDocument.TypeCode.Value, out type))
                {
                    if (type.Description != daikinDocument.TypeCodeName)
                    {
                        type.Description = daikinDocument.TypeCodeName;
                    }
                }
                else
                {
                    type = new DocumentType {
                        DocumentTypeId = daikinDocument.TypeCode.Value, Description = daikinDocument.TypeCodeName
                    };
                    Db.Context.DocumentTypes.Add(type);
                    documentTypesLookup.Add(daikinDocument.TypeCode.Value, type);
                }
            }

            Db.SaveChanges();

            this.Db.ReadOnly = true;

            // Add document NOTE** Never delete documents as they are used in Quote packages
            var documents = new List <DPO.Data.Document>();

            // Map imported products to DPO Product and Spec structure
            foreach (var daikinDocument in import)
            {
                var document = new DPO.Data.Document
                {
                    CreatedOn      = daikinDocument.CreatedOn,
                    FileName       = daikinDocument.Title ?? string.Empty,
                    DocumentId     = daikinDocument.Id.Value,
                    DocumentTypeId = daikinDocument.TypeCode.Value,
                    Timestamp      = daikinDocument.ModifiedOn,
                    ModifiedOn     = daikinDocument.ModifiedOn,
                };

                documents.Add(document);
            }

            Db.UpdateDocuments(documents);
        }
Exemple #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NodeMapper"/> class.
        /// </summary>
        /// <param name="engine">The engine.</param>
        /// <param name="destinationType">Type of the destination.</param>
        /// <param name="sourceDocumentType">Type of the source document.</param>
        /// <exception cref="System.ArgumentNullException">
        /// sourceDocumentType
        /// or
        /// engine
        /// or
        /// destinationType
        /// </exception>
        public NodeMapper(NodeMappingEngine engine, Type destinationType, DocumentType sourceDocumentType)
        {
            if (sourceDocumentType == null)
            {
                throw new ArgumentNullException("sourceDocumentType");
            }
            else if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            else if (destinationType == null)
            {
                throw new ArgumentNullException("destinationType");
            }

            SourceDocumentType = sourceDocumentType;
            Engine             = engine;
            DestinationType    = destinationType;
            PropertyMappers    = new List <PropertyMapperBase>();

            // See if base properties have been mapped already.
            var baseNodeMapper = Engine.GetBaseNodeMapperForType(destinationType);

            if (baseNodeMapper != null)
            {
                // Use the property mappings of the closest parent
                // (ideally they will already have the mappings of all their ancestors)
                PropertyMappers.AddRange(baseNodeMapper.PropertyMappers);
            }

            // Map properties
            foreach (var destinationProperty in destinationType.GetProperties())
            {
                if (PropertyMappers.Any(mapper => mapper.DestinationInfo.Name == destinationProperty.Name) || !destinationProperty.CanWrite)
                {
                    // A mapping already exists for this property on a base type or its a ReadOnly property.
                    continue;
                }

                PropertyMapperBase propertyMapper = null;

                var sourcePropertyAlias = GetPropertyAlias(destinationProperty);

                // Check if this property is equivalent to a default Node property.
                var defaultNodeProperty = DefaultPropertyMapper.GetDefaultMappingForName(destinationProperty);

                if (sourcePropertyAlias != null && // check corresponding source property alias was found
                    destinationProperty.PropertyType.GetMappedPropertyType() == MappedPropertyType.SystemOrEnum)
                {
                    propertyMapper = new BasicPropertyMapper(
                        x => x,                           // direct mapping
                        destinationProperty.PropertyType, // using the desired type
                        this,
                        destinationProperty,
                        sourcePropertyAlias
                        );
                }
                else if (destinationProperty.PropertyType.GetMappedPropertyType() == MappedPropertyType.Model)
                {
                    propertyMapper = new SinglePropertyMapper(
                        null,
                        null,
                        this,
                        destinationProperty,
                        sourcePropertyAlias // can be null to map ancestor
                        );
                }
                else if (destinationProperty.PropertyType.GetMappedPropertyType() == MappedPropertyType.Collection)
                {
                    propertyMapper = new CollectionPropertyMapper(
                        null,
                        null,
                        this,
                        destinationProperty,
                        sourcePropertyAlias // can be null to map descendants
                        );
                }
                else if (defaultNodeProperty != null)
                {
                    propertyMapper = new DefaultPropertyMapper(
                        this,
                        destinationProperty,
                        defaultNodeProperty,
                        null
                        );
                }

                if (propertyMapper != null)
                {
                    PropertyMappers.Add(propertyMapper);
                }
            }
        }
Exemple #34
0
 public DocumentSettingsBuilder(string apiKey, DocumentType documentType, string content)
 {
     _apiKey       = apiKey;
     _documentType = documentType;
     _content      = content;
 }
Exemple #35
0
 public static IEnumerable <ConvertFormat> GetApplicable(DocumentType type)
 {
     return(_formats.Where(f => (f.AllowedTypes & type) != 0));
 }
        private object FormPayload(IList <AsyncLogEventInfo> logEvents)
        {
            var payload = new List <object>(logEvents.Count);

            foreach (var ev in logEvents)
            {
                var logEvent = ev.LogEvent;

                var document = new Dictionary <string, object>
                {
                    { "@timestamp", logEvent.TimeStamp },
                    { "level", logEvent.Level.Name },
                    { "message", Layout.Render(logEvent) }
                };

                if (logEvent.Exception != null)
                {
                    var jsonString = JsonConvert.SerializeObject(logEvent.Exception, _jsonSerializerSettings);
                    var ex         = JsonConvert.DeserializeObject <ExpandoObject>(jsonString);
                    document.Add("exception", ex.ReplaceDotInKeys());
                }

                foreach (var field in Fields)
                {
                    var renderedField = field.Layout.Render(logEvent);
                    if (!string.IsNullOrWhiteSpace(renderedField))
                    {
                        document[field.Name] = renderedField.ToSystemType(field.LayoutType, logEvent.FormatProvider);
                    }
                }

                if (IncludeAllProperties)
                {
                    if (logEvent.Properties.Count > 0)
                    {
                        foreach (var p in logEvent.Properties)
                        {
                            var propertyKey = p.Key.ToString();
                            if (_excludedProperties.Contains(propertyKey))
                            {
                                continue;
                            }
                            if (document.ContainsKey(propertyKey))
                            {
                                continue;
                            }

                            document[propertyKey] = p.Value;
                        }
                    }
                }

                var index = Index.Render(logEvent).ToLowerInvariant();
                var type  = DocumentType.Render(logEvent);

                payload.Add(new { index = new { _index = index, _type = type } });
                payload.Add(document);
            }

            return(payload);
        }
        public override string GeneratePropertyCode(string propertyName, Case classCase, IEnumerable <AttributeProxy> attributes, DocumentType documentType)
        {
            var sb = new StringBuilder();

            var ignoreAttribute = documentType == DocumentType.Xml ? "[XmlIgnore]" : "[IgnoreDataMember]";

            sb.AppendFormat(
                @"{0}
public bool {1} {{ get; set; }}", ignoreAttribute, propertyName).AppendLine().AppendLine();

            foreach (var attribute in attributes)
            {
                sb.AppendLine(attribute.ToCode());
            }

            sb.AppendFormat(
                @"public string {0}String
{{
    get
    {{
        return {0} ? ""True"" : ""False"";
    }}
    set
    {{
        {0} = bool.Parse(value);
    }}
}}", propertyName);

            return(sb.ToString());
        }
        /// <summary>
        /// Инициализирует папку заданными значениями.
        /// </summary>
        /// <param name="Device">Прибор.</param>
        /// <param name="CodeID">ID кода СКБ.</param>
        /// <param name="CodeName">Отобразаемое значение кода СКБ.</param>
        /// <param name="DocumentID">ID документа.</param>
        /// <param name="DocumentName">Название документа.</param>
        /// <param name="FolderID">ID папки.</param>
        public DocumentsFolder(Folder ParentFolder, CardData Document, SavedSearchGroup SearchGroup, SavedView View, FolderCard FolderCard)
        {
            this.ParentFolder = ParentFolder;
            this.Document     = Document;
            DocumentID        = Document.Id;

            SectionData Properties = Document.Sections[CardOrd.Properties.ID];

            DocumentType = Properties.FindRow("@Name = '" + RefPropertiesCD.Requisities.FileType + "'").GetString("Value");
            RowData Code = Properties.FindRow("@Name = '" + RefPropertiesCD.Requisities.Code + "'");

            CodeID   = Code.GetGuid("Value").Value;
            CodeName = Code.GetString("DisplayValue");
            RowData Applicable = Properties.FindRow("@Name = '" + RefPropertiesCD.Requisities.Applicable + "'");

            Applicability = Applicable.GetString("DisplayValue");
            RowData Name = Properties.FindRow("@Name = '" + RefPropertiesCD.Requisities.DocumentName + "'");

            string ShortType = DocumentType == "СД - Спецификация (не платы)" || DocumentType == "СП - Спецификация платы" ? "" : DocumentType.Remove(DocumentType.IndexOf(" - "));

            DocumentName = CodeName + " " + ShortType + " " + Name.GetString("Value");

            Folder      = FolderCard.CreateFolder(ParentFolder.Id, DocumentName);
            Folder.Type = FolderTypes.Virtual;

            if (!SearchGroup.Queries.Any(row => row.Name == DocumentName))
            {
                SearchQuery   Query    = FolderCard.Session.CreateSearchQuery();
                CardTypeQuery CardType = Query.AttributiveSearch.CardTypeQueries.AddNew(CardOrd.ID);
                SectionQuery  Section  = CardType.SectionQueries.AddNew(CardOrd.MainInfo.ID);
                Section.Operation = SectionQueryOperation.And;
                Section.ConditionGroup.Operation = ConditionGroupOperation.And;
                Section.ConditionGroup.Conditions.AddNew(CardOrd.MainInfo.Type, FieldType.RefId, ConditionOperation.Equals, MyHelper.RefType_CD);

                Section           = CardType.SectionQueries.AddNew(CardOrd.Properties.ID);
                Section.Operation = SectionQueryOperation.And;
                Section.ConditionGroup.Operation = ConditionGroupOperation.And;
                Section.ConditionGroup.Conditions.AddNew(CardOrd.Properties.Value, FieldType.Unistring, ConditionOperation.Equals, DocumentType);
                Section.ConditionGroup.Conditions.AddNew(CardOrd.Properties.Name, FieldType.Unistring, ConditionOperation.Equals, RefPropertiesCD.Requisities.FileType);

                Section           = CardType.SectionQueries.AddNew(CardOrd.Properties.ID);
                Section.Operation = SectionQueryOperation.And;
                Section.ConditionGroup.Operation = ConditionGroupOperation.And;
                Section.ConditionGroup.Conditions.AddNew(CardOrd.Properties.Value, FieldType.RefId, ConditionOperation.Equals, CodeID);
                Section.ConditionGroup.Conditions.AddNew(CardOrd.Properties.Name, FieldType.Unistring, ConditionOperation.Equals, RefPropertiesCD.Requisities.Code);
                Query.Limit = 0;
                SearchGroup.Queries.AddNew(DocumentName).Import(Query);
            }
            SavedSearchQuery SavedQuery = SearchGroup.Queries.First(row => row.Name == DocumentName);

            Folder.RefId = SavedQuery.Id;

            Folder.CurrentViewId = View.Id;
            Folder.DefaultViewId = View.Id;
        }
Exemple #39
0
 public Document(DocumentType type, string path, int pages)
 {
     Type  = type;
     Path  = path;
     Pages = pages;
 }
Exemple #40
0
 //Constructor
 public ColumnHeaderSelectForm(IColumnHeaderRequester caller, List <string> allHeadersList, DocumentType docType, IDocHandler _docHandler)
 {
     InitializeComponent();
     callingForm         = caller;
     AllHeadersList      = allHeadersList;
     SelectedHeadersList = new List <string>();
     InitializeAllHeadersListBox(AllHeadersList);
     documentType = docType;
     ChangeUIElementsByDocType(documentType);
     docHandler = _docHandler;
 }
Exemple #41
0
        public ColumnHeaderSelectorViewModel(DocumentHandlerViewModel documentHandlerViewModel, List <string> allColumnHeaders, DocumentType DocumentType)
        {
            this.documentHandlerViewModel = documentHandlerViewModel;
            AllHeadersList    = new ObservableCollection <string>(allColumnHeaders);
            this.DocumentType = DocumentType;

            DocumentRelatedHeadersList = InitialiseExampleListView(DocumentType);
            SelectedHeadersList        = new ObservableCollection <string>();

            AddHeaderCommand             = new AddHeaderCommand(this);
            RemoveHeaderCommand          = new RemoveHeaderCommand(this);
            FinishHeaderSelectionCommand = new FinishHeaderSelectionCommand(this, documentHandlerViewModel);
        }
Exemple #42
0
 public void MyTestInitialize()
 {
     m_ExistingDocType = GetExistingDocType();
     m_NewRootDoc      = CreateNewUnderRoot(m_ExistingDocType);
 }
        /// <summary>
        /// 获取文档类型扩展名列表
        /// </summary>
        public static string GetExtensions(this DocumentType fileType)
        {
            var name = Util.Helpers.Enum.GetName <DocumentType>(fileType);

            return(FileTypeHelper.GetExtensions(name));
        }
Exemple #44
0
 /// <summary>
 /// Creates a new document using the supplied path and type
 /// </summary>
 /// <param name="path"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static DocX Create(string path, DocumentType type)
 {
     return(Create(path, type, false));
 }
Exemple #45
0
 public void Add(DocumentType type, IEnumerable <string> files, Func <string, string> pathRewriter = null)
 {
     _files.AddRange(from f in files
                     select new FileAndType(DefaultBaseDir, ToRelative(f, DefaultBaseDir), type, pathRewriter));
 }
Exemple #46
0
 /// <summary>
 /// Creates a new document using the supplied stream and type
 /// </summary>
 /// <param name="stream"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public static DocX Create(Stream stream, DocumentType type)
 {
     return(Create(stream, type, false));
 }
Exemple #47
0
 private ConvertFormat(string name, string fileExtension, bool supportsSingleFile, DocumentType allowedTypes, params string[] args)
 {
     _args              = args;
     _dialog            = null;
     Name               = name;
     FileExtension      = fileExtension;
     SupportsSingleFile = supportsSingleFile;
     AllowedTypes       = allowedTypes;
 }
Exemple #48
0
        /// <summary>
        /// Creates a new document of the supplied type using a stream
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public DocX Create(DocumentType type)
        {
            stream = new MemoryStream();

            return(Create(stream, type, false));
        }
Exemple #49
0
        public async Task <IUserMessage> ReplyAsync(string Message, Embed Embed = null, DocumentType Document = DocumentType.None)
        {
            await Context.Channel.TriggerTypingAsync();

            _ = Task.Run(() => SaveDocuments(Document));
            return(await base.ReplyAsync(Message, false, Embed, null));
        }
        protected GetTaxRequest GetCalcTaxRequestFromOrder(OriginAddress originAddress, CustomerOrder customerOrder, DocumentType requestDocType)
        {
            //BUSA-483 Tax is not calculating correctly Start
            if (customerOrder != null)
            {
                if (!string.IsNullOrEmpty(customerOrder.BTPostalCode) || !string.IsNullOrEmpty(customerOrder.STPostalCode))
                {
                    //BUSA-730 : Tax & Shipping were getting calculated wrong
                    if (customerOrder.Status.EqualsIgnoreCase("AwaitingApproval"))
                    {
                        isShipToAddressChange = false;
                    } //BUSA-730 : Tax & Shipping were getting calculated wrong
                    else if (customerOrder.BTPostalCode.EqualsIgnoreCase(customerOrder.STPostalCode) && string.IsNullOrEmpty(customerOrder.Customer.CustomerSequence))
                    {
                        isShipToAddressChange = true;
                    }
                    else
                    {
                        isShipToAddressChange = false;
                    }
                }
            }
            var currentCustomer = customerOrder.ShipTo != null && !isShipToAddressChange ? customerOrder.ShipTo : SiteContext.Current.BillTo;

            var FOBCode = string.IsNullOrEmpty(currentCustomer.GetProperty("FOBCode", string.Empty).Trim()) ? "none"
                    : currentCustomer.GetProperty("FOBCode", string.Empty).Trim();

            if (FOBCode == "02")
            {
                customerOrder.ShippingCharges = Decimal.Zero;
            }
            //BUSA-483 Tax is not calculating correctly end

            // BUSA-336 : Taxes are being calculated based on the item value BEFORE promotional discounts are applied Starts
            var promotionOrderDiscountTotal    = customerOrderUtilities.GetPromotionOrderDiscountTotal(customerOrder);
            var promotionShippingDiscountTotal = customerOrderUtilities.GetPromotionShippingDiscountTotal(customerOrder);
            // BUSA-336 : Taxes are being calculated based on the item value BEFORE promotional discounts are applied Ends

            //var companyCode = applicationSettingProvider.GetOrCreateByName<string>("TaxCalculator_Avalara_CompanyCode");
            string companyCode = customSettings.TaxCalculatorAvalaraCompanyCode;
            //var orderDiscountTotal = customerOrder.DiscountAmount; // Commented to pass discounted amount in Avalara.
            var orderDiscountTotal = promotionOrderDiscountTotal;//BUSA-562:Difference in tax amounts between ERP and Insite ($0.01) // BUSA-336 : // BUSA-336 : Taxes are being calculated based on the item value BEFORE promotional discounts are applied Starts.

            var     getTaxRequest = new GetTaxRequest();
            Address address1      = new Address();

            address1.Line1      = originAddress.Address1;
            address1.Line2      = originAddress.Address2;
            address1.Line3      = originAddress.Address3;
            address1.City       = originAddress.City;
            address1.Region     = originAddress.Region;
            address1.PostalCode = originAddress.PostalCode;
            Country country = originAddress.Country;
            string  str1    = country != null ? country.IsoCode2 : string.Empty;

            address1.Country = str1;
            if (address1.Line1.IsBlank())
            {
                throw new InvalidOperationException("The origin address for tax purposes does not have a proper address. In order to calculate tax this must be set up.");
            }

            getTaxRequest.OriginAddress = address1;
            Address address2 = new Address()
            {
                Line1      = customerOrder.STAddress1,
                Line2      = customerOrder.STAddress2,
                Line3      = customerOrder.STAddress3,
                City       = customerOrder.STCity,
                Region     = customerOrder.STState,
                PostalCode = customerOrder.STPostalCode,
                Country    = customerOrder.STCountry
            };

            getTaxRequest.DestinationAddress = address2;
            if (string.IsNullOrEmpty(address2.Line1))
            {
                throw new InvalidOperationException("The current shipto customer does not have an address specified. In order to calculate tax this must be set up.");
            }

            foreach (var orderLine in customerOrder.OrderLines)
            {
                if (!orderLine.Status.EqualsIgnoreCase("Void") && orderLine.Release <= 1)
                {
                    var line = new Line
                    {
                        No          = orderLine.Line.ToString(),
                        ItemCode    = orderLine.Product.ErpNumber,
                        Qty         = (double)orderLine.QtyOrdered,
                        Amount      = this.orderLineUtilities.GetTotalNetPrice(orderLine),
                        Discounted  = orderDiscountTotal != Decimal.Zero,
                        Description = orderLine.Product.ShortDescription,
                        TaxCode     = orderLine.Product.TaxCategory
                    };
                    if (line.TaxCode != null && line.TaxCode.Length >= 24)
                    {
                        line.TaxCode = line.TaxCode.Substring(0, 24);
                    }
                    getTaxRequest.Lines.Add(line);
                }
            }
            if (customerOrder.ShippingCharges > 0)
            {
                var freightLine = new Line()
                {
                    No       = (customerOrder.OrderLines.Count + 1).ToString(),
                    ItemCode = customSettings.TaxCalculatorAvalaraBrasselerShipCode,
                    Qty      = 1,
                    Amount   = customerOrder.ShippingCharges - promotionShippingDiscountTotal,//BUSA-562:Difference in tax amounts between ERP and Insite ($0.01)
                    //    Discounted = customerOrder.DiscountAmount != decimal.Zero -- 4.2
                    Discounted  = orderDiscountTotal != decimal.Zero,
                    Description = customSettings.TaxCalculatorAvalaraBrasselerShipCodeDescription,
                    TaxCode     = customSettings.TaxCalculatorAvalaraBrasselerShippingTaxCode
                };
                if (freightLine.TaxCode != null && freightLine.TaxCode.Length >= 24)
                {
                    freightLine.TaxCode = freightLine.TaxCode.Substring(0, 24);
                }
                getTaxRequest.Lines.Add(freightLine);
            }
            getTaxRequest.CompanyCode  = companyCode;
            getTaxRequest.DocCode      = customerOrder.OrderNumber;
            getTaxRequest.DocDate      = customerOrder.OrderDate.DateTime;
            getTaxRequest.DocType      = requestDocType;
            getTaxRequest.Discount     = orderDiscountTotal;
            getTaxRequest.CustomerCode = customerOrder.CustomerNumber;
            if (customerOrder.ShipTo != null)
            {
                getTaxRequest.CustomerUsageType = customerOrder.ShipTo.TaxCode1;
            }
            return(getTaxRequest);
        }
Exemple #51
0
        int countType = -1; //0 = Bin , 1 = PRODUCT


        public InventoryCountPresenter(IUnityContainer container, IInventoryCountView view)
        {
            View           = view;
            this.container = container;
            this.service   = new WMSServiceClient();
            View.Model     = this.container.Resolve <InventoryCountModel>();


            View.FilterByBin    += new EventHandler <DataEventArgs <string> >(View_FilterByBin);
            View.AddToAssigned  += new EventHandler <EventArgs>(View_AddToAssigned);
            View.RemoveFromList += new EventHandler <EventArgs>(View_RemoveFromList);
            View.CreateNewTask  += new EventHandler <EventArgs>(View_CreateNewTask);
            View.LoadDetails    += new EventHandler <DataEventArgs <Document> >(View_LoadDetails);
            View.ShowTicket     += new EventHandler <EventArgs>(View_ShowTicket);
            View.ChangeStatus   += new EventHandler <EventArgs>(view_ChangeStatus);
            //View.BinTaskSelected += new EventHandler<DataEventArgs<ProductStock>>(View_BinTaskSelected);
            View.ChangeCountedQty     += new EventHandler <DataEventArgs <object[]> >(View_ChangeCountedQty);
            View.ConfirmCountTask     += new EventHandler <EventArgs>(View_ConfirmCountTask);
            View.CancelTask           += new EventHandler <EventArgs>(View_CancelTask);
            View.SearchDocument       += new EventHandler <DataEventArgs <string> >(View_SearchDocument);
            View.RefreshDocuments     += new EventHandler <EventArgs>(View_RefreshDocuments);
            View.ReloadDocument       += new EventHandler <EventArgs>(View_ReloadDocument);
            View.FilterByProduct      += new EventHandler <DataEventArgs <Product> >(View_FilterByProduct);
            View.UpdateDocumentOption += new EventHandler <DataEventArgs <int> >(View_UpdateDocumentOption);
            View.ShowInitialTicket    += new EventHandler <EventArgs>(View_ShowInitialTicket);
            View.LoadNoCountBalance   += new EventHandler <EventArgs>(View_LoadNoCountBalance);
            View.SendAdjustment       += new EventHandler <EventArgs>(View_SendAdjustment);
            View.ChangeSendOption     += new EventHandler <EventArgs>(OnChangeSendOption);
            view.SelectAll            += new EventHandler <EventArgs>(OnSelectAll);
            view.UnSelectAll          += new EventHandler <EventArgs>(OnUnSelectAll);


            //DocType
            docType = new DocumentType {
                DocClass = new DocumentClass {
                    DocClassID = SDocClass.Task
                }
            };
            docType.DocTypeID = SDocType.CountTask;

            ProcessWindow pw = new ProcessWindow("Loading Bin List ...");

            //oriAvailableBin = service.GetBin(new Bin { Location = App.curLocation }).OrderBy(f=> f.BinCode).ToList();
            oriAvailableBin = service.GetBin(new Bin()).OrderBy(f => f.BinCode).ToList();

            pw.Close();

            RefreshDocuments();

            //Product Categories
            try
            {
                IList <ProductCategory> list = service.GetProductCategory(new ProductCategory());
                list.Add(new ProductCategory {
                    Name = "... Any Category"
                });
                View.Model.ProductCategories = list.OrderBy(f => f.Name).ToList();
            }
            catch { }

            // CAA [2010/07/07]  Carga los filtros de busq de bines.
            IqReportColumn rc = new IqReportColumn();

            rc.Alias         = "Filter by Bin";
            rc.FilteredValue = "";
            View.BFilters.cboStrComp.SelectedValue = " = _val";
            View.BFilters.RepColumn = rc;
        }
 public void RegisterTypeOf <T>() where T : class
 {
     TypeOf.Add(DocumentType.FromClass <T>());
 }
Exemple #53
0
        private void setupChannel()
        {
            Channel userChannel;

            try
            {
                userChannel =
                    new Channel(u.Id);
            }
            catch
            {
                userChannel = new Channel();
            }

            // Populate dropdowns
            foreach (DocumentType dt in DocumentType.GetAllAsList())
            {
                cDocumentType.Items.Add(
                    new ListItem(dt.Text, dt.Alias)
                    );
            }

            // populate fields
            ArrayList fields = new ArrayList();

            cDescription.ID = "cDescription";
            cCategories.ID  = "cCategories";
            cExcerpt.ID     = "cExcerpt";
            cDescription.Items.Add(new ListItem(ui.Text("choose"), ""));
            cCategories.Items.Add(new ListItem(ui.Text("choose"), ""));
            cExcerpt.Items.Add(new ListItem(ui.Text("choose"), ""));

            foreach (PropertyType pt in PropertyType.GetAll())
            {
                if (!fields.Contains(pt.Alias))
                {
                    cDescription.Items.Add(new ListItem(string.Format("{0} ({1})", pt.Name, pt.Alias), pt.Alias));
                    cCategories.Items.Add(new ListItem(string.Format("{0} ({1})", pt.Name, pt.Alias), pt.Alias));
                    cExcerpt.Items.Add(new ListItem(string.Format("{0} ({1})", pt.Name, pt.Alias), pt.Alias));
                    fields.Add(pt.Alias);
                }
            }

            // Handle content and media pickers

            PlaceHolder medias = new PlaceHolder();

            cMediaPicker.AppAlias  = Constants.Applications.Media;
            cMediaPicker.TreeAlias = "media";

            if (userChannel.MediaFolder > 0)
            {
                cMediaPicker.Value = userChannel.MediaFolder.ToString();
            }
            else
            {
                cMediaPicker.Value = "-1";
            }

            medias.Controls.Add(cMediaPicker);

            PlaceHolder content = new PlaceHolder();

            cContentPicker.AppAlias  = Constants.Applications.Content;
            cContentPicker.TreeAlias = "content";

            if (userChannel.StartNode > 0)
            {
                cContentPicker.Value = userChannel.StartNode.ToString();
            }
            else
            {
                cContentPicker.Value = "-1";
            }

            content.Controls.Add(cContentPicker);


            // Setup the panes
            Pane ppInfo = new Pane();

            ppInfo.addProperty(ui.Text("name", base.getUser()), cName);
            ppInfo.addProperty(ui.Text("user", "startnode", base.getUser()), content);
            ppInfo.addProperty(ui.Text("user", "searchAllChildren", base.getUser()), cFulltree);
            ppInfo.addProperty(ui.Text("user", "mediastartnode", base.getUser()), medias);

            Pane ppFields = new Pane();

            ppFields.addProperty(ui.Text("user", "documentType", base.getUser()), cDocumentType);
            ppFields.addProperty(ui.Text("user", "descriptionField", base.getUser()), cDescription);
            ppFields.addProperty(ui.Text("user", "categoryField", base.getUser()), cCategories);
            ppFields.addProperty(ui.Text("user", "excerptField", base.getUser()), cExcerpt);


            TabPage channelInfo = UserTabs.NewTabPage(ui.Text("user", "contentChannel", base.getUser()));

            channelInfo.Controls.Add(ppInfo);
            channelInfo.Controls.Add(ppFields);

            channelInfo.HasMenu = true;
            ImageButton save = channelInfo.Menu.NewImageButton();

            save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif";
            save.Click   += new ImageClickEventHandler(saveUser_Click);
            save.ID       = "save";
            if (!IsPostBack)
            {
                cName.Text = userChannel.Name;
                cDescription.SelectedValue  = userChannel.FieldDescriptionAlias;
                cCategories.SelectedValue   = userChannel.FieldCategoriesAlias;
                cExcerpt.SelectedValue      = userChannel.FieldExcerptAlias;
                cDocumentType.SelectedValue = userChannel.DocumentTypeAlias;
                cFulltree.Checked           = userChannel.FullTree;
            }
        }
        private static DocumentType CreateCodeGenDocumentType()
        {
            var expected = new DocumentType
            {
                Info = new DocumentTypeInfo
                {
                    Alias            = "SomeDocumentType",
                    AllowAtRoot      = true,
                    AllowedTemplates = new List <string> {
                        "ATemplate", "AnotherTemplate"
                    },
                    DefaultTemplate = "ATemplate",
                    Description     = "A description of some document type",
                    Icon            = "privateMemberIcon.gif",
                    Master          = "",
                    Name            = "Some document type",
                    Thumbnail       = "privateMemberThumb.png"
                },
                Tabs = new List <Tab>
                {
                    new Tab {
                        Caption = "A tab"
                    },
                    new Tab()
                },
                Structure = new List <string>
                {
                    "SomeOtherDocType"
                },
                Composition = new List <ContentType>
                {
                    new ContentType
                    {
                        Info = new Info
                        {
                            Alias = "Mixin"
                        },
                        Tabs = new List <Tab> {
                            new Tab {
                                Caption = "Mixin tab"
                            }
                        },
                        GenericProperties = new List <GenericProperty>
                        {
                            new GenericProperty
                            {
                                Alias = "mixinProp",
                                Name  = "Mixin prop",
                                Type  = "Umbraco.Integer",
                                Tab   = "Mixin tab"
                            }
                        }
                    }
                },
                GenericProperties = new List <GenericProperty>
                {
                    new GenericProperty
                    {
                        Alias       = "someProperty",
                        Definition  = null,
                        Description = "A description",
                        Name        = "Some property",
                        Tab         = "A tab",
                        Type        = "Umbraco.Richtext"
                    },
                    new GenericProperty
                    {
                        Alias       = "anotherProperty",
                        Definition  = null,
                        Description = "Another description",
                        Name        = "Another property",
                        Tab         = "A tab",
                        Type        = "Umbraco.Richtext"
                    },
                    new GenericProperty
                    {
                        Alias      = "tablessProperty",
                        Definition = null,
                        Name       = "Tabless property",
                        Type       = "Umbraco.Integer"
                    },
                }
            };

            return(expected);
        }
Exemple #55
0
 private void VerifyIsSubclass(Type subclassType)
 {
     if (!subclassType.CanBeCastTo(DocumentType))
     {
         throw new ArgumentOutOfRangeException(nameof(subclassType),
                                               $"Type '{subclassType.GetFullName()}' cannot be cast to '{DocumentType.GetFullName()}'");
     }
 }
Exemple #56
0
 public bool IsHierarchy()
 {
     return(_subClasses.Any() || DocumentType.GetTypeInfo().IsAbstract || DocumentType.GetTypeInfo().IsInterface);
 }
 private static void AddFileMapping(FileCollection fileCollection, string baseDirectory, DocumentType type, FileMapping mapping)
 {
     if (mapping != null)
     {
         foreach (var item in mapping.Items)
         {
             fileCollection.Add(
                 type,
                 item.Files,
                 s => RewritePath(baseDirectory, s, item));
         }
     }
 }
 public Document(DocumentType type, string value)
 {
     Type  = type;
     Value = value;
 }
        /// <summary>
        /// Initialises the Sales Invoice / Purchase Report Datagrids after we finish filtering/removing unwanted columns
        /// </summary>
        /// <param name="docColumnHeaders_List">Needed/Selected column headers</param>
        /// <param name="docType">the document type(Sales Invoice / Purchase Report)</param>
        public void FinishedHeaderSelection(Dictionary <string, string> docColumnHeaders_List, DocumentType docType)
        {
            if (docType == DocumentType.SalesInvoice)
            {
                InvoiceContent       = excelReader.ConvertToInvoiceModel(excelInvoiceContent, docColumnHeaders_List);
                BackupInvoiceContent = InvoiceContent;
                InvoiceContentDataGridView.DataSource = null;
                InvoiceContentDataGridView.DataSource = InvoiceContent;

                string[] headers = docColumnHeaders_List.Keys.ToArray();
                cellColumnIndex = Array.IndexOf(headers, "PurchaseInvoice");

                for (int i = 0; i < InvoiceContentDataGridView.Columns.Count - 1; i++)
                {
                    InvoiceContentDataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                }
            }
            else
            {
                PurchaseReportContent = excelReader.ConvertToPurchaseReportModel(excelReportContent, docColumnHeaders_List);
                PurchaseReportDataGridView.DataSource = null;
                PurchaseReportDataGridView.DataSource = PurchaseReportContent;

                for (int i = 0; i < PurchaseReportDataGridView.Columns.Count - 1; i++)
                {
                    PurchaseReportDataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
                }
            }
        }
Exemple #60
0
        /// <summary>
        /// CK_API_DOC_SEARCH - Download all documents using selected filters
        /// </summary>
        /// <param name="year">Defaults to current year</param>
        public async Task <List <Document> > SearchDocuments(int monthFrom = 1, int monthTo = 12, int?year = null, DateType dateType = DateType.doc_book_date, DocumentType docType = DocumentType.AllTypes)
        {
            //consts
            const int    pageSize = 50;
            const string method   = "CK_API_DOC_SEARCH";

            //date checks
            if (year == null)
            {
                year = DateTime.Now.Year;
            }
            if (monthFrom < 1 || monthFrom > 12)
            {
                throw new ArgumentOutOfRangeException(nameof(monthFrom));
            }
            if (monthTo < 1 || monthTo > 12)
            {
                throw new ArgumentOutOfRangeException(nameof(monthTo));
            }

            //optional tags initialization
            string docTypeTag = string.Empty;

            if (docType != DocumentType.AllTypes)
            {
                docTypeTag = $"<doc_type>{docType.ToDocType()}</doc_type>";
            }

            //deftault variables initalization
            var dateRange             = GetDateRange(monthFrom, monthTo, year.Value);
            var completeDocumentsList = new List <Document>();
            int pageNumber            = 0;
            int lastDownloadCount     = 0;

            do
            {
                string payload  = $"<request><company_id>{_companyId}</company_id><page_number>{pageNumber}</page_number><page_size>{pageSize}</page_size>{docTypeTag}<date_type>{dateType}</date_type><date_from>{dateRange.Item1}</date_from><date_to>{dateRange.Item2}</date_to></request>";
                var    response = await Client.GetAsync(GetUrl(method, payload));

                string xml = await response.Content.ReadAsStringAsync();

                if (response.IsSuccessStatusCode == false)
                {
                    throw new CostkillerException(response, response.RequestMessage);
                }
                XmlDocument XmlDoc = new XmlDocument();
                XmlDoc.LoadXml(xml);
                var docNode        = XmlDoc.SelectSingleNode("/response/documents");
                var documentString = docNode.OuterXml;
                var serializer     = new XmlSerializer(typeof(DocumentHolder));
                using (var reader = new StringReader(documentString))
                {
                    var documents = (DocumentHolder)serializer.Deserialize(reader);
                    completeDocumentsList.AddRange(documents.Documents);
                    lastDownloadCount = documents.Documents.Count();
                }
                pageNumber++;
            } while (lastDownloadCount == pageSize);

            return(completeDocumentsList);
        }