示例#1
0
        public override void Assign()
        {
            PropertyGridProperty prop_Name         = GetReadOnlyProperty("Name");
            PropertyGridProperty prop_EditableName = GetReadOnlyProperty("EditableName");

            if (DataSource == null)
            {
                //default values, just to show screen beautiful
                DataFormatType       = DataFormatTypes.Delimited;
                OutputFileNameFormat = "Same as Input";
                OutputFileExtension  = ".csv";
                HasHeader            = true;
                OutputHasHeader      = true;
                prop_Name.FieldToChange.SetValue(prop_Name.BrowsableAttribute, true);
                prop_EditableName.FieldToChange.SetValue(prop_EditableName.BrowsableAttribute, false);
            }
            else
            {
                if (DataSource.Id == 0)
                {
                    prop_Name.FieldToChange.SetValue(prop_Name.BrowsableAttribute, false);
                    prop_EditableName.FieldToChange.SetValue(prop_EditableName.BrowsableAttribute, true);
                    HasHeader       = true;
                    OutputHasHeader = true;
                }
                else
                {
                    DataSourceKeys = new Manager().GetKeys(this.DataSource.Id);
                    prop_Name.FieldToChange.SetValue(prop_Name.BrowsableAttribute, true);
                    prop_EditableName.FieldToChange.SetValue(prop_EditableName.BrowsableAttribute, false);
                    HasHeader       = DataSourceKeys.GetKeyValue(IdpeKeyTypes.IsFirstRowHeader).ParseBool();
                    OutputHasHeader = DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputIsFirstRowHeader).ParseBool();
                }

                DataFeederType     = (DataFeederTypes)DataSource.DataFeederType;
                DataFormatType     = (DataFormatTypes)DataSource.DataFormatType;
                Description        = DataSource.Description;
                SystemDataSourceId = (int)DataSource.SystemDataSourceId;

                if (DataFormatType == DataFormatTypes.Custom)
                {
                    IdpeKey key = new Manager().GetKey(this.DataSource.Id, IdpeKeyTypes.FileInterfaceName.ToString());
                    if (key != null)
                    {
                        ConfigureDataFormat = key.Value;
                    }
                }

                if (SystemDataSourceId > 0)
                {
                    IdpeDataSource sysDs = new Manager().GetDataSourceDetails(SystemDataSourceId);
                    if (sysDs != null)
                    {
                        SystemName = sysDs.Name;
                    }
                }
                else
                {
                    SystemName = string.Empty;
                }
                OutputDataFormatType      = (OutputTypes)DataSource.OutputType;
                OutputCustomInterfaceName = DataSource.OutputWriterTypeFullName;

                IdpeKey keyTestFileName = new Manager().GetKey(this.DataSource.Id, IdpeKeyTypes.TestFileName.ToString());
                if (keyTestFileName != null)
                {
                    TestFileName = keyTestFileName.Value;
                }

                #region Post Events

                PusherTypeFullName           = DataSource.PusherTypeFullName;
                PostEvent                    = (PusherTypes)DataSource.PusherType;
                PostEventCustomInterfaceName = DataSource.PusherTypeFullName;

                #endregion Post Events

                if (DataSource.Id == 0)
                {
                    return;//as keys are not available, its a new data source
                }
                SpreadSheetNumber   = (int)DataSourceKeys.GetKeyValue(IdpeKeyTypes.SpreadSheetNumber).ParseInt();
                WriteStandardOutput = DataSourceKeys.GetKeyValue(IdpeKeyTypes.WcfCallsGenerateStandardOutput).ParseBool();

                if (string.IsNullOrEmpty(DataSource.Delimiter))
                {
                    Delimiter = ",";
                }
                else if ((DataSource.Delimiter != null) && (DataSource.Delimiter.ToLower() == "\t"))
                {
                    Delimiter = "Tab";
                }
                else
                {
                    Delimiter = DataSource.Delimiter;
                }

                RenameHeader = DataSourceKeys.GetKeyValue(IdpeKeyTypes.RenameColumnHeader).ParseBool();

                #region Output

                AllowPartial = DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputPartialRecordsAllowed).ParseBool();

                string strDelmiterOutput = DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputDelimiter);

                if (string.IsNullOrEmpty(strDelmiterOutput))
                {
                    OutputDelimiter = ",";
                }
                else if ((strDelmiterOutput != null) && (strDelmiterOutput.ToLower() == "\t"))
                {
                    OutputDelimiter = "Tab";
                }
                else
                {
                    OutputDelimiter = strDelmiterOutput;
                }

                string outputFileName = DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputFileName);
                if (!string.IsNullOrEmpty(outputFileName))
                {
                    OutputFileNameFormat = outputFileName;
                }
                else
                {
                    OutputFileNameFormat = "Same as Input";
                }

                string outputFileExt = DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputFileExtension);
                if (!string.IsNullOrEmpty(outputFileExt))
                {
                    OutputFileExtension = outputFileExt;
                }
                else
                {
                    OutputFileExtension = ".xml";
                }

                EncloseWithDoubleQuote = !DataSourceKeys.GetKeyValue(IdpeKeyTypes.OutputDelimiterDoNotEncloseWithDoubleQuote).ParseBool();
                #endregion Output
            }
        }
