Exemplo n.º 1
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var ret = new System.Collections.Generic.List<byte>();
     ret.AddRange(BaseProtoObject.encodeUI32(packLen));
     ret.AddRange(BaseProtoObject.encodeUI16(reserve));
     ret.AddRange(BaseProtoObject.encodeUI16(protoID));
     return ret;
 }
Exemplo n.º 2
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeUI64(uID));
     data.AddRange(Proto4z.BaseProtoObject.encodeString(token));
     data.AddRange(Proto4z.BaseProtoObject.encodeUI32(expire));
     return data;
 }
 public byte[] ToBytes()
 {
     System.Collections.Generic.List<byte> dataBuffer = new System.Collections.Generic.List<byte>();
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>((ushort)(this.BlockT.blockType)));
     dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.BlockT.blockLen));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.numChannels));
     dataBuffer.AddRange(TypeMarshal.ToBytes<TS_RFX_CHANNELT>(this.channels[0]));
     return dataBuffer.ToArray();
 }
Exemplo n.º 4
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.id));
     data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.serviceID));
     data.AddRange(Proto4z.BaseProtoObject.encodeString(this.streamBlob));
     data.AddRange(Proto4z.BaseProtoObject.encodeUI16(this.status));
     data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.timestamp));
     return data;
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="lt"></param>
 /// <param name="rt"></param>
 /// <param name="lb"></param>
 /// <param name="rb"></param>
 /// <returns></returns>
 public static AttributeBase Create( float[] lt, float[] rt, float[] lb, float[] rb )
 {
     System.Collections.Generic.List<float> values = new System.Collections.Generic.List<float>( 2 * 4 );
     values.AddRange( lt );
     values.AddRange( rt );
     values.AddRange( lb );
     values.AddRange( rb );
     var self = new AttributeBase( AttributeBase.Target.kVertex, null,
         values.ToArray(), null );
     return self;
 }
Exemplo n.º 6
0
        public System.Collections.Generic.List<byte> __encode()
        {
            Proto4z.ui32 sttLen = 0;
            Proto4z.ui64 tag = 3;

            var data = new System.Collections.Generic.List<byte>();
            data.AddRange(retCode.__encode());
            data.AddRange(users.__encode());
            sttLen = (System.UInt32)data.Count + 8;
            var ret = new System.Collections.Generic.List<byte>();
            ret.AddRange(sttLen.__encode());
            ret.AddRange(tag.__encode());
            ret.AddRange(data);
            return ret;
        }
Exemplo n.º 7
0
        public static Specification FromProperty(PropertyInfo property)
        {
            System.Collections.Generic.List<string> enumList = new System.Collections.Generic.List<string>();
            if (property.PropertyType.IsEnum)
            {
                enumList.AddRange(Enum.GetNames(property.PropertyType));
            }
            
            var attrs = property.GetCustomAttributes(true);
            var oa = attrs.OfType<OptionAttribute>();
            if (oa.Count() == 1)
            {
                var spec = OptionSpecification.FromAttribute(oa.Single(), property.PropertyType, enumList);
                if (spec.ShortName.Length == 0 && spec.LongName.Length == 0)
                {
                    return spec.WithLongName(property.Name.ToLowerInvariant(), enumList);
                }
                return spec;
            }

            var va = attrs.OfType<ValueAttribute>();
            if (va.Count() == 1)
            {
                return ValueSpecification.FromAttribute(va.Single(), property.PropertyType);
            }

            throw new InvalidOperationException();
        }
        //TODO simple JSON writer
        //struct Info
        //{
        //    public string Provider { get; set; }
        //}
        public override void ProcessRequest(WebRequest request)
        {
            //We don't need a list here, but I rather get away from the lock quicker.
            var dependencies = new System.Collections.Generic.List<ResourceDependancy>();
            WebServer.ForEachPage((page) =>
            {
                var dpd = page.GetDependencies();
                if (dpd != null)
                {
                    dependencies.AddRange(dpd);
                }
            });

            //Since we are using a list we can make it a bit easier
            request.Writer.Buffer(dependencies.Count);

            foreach (var item in dependencies)
            {
                request.Writer.Buffer((byte)item.Type);
                request.Writer.Buffer(item.Url);
            }

            dependencies.Clear();
            dependencies = null;

            request.WriteOut("application/octet-stream");
        }
            protected override IList<Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                    return new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                DomainRole domainRole = component as DomainRole;
                System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);

                System.Collections.Generic.IList<Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    PropertyGridEditor p = modelElement as PropertyGridEditor;
                    bool bFound = false;
                    foreach (PropertyGridEditor e in list)
                        if (e.Name == p.Name)
                        {
                            bFound = true;
                            break;
                        }

                    if (!bFound)
                        list.Add(p);
                }
                return list;
            }
Exemplo n.º 10
0
 void Start()
 {
     Foxes = new System.Collections.Generic.List<GameObject>();
     Foxes.AddRange(new[] { DownLeftFox, DownRightFox, UpLeftFox, UpRightFox });
     SetUnvisibleAll();
     DownRightFox.SetActive(true);
 }
 public void BasicTest()
 {
     System.Collections.Generic.List<string> TestObject = new System.Collections.Generic.List<string>();
     TestObject.AddRange(new string[] { "this", "is", "a", "test" });
     ListMapping<int, string> Results = TestObject.Permute();
     Assert.Equal(24, Results.Keys.Count);
     foreach (int Key in Results.Keys)
         foreach (string Item in Results[Key])
             Assert.True(Item == "this" || Item == "is" || Item == "a" || Item == "test");
 }
 public byte[] ToBytes()
 {
     System.Collections.Generic.List<byte> dataBuffer = new System.Collections.Generic.List<byte>();
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>((ushort)this.CodecChannelT.blockType));
     dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.CodecChannelT.blockLen));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.codecId));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.channelId));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.regionFlags));
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.numRects));
     foreach (TS_RFX_RECT rect in this.rects)
     {
         dataBuffer.AddRange(TypeMarshal.ToBytes<TS_RFX_RECT>(rect));
     }
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.regionType));
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>(this.numTilesets));
     return dataBuffer.ToArray();
 }
Exemplo n.º 13
0
        public void ShouldCallOnMessageAfterSplitFrame()
        {
            const string part1 = "Writing tests";
            const string part2 = " is good for your health";
            const string expected = part1 + part2;

            var bytes = new System.Collections.Generic.List<byte>();
            bytes.Add(0);
            bytes.AddRange(Encoding.UTF8.GetBytes(part1));

            var bytes2 = new System.Collections.Generic.List<byte>();
            bytes.AddRange(Encoding.UTF8.GetBytes(part2));
            bytes.Add(255);

            string result = null;
            _onMessage = s => result = s;

            _handler.Recieve(bytes);
            _handler.Recieve(bytes2);
            Assert.AreEqual(expected, result);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="isVisible"></param>
 public static AttributeBase Create( int? integer, float[] point, float[] rect, string message )
 {
     bool[] has = { integer.HasValue, point != null, rect != null, message != null };
     int[] iValues = new int[1];
     if ( integer.HasValue ) {
         iValues[0] = integer.Value;
     }
     var floats = new System.Collections.Generic.List<float>( 6 );
     if ( point != null ) {
         floats.AddRange( point );
     }
     if ( rect != null ) {
         floats.AddRange( rect );
     }
     string[] texts = null;
     if ( message != null ) {
         texts = new string[] { message };
     }
     var self = new AttributeBase( AttributeBase.Target.kUserNotify, iValues, floats.ToArray(), has, texts );
     return self;
 }
Exemplo n.º 15
0
        public void ShouldCallOnMessageOnCompleteFrame()
        {
            const string expected = "Once upon a time...";
            var bytes = new System.Collections.Generic.List<byte>();
            bytes.Add(0);
            bytes.AddRange(Encoding.UTF8.GetBytes(expected));
            bytes.Add(255);

            string result = null;
            _onMessage = s => result = s;

            _handler.Recieve(bytes);
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 16
0
        public static void TestUseCase()
        {
            var a = new string[] { "a", "b", "c" };
            var list = new System.Collections.Generic.List<string>(a);

            list.AddRange(a);

            Assert.AreEqual(a.Length, 3, "Bridge503: array.Length is correct");
            Assert.AreEqual(list.Count, 6, "Bridge503: list.Count is correct");

            list.Clear();

            Assert.AreEqual(a.Length, 3, "Bridge503: array.Length is correct");
            Assert.AreEqual(list.Count, 0, "Bridge503: list.Count is correct");
        }
 public byte[] ToBytes()
 {
     System.Collections.Generic.List<byte> dataBuffer = new System.Collections.Generic.List<byte>();
     dataBuffer.AddRange(TypeMarshal.ToBytes<ushort>((ushort)this.CodecChannelT.blockType));
     dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.CodecChannelT.blockLen));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.codecId));
     dataBuffer.AddRange(TypeMarshal.ToBytes<byte>(this.CodecChannelT.channelId));
     dataBuffer.AddRange(TypeMarshal.ToBytes<uint>(this.frameIdx));
     dataBuffer.AddRange(TypeMarshal.ToBytes<short>(this.numRegions));
     return dataBuffer.ToArray();
 }
Exemplo n.º 18
0
        /// <summary>
        /// Resets the id provider.
        /// </summary>
        /// <param name="servicesToDiscard">Services to ignore.</param>
        public virtual void Reset(System.Collections.Generic.List <DslEditorModeling::IDomainModelServices> servicesToDiscard)
        {
            IDList.Clear();

            // extern services
            System.Collections.Generic.List <DslEditorModeling::IDomainModelServices> discard = new System.Collections.Generic.List <DslEditorModeling::IDomainModelServices>();
            discard.AddRange(servicesToDiscard);
            discard.Add(FamilyTreeDSLDomainModelServices.Instance);

            foreach (DslEditorModeling::IDomainModelServices externService in FamilyTreeDSLDomainModelExtensionServices.Instance.ExternServices)
            {
                if (discard.Contains(externService))
                {
                    continue;
                }

                externService.ElementIdProvider.Reset(discard);
            }
        }
