Пример #1
0
 private void LoadAppInfo()
 {
     try
     {
         using (ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS())
         {
             string templatePathByUser = ApplicationInfo.GetTemplatePathByUser();
             string text = templatePathByUser + "\\ApplicationInfo.xml";
             if (File.Exists(text))
             {
                 applicationInfoDS.ReadXml(text);
             }
             if (applicationInfoDS.Info.Rows.Count > 0)
             {
                 if (applicationInfoDS.Info.Columns.Contains("TPBlinkColor"))
                 {
                     if (applicationInfoDS.Info[0].TPBlinkColor == "Y")
                     {
                         ApplicationInfo.IsSupportTPBlinkColor = true;
                     }
                     else
                     {
                         ApplicationInfo.IsSupportTPBlinkColor = false;
                     }
                 }
                 if (applicationInfoDS.Info.Columns.Contains("ValidatePolicy"))
                 {
                     ApplicationInfo.IsRiskActive = applicationInfoDS.Info[0].ValidatePolicy;
                 }
                 if (applicationInfoDS.Info.Columns.Contains("AlertEnable"))
                 {
                     ApplicationInfo.AlertOpen = applicationInfoDS.Info[0].AlertEnable;
                 }
                 if (applicationInfoDS.Info.Columns.Contains("AlertAutoPopup"))
                 {
                     ApplicationInfo.AlertAutoPopup = applicationInfoDS.Info[0].AlertAutoPopup;
                 }
                 if (applicationInfoDS.Info.Columns.Contains("AlertSound"))
                 {
                     ApplicationInfo.AlertSound = applicationInfoDS.Info[0].AlertSound;
                 }
             }
             else
             {
                 ApplicationInfo.IsSupportTPBlinkColor = true;
                 ApplicationInfo.IsRiskActive = false;
                 ApplicationInfo.AlertOpen = false;
                 ApplicationInfo.AlertAutoPopup = true;
                 ApplicationInfo.AlertSound = false;
             }
             applicationInfoDS.Clear();
         }
     }
     catch (Exception ex)
     {
         this.ShowError("LoadAppInfo", ex);
     }
 }
Пример #2
0
 private void SaveAppInfo()
 {
     try
     {
         using (ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS())
         {
             string text = ApplicationInfo.GetTemplatePathByUser() + "\\ApplicationInfo.xml";
             if (File.Exists(text))
             {
                 applicationInfoDS.ReadXml(text);
                 applicationInfoDS.Info.Clear();
             }
             ApplicationInfoDS.InfoRow infoRow = applicationInfoDS.Info.NewInfoRow();
             if (ApplicationInfo.IsSupportTPBlinkColor)
             {
                 infoRow.TPBlinkColor = "Y";
             }
             else
             {
                 infoRow.TPBlinkColor = "N";
             }
             infoRow.ValidatePolicy = ApplicationInfo.IsRiskActive;
             infoRow.AlertEnable = ApplicationInfo.AlertOpen;
             infoRow.AlertSound = ApplicationInfo.AlertSound;
             infoRow.AlertAutoPopup = ApplicationInfo.AlertAutoPopup;
             applicationInfoDS.Info.AddInfoRow(infoRow);
             if (File.Exists(text))
             {
                 applicationInfoDS.WriteXml(text);
             }
             else
             {
                 if (!Directory.Exists(ApplicationInfo.GetTemplatePathByUser()))
                 {
                     Directory.CreateDirectory(ApplicationInfo.GetTemplatePathByUser());
                 }
                 applicationInfoDS.WriteXml(text);
             }
         }
     }
     catch (Exception ex)
     {
         this.ShowError("SaveUserProfile", ex);
     }
 }
Пример #3
0
 public InfoRowChangeEvent(ApplicationInfoDS.InfoRow row, DataRowAction action)
 {
     this.eventRow = row;
     this.eventAction = action;
 }
Пример #4
0
 public void RemoveInfoRow(ApplicationInfoDS.InfoRow row)
 {
     base.Rows.Remove(row);
 }
Пример #5
0
 public void AddInfoRow(ApplicationInfoDS.InfoRow row)
 {
     base.Rows.Add(row);
 }
