本文整理汇总了C#中DocumentType类的典型用法代码示例。如果您正苦于以下问题:C# DocumentType类的具体用法?C# DocumentType怎么用?C# DocumentType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DocumentType类属于命名空间,在下文中一共展示了DocumentType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ExpertControl
/// <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();
}
开发者ID:reckcn,项目名称:DevLib.Comm,代码行数:37,代码来源:ExportData.cs
示例2: DocumentFile
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;
}
开发者ID:jhorv,项目名称:dotnetpad,代码行数:7,代码来源:DocumentFile.cs
示例3: Write
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("}");
}
}
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:29,代码来源:ClassGenerator.cs
示例4: GetDocumentsForForeignObject
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();
}
}
}
开发者ID:SwarmCorp,项目名称:Swarmops,代码行数:26,代码来源:Database-Documents.cs
示例5: Print
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();
}
开发者ID:rymbln,项目名称:WPFDB,代码行数:29,代码来源:PrintManager.cs
示例6: EditDocumentType
public String EditDocumentType(DocumentType documentType)
{
db.Entry(documentType).State = EntityState.Modified;
db.SaveChanges();
return "Success";
}
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:DocumentRepository.cs
示例7: DeleteDocumentType
public String DeleteDocumentType(DocumentType documentType)
{
db.DocumentTypes.Remove(documentType);
db.SaveChanges();
return "Success";
}
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:DocumentRepository.cs
示例8: CreateDocumentType
public String CreateDocumentType(DocumentType documentType)
{
db.DocumentTypes.Add(documentType);
db.SaveChanges();
return "Success";
}
开发者ID:pkookie,项目名称:ApplicationPortfolio,代码行数:7,代码来源:DocumentRepository.cs
示例9: GeneratePropertyCode
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();
}
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:33,代码来源:NullableBclClass.cs
示例10: GetText
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();
}
开发者ID:neuhauser,项目名称:perseus-plugins,代码行数:31,代码来源:ParameterDescription.cs
示例11: GetFiles
/// <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();
}
开发者ID:usmanazizgroupdocs,项目名称:GroupDocs_Metadata_NET,代码行数:32,代码来源:DocumentTypeDetector.cs
示例12: GetFiles
/// <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();
}
开发者ID:usmanazizgroupdocs,项目名称:GroupDocs_Metadata_NET,代码行数:31,代码来源:MyExtension.cs
示例13: Print
public void Print(ClientHelper clientHelper, DocumentType documentType)
{
if (documentType == DocumentType.Service)
PrintServiceDocumentString(clientHelper);
else
PrintFiscalDocumentString(clientHelper);
}
开发者ID:Dennis-Petrov,项目名称:Cash,代码行数:7,代码来源:BufferedString.cs
示例14: GeneratePropertyCode
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();
}
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:28,代码来源:ListClass.cs
示例15: GeneratePropertyCode
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();
}
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:30,代码来源:FormattedDateTime.cs
示例16: When_requesting_Create_values_are_set_correctly
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));
}
开发者ID:mnasif786,项目名称:Business-Safe,代码行数:32,代码来源:Create.cs
示例17: GetTransactionType
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;
}
开发者ID:asanyaga,项目名称:BuildTest,代码行数:25,代码来源:TransactionRepository.cs
示例18: ParseChannelQueryString
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;
}
}
开发者ID:leesanghyun2,项目名称:mp-onlinevideos2,代码行数:34,代码来源:RssHttpHandlerHelper.cs
示例19: GeneratePropertyCode
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();
}
开发者ID:sethkontny,项目名称:CSharpinator,代码行数:30,代码来源:PascalCaseBooleanClass.cs
示例20: ViewDocument
public void ViewDocument(Guid documentId, DocumentType docType)
{
_vm.DocumentId = documentId;
_vm.DocumentType = docType;
_vm.SetUp();
this.Show();
}
开发者ID:asanyaga,项目名称:BuildTest,代码行数:7,代码来源:DocumentReportViewer.xaml.cs
注:本文中的DocumentType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论