Exemplo n.º 19
0
        public static bool Validate(Composition composition, OperationalTemplate template,
                                    string context, System.Collections.Generic.List <string> validationErrors)
        {
            Check.Require(composition != null, "composition must not be null.");
            Check.Require(template != null, "template must not be null.");

            ErrorLog errorLog = new ErrorLog(context);
            bool     isValid  = true;

            if (string.IsNullOrEmpty(composition.ArchetypeDetails.TemplateId.Value))
            {
                errorLog.LogError("Composition TemplateId is missing for " + composition.Concept);
                isValid = false;
            }
            if (string.IsNullOrEmpty(template.TemplateId.Value))
            {
                errorLog.LogError("Operational template TemplateId is missing for " + template.Concept);
                isValid = false;
            }
            if (isValid && composition.ArchetypeDetails.TemplateId.Value != template.TemplateId.Value)
            {
                errorLog.LogError(string.Format("Operational TemplateId {0} does not match Composition TemplateId {1}",
                                                template.TemplateId.Value, composition.ArchetypeDetails.TemplateId.Value));

                isValid = false;
            }

            isValid &= Validate(composition, template,
                                delegate(object sender, ValidationEventArgs e) { errorLog.LogError(e); });

            if (!isValid && errorLog.Log.Count <= 0)
            {
                errorLog.LogError("The composition was invalid and no validation errors were logged.");
            }

            if (!isValid)
            {
                validationErrors.AddRange(errorLog.Log);
            }

            return(isValid);
        }
Exemplo n.º 20
0
        public System.Collections.Generic.List <byte> __encode()
        {
            var data = new System.Collections.Generic.List <byte>();

            data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.buffID));
            if (this.activeOrg == null)
            {
                this.activeOrg = new EPosition();
            }
            data.AddRange(this.activeOrg.__encode());
            data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.activeOrgEID));
            if (this.activeDst == null)
            {
                this.activeDst = new EPosition();
            }
            data.AddRange(this.activeDst.__encode());
            data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.activeDstEID));
            data.AddRange(Proto4z.BaseProtoObject.encodeDouble(this.activeTime));
            data.AddRange(Proto4z.BaseProtoObject.encodeDouble(this.lastTriggerTime));
            data.AddRange(Proto4z.BaseProtoObject.encodeDouble(this.activeCount));
            return(data);
        }
Exemplo n.º 21
0
        /// <summary>
        ///		Carga recursivamente una colección de archivos de un directorio
        /// </summary>
        public static System.Collections.Generic.List <string> LoadRecursive(string strPathSource)
        {
            System.Collections.Generic.List <string> objColFiles = new System.Collections.Generic.List <string>();
            string [] arrStrFiles;

            // Obtiene los archivos
            arrStrFiles = Directory.GetFiles(strPathSource);
            foreach (string strFile in arrStrFiles)
            {
                objColFiles.Add(strFile);
            }
            // Obtiene los directorios
            arrStrFiles = Directory.GetDirectories(strPathSource);
            foreach (string strPath in arrStrFiles)
            {
                objColFiles.AddRange(LoadRecursive(Path.Combine(strPathSource, Path.GetFileName(strPath))));
            }
            // Devuelve la colección de archivos
            return(objColFiles);
        }
Exemplo n.º 22
0
        void SetupFontList()
        {
            InstalledTypeface selectedInstalledTypeface = null;
            int  selected_index = 0;
            int  ffcount        = 0;
            bool found          = false;


            var tempList = new System.Collections.Generic.List <InstalledTypeface>();

            tempList.AddRange(_options.GetInstalledTypefaceIter());
            tempList.Sort((f1, f2) => f1.ToString().CompareTo(f2.ToString()));

            //add to list and find default font
            string defaultFont = "Tahoma";

            //string defaultFont = "Alef"; //test hebrew
            //string defaultFont = "Century";
            foreach (InstalledTypeface installedTypeface in tempList)
            {
                if (!found && installedTypeface.FontName == defaultFont)
                {
                    selectedInstalledTypeface  = installedTypeface;
                    selected_index             = ffcount;
                    _options.InstalledTypeface = installedTypeface;
                    found = true;
                }
                lstFontList.Items.Add(installedTypeface);
                ffcount++;
            }
            //set default font for current text printer
            //

            if (selected_index < 0)
            {
                selected_index = 0;
            }

            lstFontList.SelectedIndex         = selected_index;
            lstFontList.SelectedIndexChanged += (s, e) => ChangeSelectedTypeface(lstFontList.SelectedItem as InstalledTypeface);
        }
Exemplo n.º 23
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         System.Collections.Generic.List <Entidades.PuntoVta> listaPuntoVta = ((Entidades.Sesion)Session["Sesion"]).UN.PuntosVta;
         System.Collections.Generic.List <Entidades.PuntoVta> puntoVtalist  = new System.Collections.Generic.List <Entidades.PuntoVta>();
         Entidades.PuntoVta puntoVta = new Entidades.PuntoVta();
         puntoVta.Nro = 0;
         puntoVtalist.Add(puntoVta);
         if (listaPuntoVta != null)
         {
             puntoVtalist.AddRange(listaPuntoVta);
         }
         PtoVtaConsultaDropDownList.DataValueField = "Nro";
         PtoVtaConsultaDropDownList.DataTextField  = "DescrCombo";
         PtoVtaConsultaDropDownList.DataSource     = puntoVtalist;
         PtoVtaConsultaDropDownList.DataBind();
         DataBind();
         CuitConsultaTextBox.Text = ((Entidades.Sesion)Session["Sesion"]).Cuit.Nro;
     }
 }
Exemplo n.º 24
0
        /// <summary>
        /// Concatenates all of the <paramref name="words"/> with a '.' separator.
        /// <para>Each word is passed through the <c>AsValidWord</c> method ensuring that it is a valid for a namespace segment.</para>
        /// <para>Leading, trailing, and more than one consecutive '.' are removed.</para>
        /// </summary>
        /// <example>
        /// This sample shows how to call the <see cref="AsNamespace"/> method.
        /// <code>
        ///     string[] segments = new string[5]{ ".My", "Namespace.", "For", "The...Sample..", "Project."};
        ///     string ns = segments.AsNamespace();
        /// </code>
        /// The <c>ns</c> variable would contain "<c>My.Namespace.For.The.Sample.Project</c>".
        /// </example>
        /// <param name="words">The namespace segments.</param>
        /// <returns>A valid string in valid namespace format.</returns>
        public static string AsNamespace(System.Collections.Generic.IEnumerable <string> words)
        {
            System.Collections.Generic.List <string> joinedNamespace = new System.Collections.Generic.List <string>();
            foreach (string segment in words)
            {
                if (segment != null)
                {
                    // split apart any strings with a '.' and remove any consecutive multiple '.'
                    string[] segments = segment.Split(new char[1] {
                        '.'
                    }, StringSplitOptions.RemoveEmptyEntries);

                    // being we are making a namespace, make sure the segments are valid
                    System.Collections.Generic.IEnumerable <string> validSegments = AsValidWords(segments);
                    joinedNamespace.AddRange(validSegments);
                }
            }
            string ns = string.Join(".", joinedNamespace.ToArray());

            return(ns);
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!this.IsPostBack)
     {
         System.Collections.Generic.List<Entidades.PuntoVta> listaPuntoVta = ((Entidades.Sesion)Session["Sesion"]).UN.PuntosVta;
         System.Collections.Generic.List<Entidades.PuntoVta> puntoVtalist = new System.Collections.Generic.List<Entidades.PuntoVta>();
         Entidades.PuntoVta puntoVta = new Entidades.PuntoVta();
         puntoVta.Nro = 0;
         puntoVtalist.Add(puntoVta);
         if (listaPuntoVta != null)
         {
             puntoVtalist.AddRange(listaPuntoVta);
         }
         PtoVtaConsultaDropDownList.DataValueField = "Nro";
         PtoVtaConsultaDropDownList.DataTextField = "DescrCombo";
         PtoVtaConsultaDropDownList.DataSource = puntoVtalist;
         PtoVtaConsultaDropDownList.DataBind();
         DataBind();
         CuitConsultaTextBox.Text = ((Entidades.Sesion)Session["Sesion"]).Cuit.Nro;
     }
 }
Exemplo n.º 26
0
        private void SetupCustomRenderSettings(string fieldName, int layerIndex, TooltipHeaderFieldNamePair[] tooltipFields)
        {
            //get the required layer
            EGIS.ShapeFileLib.RenderSettings renderSettings = SFMap1.GetLayer(layerIndex).RenderSettings;
            int numRecords = SFMap1.GetLayer(layerIndex).RecordCount;

            EGIS.ShapeFileLib.DbfReader dbfReader = renderSettings.DbfReader;
            int fieldIndex = dbfReader.IndexOfFieldName(fieldName);

            double[] samples = new double[numRecords];
            //find the range of population values and obtain the quintile quantiles
            for (int n = 0; n < numRecords; n++)
            {
                double d = double.Parse(dbfReader.GetField(n, fieldIndex), System.Globalization.CultureInfo.InvariantCulture);
                samples[n] = d;
            }
            double[] ranges = GetQuintiles(samples);

            //create the quintile colors - there will be 1 more color than the number of elements in quantiles
            Color[] cols = new Color[] {
                Color.FromArgb(80, 0, 20),
                Color.FromArgb(120, 0, 20),
                Color.FromArgb(180, 0, 20),
                Color.FromArgb(220, 0, 20),
                Color.FromArgb(250, 0, 20)
            };

            //setup the list of tooltip fields
            System.Collections.Generic.List <TooltipHeaderFieldNamePair> tooltipPairList = null;
            if (tooltipFields != null)
            {
                tooltipPairList = new System.Collections.Generic.List <TooltipHeaderFieldNamePair>();
                tooltipPairList.AddRange(tooltipFields);
            }

            //create a new QuantileCustomRenderSettings and add it to the SFMap
            QuantileCustomRenderSettings rcrs = new QuantileCustomRenderSettings(renderSettings, cols, ranges, fieldName, tooltipPairList);

            SFMap1.SetCustomRenderSettings(layerIndex, rcrs);
        }