示例#2
0
        public override void Assign()
        {
            if (Attribute == null)
            {
                //default values, just to show screen beautiful
            }
            else
            {
                IsInUse = new Manager().IsAttributeInUse(this.Id);

                PropertyGridProperty prop_Name         = GetReadOnlyProperty("Name");
                PropertyGridProperty prop_NameEditable = GetReadOnlyProperty("NameEditable");
                PropertyGridProperty prop_Type         = GetReadOnlyProperty("Type");
                PropertyGridProperty prop_TypeEditable = GetReadOnlyProperty("TypeEditable");
                PropertyGridProperty prop_Printable    = GetReadOnlyProperty("Printable");
                PropertyGridProperty prop_PrintFormat  = GetReadOnlyProperty("PrintFormat");
                PropertyGridProperty prop_LovName      = GetReadOnlyProperty("LovName");

                if (IsInUse)
                {
                    prop_Name.FieldToChange.SetValue(prop_Name.BrowsableAttribute, true);
                    prop_NameEditable.FieldToChange.SetValue(prop_NameEditable.BrowsableAttribute, false);
                    prop_Type.FieldToChange.SetValue(prop_Type.BrowsableAttribute, true);
                    prop_Printable.FieldToChange.SetValue(prop_Printable.BrowsableAttribute, false);
                    prop_TypeEditable.FieldToChange.SetValue(prop_TypeEditable.BrowsableAttribute, false);
                }
                else
                {
                    prop_Name.FieldToChange.SetValue(prop_Name.BrowsableAttribute, false);
                    prop_NameEditable.FieldToChange.SetValue(prop_NameEditable.BrowsableAttribute, true);
                    prop_Type.FieldToChange.SetValue(prop_Type.BrowsableAttribute, false);
                    prop_Printable.FieldToChange.SetValue(prop_Printable.BrowsableAttribute, false);
                    prop_TypeEditable.FieldToChange.SetValue(prop_TypeEditable.BrowsableAttribute, true);
                }

                if (IsAssociatedWithSystemDataSource)
                {
                    prop_Printable.FieldToChange.SetValue(prop_Printable.BrowsableAttribute, true);
                    prop_PrintFormat.FieldToChange.SetValue(prop_PrintFormat.BrowsableAttribute, true);
                }
                else
                {
                    prop_Printable.FieldToChange.SetValue(prop_Printable.BrowsableAttribute, false);
                    prop_PrintFormat.FieldToChange.SetValue(prop_PrintFormat.BrowsableAttribute, false);
                }

                if (Attribute.Type == AttributeTypes.Codeset.ToString())
                {
                    prop_LovName.FieldToChange.SetValue(prop_LovName.BrowsableAttribute, true);
                }
                else
                {
                    prop_LovName.FieldToChange.SetValue(prop_LovName.BrowsableAttribute, false);
                }
                Formula     = Attribute.Formula;
                LovName     = Services.SreCodeset.ParseFormulaGetCode(Attribute.Formula);
                Position    = Attribute.Position;
                Printable   = (bool)Attribute.IsAcceptable;
                PrintFormat = Attribute.AttributePrintValueType != null? (AttributePrintValueTypes)Attribute.AttributePrintValueType: AttributePrintValueTypes.Value;
                Formula     = Attribute.Formula;
                CSharpCode  = Attribute.AttributePrintValueCustom;
            }
        }