protected void LimitValidator_Validate(object sender, ServerValidateEventArgs e) { // Do not validate fixed values DropDownList propertyField = (DropDownList)((Control)sender).NamingContainer.FindControl("LimitPackagePropertyField"); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), propertyField.SelectedValue); if (packageProperty != PackageProperties.FixedAmountOne && packageProperty != PackageProperties.Separator0) { if (string.IsNullOrEmpty(e.Value)) { e.IsValid = false; } else { Decimal result; e.IsValid = Decimal.TryParse(e.Value, out result); } } else { e.IsValid = true; } }
protected void MatchPackagePropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList propertyField = (DropDownList)sender; PackageProperties matchProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), propertyField.SelectedValue); DropDownList itemPropertyField = (DropDownList)propertyField.NamingContainer.FindControl("MatchItemPropertyField"); ItemProperties itemProperty = (ItemProperties)Enum.Parse(typeof(ItemProperties), itemPropertyField.SelectedValue); DropDownList customPropertyField = (DropDownList)propertyField.NamingContainer.FindControl("MatchCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)propertyField.NamingContainer.FindControl("MatchCustomPropertyLabel"); if (matchProperty == PackageProperties.ItemProperty) { itemPropertyField.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, itemProperty); } else { itemPropertyField.Visible = false; customPropertyField.Visible = false; Page.Validate("RuleGroup"); if (Page.IsValid) { PrepareCustomPropertyField(customPropertyLabel, customPropertyField, matchProperty); } } } }
private static void PrepareValueField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, PackageProperties property) { PropertyTypes propertyType = PackagePropertiesHelper.GetPropertyType(property); PrepareValueField(multiplier, label, field, requiredValidator, numericValidator, propertyType); }
/// <summary> /// Creates a sample XpsDocument with one page for each canvas. /// Page size will match canvas size. /// Page name is 'PageX' where 'X' is the index + 1 of the canvas. /// </summary> /// <param name="fileName">The name of the file to create.</param> /// <param name="canvases">A list of canvases that will be used to create pages.</param> /// <param name="coreProperties">A PackageProperties element to be included in the package.</param> public static void CreatePackage(string fileName, Canvas[] canvases, PackageProperties coreProperties) { if (File.Exists(fileName)) { File.Delete(fileName); } XpsDocument rp = new XpsDocument(fileName, FileAccess.ReadWrite); FixedPage[] pages = new FixedPage[canvases.Length]; for (int i = 0; i < canvases.Length; i++) { pages[i] = CreateFixedPage( canvases[i], string.Format(CultureInfo.InvariantCulture, "Page{0}", i + 1)); } FixedDocumentSequence fds = CreateFixedDocumentSequence( CreateFixedDocument(pages)); AttachSequenceToPackage(fds, rp); if (coreProperties != null) { AttachCorePropertiesToPackage(coreProperties, rp); } rp.Close(); }
private void CompareProperties(OPCPackage p) { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); DateTime expectedDate = DateTime.Parse("2007/05/12T08:00:00Z").ToUniversalTime(); // Gets the core properties PackageProperties props = p.GetPackageProperties(); Assert.AreEqual("MyCategory", props.GetCategoryProperty()); Assert.AreEqual("MyContentStatus", props.GetContentStatusProperty() ); Assert.AreEqual("MyContentType", props.GetContentTypeProperty()); Assert.AreEqual(expectedDate, props.GetCreatedProperty()); Assert.AreEqual("MyCreator", props.GetCreatorProperty()); Assert.AreEqual("MyDescription", props.GetDescriptionProperty()); Assert.AreEqual("MyIdentifier", props.GetIdentifierProperty()); Assert.AreEqual("MyKeywords", props.GetKeywordsProperty()); Assert.AreEqual("MyLanguage", props.GetLanguageProperty()); Assert.AreEqual("Julien Chable", props.GetLastModifiedByProperty() ); Assert.AreEqual(expectedDate, props.GetLastPrintedProperty()); Assert.AreEqual(expectedDate, props.GetModifiedProperty()); Assert.AreEqual("2", props.GetRevisionProperty()); Assert.AreEqual("MySubject", props.GetSubjectProperty()); Assert.AreEqual("MyTitle", props.GetTitleProperty()); Assert.AreEqual("2", props.GetVersionProperty()); }
// Token: 0x06006CD0 RID: 27856 RVA: 0x001F4D64 File Offset: 0x001F2F64 internal CorePropertyEnumerator(PackageProperties coreProperties, IFILTER_INIT grfFlags, ManagedFullPropSpec[] attributes) { if (attributes != null && attributes.Length != 0) { this._attributes = attributes; } else if ((grfFlags & IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES) == IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES) { this._attributes = new ManagedFullPropSpec[] { new ManagedFullPropSpec(FormatId.SummaryInformation, 2U), new ManagedFullPropSpec(FormatId.SummaryInformation, 3U), new ManagedFullPropSpec(FormatId.SummaryInformation, 4U), new ManagedFullPropSpec(FormatId.SummaryInformation, 5U), new ManagedFullPropSpec(FormatId.SummaryInformation, 6U), new ManagedFullPropSpec(FormatId.SummaryInformation, 8U), new ManagedFullPropSpec(FormatId.SummaryInformation, 9U), new ManagedFullPropSpec(FormatId.SummaryInformation, 11U), new ManagedFullPropSpec(FormatId.SummaryInformation, 12U), new ManagedFullPropSpec(FormatId.SummaryInformation, 13U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 2U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 18U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 26U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 27U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 28U), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, 29U) }; } this._coreProperties = coreProperties; this._currentIndex = -1; }
/// <summary> /// Attaches PackageProperties to an XpsDocument. /// </summary> /// <param name="coreProperties">The PackageProperties to attach.</param> /// <param name="rp">The Xps package that will contain the properties.</param> private static void AttachCorePropertiesToPackage(PackageProperties coreProperties, XpsDocument rp) { TestServices.Assert(rp.CoreDocumentProperties != null, "XpsDocument.CoreDocumentProperties is null, cannot set new property values."); rp.CoreDocumentProperties.Category = coreProperties.Category; rp.CoreDocumentProperties.ContentStatus = coreProperties.ContentStatus; rp.CoreDocumentProperties.ContentType = coreProperties.ContentType; rp.CoreDocumentProperties.Creator = coreProperties.Creator; if (coreProperties.Created.HasValue) { rp.CoreDocumentProperties.Created = coreProperties.Created.Value; } if (coreProperties.Modified.HasValue) { rp.CoreDocumentProperties.Modified = coreProperties.Modified.Value; } rp.CoreDocumentProperties.Description = coreProperties.Description; rp.CoreDocumentProperties.Identifier = coreProperties.Identifier; rp.CoreDocumentProperties.Keywords = coreProperties.Keywords; rp.CoreDocumentProperties.Language = coreProperties.Language; rp.CoreDocumentProperties.LastModifiedBy = coreProperties.LastModifiedBy; if (coreProperties.LastPrinted.HasValue) { rp.CoreDocumentProperties.LastPrinted = coreProperties.LastPrinted.Value; } rp.CoreDocumentProperties.Revision = coreProperties.Revision; rp.CoreDocumentProperties.Subject = coreProperties.Subject; rp.CoreDocumentProperties.Title = coreProperties.Title; rp.CoreDocumentProperties.Version = coreProperties.Version; }
protected void LimitPackagePropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList packagePropertyField = (DropDownList)sender; DropDownList customPropertyField = (DropDownList)packagePropertyField.NamingContainer.FindControl("LimitCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)packagePropertyField.NamingContainer.FindControl("LimitCustomPropertyLabel"); Label multiplierLabel = (Label)packagePropertyField.NamingContainer.FindControl("LimitMultiplierLabel"); HelpLabel limitLabel = (HelpLabel)packagePropertyField.NamingContainer.FindControl("LimitLabel"); TextBox limitField = (TextBox)packagePropertyField.NamingContainer.FindControl("LimitField"); BaseValidator limitRequired = (BaseValidator)packagePropertyField.NamingContainer.FindControl("LimitRequired"); BaseValidator limitNumeric = (BaseValidator)packagePropertyField.NamingContainer.FindControl("LimitNumeric"); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); PrepareLimitField(multiplierLabel, limitLabel, limitField, limitRequired, limitNumeric, packageProperty); } }
/// <summary> /// If the package designer is already open, then use the package object on it which may have in-memory modifications. /// If the package designer is not open, then just load the package from disk. /// </summary> /// <param name="pi"></param> /// <returns></returns> private PackageProperties GetPackageProperties(ProjectItem pi) { Package package; bool bIsOpen = pi.get_IsOpen(BIDSViewKinds.Designer); if (bIsOpen) { Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer w.Activate(); IDesignerHost designer = w.Object as IDesignerHost; if (designer == null) { return(null); } EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); package = win.PropertiesLinkComponent as Package; } else { Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); package = app.LoadPackage(pi.get_FileNames(0), null); } if (package == null) { return(null); } PackageProperties props = new PackageProperties(package); props.DatabaseName = this.DatabaseName; props.PackagePathPrefix = this.PackagePathPrefix; return(props); }
// Token: 0x06006CC9 RID: 27849 RVA: 0x001F4C45 File Offset: 0x001F2E45 internal CorePropertiesFilter(PackageProperties coreProperties) { if (coreProperties == null) { throw new ArgumentNullException("coreProperties"); } this._coreProperties = coreProperties; }
public void UpdateProperties(PackageProperties properties) { foreach (PropertyInfo _propertyX in typeof(PackageProperties).GetProperties()) { object x = _propertyX.GetValue(this, null); _propertyX.SetValue(properties, x, null); } }
/// <summary> /// <see cref="MS.Internal.Documents.Application.IDocumentController"/> /// </summary> bool IDocumentController.Rebind(Document document) { RightsDocument doc = (RightsDocument)document; // see class remarks on why this is ok Stream ciphered = doc.Dependency.Source; Stream clear = ciphered; if (doc.IsRebindNeeded) { if (doc.SourcePackage != null) { CloseEnvelope(doc.SourcePackage); doc.SourcePackage = null; } EncryptedPackageEnvelope envelope = null; PackageProperties properties = null; bool isSourceProtected = doc.IsSourceProtected(); if (isSourceProtected) { envelope = OpenEnvelopeOnStream(ciphered); doc.SourcePackage = envelope; properties = new SuppressedProperties(envelope); } DocumentProperties.Current.SetRightsManagedProperties(properties); DocumentRightsManagementManager.Current.SetEncryptedPackage(envelope); if (isSourceProtected) { clear = DocumentRightsManagementManager.Current.DecryptPackage(); if (clear != null) { clear = new RightsManagementSuppressedStream( clear, DocumentRightsManagementManager.Current.HasPermissionToEdit); // Reset the position of the stream since GetPackageStream will // create a package and move the stream pointer somewhere else clear.Position = 0; } else { Trace.SafeWrite( Trace.Rights, "You do not have rights for the current document."); return(false); } } doc.SourceProxy.Target = clear; } return(true); }
/// <summary> /// Constructor. /// </summary> /// <param name="coreProperties">CoreProperties to enumerate</param> /// <param name="grfFlags"> /// if IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is specified, /// this indicates all core properties to be returned unless /// the parameter aAttributes is non-empty. /// </param> /// <param name="attributes"> /// attributes specified corresponding to the properties to filter. /// </param> internal CorePropertyEnumerator(PackageProperties coreProperties, IFILTER_INIT grfFlags, ManagedFullPropSpec[] attributes) { if (attributes != null && attributes.Length > 0) { // // If attruibutes list specified, // return core properties for only those attributes. // _attributes = attributes; } else if ((grfFlags & IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES) == IFILTER_INIT.IFILTER_INIT_APPLY_INDEX_ATTRIBUTES) { // // If no attributes list specified, // but IFILTER_INIT_APPLY_INDEX_ATTRIBUTES is present in grfFlags, // return all core properties. // _attributes = new ManagedFullPropSpec[] { // // SummaryInformation // new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Title), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Subject), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Creator), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Keywords), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Description), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastModifiedBy), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.Revision), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.LastPrinted), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateCreated), new ManagedFullPropSpec(FormatId.SummaryInformation, PropertyId.DateModified), // // DocumentSummaryInformation // new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Category), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Identifier), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentType), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Language), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.Version), new ManagedFullPropSpec(FormatId.DocumentSummaryInformation, PropertyId.ContentStatus) }; } else { // No core properties to be returned. } _coreProperties = coreProperties; _currentIndex = -1; }
public void TestSetProperties() { String inputPath = OpenXml4NetTestDataSamples.GetSampleFileName("TestPackageCoreProperiesSetters.docx"); FileInfo outputFile = OpenXml4NetTestDataSamples.GetOutputFile("TestPackageCoreProperiesSettersOUTPUT.docx"); // Open namespace OPCPackage p = OPCPackage.Open(inputPath, PackageAccess.READ_WRITE); try { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); DateTime dateToInsert = DateTime.Parse("2007-05-12T08:00:00Z").ToUniversalTime(); PackageProperties props = p.GetPackageProperties(); props.SetCategoryProperty("MyCategory"); props.SetContentStatusProperty("MyContentStatus"); props.SetContentTypeProperty("MyContentType"); props.SetCreatedProperty(new DateTime?(dateToInsert)); props.SetCreatorProperty("MyCreator"); props.SetDescriptionProperty("MyDescription"); props.SetIdentifierProperty("MyIdentifier"); props.SetKeywordsProperty("MyKeywords"); props.SetLanguageProperty("MyLanguage"); props.SetLastModifiedByProperty("Julien Chable"); props.SetLastPrintedProperty(new Nullable <DateTime>(dateToInsert)); props.SetModifiedProperty(new Nullable <DateTime>(dateToInsert)); props.SetRevisionProperty("2"); props.SetTitleProperty("MyTitle"); props.SetSubjectProperty("MySubject"); props.SetVersionProperty("2"); using (FileStream fs = outputFile.OpenWrite()) { // Save the namespace in the output directory p.Save(fs); } // Open the newly Created file to check core properties saved values. OPCPackage p2 = OPCPackage.Open(outputFile.Name, PackageAccess.READ); try { CompareProperties(p2); p2.Revert(); } finally { p2.Close(); } outputFile.Delete(); } finally { // use revert to not re-write the input file p.Revert(); } }
protected void LimitOrderPropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList orderPropertyField = (DropDownList)sender; DropDownList itemPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("LimitItemPropertyField"); DropDownList packagePropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("LimitPackagePropertyField"); DropDownList customPropertyField = (DropDownList)orderPropertyField.NamingContainer.FindControl("LimitCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)orderPropertyField.NamingContainer.FindControl("LimitCustomPropertyLabel"); Label multiplierLabel = (Label)orderPropertyField.NamingContainer.FindControl("LimitMultiplierLabel"); HelpLabel limitLabel = (HelpLabel)orderPropertyField.NamingContainer.FindControl("LimitLabel"); TextBox limitField = (TextBox)orderPropertyField.NamingContainer.FindControl("LimitField"); BaseValidator limitRequired = (BaseValidator)orderPropertyField.NamingContainer.FindControl("LimitRequired"); BaseValidator limitNumeric = (BaseValidator)orderPropertyField.NamingContainer.FindControl("LimitNumeric"); OrderProperties orderProperty = (OrderProperties)Enum.Parse(typeof(OrderProperties), orderPropertyField.SelectedValue); ItemProperties itemProperty = (ItemProperties)Enum.Parse(typeof(ItemProperties), itemPropertyField.SelectedValue); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); if (orderProperty == OrderProperties.ItemProperty) { itemPropertyField.Visible = true; packagePropertyField.Visible = false; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, itemProperty); PrepareLimitField(multiplierLabel, limitLabel, limitField, limitRequired, limitNumeric, itemProperty); } else if (orderProperty == OrderProperties.PackageProperty) { itemPropertyField.Visible = false; packagePropertyField.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); PrepareLimitField(multiplierLabel, limitLabel, limitField, limitRequired, limitNumeric, packageProperty); } else { itemPropertyField.Visible = false; packagePropertyField.Visible = false; customPropertyField.Visible = false; PrepareLimitField(multiplierLabel, limitLabel, limitField, limitRequired, limitNumeric, orderProperty); Page.Validate("RuleGroup"); if (Page.IsValid) { PrepareCustomPropertyField(customPropertyLabel, customPropertyField, orderProperty); } } } }
public static DateTime?WDGetCreationDate(string fileName) { DateTime?creationDate = null; using (WordprocessingDocument wordprocessingDocument = WordprocessingDocument.Open(fileName, false)) { PackageProperties properties = wordprocessingDocument.PackageProperties; creationDate = properties.Created; } return(creationDate); }
public static InstalationPackageProperties GetProperties(PackageProperties source, FileInfo Location) { InstalationPackageProperties _ret = new InstalationPackageProperties(); _ret.Location = Location; foreach (PropertyInfo _propertyX in typeof(PackageProperties).GetProperties()) { object x = _propertyX.GetValue(source, null); _propertyX.SetValue(_ret, x, null); } return(_ret); }
/** * Copy core namespace properties * * @param src source properties * @param tgt target properties */ private static void CopyProperties(PackageProperties src, PackageProperties tgt) { tgt.SetCategoryProperty(src.GetCategoryProperty()); tgt.SetContentStatusProperty(src.GetContentStatusProperty()); tgt.SetContentTypeProperty(src.GetContentTypeProperty()); tgt.SetCreatorProperty(src.GetCreatorProperty()); tgt.SetDescriptionProperty(src.GetDescriptionProperty()); tgt.SetIdentifierProperty(src.GetIdentifierProperty()); tgt.SetKeywordsProperty(src.GetKeywordsProperty()); tgt.SetLanguageProperty(src.GetLanguageProperty()); tgt.SetRevisionProperty(src.GetRevisionProperty()); tgt.SetSubjectProperty(src.GetSubjectProperty()); tgt.SetTitleProperty(src.GetTitleProperty()); tgt.SetVersionProperty(src.GetVersionProperty()); }
protected void MatchPackagePropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList packagePropertyField = (DropDownList)sender; DropDownList customPropertyField = (DropDownList)packagePropertyField.NamingContainer.FindControl("MatchCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)packagePropertyField.NamingContainer.FindControl("MatchCustomPropertyLabel"); PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); } }
/// <summary> /// Creates a package zip file containing specified content and resource files. /// </summary> internal static void CreatePackage(DirectoryInfo content, string packageName, Action <PackageProperties> update) { // Create the Package (If the package file already exists, FileMode.Create will automatically delete it first before creating a new one. using (Package package = Package.Open(packageName, FileMode.Create)) { PackageProperties _Properties = package.PackageProperties; update(_Properties); foreach (FileInfo _item in content.GetFileSystemInfos()) { Uri _partUri = PackUriHelper.CreatePartUri(new Uri(_item.Name, UriKind.Relative)); // Add the Document part to the Package string _mediaType = String.Empty; string _contentType = String.Empty; switch (_item.Extension.ToLower()) { case ".xml": _mediaType = MediaTypeNames.Text.Xml; _contentType = Definitions.PackageDescriptionRelationshipType; break; case ".wsp": _mediaType = MediaTypeNames.Application.Zip; _contentType = String.Format(Definitions.PackageSolutionRelationshipTypeFormat, Uri.EscapeDataString(_item.Name)); break; case ".jpg": _mediaType = MediaTypeNames.Image.Jpeg; _contentType = Definitions.PackageOthetRelationshipType; break; default: _mediaType = MediaTypeNames.Application.Octet; _contentType = Definitions.PackageOthetRelationshipType; break; } PackagePart _packagePart = package.CreatePart(_partUri, _mediaType); // Copy the data to the Document Part using (FileStream _fileStream = _item.OpenRead()) { CopyStream(_fileStream, _packagePart.GetStream()); }// end:using(fileStream) - Close and dispose fileStream. // Add a Package Relationship to the Document Part package.CreateRelationship(_packagePart.Uri, TargetMode.Internal, _contentType); } package.Flush(); package.Close(); } // end:using (Package package) - Close and dispose package. } // end:CreatePackage()
public override void Start(HttpListenerContext context) { XmlDocument options = context.GetRequestDataAsXml(); string pkgxml = options.DocumentElement["executable"].InnerText; PackageProperties properties = PackageProperties.Deserialize(Path.Combine(RemotePath, pkgxml)); if (properties.AutoGenerateRelease) { properties.Release = DateTime.Now.ToString("yyyyMMdd.HHmmss"); } PackageBuilder builder = new PackageBuilder(properties); builder.Root = RemotePath; bool result = builder.Build(); if (result) { // Build was successful string rpm = String.Format("{0}-{1}-{2}.noarch.rpm", properties.ShortName, properties.Version, properties.Release); rpm_file = String.Format("{0}/{1}", RemotePath, rpm); // See if we are supposed to leave a copy on the server if (properties.LeavePackageOnServer) { try { if (!Directory.Exists(properties.ServerLocation)) { Directory.CreateDirectory(properties.ServerLocation); } File.Copy(rpm_file, Path.Combine(properties.ServerLocation, rpm), true); } catch (Exception ex) { copy_exception = ex; } } } else { build_exception = new Exception(builder.Errors[0].ErrorText); } HasTerminated = true; context.WriteString(ToXml()); }
private void PrepareCustomPropertyField(WebControl label, ListControl list, PackageProperties property) { list.Items.Clear(); if (property == PackageProperties.DestinationAddress || property == PackageProperties.SourceAddress) { label.ToolTip = "<p>Select the address property to use.</p>"; list.Items.AddRange(GetAddressProperties()); list.Visible = true; } else { label.ToolTip = ""; list.Items.Add(new ListItem("n/a", "")); list.Visible = false; } }
public void TestGetPropertiesLO() { // Open the namespace OPCPackage pkg1 = OPCPackage.Open(OpenXml4NetTestDataSamples.OpenSampleStream("51444.xlsx")); PackageProperties props1 = pkg1.GetPackageProperties(); Assert.AreEqual(null, props1.GetTitleProperty()); props1.SetTitleProperty("Bug 51444 fixed"); MemoryStream out1 = new MemoryStream(); pkg1.Save(out1); out1.Close(); OPCPackage pkg2 = OPCPackage.Open(new MemoryStream(out1.ToArray())); PackageProperties props2 = pkg2.GetPackageProperties(); props2.SetTitleProperty("Bug 51444 fixed"); }
private static void ProcessDocxFile(Order order, string filePath) { try { using (WordprocessingDocument package = WordprocessingDocument.Open(filePath, true)) { PackageProperties fileProperties = package.PackageProperties; order.NoticeCreator = fileProperties.Creator; order.NoticeSubject = fileProperties.Subject; order.NoticeTitle = fileProperties.Title; order.NoticeLastAuthor = fileProperties.LastModifiedBy; order.NoticeDatePrinted = fileProperties.LastPrinted.ToString(); order.NoticeDateCreated = fileProperties.Created.ToString(); order.NoticeDateSaved = fileProperties.Modified.ToString(); } } catch { } }
/************************************************************************/ #region Constructor (internal) /// <summary> /// Initializes a new instance of the <see cref="PropertiesAdapter"/> class. /// </summary> /// <param name="props">The core properties.</param> internal CoreProperties(PackageProperties props) { Category = props.Category; ContentStatus = props.ContentStatus; ContentType = props.ContentType; Created = props.Created; Creator = props.Creator; Description = props.Description; Identifier = props.Identifier; Keywords = props.Keywords; Language = props.Language; LastModifiedBy = props.LastModifiedBy; LastPrinted = props.LastPrinted; Modified = props.Modified; Revision = props.Revision; Subject = props.Subject; Title = props.Title; Version = props.Version; }
//------------------------------------------------------ // // Internal Methods // //------------------------------------------------------ #region Internal Methods /// <summary> /// This method copies members from one PackageProperties object to another. /// </summary> /// <remarks> /// This design is very fragile as if new properties are added by PackageProperties /// we will quietly lose data. An improved implementation would be to have /// PackageProperties implement this behavior or have a KeyValue pair exposed /// that we would iterate through and copy. /// </remarks> internal static void Copy(PackageProperties source, PackageProperties target) { target.Category = source.Category; target.ContentStatus = source.ContentStatus; target.ContentType = source.ContentType; target.Created = source.Created; target.Creator = source.Creator; target.Description = source.Description; target.Identifier = source.Identifier; target.Keywords = source.Keywords; target.Language = source.Language; target.LastModifiedBy = source.LastModifiedBy; target.LastPrinted = source.LastPrinted; target.Modified = source.Modified; target.Revision = source.Revision; target.Subject = source.Subject; target.Title = source.Title; target.Version = source.Version; }
protected void ValuePackagePropertyField_SelectedIndexChanged(object sender, EventArgs e) { if (sender != null) { DropDownList packagePropertyField = (DropDownList)sender; PackageProperties packageProperty = (PackageProperties)Enum.Parse(typeof(PackageProperties), packagePropertyField.SelectedValue); DropDownList itemPropertyField = (DropDownList)packagePropertyField.NamingContainer.FindControl("ValueItemPropertyField"); ItemProperties itemProperty = (ItemProperties)Enum.Parse(typeof(ItemProperties), itemPropertyField.SelectedValue); DropDownList customPropertyField = (DropDownList)packagePropertyField.NamingContainer.FindControl("ValueCustomPropertyField"); HelpLabel customPropertyLabel = (HelpLabel)packagePropertyField.NamingContainer.FindControl("ValueCustomPropertyLabel"); Label multiplierLabel = (Label)packagePropertyField.NamingContainer.FindControl("ValueMultiplierLabel"); HelpLabel valueLabel = (HelpLabel)packagePropertyField.NamingContainer.FindControl("ValueLabel"); TextBox valueField = (TextBox)packagePropertyField.NamingContainer.FindControl("ValueField"); BaseValidator valueRequired = (BaseValidator)packagePropertyField.NamingContainer.FindControl("ValueRequired"); BaseValidator valueNumeric = (BaseValidator)packagePropertyField.NamingContainer.FindControl("ValueNumeric"); if (packageProperty == PackageProperties.ItemProperty) { itemPropertyField.Visible = true; PrepareCustomPropertyField(customPropertyLabel, customPropertyField, itemProperty); PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, itemProperty); } else { itemPropertyField.Visible = false; customPropertyField.Visible = false; PrepareValueField(multiplierLabel, valueLabel, valueField, valueRequired, valueNumeric, packageProperty); Page.Validate("RuleGroup"); if (Page.IsValid) { PrepareCustomPropertyField(customPropertyLabel, customPropertyField, packageProperty); } } } }
public void PackagePropertiesPreReleaseVersionTest() { var hostDirectory = @"..\..\"; var moduleNames = new List <string> { "module1", "module2", "module3" }; var id = "id"; var title = "title"; var description = "description"; var versions = new List <string> { "1.4.0.0", "1.5.0.0", "1.3.0.0-prerelease" }; var pp = new PackageProperties(hostDirectory, moduleNames, id, title, description, versions); Assert.AreEqual("title", pp.Title); Assert.AreEqual(0, pp.Dependencies.Count()); Assert.AreEqual("description", pp.Description); Assert.AreEqual("id", pp.Id); Assert.AreEqual("1.3.0.0-prerelease", pp.Version); }
private void PrepareCustomPropertyField(WebControl label, ListControl list, PackageProperties property) { list.Items.Clear(); if (property == PackageProperties.DestinationAddress || property == PackageProperties.SourceAddress) { label.ToolTip = "<p>Select the address property to use.</p>"; list.Items.AddRange(GetAddressProperties()); list.Visible = true; } else if (property == PackageProperties.UseMethod) { label.ToolTip = "<p>Select the shipping method to use.</p><p>Note that only shipping methods that can calculate package shipping costs are shown.</p>"; list.Items.AddRange(GetShippingMethods()); list.Visible = true; } else { label.ToolTip = ""; list.Items.Add(new ListItem("n/a", "")); list.Visible = false; } }
/// <summary> /// Obtém as propriedades de um arquivo office comum /// </summary> /// <param name="properties"></param> /// <returns></returns> private static Dictionary <FileProperties, string> getFileProperties(PackageProperties properties) { Dictionary <FileProperties, string> ret = new Dictionary <FileProperties, string>(); if (properties.Creator != null && properties.Creator != string.Empty) { ret.Add(FileProperties.Author, properties.Creator); } if (properties.LastModifiedBy != null && properties.LastModifiedBy != string.Empty) { ret.Add(FileProperties.LastModifiedBy, properties.LastModifiedBy); } if (properties.Title != null && properties.Title != string.Empty) { ret.Add(FileProperties.Title, properties.Title); } if (properties.Description != null && properties.Description != string.Empty) { ret.Add(FileProperties.Description, properties.Description); } if (properties.Created.HasValue) { ret.Add(FileProperties.CreationDate, properties.Created.Value.ToString(Constants.DateTimeFormat)); } if (properties.Modified.HasValue) { ret.Add(FileProperties.ModDate, properties.Modified.Value.ToString(Constants.DateTimeFormat)); } return(ret); }
private static void PrepareLimitField(Control multiplier, Label label, Control field, WebControl requiredValidator, WebControl numericValidator, PackageProperties property) { PropertyTypes propertyType = PackagePropertiesHelper.GetPropertyType(property); PrepareLimitField(multiplier, label, field, requiredValidator, numericValidator, propertyType); }
private static void InternalSynchronize (string synchronizationGroup, Sybase.Persistence.SyncStatusListener listener, Sybase.Persistence.SynchronizationContext syncContext, com.sybase.afx.json.JsonObject syncContextEx) { string mlServerHost; int mlServerPort; string syncUsername; string syncPassword; bool isInitialSync = "initialSync".Equals(synchronizationGroup) || KeyGenerator.InitSync(); YPF.Comercial.RRCC.SUP.PersonalizationParameters _pp = GetPersonalizationParameters(); _pp.Username =(GetSynchronizationProfile().UserName); _pp.Password =(GetSynchronizationProfile().Password); _pp.SaveUserNamePassword(); lock(_synchronizeLock) { Sybase.Mobile.Application.GetInstance().ApplicationSettings.CheckApplicationSettingsAvailable(); Sybase.Persistence.ConnectionProfile _interProfile = new Sybase.Persistence.ConnectionProfile(); _interProfile.DomainName =("default"); _interProfile.ServerName =("sdbuetmapl28"); _interProfile.PortNumber =(2480); _interProfile.NetworkProtocol =("http,https"); _interProfile.NetworkStreamParams =("trusted_certificates=;url_suffix="); _interProfile.ApplyProperties(Sybase.Mobile.Application.GetInstance().ApplicationSettings); _interProfile.ApplyProperties(GetSynchronizationProfile()); mlServerHost = _interProfile.ServerName; mlServerPort = _interProfile.PortNumber; syncUsername = _interProfile.UserName; syncPassword = _interProfile.Password; string sysPlatform = _interProfile.GetProperty("os"); Sybase.Persistence.ConnectionWrapper ulConn = null; com.sybase.afx.db.ConnectionSyncParams syncParms = new com.sybase.afx.db.ConnectionSyncParams(); try { YPF.Comercial.RRCC.SUP.PersonalizationParameters pp = new YPF.Comercial.RRCC.SUP.PersonalizationParameters(); syncUsername += ("@" + _interProfile.DomainName); com.sybase.afx.json.JsonObject json = new com.sybase.afx.json.JsonObject(); Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.ClientPersonalization> listClientPersonalization = pp.ListClientPK; foreach(YPF.Comercial.RRCC.SUP.ClientPersonalization __item in listClientPersonalization) { json.Put(__item.Key_name, __item.GetRealValue()); } Sybase.Collections.GenericList<YPF.Comercial.RRCC.SUP.SessionPersonalization> sessionServerPersonalization = pp.ListSessionPK; foreach(YPF.Comercial.RRCC.SUP.SessionPersonalization __item in sessionServerPersonalization) { json.Put(__item.Key_name, __item.Value); } json.Put("pv", "" + YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.GetProtocolVersion()); json.Put("pid", com.sybase.afx.util.PidUtil.GetId()); json.Put("cle", _interProfile.GetProperty("changeLogEnabled", "false")); if(isInitialSync) { com.sybase.afx.json.JsonObject jsonMBOMap = new com.sybase.afx.json.JsonObject(); jsonMBOMap.Put("DireccionEntrega",231); jsonMBOMap.Put("Interaccion",232); jsonMBOMap.Put("CalendarioInteraccionLocal",233); jsonMBOMap.Put("CategoriaPregunta",234); jsonMBOMap.Put("ClienteCabeceraPedido",235); jsonMBOMap.Put("ClienteDetallePedido",236); jsonMBOMap.Put("ClienteDeuda",237); jsonMBOMap.Put("ClienteFacturacion",238); jsonMBOMap.Put("CustomLocalData",239); jsonMBOMap.Put("Direccion",240); jsonMBOMap.Put("EstadoInteraccion",241); jsonMBOMap.Put("Formulario",242); jsonMBOMap.Put("FormularioMercado",243); jsonMBOMap.Put("FormularioMercadoSegmento",244); jsonMBOMap.Put("FormularioMercadoSubsegmento",245); jsonMBOMap.Put("FormularioMercadoTamano",246); jsonMBOMap.Put("FormularioPrecios",247); jsonMBOMap.Put("FormularioPreciosMercado",248); jsonMBOMap.Put("FormularioPreciosRed",249); jsonMBOMap.Put("FormularioPreciosZonaInspeccion",250); jsonMBOMap.Put("FormularioTransporte",251); jsonMBOMap.Put("Mail",252); jsonMBOMap.Put("Motivo",253); jsonMBOMap.Put("Negocio",254); jsonMBOMap.Put("OpcionRespuesta",255); jsonMBOMap.Put("Parametro",256); jsonMBOMap.Put("Pregunta",257); jsonMBOMap.Put("PreguntaFormulario",258); jsonMBOMap.Put("Provincia",259); jsonMBOMap.Put("RelevamientoPrecios",260); jsonMBOMap.Put("RelevamientoPreciosProducto",261); jsonMBOMap.Put("RelevamientoProducto",262); jsonMBOMap.Put("RelevamientoProductoProducto",263); jsonMBOMap.Put("RelevamientoProductoTipo",264); jsonMBOMap.Put("RelevamientoProveedor",265); jsonMBOMap.Put("RelevamientoProveedorCanal",266); jsonMBOMap.Put("RelevamientoProveedorLogistica",267); jsonMBOMap.Put("RelevamientoTransporte",268); jsonMBOMap.Put("RelevamientoTransporteCompetidor",269); jsonMBOMap.Put("RelevamientoTransporteProducto",270); jsonMBOMap.Put("RepresentanteComercial",271); jsonMBOMap.Put("Respuesta",272); jsonMBOMap.Put("RespuestaInteraccionFormulario",273); jsonMBOMap.Put("Segmento",274); jsonMBOMap.Put("SeleccionFormulario",275); jsonMBOMap.Put("SeleccionTablaRelevamiento",276); jsonMBOMap.Put("TablaRelevamiento",277); jsonMBOMap.Put("Telefono",278); jsonMBOMap.Put("TipoInteraccion",279); jsonMBOMap.Put("LogRecordImpl",281); jsonMBOMap.Put("OperationReplay",282); jsonMBOMap.Put("SISSubscription",285); jsonMBOMap.Put("PackageProperties",286); jsonMBOMap.Put("ChangeLogImpl",288); jsonMBOMap.Put("OfflineAuthentication",289); jsonMBOMap.Put("RepresentanteComercialSynchronizationParameters",290); jsonMBOMap.Put("RepresentanteComercial_pull_pq",291); jsonMBOMap.Put("ClientPersonalization",341); jsonMBOMap.Put("KeyGenerator",346); jsonMBOMap.Put("LocalKeyGenerator",348); json.Put("mboMap", jsonMBOMap); json.Put("publications", synchronizationGroup); json.Put("isInitialSync", isInitialSync.ToString()); } else { json.Put("publications", synchronizationGroup); } bool async = !isInitialSync && _interProfile.GetBoolean("asyncReplay", true); if(syncContextEx == null) { syncContextEx = new com.sybase.afx.json.JsonObject(); } syncContextEx.Remove("async"); syncContextEx.Put("async", async + ""); json.Put("_as", async + ""); if(async && !IsReplayQueueEmpty()) { YPF.Comercial.RRCC.SUP.intrnl.OperationReplay rq = new YPF.Comercial.RRCC.SUP.intrnl.OperationReplay(); rq.SetComponent("CRMMobileDesaDB"); com.sybase.afx.json.JsonObject parameter = new com.sybase.afx.json.JsonObject(); if(syncContext != null) { object userContext = syncContext.UserContext; if(userContext != null) { if(userContext is string) { parameter.Put("userContext", userContext); } else { throw new Sybase.Persistence.PersistenceException("user context must be string for async operation replay"); } } parameter.Put("synchronizationGroup",synchronizationGroup); } rq.SetParameters(parameter.ToString()); rq.SetOperation("batchNotify"); rq.Save(); } if(_appName != null) { json.Put("app", _appName); } json.Put("appId", Sybase.Mobile.Application.GetInstance().ApplicationIdentifier); if (sysPlatform != null) { json.Put("os", sysPlatform); } string str = json.ToString(); byte[] bin = com.sybase.afx.util.StringUtil.ToUTF8(str); string authParam = com.sybase.afx.util.BinaryUtil.ToStringBase64(bin); bool isHttps = _interProfile.NetworkProtocol.Equals("https", System.StringComparison.OrdinalIgnoreCase); int maxLen = 4000; int size = (authParam.Length + maxLen - 1) / maxLen; if (size > 16) { throw new Sybase.Persistence.SynchronizeException("the whole length of personalization parameters exceeds the limit of authenticate parameters and the safe length is 512 bytes"); } string[] authList = new string[16]; for (int i = 0; i < size; i++) { authList[i] = authParam.Substring(i * maxLen, ((i + 1) * maxLen < authParam.Length) ? maxLen : (authParam.Length - i * maxLen)); } for (int i = size; i < 16; i++) { authList[i] = "x";//Spacer } ulConn = AcquireDBWriteConnection(); syncParms.IsHttps = isHttps; syncParms.Version = _interProfile.DomainName + "_" + "crmmobiledesa.1_0"; syncParms.UserName = syncUsername; if(_interProfile.Certificate != null) { syncPassword = null; } syncParms.Password = syncPassword + ("@" + com.sybase.afx.util.PidUtil.GetId()); string mlStreamParams = "host=\"" + mlServerHost + "\";port=\"" + mlServerPort + "\""; string urlSuffix = com.sybase.afx.util.NetworkStreamParams.ExtractValue("url_suffix", _interProfile.NetworkStreamParams); if(urlSuffix != null && urlSuffix.Length != 0) { mlStreamParams = "host=\"" + mlServerHost + "\";port=\"" + mlServerPort + "\";url_suffix=\"" + urlSuffix + "\""; } //setting http_userid and http_password if HTTPCredentials are available Sybase.Persistence.LoginCredentials lc = Sybase.Mobile.Application.GetInstance().ConnectionProperties.HTTPCredentials; if (lc != null) { string http_userid = lc.UserName; string http_password = lc.Password; mlStreamParams = mlStreamParams + ";http_userid=\"" + http_userid + "\";http_password=\"" + http_password + "\""; } string cookie = com.sybase.afx.util.NetworkStreamParams.ExtractValue("set_cookie", _interProfile.NetworkStreamParams); Sybase.Collections.StringProperties httpCookies = Sybase.Mobile.Application.GetInstance().ConnectionProperties.HttpCookies; if (httpCookies != null) { foreach(string key in httpCookies.Keys()) { string value = httpCookies.Item(key); if (cookie == null || cookie.Length == 0) { cookie = key + "=" + value; } else { cookie += "," + key + "=" + value; } } } if (cookie != null && cookie.Length != 0) { mlStreamParams = mlStreamParams + ";set_cookie=\"" + cookie +"\""; } System.Collections.Generic.List<string> headers = com.sybase.afx.util.NetworkStreamParams.ExtractListValue("custom_header", _interProfile.NetworkStreamParams); foreach (string header in headers) { mlStreamParams = mlStreamParams + ";custom_header=\"" + header +"\""; } Sybase.Collections.StringProperties httpHeaders = Sybase.Mobile.Application.GetInstance().ConnectionProperties.HttpHeaders; if (httpHeaders != null) { foreach(string key in httpHeaders.Keys()) { string value = httpHeaders.Item(key); mlStreamParams = mlStreamParams + ";custom_header=\"" + key + ":" + value + "\""; } } string ip = _interProfile.GetString("client_ip"); if(ip != null && ip.Length != 0) { mlStreamParams = mlStreamParams + ";client_ip_addr=\"" + ip + "\""; } if(isHttps) { string ts = com.sybase.afx.util.NetworkStreamParams.ExtractValue("trusted_certificates", _interProfile.NetworkStreamParams); mlStreamParams += ";trusted_certificates=\"" + ts + "\""; string tls = com.sybase.afx.util.NetworkStreamParams.ExtractValue("tls_type", _interProfile.NetworkStreamParams); if (tls != null) { mlStreamParams += ";tls_type=\"" + tls + "\""; } } System.Collections.Generic.IList<System.Collections.Generic.KeyValuePair<string, string>> nwParams = com.sybase.afx.util.NetworkStreamParams.Parse(_interProfile.NetworkStreamParams); foreach (System.Collections.Generic.KeyValuePair<string, string> entry in nwParams) { string v = entry.Key; if (!v.StartsWith("url_suffix") && !v.StartsWith("trusted_certificates") && !v.StartsWith("tls_type") && !v.StartsWith("http_userid") && !v.StartsWith("http_password") && !v.StartsWith("set_cookie") && !v.StartsWith("custom_header")) { mlStreamParams += ";" + v + "=\"" + entry.Value + "\""; } } syncParms.StreamParms = mlStreamParams; syncParms.Publications = synchronizationGroup; syncParms.AuthenticationParms = authList; syncParms.UploadOnly = syncContextEx.GetBoolean("uploadOnly"); com.sybase.afx.db.ConnectionUtil.SetConnectionSyncParams(ulConn, syncParms); com.sybase.afx.db.CommandUtil.TraceSynchronize(_profile.GetSyncProfile(), synchronizationGroup, syncContext, GetRemoteId(ulConn)); if (listener != null) { string[] mboNames = com.sybase.afx.DatabaseBase.GetMBONames(synchronizationGroup, GetPublications()); System.Collections.Hashtable tableMBOMap = getTableMBOMap(); com.sybase.afx.db.ConnectionUtil.Synchronize(ulConn, listener, _interProfile.ToSyncConnection(), mboNames, tableMBOMap); } else { com.sybase.afx.db.ConnectionUtil.Synchronize(ulConn); } //check protocol version PackageProperties _props = PackageProperties.Find("protocol_version"); int _pv = 0; if (_props != null) { _pv = System.Int32.Parse(_props.Value); } if (!isInitialSync && GetProtocolVersion() > _pv) { string _msg = "device's protocol version is incompatible with the server's protocol version. (" + GetProtocolVersion() + " > " + _pv + ")"; Sybase.Persistence.ProtocolException _pe = new Sybase.Persistence.ProtocolException(_msg); GetCallbackHandler().OnMessageException(_pe); throw _pe; } PackageProperties lastRequestId = PackageProperties.Find("lastRequestId"); if(lastRequestId == null) { lastRequestId = new PackageProperties(); lastRequestId.Key = "lastRequestId"; } try { lastRequestId.Value = KeyGenerator.GenerateId()+""; } catch(Sybase.Persistence.SynchronizeRequiredException) { lastRequestId = null; } if(lastRequestId != null) { lastRequestId.Save(); } YPF.Comercial.RRCC.SUP.intrnl.OperationReplay.Finish(); } catch(com.sybase.afx.db.SynchronizationException _ex) { string exMsg = _ex.ToString(); com.sybase.afx.db.ConnectionImpl connImpl = (com.sybase.afx.db.ConnectionImpl)ulConn; iAnywhere.Data.UltraLite.ULConnection ul_conn = (iAnywhere.Data.UltraLite.ULConnection)connImpl.GetConnection(); if (_ex.NativeError == com.sybase.afx.db.SynchronizationException.SQLE_MOBILINK_COMMUNICATIONS_ERROR) { string strMessage = ul_conn.SyncResult.StreamErrorParameters; try { int errorCode = System.Convert.ToInt32(strMessage); Sybase.Mobile.Application.GetInstance().ApplicationCallback.OnHttpCommunicationError(errorCode, "", new Sybase.Collections.StringProperties()); } catch (System.FormatException) { } } long authValue = ul_conn.SyncResult.AuthValue; if ((_ex.NativeError == com.sybase.afx.db.SynchronizationException.SQLE_MOBILINK_AUTHENTICATION_FAILED) && (authValue == com.sybase.afx.util.AuthExceptionUtil.FAILURE_CODE_TOKEN_VALIDATION_ERROR || authValue == 4000)) { GetCallbackHandler().OnLoginFailure(); if (syncContext == null) { syncContext = new Sybase.Persistence.SynchronizationContext(); } syncContext.ErrorCode = 401; syncContext.ErrorMessage = "authentication failed."; if (authValue == com.sybase.afx.util.AuthExceptionUtil.FAILURE_CODE_TOKEN_VALIDATION_ERROR) { syncContext.ErrorCode = 412; } } com.sybase.afx.util.AuthExceptionUtil.CheckAuthValueAfterSync(com.sybase.afx.db.ConnectionUtil.GetConnectionSyncAuthValue(ulConn), _ex); if (_ex.NativeError == com.sybase.afx.db.SynchronizationException.SQLE_MOBILINK_COMMUNICATIONS_ERROR) { exMsg += "Details:\n" + com.sybase.afx.db.ConnectionUtil.GetConnectionSyncDetail(ulConn) + "\n"; } if( !"system".Equals(synchronizationGroup) && com.sybase.afx.db.SynchronizationException.SQLE_SERVER_SYNCHRONIZATION_ERROR == _ex.NativeError ) { try { YPF.Comercial.RRCC.SUP.CRMMobileDesaDB.Synchronize("system", null); } catch { if (!"initialSync".Equals(synchronizationGroup)) { string _msg = "the package is not deployed or device's protocol version may be incompatible with the server's protocol version. (" + GetProtocolVersion() + " > 0)"; Sybase.Persistence.ProtocolException _pe = new Sybase.Persistence.ProtocolException(_msg); GetCallbackHandler().OnMessageException(_pe); throw _pe; } } } throw new Sybase.Persistence.SynchronizeException(exMsg,_ex); } catch(System.Exception _ex) { throw new Sybase.Persistence.SynchronizeException(_ex.ToString(),_ex); } finally { if(ulConn != null) { ReleaseDBConnection();; } } } }
private void PrepareCustomPropertyField(WebControl label, ListControl list, PackageProperties property) { list.Items.Clear(); if (property == PackageProperties.DestinationAddress || property == PackageProperties.SourceAddress) { label.ToolTip = "<p>Select the address property to use.</p>"; list.Items.AddRange(GetAddressProperties()); list.Visible = true; } else if (property == PackageProperties.UseMethod) { label.ToolTip = "<p>Select the shipping method to use.</p>"; list.Items.AddRange(GetShippingMethods()); list.Visible = true; } else { label.ToolTip = ""; list.Items.Add(new ListItem("n/a", "")); list.Visible = false; } }
/// <summary> /// If the package designer is already open, then use the package object on it which may have in-memory modifications. /// If the package designer is not open, then just load the package from disk. /// </summary> /// <param name="pi"></param> /// <returns></returns> private PackageProperties GetPackageProperties(ProjectItem pi) { Package package; bool bIsOpen = pi.get_IsOpen(BIDSViewKinds.Designer); if (bIsOpen) { Window w = pi.Open(BIDSViewKinds.Designer); //opens the designer w.Activate(); IDesignerHost designer = w.Object as IDesignerHost; if (designer == null) return null; EditorWindow win = (EditorWindow)designer.GetService(typeof(Microsoft.DataWarehouse.ComponentModel.IComponentNavigator)); package = win.PropertiesLinkComponent as Package; } else { Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); package = app.LoadPackage(pi.get_FileNames(0), null); } if (package == null) return null; PackageProperties props = new PackageProperties(package); props.DatabaseName = this.DatabaseName; props.PackagePathPrefix = this.PackagePathPrefix; return props; }