Exemplo n.º 27
0
        private void QueryLimiter(SiteMape sm, System.Collections.Generic.List <string> externalListLinks, System.Int32 QUANTITY, System.Collections.Generic.List <string> innerList)
        {
            int amount = QUANTITY;

            do
            {
                innerList.AddRange(DeepSearchSitemapParallel(sm, externalListLinks.GetRange(0, amount), flag: true));

                innerList = innerList.Except(listVisitedLinks).ToList <string>();

                externalListLinks = externalListLinks.Except(listVisitedLinks).ToList <string>();

                if (amount > externalListLinks.Count)
                {
                    amount = externalListLinks.Count;
                    if (amount <= 0)
                    {
                        break;
                    }
                }
            } while (true);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Gets creatable relationship shapes.
        /// </summary>
        /// <param name="info">Info specifying the relationship to create.</param>
        public override System.Collections.Generic.List <DslEditorSelection::SearchRSType.SearchRSTypeStruct> GetCreatableRelationships(DslEditorViewDiagrams::ViewModelRelationshipCreationInfo info)
        {
            System.Collections.Generic.List <DslEditorSelection::SearchRSType.SearchRSTypeStruct> shapesPossible = base.GetCreatableRelationships(info);

            if (CanCreateRelationshipShapeReferenceShape(info))
            {
                shapesPossible.Add(new DslEditorSelection::SearchRSType.SearchRSTypeStruct(
                                       global::Tum.PDE.ModelingDSL.ReferenceShape.DomainClassId, "Reference Relationship", "Reference Shape"));
            }
            if (CanCreateRelationshipShapeEmbeddingShape(info))
            {
                shapesPossible.Add(new DslEditorSelection::SearchRSType.SearchRSTypeStruct(
                                       global::Tum.PDE.ModelingDSL.EmbeddingShape.DomainClassId, "Embedding Relationship", "Embedding Shape"));
            }

            foreach (DslEditorViewDiagrams::DiagramSurfaceViewModel vm in this.IncludedSurfaceViewModels)
            {
                shapesPossible.AddRange(vm.GetCreatableRelationships(info));
            }

            return(shapesPossible);
        }
Exemplo n.º 29
0
        /// <summary>
        /// Gets creatable relationship shapes.
        /// </summary>
        /// <param name="info">Info specifying the relationship to create.</param>
        public override System.Collections.Generic.List <DslEditorSelection::SearchRSType.SearchRSTypeStruct> GetCreatableRelationships(DslEditorViewDiagrams::ViewModelRelationshipCreationInfo info)
        {
            System.Collections.Generic.List <DslEditorSelection::SearchRSType.SearchRSTypeStruct> shapesPossible = base.GetCreatableRelationships(info);

            if (CanCreateRelationshipShapeParentOfShape(info))
            {
                shapesPossible.Add(new DslEditorSelection::SearchRSType.SearchRSTypeStruct(
                                       global::Tum.FamilyTreeDSL.ParentOfShape.DomainClassId, "Parent Of", "Parent Of Shape"));
            }
            if (CanCreateRelationshipShapeMarriedToShape(info))
            {
                shapesPossible.Add(new DslEditorSelection::SearchRSType.SearchRSTypeStruct(
                                       global::Tum.FamilyTreeDSL.MarriedToShape.DomainClassId, "Married To", "Married To Shape"));
            }

            foreach (DslEditorViewDiagrams::DiagramSurfaceViewModel vm in this.IncludedSurfaceViewModels)
            {
                shapesPossible.AddRange(vm.GetCreatableRelationships(info));
            }

            return(shapesPossible);
        }
Exemplo n.º 30
0
        /// <summary>
        /// Total error calculation
        /// </summary>
        /// <param name="info">NetworkInfo</param>
        /// <param name="inp">ref Input - input data patterns</param>
        /// <param name="dout">ref Output - output data</param>
        /// <param name="topo">ref Topography - topo is network topology in the form of one vector</param>
        /// <param name="ww">ref Weights  weights</param>
        /// <param name="act">ref Activation - type of activation function</param>
        /// <param name="gain">ref Gain - strengthening the activation function</param>
        /// <param name="iw">ref WeightsPointers - index pointers used for network topology stored in top in the form of one vector</param>
        /// <remarks>Network error will be overriden so please save it</remarks>
        public double CalculateError(ref NetworkInfo info, ref Input inp, ref Output dout, ref Topography topo,
                                     Weights ww, ref Activation act, ref Gain gain, ref Index iw)
        {
            try
            {
                Error = 0;
                for (p = 0; p < info.np; p++)
                {
                    node.Clear();
                    node.AddRange(inp.Data[p]);

                    for (n = 0; n < info.nn; n++)
                    {
                        net = ww[iw.Pos(n)];

                        int from = iw.Pos(n) + 1;
                        int to   = iw.Pos(n + 1) - 1;

                        for (i = from; i <= to; i++)
                        {
                            net += node[(int)topo[i]] * ww[i];
                        }

                        node.Add(ActivationFunction.computeFunction(ref n, ref net, ref act, ref gain));
                    }

                    for (k = 0; k < info.no; k++)
                    {
                        Error += System.Math.Pow((dout.Data[p][k] - node[info.nio + k]), 2);
                    }
                }

                return(Error);
            }
            catch (System.Exception ex)
            {
                throw new NeuralNetworkError("Błąd uaktualnienia błędu sieci neuronowej. " + ex.Message, ex);
            }
        } //update error method
Exemplo n.º 31
0
        static int _m_AddRange(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            System.Collections.Generic.List <xc.Task> __cl_gen_to_be_invoked = (System.Collections.Generic.List <xc.Task>)translator.FastGetCSObj(L, 1);


            try {
                {
                    System.Collections.Generic.IEnumerable <xc.Task> collection = (System.Collections.Generic.IEnumerable <xc.Task>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <xc.Task>));

                    __cl_gen_to_be_invoked.AddRange(collection);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Exemplo n.º 32
0
        private static byte[] PixelsToAveragedByteArray(Bitmap bmp)
        {
            //Re-color
            var bmpTmp = new Bitmap(bmp.Width, bmp.Height, System.Drawing.Imaging.PixelFormat.Format8bppIndexed);

            using (var gr = Graphics.FromImage(bmp))
                gr.DrawImage(bmp, new Rectangle(0, 0, bmp.Width, bmp.Height));

            //Downscale
            var bmpSmall = new Bitmap(bmpTmp, new Size(16, 16));

            var bytes = new System.Collections.Generic.List <byte>();

            for (int x = 0; x < bmpSmall.Width; x++)
            {
                for (int y = 0; y < bmpSmall.Height; y++)
                {
                    bytes.AddRange(new byte[] { bmpSmall.GetPixel(x, y).R, bmpSmall.GetPixel(x, y).G, bmpSmall.GetPixel(x, y).B });
                }
            }
            return(bytes.ToArray());
        }
Exemplo n.º 33
0
 static byte[] ReadInput(string filename)
 {
     if (filename == "-")
     {
         System.Collections.Generic.List <byte> result = new System.Collections.Generic.List <byte>();
         using (Stream stdin = Console.OpenStandardInput())
             using (BinaryReader read = new BinaryReader(stdin))
             {
                 byte[] buf = read.ReadBytes(1024);
                 do
                 {
                     result.AddRange(buf);
                     buf = read.ReadBytes(1024);
                 }while (buf.Length > 0);
             }
         return(result.ToArray());
     }
     else
     {
         return(File.ReadAllBytes(filename));
     }
 }
Exemplo n.º 34
0
        public System.Collections.Generic.List <byte> __encode()
        {
            var data = new System.Collections.Generic.List <byte>();

            data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.eid));
            if (this.position == null)
            {
                this.position = new EPosition();
            }
            data.AddRange(this.position.__encode());
            data.AddRange(Proto4z.BaseProtoObject.encodeUI16(this.action));
            data.AddRange(Proto4z.BaseProtoObject.encodeDouble(this.realSpeed));
            data.AddRange(Proto4z.BaseProtoObject.encodeDouble(this.expectSpeed));
            if (this.waypoints == null)
            {
                this.waypoints = new EPositionArray();
            }
            data.AddRange(this.waypoints.__encode());
            data.AddRange(Proto4z.BaseProtoObject.encodeUI64(this.follow));
            return(data);
        }
            protected override IList<Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                    return new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List<Microsoft.VisualStudio.Modeling.ModelElement>();
                DomainProperty domainProperty = component as DomainProperty;
                if (domainProperty == null)
                    if (component is IList)
                        if ((component as IList).Count > 0)
                            domainProperty = (component as IList)[0] as DomainProperty;

                    if (domainProperty != null)
                    {
                        list.AddRange(domainProperty.Element.ParentModelContext.MetaModel.DomainTypes);

                        System.Collections.Generic.IList<Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, true);
                        foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                        {
                            DomainType p = modelElement as DomainType;
                            bool bFound = false;
                            foreach (DomainType e in list)
                                if (e.Name == p.Name &&
                                    e.Namespace == p.Namespace)
                                {
                                    bFound = true;
                                    break;
                                }

                            if (!bFound)
                                list.Add(p);
                        }
                    }
                return list;
            }