Пример #6
0
 public static XmlSchemaComplexType GetTypedTableSchema(XmlSchemaSet xs)
 {
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS();
     XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();
     xmlSchemaAny.Namespace = "http://www.w3.org/2001/XMLSchema";
     xmlSchemaAny.MinOccurs = 0m;
     xmlSchemaAny.MaxOccurs = 79228162514264337593543950335m;
     xmlSchemaAny.ProcessContents = XmlSchemaContentProcessing.Lax;
     xmlSchemaSequence.Items.Add(xmlSchemaAny);
     XmlSchemaAny xmlSchemaAny2 = new XmlSchemaAny();
     xmlSchemaAny2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     xmlSchemaAny2.MinOccurs = 1m;
     xmlSchemaAny2.ProcessContents = XmlSchemaContentProcessing.Lax;
     xmlSchemaSequence.Items.Add(xmlSchemaAny2);
     XmlSchemaAttribute xmlSchemaAttribute = new XmlSchemaAttribute();
     xmlSchemaAttribute.Name = "namespace";
     xmlSchemaAttribute.FixedValue = applicationInfoDS.Namespace;
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute);
     XmlSchemaAttribute xmlSchemaAttribute2 = new XmlSchemaAttribute();
     xmlSchemaAttribute2.Name = "tableTypeName";
     xmlSchemaAttribute2.FixedValue = "InfoDataTable";
     xmlSchemaComplexType.Attributes.Add(xmlSchemaAttribute2);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = applicationInfoDS.GetSchemaSerializable();
     XmlSchemaComplexType result;
     if (xs.Contains(schemaSerializable.TargetNamespace))
     {
         MemoryStream memoryStream = new MemoryStream();
         MemoryStream memoryStream2 = new MemoryStream();
         try
         {
             schemaSerializable.Write(memoryStream);
             IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 XmlSchema xmlSchema = (XmlSchema)enumerator.Current;
                 memoryStream2.SetLength(0L);
                 xmlSchema.Write(memoryStream2);
                 if (memoryStream.Length == memoryStream2.Length)
                 {
                     memoryStream.Position = 0L;
                     memoryStream2.Position = 0L;
                     while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte())
                     {
                     }
                     if (memoryStream.Position == memoryStream.Length)
                     {
                         result = xmlSchemaComplexType;
                         return result;
                     }
                 }
             }
         }
         finally
         {
             if (memoryStream != null)
             {
                 memoryStream.Close();
             }
             if (memoryStream2 != null)
             {
                 memoryStream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     result = xmlSchemaComplexType;
     return result;
 }
Пример #7
0
 public static XmlSchemaComplexType GetTypedDataSetSchema(XmlSchemaSet xs)
 {
     ApplicationInfoDS applicationInfoDS = new ApplicationInfoDS();
     XmlSchemaComplexType xmlSchemaComplexType = new XmlSchemaComplexType();
     XmlSchemaSequence xmlSchemaSequence = new XmlSchemaSequence();
     XmlSchemaAny xmlSchemaAny = new XmlSchemaAny();
     xmlSchemaAny.Namespace = applicationInfoDS.Namespace;
     xmlSchemaSequence.Items.Add(xmlSchemaAny);
     xmlSchemaComplexType.Particle = xmlSchemaSequence;
     XmlSchema schemaSerializable = applicationInfoDS.GetSchemaSerializable();
     XmlSchemaComplexType result;
     if (xs.Contains(schemaSerializable.TargetNamespace))
     {
         MemoryStream memoryStream = new MemoryStream();
         MemoryStream memoryStream2 = new MemoryStream();
         try
         {
             schemaSerializable.Write(memoryStream);
             IEnumerator enumerator = xs.Schemas(schemaSerializable.TargetNamespace).GetEnumerator();
             while (enumerator.MoveNext())
             {
                 XmlSchema xmlSchema = (XmlSchema)enumerator.Current;
                 memoryStream2.SetLength(0L);
                 xmlSchema.Write(memoryStream2);
                 if (memoryStream.Length == memoryStream2.Length)
                 {
                     memoryStream.Position = 0L;
                     memoryStream2.Position = 0L;
                     while (memoryStream.Position != memoryStream.Length && memoryStream.ReadByte() == memoryStream2.ReadByte())
                     {
                     }
                     if (memoryStream.Position == memoryStream.Length)
                     {
                         result = xmlSchemaComplexType;
                         return result;
                     }
                 }
             }
         }
         finally
         {
             if (memoryStream != null)
             {
                 memoryStream.Close();
             }
             if (memoryStream2 != null)
             {
                 memoryStream2.Close();
             }
         }
     }
     xs.Add(schemaSerializable);
     result = xmlSchemaComplexType;
     return result;
 }