163 lines
4.9 KiB
C#
163 lines
4.9 KiB
C#
// ========================================================================
|
|
// Copyright 2006 - Volian Enterprises, Inc. All rights reserved.
|
|
// Volian Enterprises - Proprietary Information - DO NOT COPY OR DISTRIBUTE
|
|
// ------------------------------------------------------------------------
|
|
// $Workfile: $ $Revision: $
|
|
// $Author: $ $Date: $
|
|
//
|
|
// $History: $
|
|
// ========================================================================
|
|
|
|
using System;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using Csla;
|
|
using Csla.Data;
|
|
using System.Configuration;
|
|
using System.IO;
|
|
using System.ComponentModel;
|
|
using System.Collections.Generic;
|
|
using System.Collections;
|
|
|
|
namespace VEPROMS.CSLA.Library
|
|
{
|
|
public partial class ChildFoldersPropertyDescriptor
|
|
{
|
|
public override string DisplayName
|
|
{ get { return Item.Name; } }
|
|
public override string Description
|
|
{ get { return Item.Title; } }
|
|
public override string Name
|
|
{ get { return Item.Name; } }
|
|
}
|
|
public partial class FolderDocVersionsPropertyDescriptor
|
|
{
|
|
public override string DisplayName
|
|
{ get { return Item.Name; } }
|
|
public override string Description
|
|
{ get { return Item.Name; } }
|
|
public override string Name
|
|
{ get { return Item.Name; } }
|
|
}
|
|
public class FormatList : System.ComponentModel.StringConverter
|
|
{
|
|
private static SortedList<string, FormatInfo> _MyFormatInfoList;
|
|
public static SortedList<string, FormatInfo> MyFormatInfoList
|
|
{
|
|
get
|
|
{
|
|
if (_MyFormatInfoList == null)
|
|
LoadSortedList();
|
|
return FormatList._MyFormatInfoList;
|
|
}
|
|
}
|
|
private static void LoadSortedList()
|
|
{
|
|
if (_MyFormatInfoList == null)
|
|
{
|
|
_MyFormatInfoList = new SortedList<string, FormatInfo>();
|
|
foreach (FormatInfo formatInfo in FormatInfoList.Get())
|
|
{
|
|
//_FormatInfoList.Add(formatInfo.Name, formatInfo);
|
|
_MyFormatInfoList.Add(formatInfo.FullName, formatInfo);
|
|
}
|
|
_MyFormatInfoList.Add("", null);
|
|
}
|
|
}
|
|
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
{
|
|
return new StandardValuesCollection((ICollection)MyFormatInfoList.Values);
|
|
}
|
|
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
public static int? ToInt(string formatName)
|
|
{
|
|
if (formatName == null || formatName == string.Empty) return null;
|
|
foreach (FormatInfo formatInfo in MyFormatInfoList.Values)
|
|
if (formatInfo != null && formatInfo.FullName == formatName) return formatInfo.FormatID;
|
|
return null;
|
|
}
|
|
public static string ToString(int? formatID)
|
|
{
|
|
if (formatID == null) return null;
|
|
foreach (FormatInfo formatInfo in MyFormatInfoList.Values)
|
|
if (formatInfo != null && formatInfo.FormatID == formatID) return formatInfo.ToString();
|
|
return null;
|
|
}
|
|
public static Format ToFormat(string formatName)
|
|
{
|
|
if (formatName == null || formatName == string.Empty) return null;
|
|
foreach (FormatInfo formatInfo in MyFormatInfoList.Values)
|
|
if (formatInfo != null && formatInfo.ToString() == formatName) return formatInfo.Get();
|
|
return null;
|
|
}
|
|
}
|
|
public class DocStyleListConverter : System.ComponentModel.StringConverter
|
|
{
|
|
private static SortedList<string, int> _MyDocStyleList;
|
|
private static SortedList<string, int> MyDocStyleList
|
|
{
|
|
get
|
|
{
|
|
if (_MyDocStyleList == null)
|
|
LoadSortedList();
|
|
return _MyDocStyleList;
|
|
}
|
|
set { _MyDocStyleList = value; }
|
|
}
|
|
private static Section _MySection;
|
|
public static Section MySection
|
|
{
|
|
get { return _MySection; }
|
|
set
|
|
{
|
|
_MySection = value;
|
|
_MyDocStyleList = null;
|
|
}
|
|
}
|
|
private static void LoadSortedList()
|
|
{
|
|
if (_MyDocStyleList == null)
|
|
{
|
|
_MyDocStyleList = new SortedList<string, int>();
|
|
foreach(DocStyle ds in _MySection.ActiveFormat.PlantFormat.DocStyles.DocStyleList)
|
|
{
|
|
_MyDocStyleList.Add(ds.Name,10000 + (int) ds.Index);
|
|
}
|
|
}
|
|
}
|
|
public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
|
|
{
|
|
return new StandardValuesCollection((ICollection)MyDocStyleList.Keys);
|
|
}
|
|
public override bool GetStandardValuesSupported(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
public override bool GetStandardValuesExclusive(ITypeDescriptorContext context)
|
|
{
|
|
return true;
|
|
}
|
|
public static int? ToInt(string docStyleName)
|
|
{
|
|
return MyDocStyleList[docStyleName];
|
|
}
|
|
public static string ToString(int? sectionType)
|
|
{
|
|
if (sectionType == null) return null;
|
|
return MyDocStyleList.Keys[MyDocStyleList.IndexOfValue((int)sectionType)];
|
|
}
|
|
public static int ToSectionType(string docStyleName)
|
|
{
|
|
return MyDocStyleList[docStyleName];
|
|
}
|
|
}
|
|
|
|
}
|