Exemplo n.º 36
0
        // sortowanie katowe punktow z tablicy p w kierunku przeciwnym do ruchu wskazowek zegara wzgledem punktu centralnego c
        // czyli sortowanie wzgledem roznacych katow odcinka (c,p[i]) z osia x
        // przy pomocy parametru ifAngleEqual mo¿na doprwcyzowaæ kryterium sortowania gdy katy sa rowne
        // (domyslnie nic nie doprecyzowujemy, pozostawiamy rowne)
        public static Point[] AngleSort(Point c, Point[] p, System.Comparison <Point> ifAngleEqual = null)
        {
            if (ifAngleEqual == null)
            {
                ifAngleEqual = (p1, p2) => 0;
            }
            if (p == null)
            {
                throw new System.ArgumentNullException();
            }
            if (p.Length < 2)
            {
                return(p);
            }
            System.Comparison <Point> cmp = delegate(Point p1, Point p2)
            {
                int r = -(new Geometry.Segment(c, p1)).Direction(p2);
                return(r != 0 ? r : ifAngleEqual(p1, p2));
            };
            var s1 = new System.Collections.Generic.List <Point>();
            var s2 = new System.Collections.Generic.List <Point>();

            for (int i = 0; i < p.Length; ++i)
            {
                if (p[i].y > c.y || (p[i].y == c.y && p[i].x >= c.x))
                {
                    s1.Add(p[i]);
                }
                else
                {
                    s2.Add(p[i]);
                }
            }
            s1.Sort(cmp);
            s2.Sort(cmp);
            s1.AddRange(s2);
            return(s1.ToArray());
        }
        static int _m_AddRange(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                System.Collections.Generic.List <XLua.LuaTable> gen_to_be_invoked = (System.Collections.Generic.List <XLua.LuaTable>)translator.FastGetCSObj(L, 1);



                {
                    System.Collections.Generic.IEnumerable <XLua.LuaTable> _collection = (System.Collections.Generic.IEnumerable <XLua.LuaTable>)translator.GetObject(L, 2, typeof(System.Collections.Generic.IEnumerable <XLua.LuaTable>));

                    gen_to_be_invoked.AddRange(_collection);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
Exemplo n.º 38
0
        private static Type[] GetApplicationTypes()
        {
            // Get all assembly and types.
            var deps     = Microsoft.Extensions.DependencyModel.DependencyContext.Default;
            var typeList = new System.Collections.Generic.List <Type>();

            deps.CompileLibraries
            // Ignore all system assembly and nuget pakage
            .Where(lib => !lib.Serviceable && lib.Type != "package")
            .ToList().ForEach(lib =>
            {
                try
                {
                    var assembly = System.Runtime.Loader.AssemblyLoadContext.Default.LoadFromAssemblyName(new System.Reflection.AssemblyName(lib.Name));
                    typeList.AddRange(assembly.GetTypes().Where(type => type != null));
                }
                catch (Exception e)
                {
                    throw new Exception("Load deps error.", e);
                }
            });
            return(typeList.ToArray());
        }
Exemplo n.º 39
0
        public void ReadHeadTest()
        {
            SocketHeadReaderTestPeer peer = new SocketHeadReaderTestPeer();

            SocketHeadReader reader    = new Regulus.Remote.SocketHeadReader(peer);
            ISocketReader    readEvent = reader as ISocketReader;
            var buffer = new System.Collections.Generic.List <byte>();

            readEvent.DoneEvent += (read_buffer) =>
            {
                buffer.AddRange(read_buffer);
            };

            reader.Read();
            readEvent.Enter();
            while (buffer.Count != 2)
            {
                readEvent.Update();
            }
            readEvent.Leave();
            Xunit.Assert.Equal(0x85, buffer[0]);
            Xunit.Assert.Equal(0x05, buffer[1]);
        }
Exemplo n.º 40
0
        public void ShouldCallOnMessageAfterSplitFrameTypeAndBody()
        {
            const string expected = "A little late";

            //Just a 0x00
            var bytes = new System.Collections.Generic.List <byte>();

            bytes.Add(0);

            //Everything else
            var bytes2 = new System.Collections.Generic.List <byte>();

            bytes2.AddRange(Encoding.UTF8.GetBytes(expected));
            bytes2.Add(255);

            string result = null;

            _onMessage = s => result = s;

            _handler.Receive(bytes);
            _handler.Receive(bytes2);
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 41
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     if (Request.Params["logout"] != null)
     {
         Response.Cookies["token"].Value = null; Response.Redirect("Login.aspx"); return;
     }
     if (!string.IsNullOrEmpty(Output.Text))
     {
         Output.Text = "";
     }
     Register.Click       += Register_Click; Submit.Click += Submit_Click;
     using HotelsContext c = new HotelsContext(); users.AddRange(from u in c.User.AsEnumerable()
                                                                 from r in c.Role.AsEnumerable() where r.Id == u.RoleId select new LoginUser(r.Name, u.Login, u.PasswordHash));
     if (Request.Cookies["token"] != null)
     {
         foreach (LoginUser u in users)
         {
             if (Utils.MakeToken(u.Login, u.PasswordHash) == Request.Cookies["token"].Value)
             {
                 NewPage(u.Role); return;
             }
         }
     }
 }
Exemplo n.º 42
0
        public void ShouldCallOnMessageAfterSplitFrame()
        {
            const string part1    = "Writing tests";
            const string part2    = " is good for your health";
            const string expected = part1 + part2;

            var bytes = new System.Collections.Generic.List <byte>();

            bytes.Add(0);
            bytes.AddRange(Encoding.UTF8.GetBytes(part1));

            var bytes2 = new System.Collections.Generic.List <byte>();

            bytes2.AddRange(Encoding.UTF8.GetBytes(part2));
            bytes2.Add(255);

            string result = null;

            _onMessage = s => result = s;

            _handler.Receive(bytes);
            _handler.Receive(bytes2);
            Assert.AreEqual(expected, result);
        }
Exemplo n.º 43
0
        private static void AppendIncomingData(byte[] payloadData)
        {
            _incomingBuffer.AddRange(payloadData);

            // If the buffer contains any complete packets, process them
            while (_incomingBuffer.Count >= 2)
            {
                ushort packetLength = BitConverter.ToUInt16(_incomingBuffer.GetRange(0, 2).ToArray(), 0);
                if (_incomingBuffer.Count >= packetLength)
                {
                    byte spacer = _incomingBuffer[2]; // skip 1 byte

                    byte[] packetData = _incomingBuffer.GetRange(3, packetLength - 3).ToArray();
                    _incomingBuffer.RemoveRange(0, packetLength);

                    DecryptPacket(packetData);
                    ParsePacket(new PacketReader(packetData));
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 44
0
        /// <summary>
        /// Creates a redirect URL for login requests
        /// </summary>
        /// <returns>A redirect URL</returns>
        protected virtual string CreateLoginRedirectUrl()
        {
            System.Collections.Generic.List <System.Tuple <string, string> > Pairs = new System.Collections.Generic.List <System.Tuple <string, string> >();
            Pairs.Add(new System.Tuple <string, string>("openid.ns", HttpUtility.UrlEncode("http://specs.openid.net/auth/2.0")));
            Pairs.Add(new System.Tuple <string, string>("openid.mode", "checkid_setup"));
            Pairs.Add(new System.Tuple <string, string>("openid.identity", HttpUtility.UrlEncode("http://specs.openid.net/auth/2.0/identifier_select")));
            Pairs.Add(new System.Tuple <string, string>("openid.claimed_id", HttpUtility.UrlEncode("http://specs.openid.net/auth/2.0/identifier_select")));
            Pairs.Add(new System.Tuple <string, string>("openid.return_to", HttpUtility.UrlEncode(RedirectURL)));
            foreach (IExtension Extension in Extensions)
            {
                Pairs.AddRange(Extension.GenerateURLAttributes());
            }
            StringBuilder Builder = new StringBuilder();

            Builder.Append(EndpointURL);
            string Splitter = "?";

            foreach (System.Tuple <string, string> Pair in Pairs)
            {
                Builder.Append(Splitter).Append(Pair.Item1).Append("=").Append(Pair.Item2);
                Splitter = "&";
            }
            return(Builder.ToString());
        }
Exemplo n.º 45
0
        private static void buildSolutions(HtWt[] arr, System.Collections.Generic.List <HtWt>[] solutions, int current_index)
        {
            if (current_index > arr.Length - 1)
            {
                return;
            }
            System.Collections.Generic.List <HtWt> longest_sequence = null;
            for (int i = current_index; i >= 0; i--)
            {
                if (arr[i].isBefore(arr[current_index]))
                {
                    longest_sequence = getLongerList(longest_sequence, solutions[i]);
                }
            }

            System.Collections.Generic.List <HtWt> new_solution = new System.Collections.Generic.List <HtWt>();
            if (longest_sequence != null)
            {
                new_solution.AddRange(longest_sequence);
            }
            new_solution.Add(arr[current_index]);
            solutions[current_index] = new_solution;
            buildSolutions(arr, solutions, current_index + 1);
        }
Exemplo n.º 46
0
        public override System.Collections.Generic.List <DisplayListMember> GetTabChildren()
        {
            System.Collections.Generic.List <DisplayListMember> list = new System.Collections.Generic.List <DisplayListMember>();

            if (FocusManager.IsFocusCandidate(_btnDec))
            {
                list.Add(_btnDec);
            }

            list.AddRange(
                _placeholder.Children.FindAll(delegate(DisplayListMember child)
            {
                InteractiveComponent comp = child as InteractiveComponent;
                return(FocusManager.IsFocusCandidate(comp));
            })
                );

            if (FocusManager.IsFocusCandidate(_btnInc))
            {
                list.Add(_btnInc);
            }

            return(list);
        }
            protected override IList <Microsoft.VisualStudio.Modeling.ModelElement> BuildElementList(object component)
            {
                Microsoft.VisualStudio.Modeling.DomainClassInfo domainClassInfo = DomainRoleInfo.RolePlayer;
                if (domainClassInfo == null || component == null)
                {
                    return(new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>());
                }

                Microsoft.VisualStudio.Modeling.Store store = this.GetStore(component);

                DomainRole domainRole = component as DomainRole;

                System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement> list = new System.Collections.Generic.List <Microsoft.VisualStudio.Modeling.ModelElement>();
                list.AddRange(domainRole.Relationship.GetMetaModel().PropertyGridEditors);

                System.Collections.Generic.IList <Microsoft.VisualStudio.Modeling.ModelElement> ilist = store.ElementDirectory.FindElements(domainClassInfo, false);
                foreach (Microsoft.VisualStudio.Modeling.ModelElement modelElement in ilist)
                {
                    PropertyGridEditor p = modelElement as PropertyGridEditor;
                    bool bFound          = false;
                    foreach (PropertyGridEditor e in list)
                    {
                        if (e.Name == p.Name)
                        {
                            bFound = true;
                            break;
                        }
                    }

                    if (!bFound)
                    {
                        list.Add(p);
                    }
                }
                return(list);
            }
Exemplo n.º 48
0
        protected void SelectAllbtn_Click(object sender, EventArgs e)
        {
            if ((LinkButton)sender == SelectAllGroupsbtn)
            {
                IList AllGroups = manager.GetGroups(string.Empty);
                this.SelectedGroups.Clear();
                foreach (IGroup currentGroup in AllGroups)
                {
                    DataRow row = this.SelectedGroups.NewRow();
                    row["Name"] = currentGroup.GroupName;
                    row["Id"]   = currentGroup.GroupId;
                    this.SelectedGroups.Rows.Add(row);
                }
                this.RepSelected.DataSource = this.SelectedGroups;
                this.RepSelected.DataBind();
                this.RepGroups.DataBind();
            }
            else if ((LinkButton)sender == selectAllRolesbtn)
            {
                System.Collections.Generic.List <string> allRoles = new System.Collections.Generic.List <string>();
                allRoles.AddRange(Telerik.Security.UserManager.Default.GetAllRoles());
                this.SelectedRoles.Clear();
                for (int index = 0; index < allRoles.Count; index++)
                {
                    DataRow row = SelectedRoles.NewRow();
                    row["Name"] = allRoles[index];
                    row["Id"]   = row["Name"];
                    this.SelectedRoles.Rows.Add(row);
                }

                this.RepSelected.DataSource = this.SelectedRoles;
                this.RepSelected.DataBind();

                this.repRoles.DataBind();
            }
        }
Exemplo n.º 49
0
        /// <summary>
        /// Removes a specific key.
        /// </summary>
        /// <param name="modelElement">Domain model element to remove the key for.</param>
        /// <param name="servicesToDiscard">Services to ignore.</param>
        public virtual bool RemoveKey(DslModeling::ModelElement modelElement, System.Collections.Generic.List <DslEditorModeling::IDomainModelServices> servicesToDiscard)
        {
            //if( IDList.Contains(modelElement.Id) )
            //	IDList.Remove(modelElement.Id);
            try
            {
                if (modelElement is DslEditorModeling::IDableElement)
                {
                    IDList.Remove(modelElement.Id);
                }

                return(true);
            }
            catch {}

            // extern services
            System.Collections.Generic.List <DslEditorModeling::IDomainModelServices> discard = new System.Collections.Generic.List <DslEditorModeling::IDomainModelServices>();
            discard.AddRange(servicesToDiscard);
            discard.Add(VModellXTDomainModelServices.Instance);

            foreach (DslEditorModeling::IDomainModelServices externService in VModellXTDomainModelExtensionServices.Instance.ExternServices)
            {
                if (discard.Contains(externService))
                {
                    continue;
                }

                bool bRemoved = externService.ElementIdProvider.RemoveKey(modelElement, discard);
                if (bRemoved)
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 50
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeUI16(retCode));
     return data;
 }
Exemplo n.º 51
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeUI16(retCode));
     if (users == null) users = new BaseInfoArray();
     data.AddRange(users.__encode());
     return data;
 }
Exemplo n.º 52
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeUI32(timeStamp));
     data.AddRange(Proto4z.BaseProtoObject.encodeUI32(timeTick));
     return data;
 }
Exemplo n.º 53
0
 public System.Collections.Generic.List<byte> __encode()
 {
     var data = new System.Collections.Generic.List<byte>();
     data.AddRange(Proto4z.BaseProtoObject.encodeString(nickName));
     data.AddRange(Proto4z.BaseProtoObject.encodeI32(iconID));
     return data;
 }
Exemplo n.º 54
0
            /*
			/// <summary>
			/// Will strip abnormal characters (colors, etc) from the string
			/// </summary>
			/// <param name="line">line to clean (left intact)</param>
			/// <returns>string containing the cleaned line</returns>
			private string CleanLine(string line)
			{
				string cleanedString = line;
				byte[] bytearray1252 = System.Text.Encoding.GetEncoding(1252).GetBytes(cleanedString);
				int i = 0, len = bytearray1252.Length;
				string sEF = "\xFF\x1F\x20\x21\x22\x23\x24\x25\x26\x27\x28\xFF";
				// 1f 20 21 22 23 24 25 26 27 28
				string rep = "<FIAETWLD{}>";
				string s1E = "\x01\x02\x03\xFC\xFD";
				string s1F = "\x0E\x0F\x2F\x7F\x79\x7B\x7C\x8D\x88\x8A\xA1\xD0\r\n\x07";
				string sExtra = "\r\n\x07\x7F\x81\x87";
				System.Collections.Generic.List<Byte> cleaned = new System.Collections.Generic.List<byte>();
				int ndx = -1;

				for (int c = 0; c < len; ++c)
				{

					if ((bytearray1252[c] == '\xEF') && (((c + 1) < len) && ((ndx = sEF.IndexOf((char)bytearray1252[c + 1])) >= 0)))
					{
						// 3C <  3E >
						// 7B {  7D }
						if (sEF[ndx] != '\x28') // Not closing brace? Needs starter char
							cleaned.Add((byte)rep[0]);
						cleaned.Add((byte)rep[ndx]); // add rep.char based on Index
						if (sEF[ndx] != '\x27') // Not opening brace? Needs closer char
							cleaned.Add((byte)rep[rep.Length - 1]); // >  Final: <{ and }> for Auto-translate braces
						++c;
					}
					else if ((bytearray1252[c] == '\x1F') && (((c + 1) < len) && s1F.IndexOf((char)bytearray1252[c + 1]) >= 0))
					{
						++c;
					}
					else if ((bytearray1252[c] == '\x1E') && (((c + 1) < len) && s1E.IndexOf((char)bytearray1252[c + 1]) >= 0))
					{
						++c;
					}
					else
					{
						i = sExtra.IndexOf((char)bytearray1252[c]);
						if (i >= 3) // \r\n\07 are singles, others are doubles
						{
							if (((bytearray1252[c] == '\x7F') && (((c + 1) < len) && bytearray1252[c + 1] == '\x31')) ||
								((bytearray1252[c] == '\x81') && (((c + 1) < len) && bytearray1252[c + 1] == '\xA1')) ||
								((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB2')) ||
								((bytearray1252[c] == '\x87') && (((c + 1) < len) && bytearray1252[c + 1] == '\xB3')))
							{
								++c;
							}
							else
							{
								i = -1; // not a target, so "wasn't found"
							}
						}
						if (i < 0)
						{
							cleaned.Add(bytearray1252[c]);
						}
					}
				}
				cleaned.Add(0);
				if (cleaned[0] != 0)
					cleanedString = System.Text.Encoding.GetEncoding(932).GetString(cleaned.ToArray());
				else
					cleanedString = String.Empty;
				if (cleanedString.StartsWith("["))  // Detect and remove Windower Timestamp plugin text.
				{
					string text = cleanedString.Substring(1, 8);
					string re1 = ".*?";	// Non-greedy match on filler
					string re2 = "((?:(?:[0-1][0-9])|(?:[2][0-3])|(?:[0-9])):(?:[0-5][0-9])(?::[0-5][0-9])?(?:\\s?(?:am|AM|pm|PM))?)";

					Regex r = new Regex(re1 + re2, RegexOptions.IgnoreCase | RegexOptions.Singleline);
					Match m = r.Match(text);
					if (m.Success)
					{
						cleanedString = cleanedString.Remove(0, 11); // this assumes timestamp found is only 10+1 space in length
						// Better way? : line = line.Remove(0,m.Length+1);
					}
				} // Detect and remove Windower Timestamp plugin text.

				return cleanedString;

			} // private CleanLine(string line)
			*/
            #endregion

            public DialogText Clone (DialogText dt)
            {
                if (dt == null)
                    return null;
                DialogText ret = new DialogText(String.Empty);
                ret._Question = dt._Question;
                System.Collections.Generic.List<String> tmp = new System.Collections.Generic.List<string>();
                tmp.AddRange(dt._Options);
                ret._Options = new string[dt._Options.Length];
                for (int i = 0; i < dt._Options.Length; i++)
                {
                    ret._Options[i] = dt._Options[i];
                }
                return ret;
            }
        /// <summary>
        /// Removes a specific key.
        /// </summary>
        /// <param name="modelElement">Domain model element to remove the key for.</param>
        /// <param name="servicesToDiscard">Services to ignore.</param>
        public virtual bool RemoveKey(DslModeling::ModelElement modelElement, System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> servicesToDiscard)
		{
			//if( IDList.Contains(modelElement.Id) )
			//	IDList.Remove(modelElement.Id);
			try
			{
				if( modelElement is DslEditorModeling::IDableElement )			
					IDList.Remove(modelElement.Id);
					
				return true;
			}
			catch{}		
			
			// extern services
			System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> discard = new System.Collections.Generic.List<DslEditorModeling::IDomainModelServices>();
			discard.AddRange(servicesToDiscard);
			discard.Add(VSPluginDSLDomainModelServices.Instance);

			foreach(DslEditorModeling::IDomainModelServices externService in VSPluginDSLDomainModelExtensionServices.Instance.ExternServices)
			{
				if( discard.Contains(externService) )
					continue;
			
				bool bRemoved = externService.ElementIdProvider.RemoveKey(modelElement, discard);
				if( bRemoved )
					return true;
			}
		
			return false;
		}
        /// <summary>
        /// Resets the id provider.
        /// </summary>
        /// <param name="servicesToDiscard">Services to ignore.</param>
        public virtual void Reset(System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> servicesToDiscard)
		{
			IDList.Clear();
			
			// extern services
			System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> discard = new System.Collections.Generic.List<DslEditorModeling::IDomainModelServices>();
			discard.AddRange(servicesToDiscard);
			discard.Add(VSPluginDSLDomainModelServices.Instance);

			foreach(DslEditorModeling::IDomainModelServices externService in VSPluginDSLDomainModelExtensionServices.Instance.ExternServices)
			{
				if( discard.Contains(externService) )
					continue;
			
				externService.ElementIdProvider.Reset(discard);
			}
		}
        /// <summary>
        /// Gets whether a certain key has already been assigned.
        /// </summary>
        /// <param name="modelElementId">Domain model element Id.</param>
        /// <param name="servicesToDiscard">Services to ignore.</param>
        /// <returns>True if the given id has already been assigned; false otherwise.</returns>
        public virtual bool HasKey(System.Guid modelElementId, System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> servicesToDiscard)
		{
			if( IDList.Contains(modelElementId) )
				return true;
				
			if( ExcludedIDList.Contains(modelElementId) )
				return true;
		
			// extern services
			System.Collections.Generic.List<DslEditorModeling::IDomainModelServices> discard = new System.Collections.Generic.List<DslEditorModeling::IDomainModelServices>();
			discard.AddRange(servicesToDiscard);
			discard.Add(VSPluginDSLDomainModelServices.Instance);

			foreach(DslEditorModeling::IDomainModelServices externService in VSPluginDSLDomainModelExtensionServices.Instance.ExternServices)
			{
				if( discard.Contains(externService) )
					continue;
			
				bool bHasKey = externService.ElementIdProvider.HasKey(modelElementId, discard);
				if( bHasKey )
					return true;
			}
		
			return false;
		}
Exemplo n.º 58
0
		public override System.String[] ListAll()
		{
            System.Collections.Generic.List<string> files = new System.Collections.Generic.List<string>();
            files.AddRange(primaryDir.ListAll());
            files.AddRange(secondaryDir.ListAll());
            return files.ToArray();
		}
Exemplo n.º 59
0
        protected void PaisDestinoExpDropDownList_SelectedIndexChanged(object sender, EventArgs e)
        {
            int auxPV = Convert.ToInt32(((DropDownList)PuntoVtaDropDownList).SelectedValue);
            string idtipo = ((Entidades.Sesion)Session["Sesion"]).UN.PuntosVta.Find(delegate(Entidades.PuntoVta pv)
            {
                return pv.Nro == auxPV;
            }).IdTipoPuntoVta;
            if (!idtipo.Equals("Exportacion"))
            {
                return;
            }
            System.Collections.Generic.List<Entidades.Persona> listacompradores = new List<Entidades.Persona>();
            Codigo_Doc_Identificatorio_CompradorDropDownList.DataValueField = "Codigo";
            Codigo_Doc_Identificatorio_CompradorDropDownList.DataTextField = "Descr";
            if (PaisDestinoExpDropDownList.SelectedItem.Text.ToUpper().Contains("ARGENTINA"))
            {
                if (Funciones.SessionTimeOut(Session))
                {
                    Response.Redirect("~/SessionTimeout.aspx");
                }
                else
                {
                    listacompradores = RN.Persona.ListaSinExportacion(((Entidades.Sesion)Session["Sesion"]).Usuario, ((Entidades.Sesion)Session["Sesion"]), true);
                    Nro_Doc_Identificatorio_CompradorTextBox.Visible = true;
                    Nro_Doc_Identificatorio_CompradorDropDownList.Visible = false;
                    Nro_Doc_Identificatorio_CompradorTextBox.Text = string.Empty;
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.Documentos.Documento.ListaNoExportacion();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUIT().Codigo.ToString();
                }
            }
            else if (PaisDestinoExpDropDownList.SelectedItem.Text.Equals(string.Empty))
            {
                try
                {
                    if (Funciones.SessionTimeOut(Session))
                    {
                        Response.Redirect("~/SessionTimeout.aspx");
                    }
                    else
                    {
                        listacompradores = RN.Persona.ListaExportacion(((Entidades.Sesion)Session["Sesion"]).Usuario, ((Entidades.Sesion)Session["Sesion"]), true);
                        Nro_Doc_Identificatorio_CompradorTextBox.Visible = false;
                        Nro_Doc_Identificatorio_CompradorDropDownList.Visible = true;
                        Nro_Doc_Identificatorio_CompradorDropDownList.DataValueField = "Codigo";
                        Nro_Doc_Identificatorio_CompradorDropDownList.DataTextField = "Descr";
                        Nro_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.DestinosCuit.DestinoCuit.ListaSinInformar();
                        Nro_Doc_Identificatorio_CompradorDropDownList.DataBind();
                        Nro_Doc_Identificatorio_CompradorDropDownList.SelectedIndex = -1;
                        Codigo_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.Documentos.Documento.ListaExportacion();
                        Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
                        Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUITPais().Codigo.ToString();
                    }
                }
                catch
                {
                    if (Funciones.SessionTimeOut(Session))
                    {
                        Response.Redirect("~/SessionTimeout.aspx");
                    }
                    else
                    {
                        listacompradores = RN.Persona.ListaPorCuit(true, Entidades.Enum.TipoPersona.Cliente, ((Entidades.Sesion)Session["Sesion"]));
                        Nro_Doc_Identificatorio_CompradorTextBox.Visible = true;
                        Nro_Doc_Identificatorio_CompradorDropDownList.Visible = false;
                        Nro_Doc_Identificatorio_CompradorTextBox.Text = string.Empty;
                        Codigo_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.Documentos.Documento.Lista();
                        Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
                        Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUIT().Codigo.ToString();
                    }
                }
            }
            else
            {
                if (Funciones.SessionTimeOut(Session))
                {
                    Response.Redirect("~/SessionTimeout.aspx");
                }
                else
                {
                    listacompradores = RN.Persona.ListaExportacion(((Entidades.Sesion)Session["Sesion"]).Usuario, ((Entidades.Sesion)Session["Sesion"]), true);
                    Nro_Doc_Identificatorio_CompradorTextBox.Visible = false;
                    Nro_Doc_Identificatorio_CompradorDropDownList.Visible = true;
                    Nro_Doc_Identificatorio_CompradorDropDownList.DataValueField = "Codigo";
                    Nro_Doc_Identificatorio_CompradorDropDownList.DataTextField = "Descr";
                    Nro_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.DestinosCuit.DestinoCuit.ListaSinInformar();
                    Nro_Doc_Identificatorio_CompradorDropDownList.DataBind();
                    Nro_Doc_Identificatorio_CompradorDropDownList.SelectedIndex = -1;

                    Codigo_Doc_Identificatorio_CompradorDropDownList.Items.Clear();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedIndex = -1;
                    Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = null;
                    Codigo_Doc_Identificatorio_CompradorDropDownList.ClearSelection();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.Documentos.Documento.ListaExportacion();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataValueField = "Codigo";
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataTextField = "Descr";
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUITPais().Codigo.ToString();
                }
            }
            CompradorDropDownList.DataValueField = "ClavePrimaria";
            CompradorDropDownList.DataTextField = "RazonSocial";
            Entidades.Persona persona = new Entidades.Persona();
            System.Collections.Generic.List<Entidades.Persona> personalist = new System.Collections.Generic.List<Entidades.Persona>();
            persona.RazonSocial = "";
            personalist.Add(persona);
            personalist.AddRange(listacompradores);
            CompradorDropDownList.DataSource = personalist;
            CompradorDropDownList.DataBind();
            CompradorDropDownList.SelectedIndex = 0;
            if (CompradorDropDownList.Items.Count > 1)
            {
                CompradorDropDownList.Visible = true;
            }
            else
            {
                CompradorDropDownList.Visible = false;
            }
            Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
            Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedIndex = -1;
            ResetearComprador();
        }
Exemplo n.º 60
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                if (Funciones.SessionTimeOut(Session))
                {
                    Response.Redirect("~/SessionTimeout.aspx");
                }
                else
                {
                    Entidades.Sesion sesion = (Entidades.Sesion)Session["Sesion"];
                    Session.Remove("FaltaCalcularTotales");
                    Entidades.ComprobanteATratar comprobanteATratar = (Entidades.ComprobanteATratar)Session["ComprobanteATratar"];
                    TratamientoTextBox.Text = comprobanteATratar.Tratamiento.ToString();
                    string descrTratamiento = String.Empty;
                    switch (TratamientoTextBox.Text)
                    {
                        case "Alta":
                            descrTratamiento = "Alta";
                            break;
                        case "Clonado":
                            descrTratamiento = "Alta";
                            break;
                        case "Modificacion":
                            descrTratamiento = "Modificación";
                            break;
                    }
                    IdNaturalezaComprobanteTextBox.Text = comprobanteATratar.Comprobante.NaturalezaComprobante.Id;
                    switch (IdNaturalezaComprobanteTextBox.Text)
                    {
                        case "Venta":
                            TituloPaginaLabel.Text = descrTratamiento + " de Comprobante";
                            DatosComprobanteLabel.Text = "COMPROBANTE DE VENTA (electrónica)";
                            if (descrTratamiento == "Alta") ProximoNroComprobanteLinkButton.Visible = true;
                            DatosEmailAvisoComprobanteContratoPanel.Visible = false;
                            break;
                        case "VentaTradic":
                            TituloPaginaLabel.Text = descrTratamiento + " de Comprobante";
                            DatosComprobanteLabel.Text = "COMPROBANTE DE VENTA (tradicional)";
                            DatosEmailAvisoComprobanteContratoPanel.Visible = false;
                            break;
                        case "VentaContrato":
                            TituloPaginaLabel.Text = descrTratamiento + " de Contrato";
                            DatosComprobanteLabel.Text = "COMPROBANTE DE VENTA (electrónica)";
                            NumeroDeLabel.Text = "Número de contrato";
                            break;
                        case "Compra":
                            TituloPaginaLabel.Text = descrTratamiento + " de Comprobante";
                            DatosComprobanteLabel.Text = "COMPROBANTE DE COMPRA";
                            DatosEmailAvisoComprobanteContratoPanel.Visible = false;
                            break;
                        default:
                            DatosComprobanteLabel.Text = "<<< NATURALEZA y TRATAMIENTO DEL COMPROBANTE DESCONOCIDOS >>>";
                            break;
                    }

                    //referencias = new System.Collections.Generic.List<FeaEntidades.InterFacturas.informacion_comprobanteReferencias>();
                    //FeaEntidades.InterFacturas.informacion_comprobanteReferencias referencia = new FeaEntidades.InterFacturas.informacion_comprobanteReferencias();
                    //referencias.Add(referencia);
                    //referenciasGridView.DataSource = referencias;
                    //referenciasGridView.DataBind();
                    //ViewState["referencias"] = referencias;

                    //VENDEDOR
                    Condicion_IVA_VendedorDropDownList.DataValueField = "Codigo";
                    Condicion_IVA_VendedorDropDownList.DataTextField = "Descr";
                    Condicion_IVA_VendedorDropDownList.DataSource = FeaEntidades.CondicionesIVA.CondicionIVA.Lista();
                    Condicion_IVA_VendedorDropDownList.DataBind();
                    Condicion_Ingresos_Brutos_VendedorDropDownList.DataValueField = "Codigo";
                    Condicion_Ingresos_Brutos_VendedorDropDownList.DataTextField = "Descr";
                    Condicion_Ingresos_Brutos_VendedorDropDownList.DataSource = FeaEntidades.CondicionesIB.CondicionIB.Lista();
                    Condicion_Ingresos_Brutos_VendedorDropDownList.DataBind();
                    Provincia_VendedorDropDownList.DataValueField = "Codigo";
                    Provincia_VendedorDropDownList.DataTextField = "Descr";
                    Provincia_VendedorDropDownList.DataSource = FeaEntidades.CodigosProvincia.CodigoProvincia.Lista();
                    Provincia_VendedorDropDownList.DataBind();

                    //COMPRADOR
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataValueField = "Codigo";
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataTextField = "Descr";
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataSource = FeaEntidades.Documentos.Documento.Lista();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.DataBind();
                    Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUIT().Codigo.ToString();
                    Condicion_IVA_CompradorDropDownList.DataValueField = "Codigo";
                    Condicion_IVA_CompradorDropDownList.DataTextField = "Descr";
                    Condicion_IVA_CompradorDropDownList.DataSource = FeaEntidades.CondicionesIVA.CondicionIVA.Lista();
                    Condicion_IVA_CompradorDropDownList.DataBind();
                    Provincia_CompradorDropDownList.DataValueField = "Codigo";
                    Provincia_CompradorDropDownList.DataTextField = "Descr";
                    Provincia_CompradorDropDownList.DataSource = FeaEntidades.CodigosProvincia.CodigoProvincia.Lista();
                    Provincia_CompradorDropDownList.DataBind();

                    //COMPROBANTE
                    if (IdNaturalezaComprobanteTextBox.Text.IndexOf("Venta") != -1)
                    {
                        Tipo_De_ComprobanteDropDownList.DataValueField = "Codigo";
                        Tipo_De_ComprobanteDropDownList.DataTextField = "Descr";
                        Tipo_De_ComprobanteDropDownList.DataSource = FeaEntidades.TiposDeComprobantes.TipoComprobante.ListaCompletaAFIP();
                        Tipo_De_ComprobanteDropDownList.DataBind();
                    }
                    else
                    {
                        Tipo_De_ComprobanteDropDownList.DataValueField = "Codigo";
                        Tipo_De_ComprobanteDropDownList.DataTextField = "DescrCompleta";
                        Tipo_De_ComprobanteDropDownList.DataSource = FeaEntidades.TiposDeComprobantes.TipoComprobante.ListaCompletaAFIPCompras();
                        Tipo_De_ComprobanteDropDownList.DataBind();
                    }
                    CodigoOperacionDropDownList.DataValueField = "Codigo";
                    CodigoOperacionDropDownList.DataTextField = "Descr";
                    CodigoOperacionDropDownList.DataSource = FeaEntidades.CodigosOperacion.CodigoOperacion.Lista();
                    CodigoOperacionDropDownList.DataBind();
                    IVAcomputableDropDownList.DataValueField = "Codigo";
                    IVAcomputableDropDownList.DataTextField = "Descr";
                    IVAcomputableDropDownList.DataSource = FeaEntidades.Dicotomicos.Dicotomico.Lista();
                    IVAcomputableDropDownList.DataBind();
                    MonedaComprobanteDropDownList.DataValueField = "Codigo";
                    MonedaComprobanteDropDownList.DataTextField = "Descr";
                    MonedaComprobanteDropDownList.DataSource = FeaEntidades.CodigosMoneda.CodigoMoneda.ListaNoExportacion();
                    MonedaComprobanteDropDownList.DataBind();

                    //EXPORTACION
                    TipoExpDropDownList.DataValueField = "Codigo";
                    TipoExpDropDownList.DataTextField = "Descr";
                    TipoExpDropDownList.DataSource = FeaEntidades.TiposExportacion.TipoExportacion.ListaSinInformar();
                    TipoExpDropDownList.DataBind();
                    IdiomaDropDownList.DataValueField = "Codigo";
                    IdiomaDropDownList.DataTextField = "Descr";
                    IdiomaDropDownList.DataSource = FeaEntidades.Idiomas.Idioma.ListaSinInformar();
                    IdiomaDropDownList.DataBind();
                    PaisDestinoExpDropDownList.DataValueField = "Codigo";
                    PaisDestinoExpDropDownList.DataTextField = "Descr";
                    PaisDestinoExpDropDownList.DataSource = FeaEntidades.DestinosPais.DestinoPais.ListaSinInformar();
                    PaisDestinoExpDropDownList.DataBind();
                    IncotermsDropDownList.DataValueField = "Codigo";
                    IncotermsDropDownList.DataTextField = "Descr";
                    IncotermsDropDownList.DataSource = FeaEntidades.Incoterms.Incoterm.ListaSinInformar();
                    IncotermsDropDownList.DataBind();
                    CodigoConceptoDropDownList.DataValueField = "Codigo";
                    CodigoConceptoDropDownList.DataTextField = "Descr";
                    CodigoConceptoDropDownList.DataSource = FeaEntidades.CodigosConcepto.CodigosConcepto.Lista();
                    CodigoConceptoDropDownList.DataBind();

                    //DETALLE DE ARTÍCULOS / SERVICIOS
                    DetalleLinea.IdNaturalezaComprobante = IdNaturalezaComprobanteTextBox.Text;

                    //DATOS DE EMISIÓN
                    PeriodicidadEmisionDropDownList.DataValueField = "Id";
                    PeriodicidadEmisionDropDownList.DataTextField = "Descr";
                    PeriodicidadEmisionDropDownList.DataSource = RN.PeriodicidadEmision.Lista(IdNaturalezaComprobanteTextBox.Text == "VentaContrato");
                    PeriodicidadEmisionDropDownList.DataBind();
                    PeriodicidadEmisionDropDownList.SelectedIndex = 0;
                    IdDestinoComprobanteDropDownList.DataValueField = "Id";
                    IdDestinoComprobanteDropDownList.DataTextField = "Descr";
                    IdDestinoComprobanteDropDownList.DataSource = sesion.Cuit.DestinosComprobante();
                    IdDestinoComprobanteDropDownList.DataBind();
                    IdDestinoComprobanteDropDownList.SelectedIndex = 0;

                    if (IdNaturalezaComprobanteTextBox.Text.IndexOf("Venta") != -1)
                    {
                        #region Personalización campos vendedor y comprador para VENTAS
                        //VendedorUpdatePanel.Visible = false;
                        pBody.Enabled = false;
                        switch (IdNaturalezaComprobanteTextBox.Text)
                        {
                            case "Venta":
                                ComprobantePanel.Visible = false;
                                if (TratamientoTextBox.Text == "Clonado" || TratamientoTextBox.Text == "Modificacion")
                                {
                                    UtilizarComprobantePreexistentePanel.Visible = false;
                                }
                                DatosEmisionPanel.Visible = false;
                                FechaProximaEmisionDatePickerWebUserControl.Text = new DateTime(9999, 12, 31).ToString("yyyyMMdd");
                                break;
                            case "VentaTradic":
                                UtilizarComprobantePreexistentePanel.Visible = false;
                                LoteUpdatePanel.Visible = false;
                                Id_LoteTextbox.Text = "1";
                                AFIPpanel.Visible = false;
                                InterfacturasOnLinePanel.Visible = false;
                                InterfacturasArchivoXMLpanel.Visible = false;
                                PrevisualizacionComprobantePanel.Visible = false;
                                DatosEmisionPanel.Visible = false;
                                FechaProximaEmisionDatePickerWebUserControl.Text = new DateTime(9999, 12, 31).ToString("yyyyMMdd");
                                break;
                            case "VentaContrato":
                                UtilizarComprobantePreexistentePanel.Visible = false;
                                LoteUpdatePanel.Visible = false;
                                Id_LoteTextbox.Text = "1";
                                AFIPpanel.Visible = false;
                                InterfacturasOnLinePanel.Visible = false;
                                InterfacturasArchivoXMLpanel.Visible = false;
                                PrevisualizacionComprobantePanel.Visible = false;
                                CAEPanel.Visible = false;
                                FechaEmisionDatePickerWebUserControl.Text = DateTime.Today.ToString("yyyyMMdd");
                                FechaProximaEmisionDatePickerWebUserControl.Text = DateTime.Today.ToString("yyyyMMdd");
                                CodigoConceptoDropDownList.SelectedValue = new FeaEntidades.CodigosConcepto.Servicios().Codigo.ToString();
                                FechaEmisionLabel.Text = "Fecha de alta:";
                                break;
                        }
                        if (sesion.Usuario.Id != null)
                        {
                            //Email_VendedorRequiredFieldValidator.Enabled = false;
                            EnviarXMLporMailButton.ToolTip = "se enviará, al vendedor, a " + ((Entidades.Sesion)Session["Sesion"]).Usuario.Email;
                            CompradorDropDownList.Enabled = true;
                        }
                        if (sesion.Cuit.Nro != null && sesion.Cuit.Nro != "")
                        {
                            Entidades.Cuit v = ((Entidades.Sesion)Session["Sesion"]).Cuit;
                            Cuit_VendedorTextBox.Text = v.Nro.ToString();
                            Razon_Social_VendedorTextBox.Text = v.RazonSocial;

                            Domicilio_Calle_VendedorTextBox.Text = v.Domicilio.Calle;
                            Domicilio_Numero_VendedorTextBox.Text = v.Domicilio.Nro;
                            Domicilio_Piso_VendedorTextBox.Text = v.Domicilio.Piso;
                            Domicilio_Depto_VendedorTextBox.Text = v.Domicilio.Depto;
                            Domicilio_Sector_VendedorTextBox.Text = v.Domicilio.Sector;
                            Domicilio_Torre_VendedorTextBox.Text = v.Domicilio.Torre;
                            Domicilio_Manzana_VendedorTextBox.Text = v.Domicilio.Manzana;
                            Localidad_VendedorTextBox.Text = v.Domicilio.Localidad;
                            Provincia_VendedorDropDownList.SelectedValue = v.Domicilio.Provincia.Id;
                            Cp_VendedorTextBox.Text = v.Domicilio.CodPost;
                            Contacto_VendedorTextBox.Text = v.Contacto.Nombre;
                            Email_VendedorTextBox.Text = v.Contacto.Email;
                            Telefono_VendedorTextBox.Text = v.Contacto.Telefono.ToString();
                            Condicion_IVA_VendedorDropDownList.SelectedValue = v.DatosImpositivos.IdCondIVA.ToString();
                            NroIBVendedorTextBox.Text = v.DatosImpositivos.NroIngBrutos.ToString();
                            Condicion_Ingresos_Brutos_VendedorDropDownList.SelectedValue = v.DatosImpositivos.IdCondIngBrutos.ToString();
                            if (!v.DatosIdentificatorios.GLN.ToString().Equals("0"))
                            {
                                GLN_VendedorTextBox.Text = v.DatosIdentificatorios.GLN.ToString();
                            }
                            Codigo_Interno_VendedorTextBox.Text = v.DatosIdentificatorios.CodigoInterno;
                            InicioDeActividadesVendedorDatePickerWebUserControl.Text = v.DatosImpositivos.FechaInicioActividades.ToString("yyyyMMdd");
                        }
                        System.Collections.Generic.List<Entidades.Persona> listacompradores = ((Entidades.Sesion)Session["Sesion"]).ClientesDelCuit;
                        if (listacompradores.Count > 0)
                        {
                            CompradorDropDownList.Visible = true;
                            CompradorDropDownList.DataValueField = "ClavePrimaria";
                            CompradorDropDownList.DataTextField = "RazonSocial";
                            Entidades.Persona persona = new Entidades.Persona();
                            System.Collections.Generic.List<Entidades.Persona> personalist = new System.Collections.Generic.List<Entidades.Persona>();
                            persona.RazonSocial = "";
                            personalist.Add(persona);
                            personalist.AddRange(listacompradores);
                            CompradorDropDownList.DataSource = personalist;
                            CompradorDropDownList.DataBind();
                        }
                        else
                        {
                            CompradorDropDownList.Visible = false;
                            CompradorDropDownList.DataSource = null;
                        }
                        PuntoVtaDropDownList.Enabled = true;
                        System.Collections.Generic.List<Entidades.PuntoVta> listaPuntoVta = ((Entidades.Sesion)Session["Sesion"]).UN.PuntosVtaVigentes;
                        PuntoVtaDropDownList.Visible = true;
                        PuntoVtaDropDownList.DataValueField = "Nro";
                        PuntoVtaDropDownList.DataTextField = "Descr";
                        PuntoVtaDropDownList.DataSource = listaPuntoVta;
                        PuntoVtaDropDownList.DataBind();
                        PuntoVtaDropDownList_SelectedIndexChanged(PuntoVtaDropDownList, new EventArgs());

                        VerificarDatosVendedorDelPuntoVta();
                        #endregion
                    }
                    else
                    {
                        #region Personalización campos vendedor y comprador para COMPRAS
                        CollapsiblePanelExtenderVendedor.Collapsed = false;
                        UtilizarComprobantePreexistentePanel.Visible = false;
                        PuntoVtaDropDownList.Visible = false;
                        PuntoVtaTextBox.Visible = true;
                        LoteUpdatePanel.Visible = false;
                        Id_LoteTextbox.Text = "1";
                        compradorUpdatePanel.Visible = false;
                        ReferenciasPanel.Visible = false;
                        ExportacionPanel.Visible = false;
                        DatosComerciales.Visible = false;
                        AFIPpanel.Visible = false;
                        InterfacturasOnLinePanel.Visible = false;
                        InterfacturasArchivoXMLpanel.Visible = false;
                        PrevisualizacionComprobantePanel.Visible = false;
                        VendedorDropDownList.Enabled = true;
                        DatosEmisionPanel.Visible = false;
                        FechaProximaEmisionDatePickerWebUserControl.Text = new DateTime(9999, 12, 31).ToString("yyyyMMdd");
                        if (sesion.Cuit.Nro != null && sesion.Cuit.Nro != "")
                        {
                            Entidades.Cuit v = ((Entidades.Sesion)Session["Sesion"]).Cuit;
                            Denominacion_CompradorTextBox.Text = v.RazonSocial;
                            Domicilio_Calle_CompradorTextBox.Text = v.Domicilio.Calle;
                            Domicilio_Numero_CompradorTextBox.Text = v.Domicilio.Nro;
                            Domicilio_Piso_CompradorTextBox.Text = v.Domicilio.Piso;
                            Domicilio_Depto_CompradorTextBox.Text = v.Domicilio.Depto;
                            Domicilio_Sector_CompradorTextBox.Text = v.Domicilio.Sector;
                            Domicilio_Torre_CompradorTextBox.Text = v.Domicilio.Torre;
                            Domicilio_Manzana_CompradorTextBox.Text = v.Domicilio.Manzana;
                            Localidad_CompradorTextBox.Text = v.Domicilio.Localidad;
                            Provincia_CompradorDropDownList.SelectedValue = v.Domicilio.Provincia.Id;
                            Cp_CompradorTextBox.Text = v.Domicilio.CodPost;
                            Contacto_CompradorTextBox.Text = v.Contacto.Nombre;
                            Email_CompradorTextBox.Text = v.Contacto.Email;
                            Telefono_CompradorTextBox.Text = v.Contacto.Telefono.ToString();
                            Codigo_Doc_Identificatorio_CompradorDropDownList.SelectedValue = new FeaEntidades.Documentos.CUIT().Codigo.ToString();
                            Nro_Doc_Identificatorio_CompradorTextBox.Text = v.Nro.ToString();
                            Condicion_IVA_CompradorDropDownList.SelectedValue = v.DatosImpositivos.IdCondIVA.ToString();
                            if (!v.DatosIdentificatorios.GLN.ToString().Equals("0"))
                            {
                                GLN_CompradorTextBox.Text = v.DatosIdentificatorios.GLN.ToString();
                            }
                            Codigo_Interno_CompradorTextBox.Text = v.DatosIdentificatorios.CodigoInterno;
                            InicioDeActividadesCompradorDatePickerWebUserControl.Text = v.DatosImpositivos.FechaInicioActividades.ToString("yyyyMMdd");
                        }
                        System.Collections.Generic.List<Entidades.Persona> listavendedores = ((Entidades.Sesion)Session["Sesion"]).ProveedoresDelCuit;
                        if (listavendedores.Count > 0)
                        {
                            VendedorDropDownList.Visible = true;
                            VendedorDropDownList.DataValueField = "ClavePrimaria";
                            VendedorDropDownList.DataTextField = "RazonSocialeIdPersona";
                            Entidades.Persona persona = new Entidades.Persona();
                            System.Collections.Generic.List<Entidades.Persona> personalist = new System.Collections.Generic.List<Entidades.Persona>();
                            persona.RazonSocial = "";
                            personalist.Add(persona);
                            personalist.AddRange(listavendedores);
                            VendedorDropDownList.DataSource = personalist;
                            VendedorDropDownList.DataBind();
                        }
                        else
                        {
                            VendedorDropDownList.Visible = false;
                            VendedorDropDownList.DataSource = null;
                        }
                        //Hacer algo con el punto de venta
                        #endregion
                    }

                    BindearDropDownLists();

                    MonedaComprobanteDropDownList.Enabled = true;

                    Numero_ComprobanteTextBox.Attributes.Add("autocomplete", "off");

                    try
                    {
                        //Tratamiento de clonado y modificación
                        if (comprobanteATratar.Tratamiento != Entidades.Enum.TratamientoComprobante.Alta)
                        {
                            FeaEntidades.InterFacturas.lote_comprobantes lote = new FeaEntidades.InterFacturas.lote_comprobantes();
                            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(lote.GetType());
                            byte[] bytes = new byte[comprobanteATratar.Comprobante.Request.Length * sizeof(char)];
                            System.Buffer.BlockCopy(comprobanteATratar.Comprobante.Request.ToCharArray(), 0, bytes, 0, bytes.Length);
                            System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
                            ms.Seek(0, System.IO.SeekOrigin.Begin);
                            lote = (FeaEntidades.InterFacturas.lote_comprobantes)x.Deserialize(ms);
                            if (lote != null)
                            {
                                LlenarCampos(lote, comprobanteATratar);
                                if (comprobanteATratar.Tratamiento == Entidades.Enum.TratamientoComprobante.Clonado) BorrarCamposNoClonables();
                            }

                            if (IdNaturalezaComprobanteTextBox.Text == "Venta" || IdNaturalezaComprobanteTextBox.Text == "VentaTradic")
                            {
                                //Informar datos actualizados del cuit.
                                VerificarDatosVendedorDelPuntoVta();

                                //Informar datos actualizados del cliente.
                                //System.Collections.Generic.List<Entidades.Persona> listaP = sesion.ClientesDelCuit.FindAll(delegate(Entidades.Persona p)
                                //{
                                //    return p.Cuit == Nro_Doc_Identificatorio_CompradorTextBox.Text && p.IdPersona == IdPersonaCompradorTextBox.Text;
                                //});
                                //if (listaP.Count != 0)
                                //{
                                //    //Denominacion_CompradorTextBox.Text = listaP[0].RazonSocial;
                                //}
                            }
                        }
                    }
                    catch
                    {
                    }

                    AyudaFechaEmisionCalcular();

                    DescargarPDFPanel.Visible = false;
                    DescargarPDFButton.Visible = true;
                    ActualizarEstadoPanel.Visible = false;
                    ActualizarEstadoButton.Visible = true;
                }
            }
        }