コード例 #1
3
ファイル: Tests.cs プロジェクト: IntranetFactory/ndjango
        public IEnumerable<StringTest> smart_split_tests()
        {
            System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>();
            result.Add(new StringTest("smart split-01",
                @"This is ""a person\'s"" test.",
                new string[] { "This", "is", @"""a person\'s""", "test." }
            ));

            result.Add(new StringTest("smart split-02",
                @"Another 'person\'s' test.",
                new string[] { "Another", @"'person's'", "test." }
            ));

            result.Add(new StringTest("smart split-03",
                "A \"\\\"funky\\\" style\" test.",
                new string[] { "A", "\"\"funky\" style\"", "test." }
            ));

            result.Add(new StringTest("smart split-04",
                @"A '\'funky\' style' test.",
                new string[] { "A", @"''funky' style'", "test." }
            ));

            return result;
        }
コード例 #2
2
 public override ObjectWithId SaveChanges(bool updateTree)
 {
     DebtActionStatusContent content = new DebtActionStatusContent();
     System.Collections.Generic.List<FasetItem> list = (System.Collections.Generic.List<FasetItem>) this.bsAllActionStatusContents.get_DataSource();
     System.Collections.Generic.List<FasetItem> list2 = (System.Collections.Generic.List<FasetItem>) this.bsAvailableActionStatusContents.get_DataSource();
     System.Collections.Generic.List<FasetItem> list3 = new System.Collections.Generic.List<FasetItem>();
     this.fillStatusContent();
     foreach (FasetItem item in this.availableStatusContent)
     {
         foreach (FasetItem item2 in list2)
         {
             if (item.Id == item2.Id)
             {
                 list3.Add(item);
             }
         }
     }
     foreach (FasetItem item3 in this.availableStatusContent)
     {
         list.Remove(item3);
     }
     foreach (FasetItem item4 in list)
     {
         content.DebtActionStatusId = (int) ((int) this.status.Id);
         content.StatusId = item4.Id;
         content.Created = System.DateTime.Now;
         content.Insert();
     }
     foreach (FasetItem item5 in list3)
     {
         content.Id = content.FindByDebtActionStatusIdAndDebtActionStatusId((int) ((int) this.status.Id), item5.Id).Id;
         content.Delete();
     }
     return content;
 }
コード例 #3
2
        public System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> GetGroupedRelatedItems(AccountItem itemCompareTo, bool searchingOnlyCurrentMonthData = true, System.Action<AccountItem> itemAdded = null)
        {
            System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel> list = new System.Collections.Generic.List<GroupByCreateTimeAccountItemViewModel>();
            IOrderedEnumerable<AccountItem> source = from p in this.GetRelatedItems(itemCompareTo, searchingOnlyCurrentMonthData)
                                                     orderby p.CreateTime descending
                                                     select p;
            if (itemAdded == null)
            {
                itemAdded = delegate(AccountItem ai)
                {
                };
            }

            var dates = (from p in source select p.CreateTime.Date).Distinct<System.DateTime>();

            foreach (var item in dates)
            {
                GroupByCreateTimeAccountItemViewModel agvm = new GroupByCreateTimeAccountItemViewModel(item);

                source.Where(p => p.CreateTime.Date == item.Date).ToList<AccountItem>().ForEach(delegate(AccountItem x)
                {
                    agvm.Add(x);
                    itemAdded(x);
                });
                list.Add(agvm);
            }

            return list;
        }
コード例 #4
0
        public void CreateCallHistoryDetailsTable()
        {
            if (CheckTableExists(TABLE_CALL_HISTORY_DETAILS))
            {
                Console.WriteLine(TABLE_CALL_HISTORY_DETAILS + " table already exists");
                return;
            }

            try
            {
                List<AttributeDefinition> lstAttribDefinitions = new System.Collections.Generic.List<AttributeDefinition>();
                List<KeySchemaElement> lstSchemaElements = new List<KeySchemaElement>();
                ProvisionedThroughput throughput = new ProvisionedThroughput() { ReadCapacityUnits = 10, WriteCapacityUnits = 5 };

                lstAttribDefinitions.Add(new AttributeDefinition { AttributeName = "CallHistoryDetailsId", AttributeType = ScalarAttributeType.N });
                lstAttribDefinitions.Add(new AttributeDefinition { AttributeName = "UCID", AttributeType = ScalarAttributeType.N });

                lstSchemaElements.Add(new KeySchemaElement() { AttributeName = "UCID", KeyType = "HASH" });
                lstSchemaElements.Add(new KeySchemaElement() { AttributeName = "CallHistoryDetailsId", KeyType = "RANGE" });

                CreateTableRequest tbRequest = new CreateTableRequest(TABLE_CALL_HISTORY_DETAILS, lstSchemaElements, lstAttribDefinitions, throughput);

                var response = _client.CreateTable(tbRequest);

                WaitUntilTableReady(TABLE_CALL_HISTORY);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.StackTrace);
            }
        }
コード例 #5
0
        public void QualifyTest_ShouldReturnListOfClassifyResult_thatNotContainResultWithPropabilityUnderLimit()
        {
            List<ClassifyResult> inputList = new System.Collections.Generic.List<ClassifyResult>();
            ClassifyResult result1 = new ClassifyResult()
            {
                Propability = 0.51,
                Result = "Italian"
            };
            ClassifyResult result2 = new ClassifyResult()
            {
                Propability = 0.04,
                Result = "cafe"
            };
            ClassifyResult result3 = new ClassifyResult()
            {
                Propability = 1,
                Result = "falafel"
            };
            inputList.Add(result1);
            inputList.Add(result2);
            inputList.Add(result3);

            //Act
            var qualityClass = new ClassificationQualityFilter(inputList);
            var qualifiedList = qualityClass.Qualify();

            //Assert
            Assert.IsNotNull(qualifiedList);
            Assert.IsFalse(qualifiedList.Any(r => r.Propability <= 0.5));
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: ststeiger/Svg3Dtest
        private void Generate3dObject()
        {
            double[] frontLeftBottom = new double[] {0,0,0 };
            double[] frontRightBottom = new double[] {1,0,0 };
            double[] frontLeftTop = new double[] {0,0,1 };
            double[] frontRightTop = new double[] { 1,0,1};

            double[] backLeftBottom = new double[] { 0,1,0};
            double[] backRightBottom = new double[] { 1,1,0};
            double[] backLeftTop = new double[] {0,1,1 };
            double[] backRightTop = new double[] { 1,1,1};

            System.Collections.Generic.List<line> ls = new System.Collections.Generic.List<line>();
            ls.Add(new line(frontLeftBottom, frontRightBottom));
            ls.Add(new line(frontLeftBottom, frontLeftTop));
            ls.Add(new line(frontLeftTop, frontRightTop));
            ls.Add(new line(frontRightBottom, frontRightTop));

            double[] cameraPosition = new double[] { 0.5, -1, 0.5 };
            double cameraRotation = 0.0;

            double[][] cameraMatrixx = MatrixExtensions.UnityMatrix(3);

            double[] point = frontLeftBottom;
            double[] vec = MatrixExtensions.VectorSubtract(point, cameraPosition);
            double[] newPoint = MatrixExtensions.MatrixProduct(cameraMatrixx, vec);

            bmp = new System.Drawing.Bitmap(100, 100);
            using (System.Drawing.Graphics gfx = System.Drawing.Graphics.FromImage(bmp))
            {
                gfx.DrawRectangle(System.Drawing.Pens.Red, 10, 10, 50, 50);
            }

            this.pictureBox1.Image = bmp;
        }
コード例 #7
0
ファイル: Tests.cs プロジェクト: IntranetFactory/ndjango
        public IEnumerable<StringTest> split_token_tests()
        {
            System.Collections.Generic.List<StringTest> result = new System.Collections.Generic.List<StringTest>();
            result.Add(new StringTest("split token-01",
                @"This is _(""a person\'s"") test.",
                new string[] { "This", "is", @"_(""a person\'s"")", "test." }
            ));

            result.Add(new StringTest("split token-02",
                @"Another 'person\'s' test.",
                new string[] { "Another", @"'person's'", "test." }
            ));

            result.Add(new StringTest("split token-03",
                "A \"\\\"funky\\\" style\" test.",
                new string[] { "A", "\"\"funky\" style\"", "test." }
            ));
            /*
            result.Add(new StringTest("split token-04",
                "This is _(\"a person's\" test).",
                new string[] { "This", "is", "\"a person's\" test)." }
            ));
            // */
            return result;
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Microsoft.Reporting.WebForms.ReportViewer rview = new Microsoft.Reporting.WebForms.ReportViewer();
            rview.ServerReport.ReportServerUrl = new Uri(WebConfigurationManager.AppSettings["ReportServer"]);

            System.Collections.Generic.List<Microsoft.Reporting.WebForms.ReportParameter> paramList = new System.Collections.Generic.List<ReportParameter>();
            paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter("Param1", "Value1"));
            paramList.Add(new Microsoft.Reporting.WebForms.ReportParameter("Param2", "Value2"));

            rview.ServerReport.ReportPath = "/FlamingoSSRSReports/CustomerwiseInquiryReport";
            rview.ServerReport.SetParameters(paramList);

            string mimeType, encoding, extension, deviceInfo;
            string[] streamids;
            Microsoft.Reporting.WebForms.Warning[] warnings;

            string format = "Excel";

            deviceInfo = "<DeviceInfo>" + "<Head1>True</Head1>" + "</DeviceInfo>";
            byte[] bytes = rview.ServerReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);
            Response.Clear();

            Response.ContentType = "application/excel";
            Response.AddHeader("Content-disposition", "filename=output.xls");

            Response.OutputStream.Write(bytes, 0, bytes.Length);
            Response.OutputStream.Flush();
            Response.OutputStream.Close();
            Response.Flush();
            Response.Close();
        }
コード例 #9
0
 public System.Collections.Generic.List<DataFeed> GetDataFeed(PricingLibrary.FinancialProducts.IOption option, System.DateTime fromDate)
 {
     System.Collections.Generic.List<DataFeed> result = new System.Collections.Generic.List<DataFeed>() ;
     using (DataBaseDataContext mtdc = new DataBaseDataContext())
     {
         var result1 = (from s in mtdc.HistoricalShareValues where ((option.UnderlyingShareIds.Contains(s.id)) && (s.date >= fromDate)&&(s.date<=option.Maturity)) select s).OrderByDescending(d => d.date).ToList();
         System.DateTime curentdate = result1[result1.Count() - 1].date;
         System.Collections.Generic.Dictionary<String, decimal> priceList = new System.Collections.Generic.Dictionary<String, decimal>();
         for (int i = result1.Count() - 1; i >= 0 ; i--)
         {
             if (result1[i].date==curentdate)
             {
                 priceList.Add(result1[i].id.Trim(), result1[i].value);
             }
             else
             {
                 DataFeed datafeed = new DataFeed(curentdate, priceList);
                 result.Add(datafeed);
                 curentdate = result1[i].date;
                 priceList = new System.Collections.Generic.Dictionary<String, decimal>();
                 priceList.Add(result1[i].id.Trim(), result1[i].value);
             }
             if (i == 0)
             {
                 DataFeed datafeedOut = new DataFeed(curentdate, priceList);
                 result.Add(datafeedOut);
             }
         }
         return result;
     }
 }
コード例 #10
0
        /// <summary>
        /// Gets searchable elements as specified by search source enumeration.
        /// </summary>
        /// <param name="store">Store.</param>
        /// <param name="source">Search source.</param>
        /// <returns>List of searchable elements.</returns>
        public virtual List<ModelElement> GetSearchableElements(DomainModelStore store, SearchSourceEnum source)
        {
            System.Collections.Generic.List<ModelElement> elements = new System.Collections.Generic.List<ModelElement>();
            if( source == SearchSourceEnum.Elements || source == SearchSourceEnum.ElementsAndReferenceRelationships )
            {
                    foreach (DomainModelElement modelElement in store.ElementDirectory.FindElements<DomainModelElement>())
                    {
                        if (IsElementIncludedInDomainTree(store, modelElement.GetDomainClassId()))
                            elements.Add(modelElement);
                    }
            }
            if (source == SearchSourceEnum.ReferenceRelationships || source == SearchSourceEnum.ElementsAndReferenceRelationships)
            {
                foreach (DomainModelLink modelElement in store.ElementDirectory.FindElements<DomainModelLink>())
                {
                    if (modelElement.IsEmbedding)
                        continue;

                    DomainClassInfo info = modelElement.GetDomainClass();
                    if (IsLinkIncludedInDomainTree(store, info.Id))
                        elements.Add(modelElement);
                }
            }

            return elements;
        }
コード例 #11
0
		public void TestMercator_1SP_Projection()
		{
			CoordinateSystemFactory cFac = new SharpMap.CoordinateSystems.CoordinateSystemFactory();

			IEllipsoid ellipsoid = cFac.CreateFlattenedSphere("Bessel 1840", 6377397.155, 299.15281, LinearUnit.Metre);

			IHorizontalDatum datum = cFac.CreateHorizontalDatum("Bessel 1840", DatumType.HD_Geocentric, ellipsoid, null);
			IGeographicCoordinateSystem gcs = cFac.CreateGeographicCoordinateSystem("Bessel 1840", AngularUnit.Degrees, datum,
				PrimeMeridian.Greenwich, new AxisInfo("Lon", AxisOrientationEnum.East),
				new AxisInfo("Lat", AxisOrientationEnum.North));
			System.Collections.Generic.List<ProjectionParameter> parameters = new System.Collections.Generic.List<ProjectionParameter>(5);
			parameters.Add(new ProjectionParameter("latitude_of_origin", 0));
			parameters.Add(new ProjectionParameter("central_meridian", 110));
			parameters.Add(new ProjectionParameter("scale_factor", 0.997));
			parameters.Add(new ProjectionParameter("false_easting", 3900000));
			parameters.Add(new ProjectionParameter("false_northing", 900000));
			IProjection projection = cFac.CreateProjection("Mercator_1SP", "Mercator_1SP", parameters);

			IProjectedCoordinateSystem coordsys = cFac.CreateProjectedCoordinateSystem("Makassar / NEIEZ", gcs, projection, LinearUnit.Metre, new AxisInfo("East", AxisOrientationEnum.East), new AxisInfo("North", AxisOrientationEnum.North));

			ICoordinateTransformation trans = new CoordinateTransformationFactory().CreateFromCoordinateSystems(gcs, coordsys);

			double[] pGeo = new double[] { 120, -3 };
			double[] pUtm = trans.MathTransform.Transform(pGeo);
			double[] pGeo2 = trans.MathTransform.Inverse().Transform(pUtm);

			double[] expected = new double[] { 5009726.58, 569150.82 };
			Assert.IsTrue(ToleranceLessThan(pUtm, expected, 0.02), String.Format("Mercator_1SP forward transformation outside tolerance, Expected {0}, got {1}", expected.ToString(), pUtm.ToString()));
			Assert.IsTrue(ToleranceLessThan(pGeo, pGeo2, 0.0000001), String.Format("Mercator_1SP reverse transformation outside tolerance, Expected {0}, got {1}", pGeo.ToString(), pGeo2.ToString()));
		}
コード例 #12
0
 public System.Collections.Generic.List<string> showHints(string prefixText)
 {
     System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
     list.Add("a");
     list.Add("aaa");
     list.Add("aaaa");
     return list;
 }
コード例 #13
0
ファイル: KickCommand.cs プロジェクト: balu92/Fougerite
 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     string str = "";
     for (int i = 0; i < ChatArguments.Length; i++)
     {
         str = str + ChatArguments[i] + " ";
     }
     str = str.Trim();
     if ((ChatArguments == null) && !(str == ""))
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Kick Usage:  /kick \"playerName\"");
     }
     else if (str != "")
     {
         System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
         list.Add("Cancel");
         foreach (PlayerClient client in PlayerClient.All)
         {
             if (client.netUser.displayName.ToLower().Contains(str.ToLower()))
             {
                 if (client.netUser.displayName.ToLower() == str.ToLower())
                 {
                     if (Arguments.argUser.userID == client.userID)
                     {
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You can't kick yourself.");
                     }
                     else if (Administrator.IsAdmin(client.userID) && !Administrator.GetAdmin(Arguments.argUser.userID).HasPermission("RCON"))
                     {
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You cannot kick an administrator!");
                     }
                     else
                     {
                         Core.kickWaitList.Remove(Arguments.argUser.userID);
                         Administrator.NotifyAdmins(client.netUser.displayName + " has been kicked.");
                         client.netUser.Kick(NetError.Facepunch_Kick_Violation, true);
                     }
                     return;
                 }
                 list.Add(client.netUser.displayName);
             }
         }
         if (list.Count != 1)
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: ");
             for (int j = 1; j < list.Count; j++)
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, j + " - " + list[j]);
             }
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel");
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you were looking for.");
             Core.kickWaitList.Add(Arguments.argUser.userID, list);
         }
         else
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
         }
     }
 }
コード例 #14
0
ファイル: TeleportToCommand.cs プロジェクト: balu92/Fougerite
 public override void Execute(ConsoleSystem.Arg Arguments, string[] ChatArguments)
 {
     if (ChatArguments == null)
     {
         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage:  /tpto \"playerName\"");
     }
     else
     {
         string str = "";
         for (int i = 0; i < ChatArguments.Length; i++)
         {
             str = str + ChatArguments[i] + " ";
         }
         str = str.Trim();
         if (!(str != ""))
         {
             Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Teleport Usage:  /tphere \"playerName\"");
         }
         else
         {
             System.Collections.Generic.List<string> list = new System.Collections.Generic.List<string>();
             list.Add("ToTarget");
             foreach (PlayerClient client in PlayerClient.All)
             {
                 if (client.netUser.displayName.ToLower().Contains(str.ToLower()))
                 {
                     if (client.netUser.displayName.ToLower() == str.ToLower())
                     {
                         Arguments.Args = new string[] { Arguments.argUser.displayName, client.netUser.displayName };
                         teleport.toplayer(ref Arguments);
                         Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "You have teleported to " + client.netUser.displayName);
                         return;
                     }
                     list.Add(client.netUser.displayName);
                 }
             }
             if (list.Count != 0)
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, ((list.Count - 1)).ToString() + " Player" + (((list.Count - 1) > 1) ? "s" : "") + " were found: ");
                 for (int j = 1; j < list.Count; j++)
                 {
                     Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, j + " - " + list[j]);
                 }
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "0 - Cancel");
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "Please enter the number matching the player you were looking for.");
                 tpWaitList.Add(Arguments.argUser.userID, list);
             }
             else
             {
                 Util.sayUser(Arguments.argUser.networkPlayer, Core.Name, "No player found with the name: " + str);
             }
         }
     }
 }
 public ComicImageSource(Comicstyle style)
 {
     comicstyle = style;
     imageExtensions = new System.Collections.Generic.List<string>();
     imageExtensions.Add(".JPG");
     imageExtensions.Add(".BMP");
     imageExtensions.Add(".GIF");
     imageExtensions.Add(".PNG");
     comicExtensions = new System.Collections.Generic.List<string>();
     comicExtensions.Add(".CBR");
     comicExtensions.Add(".CBZ");
 }
コード例 #16
0
ファイル: PopupBonusScene.cs プロジェクト: travis134/WordMine
        public PopupBonusScene()
            : base()
        {
            this.dismissed = true;
            this.quiz = false;

            gameObjects = new System.Collections.Generic.List<GameObject>();

            this.cursorRectangle = new Rectangle(
                (int)cursor.mouse.X,
                (int)cursor.mouse.Y,
                1,
                1
            );
            gameObjects.Add(new CursorGameObject(cursor));

            this.sceneIndex = SceneIndex.PopupScoreScene;

            this.background = new GameObject("menu/menu", new Vector2(Game1.CAMERA_WIDTH / 2, Game1.CAMERA_HEIGHT / 2));
            this.background.zindex = 0.8f;
            gameObjects.Add(this.background);

            this.bonusText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 145), "Yippy Ay Kay Yay!");
            this.resumeButton = new MenuItem(new Vector2(Game1.CAMERA_WIDTH / 2, 345), "Resume");
            this.bonusWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 185), "Bonus Word: ...");
            this.partOfSpeechText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 225), "Part of Speech: ...");
            this.similarToText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 265), "Similar to: ...");
            this.definitionText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 305), "Definition: ...");

            this.bonusText.zindex = .9f;
            this.resumeButton.zindex = .9f;
            this.bonusWordText.zindex = .9f;
            this.partOfSpeechText.zindex = .9f;
            this.similarToText.zindex = .9f;
            this.definitionText.zindex = .9f;

            this.bonusText.fontPath = "fonts/Western";
            this.bonusText.fontColor = Color.Green;
            this.resumeButton.fontPath = "fonts/Western";

            this.bonusWordText.fontPath = "fonts/WesternSmall";
            this.partOfSpeechText.fontPath = "fonts/WesternSmall";
            this.similarToText.fontPath = "fonts/WesternSmall";
            this.definitionText.fontPath = "fonts/WesternSmall";

            gameObjects.Add(this.bonusText);
            gameObjects.Add(this.resumeButton);
            gameObjects.Add(this.bonusWordText);
            gameObjects.Add(this.partOfSpeechText);
            gameObjects.Add(this.similarToText);
            gameObjects.Add(this.definitionText);
        }
コード例 #17
0
ファイル: PopupScoreScene.cs プロジェクト: travis134/WordMine
        public PopupScoreScene()
            : base()
        {
            this.dismissed = true;

            gameObjects = new System.Collections.Generic.List<GameObject>();

            this.cursorRectangle = new Rectangle(
                (int)cursor.mouse.X,
                (int)cursor.mouse.Y,
                1,
                1
            );
            gameObjects.Add(new CursorGameObject(cursor));

            this.sceneIndex = SceneIndex.PopupScoreScene;

            this.background = new GameObject("menu/menu", new Vector2(Game1.CAMERA_WIDTH / 2, Game1.CAMERA_HEIGHT / 2));
            this.background.zindex = 0.8f;
            gameObjects.Add(this.background);

            this.congratulationsText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 145), "Congratulations!");
            this.resumeButton = new MenuItem(new Vector2(Game1.CAMERA_WIDTH / 2, 345), "Resume");
            this.longestWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 185), "Longest Word: ...");
            this.highestPointWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 225), "Highest Point Word: ...");
            this.mostCreatedWordText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 265), "Most Created Word: ...");
            this.totalWordsCreatedText = new TokenGameObject(new Vector2(Game1.CAMERA_WIDTH/2, 305), "Total Words Created: ...");

            this.congratulationsText.zindex = .9f;
            this.resumeButton.zindex = .9f;
            this.longestWordText.zindex = .9f;
            this.highestPointWordText.zindex = .9f;
            this.mostCreatedWordText.zindex = .9f;
            this.totalWordsCreatedText.zindex = .9f;

            this.congratulationsText.fontPath = "fonts/Western";
            this.congratulationsText.fontColor = Color.Gold;
            this.resumeButton.fontPath = "fonts/Western";

            this.longestWordText.fontPath = "fonts/WesternSmall";
            this.highestPointWordText.fontPath = "fonts/WesternSmall";
            this.mostCreatedWordText.fontPath = "fonts/WesternSmall";
            this.totalWordsCreatedText.fontPath = "fonts/WesternSmall";

            gameObjects.Add(this.congratulationsText);
            gameObjects.Add(this.resumeButton);
            gameObjects.Add(this.longestWordText);
            gameObjects.Add(this.highestPointWordText);
            gameObjects.Add(this.mostCreatedWordText);
            gameObjects.Add(this.totalWordsCreatedText);
        }
コード例 #18
0
ファイル: Program.cs プロジェクト: quetzalcoatl/xvsr10
        private static void SignAllParts(Package package)
        {
            if (package == null)
                throw new ArgumentNullException("SignAllParts(package)");

            // Create the DigitalSignature Manager
            PackageDigitalSignatureManager dsm =
                new PackageDigitalSignatureManager(package);
            dsm.CertificateOption =
                CertificateEmbeddingOption.InSignaturePart;

            // Create a list of all the part URIs in the package to sign
            // (GetParts() also includes PackageRelationship parts).
            System.Collections.Generic.List<Uri> toSign =
                new System.Collections.Generic.List<Uri>();
            foreach (PackagePart packagePart in package.GetParts())
            {
                // Add all package parts to the list for signing.
                toSign.Add(packagePart.Uri);
            }

            // Add the URI for SignatureOrigin PackageRelationship part.
            // The SignatureOrigin relationship is created when Sign() is called.
            // Signing the SignatureOrigin relationship disables counter-signatures.
            toSign.Add(PackUriHelper.GetRelationshipPartUri(dsm.SignatureOrigin));

            // Also sign the SignatureOrigin part.
            toSign.Add(dsm.SignatureOrigin);

            // Add the package relationship to the signature origin to be signed.
            toSign.Add(PackUriHelper.GetRelationshipPartUri(new Uri("/", UriKind.RelativeOrAbsolute)));

            // Sign() will prompt the user to select a Certificate to sign with.
            try
            {
                dsm.Sign(toSign);
            }

            // If there are no certificates or the SmartCard manager is
            // not running, catch the exception and show an error message.
            catch (CryptographicException ex)
            {
                MessageBox.Show(
                    "Cannot Sign\n" + ex.Message,
                    "No Digital Certificates Available",
                    MessageBoxButton.OK,
                    MessageBoxImage.Exclamation);
            }
        }
コード例 #19
0
        //returns the current position, according to the tiles (tile, pos on tile)
        public List<int> get_cur_tile_pos()
        {
            int xtile= locx / tile_size;
            int xpos = locx % tile_size;
            int ytile= locy / tile_size;
            int ypos = locy % tile_size;

            List<int> ret= new System.Collections.Generic.List<int>();
            ret.Add(xtile);
            ret.Add(xpos);
            ret.Add(ytile);
            ret.Add(ypos);

            return ret;
        }
コード例 #20
0
ファイル: FindOL.cs プロジェクト: Blyumenshteyn/UchetUSP
        void BuildStringAND()
        {
            string ANDstring = "";

            System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

            System.Collections.Generic.List<string> Values = new System.Collections.Generic.List<string>();

            //Номер
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox1), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.NUM " + GetCheckBoxStatus(textBox1) + " LIKE :NUM) ";
                Parameters.Add("NUM"); Values.Add(textBox1.Text);
            }
            //Номер ВПП
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox3), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.VPP_NUM " + GetCheckBoxStatus(textBox3) + " LIKE :VPP_NUM) ";
                Parameters.Add("VPP_NUM"); Values.Add(textBox3.Text);
            }

            //Номер ТЗ
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox4), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.TZ_NUM  " + GetCheckBoxStatus(textBox4) + " LIKE :TZ_NUM) ";
                Parameters.Add("TZ_NUM"); Values.Add(textBox4.Text);
            }
            //Обозначение детали
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox5), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.PART_TITLE  " + GetCheckBoxStatus(textBox5) + " LIKE :PART_TITLE) ";
                Parameters.Add("PART_TITLE"); Values.Add(textBox5.Text);
            }
            //Цех заказчик
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox6), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.WORKSHOP_CODE  " + GetCheckBoxStatus(textBox6) + " LIKE :WORKSHOP_CODE) ";
                Parameters.Add("WORKSHOP_CODE"); Values.Add(textBox6.Text);
            }
            //Владелец
            if (String.Compare(PriemSpisanie.IsNullParametr(textBox7), " ") != 0)
            {
                ANDstring += " AND (USP_ASSEMBLY_ORDERS.TECHNOLOG  " + GetCheckBoxStatus(textBox7) + " LIKE :TECHNOLOG) ";
                Parameters.Add("TECHNOLOG"); Values.Add(textBox7.Text);
            }

            GenerateData(ANDstring, ref Parameters, ref Values);
        }
コード例 #21
0
ファイル: AuxMethods.cs プロジェクト: PabloA-C/HexPuzzle
		//Sets the exit of the start tile (selecting a random one inside the bounds).
		public int startExit (Coordinate coordinate)
		{
		
				int res = 0;
				List<int> allExits = new System.Collections.Generic.List<int> ();
				for (int i =1; i<7; i++) {
						allExits.Add (i); 
				}		
		
		
				while (res == 0) {
			
						int randomVal = (int)Mathf.Floor (Random.Range (0, allExits.Count));
						int possibleExit = allExits [randomVal];
						Coordinate possibleFirstTile = getCoordinateFromExit (coordinate, possibleExit);
			
						if (isOnBounds (possibleFirstTile)) {
								res = possibleExit;
						} else {
								allExits.RemoveAt (randomVal);
						}
				} 
		
		
				return res;
		}
コード例 #22
0
        public void Notify(params object[] args)
        {
            if (args != null && args.Length != 0 && args[0] is EntityEvent)
            {
                BusinessEntity.EntityKey key = ((EntityEvent)args[0]).EntityKey;
                if (!(key == null))
                {
                    Customer customer = key.GetEntity() as Customer;
                    if (PubHelper.IsOrg_Customer2DMS(customer))
                    {
                        bool flag = PubHelper.IsUsedDMSAPI();
                        if (flag)
                        {
                            //if ((customer.CustomerCategoryKey != null && (customer.CustomerCategory.Code == "101007" || customer.CustomerCategory.Code == "101006"))
                            //    || (customer.CustomerCategory != null
                            //        && customer.CustomerCategory.DescFlexField != null
                            //        && customer.CustomerCategory.DescFlexField.PrivateDescSeg1.GetBool()
                            //        )
                            //    )
                            if(
                                PubHelper.IsUpdateDMS(customer)
                                )
                            {
                                try
                                {
                                    SI08ImplService service = new SI08ImplService();
                                    // service.Url = PubHelper.GetAddress(service.Url);
                                    System.Collections.Generic.List<dealerInfoDto> list = new System.Collections.Generic.List<dealerInfoDto>();
                                    dealerInfoDto dto = new dealerInfoDto();
                                    dto.dealerCode = customer.Code;
                                    dto.dealerName = customer.Name;
                                    dto.dealerShortName = customer.ShortName;
                                    dto.companyCode = customer.Code;
                                    dto.companyName = customer.Name;
                                    dto.companyShortName = customer.ShortName;
                                    if (customer.CustomerCategoryKey != null)
                                    {
                                        dto.dealerType = int.Parse(customer.CustomerCategory.Code);
                                    }
                                    dto.actionType = 3;
                                    // status  100201 有效 100202 无效
                                    dto.status = (customer.Effective != null && customer.Effective.IsEffective) ? "100201" : "100202";

                                    list.Add(dto);
                                    dealerInfoDto d = service.Do(list.ToArray());
                                    if (d != null && d.flag == 0)
                                    {
                                        throw new System.ApplicationException(d.errMsg);
                                    }
                                }
                                catch (System.Exception e)
                                {
                                    throw new System.ApplicationException("调用DMS接口错误:" + e.Message);
                                }
                            }
                        }
                    }
                }
            }
        }
 public static OpenXmlPowerToolsDocument Insert(OpenXmlPowerToolsDocument doc, IEnumerable<string> certificateList)
 {
     using (OpenXmlMemoryStreamDocument streamDoc = new OpenXmlMemoryStreamDocument(doc))
     {
         using (Package package = streamDoc.GetPackage())
         {
             foreach (string digitalCertificate in certificateList)
             {
                 X509Certificate x509Certificate = X509Certificate2.CreateFromCertFile(digitalCertificate);
                 PackageDigitalSignatureManager digitalSigntaureManager = new PackageDigitalSignatureManager(package);
                 digitalSigntaureManager.CertificateOption = CertificateEmbeddingOption.InSignaturePart;
                 System.Collections.Generic.List<Uri> partsToSign = new System.Collections.Generic.List<Uri>();
                 //Adds each part to the list, except relationships parts.
                 foreach (PackagePart openPackagePart in package.GetParts())
                 {
                     if (!PackUriHelper.IsRelationshipPartUri(openPackagePart.Uri))
                         partsToSign.Add(openPackagePart.Uri);
                 }
                 List<PackageRelationshipSelector> relationshipSelectors = new List<PackageRelationshipSelector>();
                 //Creates one selector for each package-level relationship, based on id
                 foreach (PackageRelationship relationship in package.GetRelationships())
                 {
                     PackageRelationshipSelector relationshipSelector =
                         new PackageRelationshipSelector(relationship.SourceUri, PackageRelationshipSelectorType.Id, relationship.Id);
                     relationshipSelectors.Add(relationshipSelector);
                 }
                 digitalSigntaureManager.Sign(partsToSign, x509Certificate, relationshipSelectors);
             }
         }
         return streamDoc.GetModifiedDocument();
     }
 }
コード例 #24
0
        public void RandomTest()
        {
            RingBuffer<int> TestObject = new RingBuffer<int>(10);
            Utilities.Random.Random Rand = new Utilities.Random.Random();
            int Value = 0;
            for (int x = 0; x < 10; ++x)
            {
                Value = Rand.Next();
                TestObject.Add(Value);
                Assert.Equal(1, TestObject.Count);
                Assert.Equal(Value, TestObject.Remove());
            }
            Assert.Equal(0, TestObject.Count);
            System.Collections.Generic.List<int> Values=new System.Collections.Generic.List<int>();
            for (int x = 0; x < 10; ++x)
            {
                Values.Add(Rand.Next());
            }
            TestObject.Add(Values);
            Assert.Equal(Values.ToArray(), TestObject.ToArray());

            for (int x = 0; x < 10; ++x)
            {
                Assert.Throws<IndexOutOfRangeException>(() => TestObject.Add(Rand.Next()));
                Assert.Equal(10, TestObject.Count);
            }
        }
コード例 #25
0
        public ICancelaResponse CancelaCFDI(string user, string password, string rfc, string[] uuid, byte[] pfx, string pfxPassword) {
            //return this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword);

            CancelaResponse response = this.cancelaCFDi(user, password, rfc, uuid, pfx, pfxPassword);

            CancelaResponseBase responseBase = new CancelaResponseBase();
            responseBase.Ack = response.ack;
            responseBase.Text = response.text;

            System.Collections.Generic.List<string> uuidsList = new System.Collections.Generic.List<string>();

            foreach (string uuidItem in response.uuids) {
                uuidsList.Add(uuidItem);
            }
            responseBase.UUIDs = uuidsList.ToArray();

            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(response.GetType());
            MemoryStream ms = new MemoryStream();
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Encoding = new UTF8Encoding();
            XmlWriter xmlWriter = XmlWriter.Create(ms, settings);
            x.Serialize(xmlWriter, response);
            string xmlContent = Encoding.UTF8.GetString(ms.GetBuffer());

            responseBase.XmlResponse = xmlContent;

            return responseBase;
        }
コード例 #26
0
        /// <summary>
        /// This method sorts the items in a listbox.
        /// </summary>
        /// <param name="items">The list control.</param>
        /// <param name="Descending">Whether to sort the list box descending. </param>
        public static void SortListItems(this ListItemCollection items, bool Descending)
        {
            System.Collections.Generic.List<ListItem> list = new System.Collections.Generic.List<ListItem>();
            foreach (ListItem i in items)
            {
                list.Add(i);
            }

            if (Descending)
            {
                IEnumerable<ListItem> itemEnum =
                    from item in list
                    orderby item.Text descending
                    select item;
                items.Clear();
                items.AddRange(itemEnum.ToArray());
                // anonymous delegate list.Sort(delegate(ListItem x, ListItem y) { return y.Text.CompareTo(x.Text); });
            }
            else
            {
                IEnumerable<ListItem> itemEnum =
                    from item in list
                    orderby item.Text ascending
                    select item;
                items.Clear();
                items.AddRange(itemEnum.ToArray());

                //list.Sort(delegate(ListItem x, ListItem y) { return x.Text.CompareTo(y.Text); });
            }
        }
コード例 #27
0
ファイル: AssetManager.cs プロジェクト: modulexcite/Batman
 /// <summary>
 /// Constructor
 /// </summary>
 public AssetManager()
 {
     Filters = AppDomain.CurrentDomain.GetAssemblies().Objects<IFilter>();
     ContentFilters = AppDomain.CurrentDomain.GetAssemblies().Objects<IContentFilter>();
     Translators = AppDomain.CurrentDomain.GetAssemblies().Objects<ITranslator>();
     FileTypes = new ListMapping<AssetType, string>();
     RunOrder = new System.Collections.Generic.List<RunTime>();
     Translators.ForEach(x => FileTypes.Add(x.TranslatesTo, x.FileTypeAccepts));
     FileTypes.Add(AssetType.CSS, "css");
     FileTypes.Add(AssetType.Javascript, "js");
     RunOrder.Add(RunTime.PostTranslate);
     RunOrder.Add(RunTime.PreMinified);
     RunOrder.Add(RunTime.Minify);
     RunOrder.Add(RunTime.PostMinified);
     RunOrder.Add(RunTime.PreCombine);
 }
コード例 #28
0
ファイル: GPGSA.cs プロジェクト: fivepmtechnology/SharpGPS
 /// <summary>
 ///  GPS DOP and active satellites and parses an NMEA sentence
 /// </summary>
 /// <param name="NMEAsentence"></param>
 public GPGSA(string NMEAsentence)
 {
     _pRNInSolution = new List<string>();
     try
     {
         if (NMEAsentence.IndexOf('*') > 0)
             NMEAsentence = NMEAsentence.Substring(0, NMEAsentence.IndexOf('*'));
         //Split into an array of strings.
         string[] split = NMEAsentence.Split(new Char[] { ',' });
         if (split[1].Length > 0)
             _mode = split[1][0];
         else
             _mode = ' ';
         if (split[2].Length > 0)
         {
             switch (split[2])
             {
                 case "2": _fixMode = GSAFixModeEnum._2D; break;
                 case "3": _fixMode = GSAFixModeEnum._3D; break;
                 default: _fixMode = GSAFixModeEnum.FixNotAvailable; break;
             }
         }
         _pRNInSolution.Clear();
         for (int i = 0; i <= 11; i++)
             if(split[i + 3]!="")
                 _pRNInSolution.Add(split[i + 3]);
         GPSHandler.dblTryParse(split[15], out _pdop);
         GPSHandler.dblTryParse(split[16], out _hdop);
         GPSHandler.dblTryParse(split[17], out _vdop);
     }
     catch { }
 }
        public static void Build(ref GMapOverlay OverlayOut)
        {
            // Here loop through defined sectors and display them on the map
            foreach (SystemAdaptationDataSet.SectorBorder Sector in SystemAdaptationDataSet.SectorBorderDataSet)
            {
                System.Collections.Generic.List<PointLatLng> SectorPointList = new System.Collections.Generic.List<PointLatLng>();
                foreach (GeoCordSystemDegMinSecUtilities.LatLongClass SectorPoint in Sector.SectorBorderPoints)
                {
                    SectorPointList.Add(new PointLatLng(SectorPoint.GetLatLongDecimal().LatitudeDecimal, SectorPoint.GetLatLongDecimal().LongitudeDecimal));
                }

                // Get sector border display attributes
                DisplayAttributes.DisplayAttributesType SectorBorderDisplayAttribute = DisplayAttributes.GetDisplayAttribute(DisplayAttributes.DisplayItemsType.SectorBorder);

                GMapPolygon SectorPolygon = new GMapPolygon(SectorPointList, Sector.SectorName);
                SectorPolygon.Stroke = new Pen(SectorBorderDisplayAttribute.LineColor, SectorBorderDisplayAttribute.LineWidth);

                Type brushType = typeof(Brushes);

                Brush myBrush = (Brush)brushType.InvokeMember(SectorBorderDisplayAttribute.AreaPolygonColor.Name,
                 BindingFlags.Public | BindingFlags.Static | BindingFlags.GetProperty,
                 null, null, new object[] { });

                SectorPolygon.Fill = myBrush;
                OverlayOut.Polygons.Add(SectorPolygon);

            }
        }
コード例 #30
0
 public void ChromeOptions_add_one_extension()
 {
     string[] expected = { "SePSX.dll" };
     AddSeChromeExtensionCommand cmdlet =
         //new AddSeChromeExtensionCommandTestFixture();
         WebDriverFactory.Container.Resolve<AddSeChromeExtensionCommand>();
     //AddSeChromeExtensionCommand.UnitTestMode = true;
     cmdlet.InputObject =
         //WebDriverFactory.GetChromeOptions();
         // resolve ChromeOptions
         WebDriverFactory.Container.Resolve<ChromeOptions>();
     cmdlet.ExtensionList =
         expected;
     SeAddChromeExtensionCommand command =
         new SeAddChromeExtensionCommand(cmdlet);
     command.Execute();
     System.Collections.Generic.List<string> listOfArguments =
         new System.Collections.Generic.List<string>();
     listOfArguments.Add(expected[0]);
     ReadOnlyCollection<string> expectedList =
         new ReadOnlyCollection<string>(listOfArguments);
     //Assert.AreEqual(expectedList, (SePSX.CommonCmdletBase.UnitTestOutput[0] as ChromeOptions).Extensions);
     Assert.AreEqual(
         expectedList,
         ((ChromeOptions)(object)PSTestLib.UnitTestOutput.LastOutput[0]).Extensions);
 }
コード例 #31
0
        public static void ImportPods(string directory, string pubsuburl)
        {
            if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl))
            {
                throw new Exception("Arguments cannot be null");
            }
            System.Collections.Generic.List <ProofOfDelivery> pods = new System.Collections.Generic.List <ProofOfDelivery>();
            bool skipheaders = true;

            string[] entries = null;


            System.Collections.Generic.List <char> delim = new System.Collections.Generic.List <char>();
            delim.Add('\r');
            delim.Add('\n');

            string[] files = System.IO.Directory.GetFiles(directory);

            foreach (var file in files)
            {
                if (!file.Contains("OrdersExported"))
                {
                    continue;
                }
                skipheaders = true;
                foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.Split(';');
                        if ((skipheaders))
                        {
                            skipheaders = false;
                            continue;
                        }
                        if ((entries.Length > 0 && (entries[0] == null || entries[0] == "") == false))
                        {
                            ProofOfDelivery proof = new ProofOfDelivery();
                            try
                            {
                                proof.DateIssued = DateTime.Parse(entries[0]);
                            }
                            catch (System.Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            proof.PODNumber      = entries[1].Trim();
                            proof.DeliveryStatus = entries[3];
                            pods?.Add(proof);
                        }
                    }
                }
                string message = ConvertToPubSubMessage(pods);
                PostMessage(message, "");
                pods?.Clear();
            }
        }
コード例 #32
0
        public static void ImportCustomers(string directory, string pubsuburl)
        {
            if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl))
            {
                throw new Exception("Arguments cannot be null");
            }
            bool skipheaders = true;

            string[] entries = null;

            System.Collections.Generic.List <Customer> customers = new System.Collections.Generic.List <Customer>();
            System.Collections.Generic.List <char>     delim     = new System.Collections.Generic.List <char>();
            delim.Add('\r');
            delim.Add('\n');

            string[] files = System.IO.Directory.GetFiles(directory);

            foreach (var file in files)
            {
                skipheaders = true;
                foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.Split(';');
                        if ((skipheaders))
                        {
                            skipheaders = false;
                            continue;
                        }
                        if ((entries.Length > 0 && (entries[0] == null || entries[0] == "") == false) && ((entries[0].Contains("1")) == false) && ((entries[0].Contains("Κωδικός")) == false))
                        {
                            Customer customer = new Customer();
                            if (((entries[0] == null || entries[0] == "")))
                            {
                                Console.WriteLine("Empty customer code in " + file);
                                continue;
                            }
                            if (((entries[1] == null || entries[1] == "")))
                            {
                                Console.WriteLine("Empty Company Name but not customer code in " + file);
                            }
                            customer.CustomerCode = entries[0].Trim();
                            customer.CompanyName  = entries[1];
                            customer.VATNo        = entries[2];
                            customer.Occupation   = entries[3];
                            customer.Telephone    = entries[4];
                            customer.Region       = entries[5];
                            customer.City         = entries[6];
                            customer.Address      = entries[7];
                            customer.PostalCode   = entries[8];
                            customer.DOY          = entries[9];
                            customer.Region_2     = entries[10];
                            customer.City_2       = entries[11];
                            customer.Address_2    = entries[12];
                            customer.PostalCode_2 = entries[11];
                            customers?.Add(customer);
                        }
                    }
                }
                string message = ConvertToPubSubMessage <Customer>(customers);
                Console.WriteLine(message);
                var url = "";
                Console.WriteLine(PostMessage(message, url));

                customers?.Clear();
            }
        }
コード例 #33
0
                /// <summary>Gets the list of Eo operations to override.</summary>
                /// <returns>The list of Eo operations to be overload.</returns>
                public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
                {
                    var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
                    var methods = Efl.Eo.Globals.GetUserMethods(type);

                    if (efl_input_focus_object_get_static_delegate == null)
                    {
                        efl_input_focus_object_get_static_delegate = new efl_input_focus_object_get_delegate(object_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetObject") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_focus_object_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_focus_object_get_static_delegate)
                        });
                    }

                    if (efl_input_focus_object_set_static_delegate == null)
                    {
                        efl_input_focus_object_set_static_delegate = new efl_input_focus_object_set_delegate(object_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetObject") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_focus_object_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_focus_object_set_static_delegate)
                        });
                    }

                    if (efl_duplicate_static_delegate == null)
                    {
                        efl_duplicate_static_delegate = new efl_duplicate_delegate(duplicate);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "Duplicate") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_duplicate"), func = Marshal.GetFunctionPointerForDelegate(efl_duplicate_static_delegate)
                        });
                    }

                    if (efl_input_timestamp_get_static_delegate == null)
                    {
                        efl_input_timestamp_get_static_delegate = new efl_input_timestamp_get_delegate(timestamp_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetTimestamp") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_timestamp_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_timestamp_get_static_delegate)
                        });
                    }

                    if (efl_input_timestamp_set_static_delegate == null)
                    {
                        efl_input_timestamp_set_static_delegate = new efl_input_timestamp_set_delegate(timestamp_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetTimestamp") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_timestamp_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_timestamp_set_static_delegate)
                        });
                    }

                    if (efl_input_device_get_static_delegate == null)
                    {
                        efl_input_device_get_static_delegate = new efl_input_device_get_delegate(device_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetDevice") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_device_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_device_get_static_delegate)
                        });
                    }

                    if (efl_input_device_set_static_delegate == null)
                    {
                        efl_input_device_set_static_delegate = new efl_input_device_set_delegate(device_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetDevice") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_device_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_device_set_static_delegate)
                        });
                    }

                    if (efl_input_event_flags_get_static_delegate == null)
                    {
                        efl_input_event_flags_get_static_delegate = new efl_input_event_flags_get_delegate(event_flags_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetEventFlags") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_event_flags_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_event_flags_get_static_delegate)
                        });
                    }

                    if (efl_input_event_flags_set_static_delegate == null)
                    {
                        efl_input_event_flags_set_static_delegate = new efl_input_event_flags_set_delegate(event_flags_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetEventFlags") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_event_flags_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_event_flags_set_static_delegate)
                        });
                    }

                    if (efl_input_processed_get_static_delegate == null)
                    {
                        efl_input_processed_get_static_delegate = new efl_input_processed_get_delegate(processed_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetProcessed") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_processed_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_processed_get_static_delegate)
                        });
                    }

                    if (efl_input_processed_set_static_delegate == null)
                    {
                        efl_input_processed_set_static_delegate = new efl_input_processed_set_delegate(processed_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetProcessed") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_processed_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_processed_set_static_delegate)
                        });
                    }

                    if (efl_input_scrolling_get_static_delegate == null)
                    {
                        efl_input_scrolling_get_static_delegate = new efl_input_scrolling_get_delegate(scrolling_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetScrolling") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_scrolling_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_scrolling_get_static_delegate)
                        });
                    }

                    if (efl_input_scrolling_set_static_delegate == null)
                    {
                        efl_input_scrolling_set_static_delegate = new efl_input_scrolling_set_delegate(scrolling_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetScrolling") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_scrolling_set"), func = Marshal.GetFunctionPointerForDelegate(efl_input_scrolling_set_static_delegate)
                        });
                    }

                    if (efl_input_fake_get_static_delegate == null)
                    {
                        efl_input_fake_get_static_delegate = new efl_input_fake_get_delegate(fake_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetFake") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_fake_get"), func = Marshal.GetFunctionPointerForDelegate(efl_input_fake_get_static_delegate)
                        });
                    }

                    if (efl_input_reset_static_delegate == null)
                    {
                        efl_input_reset_static_delegate = new efl_input_reset_delegate(reset);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "Reset") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_input_reset"), func = Marshal.GetFunctionPointerForDelegate(efl_input_reset_static_delegate)
                        });
                    }

                    descs.AddRange(base.GetEoOps(type));
                    return(descs);
                }
コード例 #34
0
        private void GetUserIdByUserName(System.Web.HttpContext context)
        {
            context.Response.ContentType = "application/json";
            string text = context.Request["uname"];

            if (string.IsNullOrWhiteSpace(text))
            {
                context.Response.Write(JsonConvert.SerializeObject(new
                {
                    status = "err",
                    msg    = "参数错误!"
                }));
                return;
            }
            try
            {
                string[] array = text.Split(new char[]
                {
                    '_'
                });
                System.Collections.Generic.List <int> list          = new System.Collections.Generic.List <int>();
                System.Text.StringBuilder             stringBuilder = new System.Text.StringBuilder();
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string text2 = array2[i];
                    int    memberIdByUserNameOrNiChen = MemberHelper.GetMemberIdByUserNameOrNiChen(text2, null);
                    if (memberIdByUserNameOrNiChen > 0)
                    {
                        list.Add(memberIdByUserNameOrNiChen);
                    }
                    else if (stringBuilder.Length <= 0)
                    {
                        stringBuilder.AppendFormat("{0}", text2);
                    }
                    else
                    {
                        stringBuilder.AppendFormat(",{0}", text2);
                    }
                }
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(" 无效!");
                    context.Response.Write(JsonConvert.SerializeObject(new
                    {
                        status = "err",
                        msg    = "用户名 " + stringBuilder.ToString()
                    }));
                }
                else
                {
                    context.Response.Write(JsonConvert.SerializeObject(new
                    {
                        status = "ok",
                        msg    = "",
                        ids    = string.Join <int>("_", list),
                        count  = list.Count
                    }));
                }
            }
            catch (System.Exception)
            {
                context.Response.Write(JsonConvert.SerializeObject(new
                {
                    status = "err",
                    msg    = "程序出错!"
                }));
            }
        }
コード例 #35
0
        private void createQueryString()
        {
            List <string>         brands     = new List <string>();
            List <AttributeValue> attributes = new System.Collections.Generic.List <AttributeValue>();
            int attributeID = 0;

            foreach (ListItem value in chkBrands.Items)
            {
                if (value.Selected)
                {
                    brands.Add(value.Value);
                }
            }

            foreach (RepeaterItem repeaterItem in rptFilter.Items)
            {
                foreach (Control control in repeaterItem.Controls)
                {
                    if (control is HiddenField)
                    {
                        attributeID = int.Parse(((HiddenField)control).Value);
                    }
                    if (control is CheckBoxList)
                    {
                        foreach (ListItem value in ((CheckBoxList)control).Items)
                        {
                            if (value.Selected)
                            {
                                attributes.Add(new AttributeValue(int.Parse(value.Value), value.Text, attributeID, 0, string.Empty, 0));
                            }
                        }
                    }
                }
            }

            //List<Product> products = new ProductBL().GetProducts(ViewState["categoryUrl"].ToString(), brands, attributes, sort, cmbPriceFrom.SelectedItem.Text, cmbPriceTo.SelectedItem.Text);
            List <Product> products = new ProductBL().GetProducts(categoryUrl, brands, attributes, sort, cmbPriceFrom.SelectedItem.Text, cmbPriceTo.SelectedItem.Text);

            PagedDataSource pagedDataSource = new PagedDataSource();

            pagedDataSource.DataSource  = products;
            pagedDataSource.AllowPaging = true;
            pagedDataSource.PageSize    = pageSize;
            //if (currentPage >= pagedDataSource.PageCount)
            //currentPage = pagedDataSource.PageCount - 1;
            //if (currentPage < 0)
            //currentPage = 0;
            pagedDataSource.CurrentPageIndex = currentPage;
            //ViewState["totalPages"] = pagedDataSource.PageCount;
            totalPages = pagedDataSource.PageCount;

            if (products != null)
            {
                //pgrPager.TotalPages = int.Parse(ViewState["totalPages"].ToString());
                pgrPager.TotalPages  = totalPages;
                pgrPager.currentPage = this.currentPage;
                pgrPager.doPaging();
                //pgrPager1.TotalPages = int.Parse(ViewState["totalPages"].ToString());
                pgrPager1.TotalPages  = totalPages;
                pgrPager1.currentPage = this.currentPage;
                pgrPager1.doPaging();

                rptProducts.DataSource = pagedDataSource;
                rptProducts.DataBind();
            }
            else
            {
                rptProducts.DataSource   = null;
                rptProducts.DataSourceID = null;
                rptProducts.DataBind();
                divStatus.Visible = true;
            }
        }
コード例 #36
0
        public static void LoadStaticContent(string contentManagerName)
        {
            if (string.IsNullOrEmpty(contentManagerName))
            {
                throw new System.ArgumentException("contentManagerName cannot be empty or null");
            }
            ContentManagerName = contentManagerName;
            // Set the content manager for Gum
            var contentManagerWrapper = new FlatRedBall.Gum.ContentManagerWrapper();

            contentManagerWrapper.ContentManagerName = contentManagerName;
            RenderingLibrary.Content.LoaderManager.Self.ContentLoader = contentManagerWrapper;
            // Access the GumProject just in case it's async loaded
            var throwaway = GlobalContent.GumProject;

            #if DEBUG
            if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                HasBeenLoadedWithGlobalContentManager = true;
            }
            else if (HasBeenLoadedWithGlobalContentManager)
            {
                throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
            }
            #endif
            bool registerUnload = false;
            if (LoadedContentManagers.Contains(contentManagerName) == false)
            {
                LoadedContentManagers.Add(contentManagerName);
                lock (mLockObject)
                {
                    if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
                    {
                        FlatRedBall.FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("Lucky_blockStaticUnload", UnloadStaticContent);
                        mRegisteredUnloads.Add(ContentManagerName);
                    }
                }
                if (!FlatRedBall.FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/lucky_block/luckyblocknormal.png", ContentManagerName))
                {
                    registerUnload = true;
                }
                luckyblocknormal = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/lucky_block/luckyblocknormal.png", ContentManagerName);
                if (!FlatRedBall.FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/lucky_block/luckyblockhasbeentouched.png", ContentManagerName))
                {
                    registerUnload = true;
                }
                luckyblockhasbeentouched = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/lucky_block/luckyblockhasbeentouched.png", ContentManagerName);
            }
            if (registerUnload && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
            {
                lock (mLockObject)
                {
                    if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
                    {
                        FlatRedBall.FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("Lucky_blockStaticUnload", UnloadStaticContent);
                        mRegisteredUnloads.Add(ContentManagerName);
                    }
                }
            }
            CustomLoadStaticContent(contentManagerName);
        }
コード例 #37
0
ファイル: ManageMembers.cs プロジェクト: damoOnly/e-commerce
 private void btnExport_Click(object sender, System.EventArgs e)
 {
     if (this.exportFieldsCheckBoxList.SelectedItem == null)
     {
         this.ShowMsg("请选择需要导出的会员信息", false);
         return;
     }
     System.Collections.Generic.IList <string> list  = new System.Collections.Generic.List <string>();
     System.Collections.Generic.IList <string> list2 = new System.Collections.Generic.List <string>();
     foreach (System.Web.UI.WebControls.ListItem listItem in this.exportFieldsCheckBoxList.Items)
     {
         if (listItem.Selected)
         {
             list.Add(listItem.Value);
             list2.Add(listItem.Text);
         }
     }
     System.Data.DataTable membersNopage = MemberHelper.GetMembersNopage(new MemberQuery
     {
         Username     = this.searchKey,
         Realname     = this.realName,
         GradeId      = this.rankId,
         RstEndTime   = this.endDate,
         RstStartTime = this.startDate
     }, list);
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     foreach (string current in list2)
     {
         stringBuilder.Append(current + ",");
         if (current == list2[list2.Count - 1])
         {
             stringBuilder = stringBuilder.Remove(stringBuilder.Length - 1, 1);
             stringBuilder.Append("\r\n");
         }
     }
     foreach (System.Data.DataRow dataRow in membersNopage.Rows)
     {
         foreach (string current2 in list)
         {
             stringBuilder.Append(dataRow[current2]).Append(",");
             if (current2 == list[list2.Count - 1])
             {
                 stringBuilder = stringBuilder.Remove(stringBuilder.Length - 1, 1);
                 stringBuilder.Append("\r\n");
             }
         }
     }
     this.Page.Response.Clear();
     this.Page.Response.Buffer  = false;
     this.Page.Response.Charset = "GB2312";
     if (this.exportFormatRadioButtonList.SelectedValue == "csv")
     {
         //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberInfo.csv");
         this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员列表.csv");
         this.Page.Response.ContentType = "application/octet-stream";
     }
     else
     {
         //this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=MemberInfo.txt");
         this.Page.Response.AppendHeader("Content-Disposition", "attachment;filename=会员列表.txt");
         this.Page.Response.ContentType = "application/vnd.ms-word";
     }
     this.Page.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
     this.Page.EnableViewState          = false;
     this.Page.Response.Write(stringBuilder.ToString());
     this.Page.Response.End();
 }
コード例 #38
0
        private void btnSave_Click(object sender, System.EventArgs e)
        {
            string str_type = "zone";

            switch (this.cboType.SelectedIndex)
            {
            case 0:
                str_type = "zone";
                break;

            case 1:
                str_type = "rack";
                break;

            case 2:
                str_type = "dev";
                break;

            case 3:
                str_type = "outlet";
                break;
            }
            bool flag = false;

            Ecovalidate.checkTextIsNull(this.tbname, ref flag);
            if (flag)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                {
                    this.lbname.Text
                }));
                this.tbname.Focus();
                return;
            }
            string text = this.tbname.Text;

            System.Collections.Generic.List <long> list = new System.Collections.Generic.List <long>();
            for (int i = 0; i < this.dgvGpmember.Rows.Count; i++)
            {
                if (this.dgvGpmember.Rows[i].Selected)
                {
                    string value = this.dgvGpmember.Rows[i].Cells[0].Value.ToString();
                    list.Add((long)System.Convert.ToInt32(value));
                }
            }
            if (list.Count == 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Comm_selectneed, new string[0]));
                this.dgvGpmember.Focus();
                return;
            }
            int num = GroupInfo.CreateNewGroup(text, str_type, "", list);

            if (num == -2)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Group_nmdup, new string[]
                {
                    text
                }));
                return;
            }
            if (num < 0)
            {
                EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.OPfail, new string[0]));
                return;
            }
            EcoGlobalVar.setDashBoardFlg(512uL, "", 64);
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
            base.Close();
        }
コード例 #39
0
        private void btnOrderGoods_Click(object sender, System.EventArgs e)
        {
            string text = "";

            if (!string.IsNullOrEmpty(base.Request["CheckBoxGroup"]))
            {
                text = base.Request["CheckBoxGroup"];
            }
            if (text.Length <= 0)
            {
                this.ShowMsg("请选要下载配货表的采购单", false);
                return;
            }
            System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
            string[] array = text.Split(new char[]
            {
                ','
            });
            for (int i = 0; i < array.Length; i++)
            {
                string str = array[i];
                list.Add("'" + str + "'");
            }
            System.Data.DataSet       purchaseOrderGoods = OrderHelper.GetPurchaseOrderGoods(string.Join(",", list.ToArray()));
            System.Text.StringBuilder stringBuilder      = new System.Text.StringBuilder();
            stringBuilder.AppendLine("<table cellspacing=\"0\" cellpadding=\"5\" rules=\"all\" border=\"1\">");
            stringBuilder.AppendLine("<caption style='text-align:center;'>配货单(仓库拣货表)</caption>");
            stringBuilder.AppendLine("<tr style=\"font-weight: bold; white-space: nowrap;\">");
            stringBuilder.AppendLine("<td>采购单编号</td>");
            if (purchaseOrderGoods.Tables[1].Rows.Count <= 0)
            {
                stringBuilder.AppendLine("<td>商品名称</td>");
            }
            else
            {
                stringBuilder.AppendLine("<td>商品(礼品)名称</td>");
            }
            stringBuilder.AppendLine("<td>货号</td>");
            stringBuilder.AppendLine("<td>规格</td>");
            stringBuilder.AppendLine("<td>拣货数量</td>");
            stringBuilder.AppendLine("<td>现库存数</td>");
            stringBuilder.AppendLine("<td>备注</td>");
            stringBuilder.AppendLine("</tr>");
            foreach (System.Data.DataRow dataRow in purchaseOrderGoods.Tables[0].Rows)
            {
                stringBuilder.AppendLine("<tr>");
                stringBuilder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + dataRow["PurchaseOrderId"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow["ProductName"] + "</td>");
                stringBuilder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + dataRow["SKU"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow["SKUContent"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow["ShipmentQuantity"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow["Stock"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow["Remark"] + "</td>");
                stringBuilder.AppendLine("</tr>");
            }
            foreach (System.Data.DataRow dataRow2 in purchaseOrderGoods.Tables[1].Rows)
            {
                stringBuilder.AppendLine("<tr>");
                stringBuilder.AppendLine("<td style=\"vnd.ms-excel.numberformat:@\">" + dataRow2["GiftPurchaseOrderId"] + "</td>");
                stringBuilder.AppendLine("<td>" + dataRow2["GiftName"] + "[礼品]</td>");
                stringBuilder.AppendLine("<td></td>");
                stringBuilder.AppendLine("<td></td>");
                stringBuilder.AppendLine("<td>" + dataRow2["Quantity"] + "</td>");
                stringBuilder.AppendLine("<td></td>");
                stringBuilder.AppendLine("<td></td>");
                stringBuilder.AppendLine("</tr>");
            }
            stringBuilder.AppendLine("</table>");
            base.Response.Clear();
            base.Response.Buffer  = false;
            base.Response.Charset = "GB2312";
            base.Response.AppendHeader("Content-Disposition", "attachment;filename=purchaseordergoods_" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + ".xls");
            base.Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");
            base.Response.ContentType     = "application/ms-excel";
            this.EnableViewState          = false;
            base.Response.Write(stringBuilder.ToString());
            base.Response.End();
        }
コード例 #40
0
        public void SubscriptionAddOverloads()
        {
            Plan         plan    = null;
            Account      account = null;
            Subscription sub     = null;

            System.Collections.Generic.List <AddOn> addons = new System.Collections.Generic.List <AddOn>();

            try
            {
                plan = new Plan(GetMockPlanCode(), "subscription addon overload plan")
                {
                    Description = "Create Subscription Plan With Addons Test"
                };
                plan.UnitAmountInCents.Add("USD", 100);
                plan.Create();

                int numberOfAddons = 7;

                for (int i = 0; i < numberOfAddons; ++i)
                {
                    var name  = "Addon" + i.AsString();
                    var addon = plan.NewAddOn(name, name);
                    addon.DisplayQuantityOnHostedPage = true;
                    addon.AddOnType = AddOn.Type.Fixed;
                    addon.UnitAmountInCents.Add("USD", 1000 + i);
                    addon.DefaultQuantity = i + 1;
                    addon.Create();
                    addons.Add(addon);
                }

                account = CreateNewAccountWithBillingInfo();

                sub = new Subscription(account, plan, "USD");
                Assert.NotNull(sub.AddOns);

                sub.AddOns.Add(new SubscriptionAddOn("Addon0", AddOn.Type.Fixed, 100, 1));
                sub.AddOns.Add(addons[1]);
                sub.AddOns.Add(addons[2], 2);
                sub.AddOns.Add(addons[3], 3, 100);
                sub.AddOns.Add(addons[4].AddOnCode, addons[4].AddOnType.Value);
                sub.AddOns.Add(addons[5].AddOnCode, addons[5].AddOnType.Value, 4);
                sub.AddOns.Add(addons[6].AddOnCode, addons[6].AddOnType.Value, 5, 100);

                sub.Create();
                sub.State.Should().Be(Subscription.SubscriptionState.Active);

                for (int i = 0; i < numberOfAddons; ++i)
                {
                    var code  = "Addon" + i.AsString();
                    var addon = sub.AddOns.AsQueryable().First(x => x.AddOnCode == code);
                    Assert.NotNull(addon);
                }

                sub.AddOns.RemoveAt(0);
                Assert.Equal(6, sub.AddOns.Count);

                sub.AddOns.Clear();
                Assert.Equal(0, sub.AddOns.Count);

                var subaddon = new SubscriptionAddOn("a", AddOn.Type.Fixed, 1);
                var list     = new System.Collections.Generic.List <SubscriptionAddOn>();
                list.Add(subaddon);
                sub.AddOns.AddRange(list);
                Assert.Equal(1, sub.AddOns.Count);


                sub.AddOns.AsReadOnly();

                Assert.True(sub.AddOns.Contains(subaddon));

                Predicate <SubscriptionAddOn> p = x => x.AddOnCode == "a";
                Assert.True(sub.AddOns.Exists(p));
                Assert.NotNull(sub.AddOns.Find(p));
                Assert.Equal(1, sub.AddOns.FindAll(p).Count);
                Assert.NotNull(sub.AddOns.FindLast(p));

                int count = 0;
                sub.AddOns.ForEach(delegate(SubscriptionAddOn s)
                {
                    count++;
                });
                Assert.Equal(1, count);

                Assert.Equal(0, sub.AddOns.IndexOf(subaddon));

                sub.AddOns.Reverse();
                sub.AddOns.Sort();
            }
            finally
            {
                try
                {
                    if (sub != null && sub.Uuid != null)
                    {
                        sub.Cancel();
                    }
                    if (plan != null)
                    {
                        plan.Deactivate();
                    }
                    if (account != null)
                    {
                        account.Close();
                    }
                }
                catch (RecurlyException) { }
            }
        }
コード例 #41
0
        /// <summary>
        /// Updates a CustomerService_Accpet into the data store based on the primitive properties. This can be used as the
        /// update method for an ObjectDataSource.
        /// </summary>
        /// <param name="iD">iD</param>
        /// <param name="serviceID">serviceID</param>
        /// <param name="accpetManID">accpetManID</param>
        /// <param name="accpetMan">accpetMan</param>
        /// <param name="appointTime">appointTime</param>
        /// <param name="addTime">addTime</param>
        /// <param name="accpetStatus">accpetStatus</param>
        /// <param name="accpetUserType">accpetUserType</param>
        /// <param name="accpetTime">accpetTime</param>
        /// <param name="helper">helper</param>
        internal static void UpdateCustomerService_Accpet(int @iD, int @serviceID, int @accpetManID, string @accpetMan, DateTime @appointTime, DateTime @addTime, int @accpetStatus, int @accpetUserType, DateTime @accpetTime, SqlHelper @helper)
        {
            string commandText = @"
DECLARE @table TABLE(
	[ID] int,
	[ServiceID] int,
	[AccpetManID] int,
	[AccpetMan] nvarchar(50),
	[AppointTime] datetime,
	[AddTime] datetime,
	[AccpetStatus] int,
	[AccpetUserType] int,
	[AccpetTime] datetime
);

UPDATE [dbo].[CustomerService_Accpet] SET 
	[CustomerService_Accpet].[ServiceID] = @ServiceID,
	[CustomerService_Accpet].[AccpetManID] = @AccpetManID,
	[CustomerService_Accpet].[AccpetMan] = @AccpetMan,
	[CustomerService_Accpet].[AppointTime] = @AppointTime,
	[CustomerService_Accpet].[AddTime] = @AddTime,
	[CustomerService_Accpet].[AccpetStatus] = @AccpetStatus,
	[CustomerService_Accpet].[AccpetUserType] = @AccpetUserType,
	[CustomerService_Accpet].[AccpetTime] = @AccpetTime 
output 
	INSERTED.[ID],
	INSERTED.[ServiceID],
	INSERTED.[AccpetManID],
	INSERTED.[AccpetMan],
	INSERTED.[AppointTime],
	INSERTED.[AddTime],
	INSERTED.[AccpetStatus],
	INSERTED.[AccpetUserType],
	INSERTED.[AccpetTime]
into @table
WHERE 
	[CustomerService_Accpet].[ID] = @ID

SELECT 
	[ID],
	[ServiceID],
	[AccpetManID],
	[AccpetMan],
	[AppointTime],
	[AddTime],
	[AccpetStatus],
	[AccpetUserType],
	[AccpetTime] 
FROM @table;
";

            System.Collections.Generic.List <SqlParameter> parameters = new System.Collections.Generic.List <SqlParameter>();
            parameters.Add(new SqlParameter("@ID", EntityBase.GetDatabaseValue(@iD)));
            parameters.Add(new SqlParameter("@ServiceID", EntityBase.GetDatabaseValue(@serviceID)));
            parameters.Add(new SqlParameter("@AccpetManID", EntityBase.GetDatabaseValue(@accpetManID)));
            parameters.Add(new SqlParameter("@AccpetMan", EntityBase.GetDatabaseValue(@accpetMan)));
            parameters.Add(new SqlParameter("@AppointTime", EntityBase.GetDatabaseValue(@appointTime)));
            parameters.Add(new SqlParameter("@AddTime", EntityBase.GetDatabaseValue(@addTime)));
            parameters.Add(new SqlParameter("@AccpetStatus", EntityBase.GetDatabaseValue(@accpetStatus)));
            parameters.Add(new SqlParameter("@AccpetUserType", EntityBase.GetDatabaseValue(@accpetUserType)));
            parameters.Add(new SqlParameter("@AccpetTime", EntityBase.GetDatabaseValue(@accpetTime)));

            @helper.Execute(commandText, CommandType.Text, parameters);
        }
コード例 #42
0
 public static void LoadStaticContent(string contentManagerName)
 {
     if (string.IsNullOrEmpty(contentManagerName))
     {
         throw new System.ArgumentException("contentManagerName cannot be empty or null");
     }
     ContentManagerName = contentManagerName;
     #if DEBUG
     if (contentManagerName == FlatRedBall.FlatRedBallServices.GlobalContentManager)
     {
         HasBeenLoadedWithGlobalContentManager = true;
     }
     else if (HasBeenLoadedWithGlobalContentManager)
     {
         throw new System.Exception("This type has been loaded with a Global content manager, then loaded with a non-global.  This can lead to a lot of bugs");
     }
     #endif
     bool registerUnload = false;
     if (LoadedContentManagers.Contains(contentManagerName) == false)
     {
         LoadedContentManagers.Add(contentManagerName);
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBall.FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
         if (PlatformerValues == null)
         {
             {
                 // We put the { and } to limit the scope of oldDelimiter
                 char oldDelimiter = FlatRedBall.IO.Csv.CsvFileManager.Delimiter;
                 FlatRedBall.IO.Csv.CsvFileManager.Delimiter = ',';
                 System.Collections.Generic.Dictionary <System.String, Soccer.DataTypes.PlatformerValues> temporaryCsvObject = new System.Collections.Generic.Dictionary <System.String, Soccer.DataTypes.PlatformerValues>();
                 FlatRedBall.IO.Csv.CsvFileManager.CsvDeserializeDictionary <System.String, Soccer.DataTypes.PlatformerValues>("content/entities/player/platformervalues.csv", temporaryCsvObject);
                 FlatRedBall.IO.Csv.CsvFileManager.Delimiter = oldDelimiter;
                 PlatformerValues = temporaryCsvObject;
             }
         }
         if (!FlatRedBall.FlatRedBallServices.IsLoaded <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/hombre.png", ContentManagerName))
         {
             registerUnload = true;
         }
         hombre = FlatRedBall.FlatRedBallServices.Load <Microsoft.Xna.Framework.Graphics.Texture2D>(@"content/entities/player/hombre.png", ContentManagerName);
         if (!FlatRedBall.FlatRedBallServices.IsLoaded <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName))
         {
             registerUnload = true;
         }
         AnimationChainListFile = FlatRedBall.FlatRedBallServices.Load <FlatRedBall.Graphics.Animation.AnimationChainList>(@"content/entities/player/animationchainlistfile.achx", ContentManagerName);
     }
     if (registerUnload && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
     {
         lock (mLockObject)
         {
             if (!mRegisteredUnloads.Contains(ContentManagerName) && ContentManagerName != FlatRedBall.FlatRedBallServices.GlobalContentManager)
             {
                 FlatRedBall.FlatRedBallServices.GetContentManagerByName(ContentManagerName).AddUnloadMethod("PlayerStaticUnload", UnloadStaticContent);
                 mRegisteredUnloads.Add(ContentManagerName);
             }
         }
     }
     CustomLoadStaticContent(contentManagerName);
 }
コード例 #43
0
            /// <summary>Gets the list of Eo operations to override.</summary>
            /// <returns>The list of Eo operations to be overload.</returns>
            public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
            {
                var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
                var methods = Efl.Eo.Globals.GetUserMethods(type);

                if (efl_view_model_children_bind_get_static_delegate == null)
                {
                    efl_view_model_children_bind_get_static_delegate = new efl_view_model_children_bind_get_delegate(children_bind_get);
                }

                if (methods.FirstOrDefault(m => m.Name == "GetChildrenBind") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_children_bind_get"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_children_bind_get_static_delegate)
                    });
                }

                if (efl_view_model_children_bind_set_static_delegate == null)
                {
                    efl_view_model_children_bind_set_static_delegate = new efl_view_model_children_bind_set_delegate(children_bind_set);
                }

                if (methods.FirstOrDefault(m => m.Name == "SetChildrenBind") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_children_bind_set"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_children_bind_set_static_delegate)
                    });
                }

                if (efl_view_model_property_string_add_static_delegate == null)
                {
                    efl_view_model_property_string_add_static_delegate = new efl_view_model_property_string_add_delegate(property_string_add);
                }

                if (methods.FirstOrDefault(m => m.Name == "AddPropertyString") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_string_add"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_string_add_static_delegate)
                    });
                }

                if (efl_view_model_property_string_del_static_delegate == null)
                {
                    efl_view_model_property_string_del_static_delegate = new efl_view_model_property_string_del_delegate(property_string_del);
                }

                if (methods.FirstOrDefault(m => m.Name == "DelPropertyString") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_string_del"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_string_del_static_delegate)
                    });
                }

                if (efl_view_model_property_logic_add_static_delegate == null)
                {
                    efl_view_model_property_logic_add_static_delegate = new efl_view_model_property_logic_add_delegate(property_logic_add);
                }

                if (methods.FirstOrDefault(m => m.Name == "AddPropertyLogic") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_logic_add"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_logic_add_static_delegate)
                    });
                }

                if (efl_view_model_property_logic_del_static_delegate == null)
                {
                    efl_view_model_property_logic_del_static_delegate = new efl_view_model_property_logic_del_delegate(property_logic_del);
                }

                if (methods.FirstOrDefault(m => m.Name == "DelPropertyLogic") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_logic_del"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_logic_del_static_delegate)
                    });
                }

                if (efl_view_model_property_bind_static_delegate == null)
                {
                    efl_view_model_property_bind_static_delegate = new efl_view_model_property_bind_delegate(property_bind);
                }

                if (methods.FirstOrDefault(m => m.Name == "PropertyBind") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_bind"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_bind_static_delegate)
                    });
                }

                if (efl_view_model_property_unbind_static_delegate == null)
                {
                    efl_view_model_property_unbind_static_delegate = new efl_view_model_property_unbind_delegate(property_unbind);
                }

                if (methods.FirstOrDefault(m => m.Name == "PropertyUnbind") != null)
                {
                    descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_view_model_property_unbind"), func = Marshal.GetFunctionPointerForDelegate(efl_view_model_property_unbind_static_delegate)
                    });
                }

                descs.AddRange(base.GetEoOps(type));
                return(descs);
            }
コード例 #44
0
                /// <summary>Gets the list of Eo operations to override.</summary>
                /// <returns>The list of Eo operations to be overload.</returns>
                public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
                {
                    var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
                    var methods = Efl.Eo.Globals.GetUserMethods(type);

                    if (efl_ui_widget_factory_item_class_get_static_delegate == null)
                    {
                        efl_ui_widget_factory_item_class_get_static_delegate = new efl_ui_widget_factory_item_class_get_delegate(item_class_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetItemClass") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_widget_factory_item_class_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_widget_factory_item_class_get_static_delegate)
                        });
                    }

                    if (efl_ui_widget_factory_item_class_set_static_delegate == null)
                    {
                        efl_ui_widget_factory_item_class_set_static_delegate = new efl_ui_widget_factory_item_class_set_delegate(item_class_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetItemClass") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_widget_factory_item_class_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_widget_factory_item_class_set_static_delegate)
                        });
                    }

                    if (efl_ui_factory_create_static_delegate == null)
                    {
                        efl_ui_factory_create_static_delegate = new efl_ui_factory_create_delegate(create);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "Create") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_create"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_create_static_delegate)
                        });
                    }

                    if (efl_ui_factory_release_static_delegate == null)
                    {
                        efl_ui_factory_release_static_delegate = new efl_ui_factory_release_delegate(release);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "Release") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_release"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_release_static_delegate)
                        });
                    }

                    if (efl_ui_factory_bind_static_delegate == null)
                    {
                        efl_ui_factory_bind_static_delegate = new efl_ui_factory_bind_delegate(factory_bind);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "FactoryBind") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_factory_bind"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_factory_bind_static_delegate)
                        });
                    }

                    if (efl_ui_property_bind_static_delegate == null)
                    {
                        efl_ui_property_bind_static_delegate = new efl_ui_property_bind_delegate(property_bind);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "PropertyBind") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_property_bind"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_property_bind_static_delegate)
                        });
                    }

                    descs.AddRange(base.GetEoOps(type));
                    return(descs);
                }
コード例 #45
0
ファイル: ScriptGenerator.cs プロジェクト: Rype69/utilities
        /// <summary>
        /// Generates a set of create scripts for all the objects in a database
        /// </summary>
        /// <returns>A <see cref="string"/> containing the SQL script.</returns>
        public static string GenerateCreateDatabaseObjectScript(string connectionString)
        {
            // NULL-check the parameter
            if (string.IsNullOrWhiteSpace(connectionString))
            {
                throw new System.ArgumentNullException(nameof(connectionString));
            }

            // Result objects
            var generateSchemataScriptStringBuilder = new System.Text.StringBuilder();
            var generateTableScriptStringBuilder    = new System.Text.StringBuilder();
            var generateObjectScriptStringBuilder   = new System.Text.StringBuilder();

            // Set of schemata for which scripts have been generated
            var schemata = new System.Collections.Generic.List <string>();

            var selectCommandText = new System.Text.StringBuilder();

            selectCommandText.Append("SELECT TABLE_SCHEMA AS [SCHEMA], TABLE_NAME AS [NAME], TABLE_TYPE AS [TYPE] FROM INFORMATION_SCHEMA.TABLES ");
            selectCommandText.Append("UNION ALL ");
            selectCommandText.Append("SELECT ROUTINE_SCHEMA AS [SCHEMA], ROUTINE_NAME AS [NAME], ROUTINE_TYPE AS [TYPE] FROM INFORMATION_SCHEMA.ROUTINES ORDER BY TYPE;");

            // For each table / view / stored procedure / function
            using (var connection = new System.Data.SqlClient.SqlConnection(connectionString))
                using (var selectCommand = new System.Data.SqlClient.SqlCommand(selectCommandText.ToString(), connection))
                {
                    selectCommand.Connection.Open();

                    using (var reader = selectCommand.ExecuteReader(System.Data.CommandBehavior.CloseConnection))
                    {
                        while (reader.Read())
                        {
                            string schema = null;

                            // TODO: Use sys.objects to determine schemas rather than INFORMATION_SCHEMA
                            if (reader["SCHEMA"] != null && !(reader["SCHEMA"] is System.DBNull))
                            {
                                schema = reader["SCHEMA"].ToString();
                                if (!schemata.Contains(schema))
                                {
                                    generateSchemataScriptStringBuilder.AppendLine(GenerateCreateSchemaScript(reader["SCHEMA"].ToString()));
                                    generateSchemataScriptStringBuilder.AppendLine("GO\r\n");
                                    schemata.Add(schema);
                                }
                            }

                            if (reader["NAME"] != null && !(reader["NAME"] is System.DBNull))
                            {
                                generateTableScriptStringBuilder.AppendLine(GenerateDropObjectScript(SqlObjectType.Table, reader["NAME"].ToString(), schema));
                                generateTableScriptStringBuilder.AppendLine("GO\r\n");

                                if (reader["TYPE"] != null && !(reader["TYPE"] is System.DBNull))
                                {
                                    switch (reader["TYPE"].ToString().ToUpper())
                                    {
                                    case "BASE TABLE":
                                        generateTableScriptStringBuilder.AppendLine(GenerateCreateTableScript(connectionString, reader["NAME"].ToString(), schema));
                                        generateTableScriptStringBuilder.AppendLine("GO\r\n");
                                        break;

                                    default:
                                        generateObjectScriptStringBuilder.AppendLine(GenerateCreateObjectScript(connectionString, reader["NAME"].ToString(), schema));
                                        generateObjectScriptStringBuilder.AppendLine("GO\r\n");
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }

            return($"{generateSchemataScriptStringBuilder}\r\n{generateTableScriptStringBuilder}\r\n{generateObjectScriptStringBuilder}");
        }
コード例 #46
0
        private static int Main(string[] args)
        {
            if (args.Length != 4)
            {
                PrintUsage();
                return(ErrorExitStatus);
            }

            // Avoid missing component errors because no components are directly used in this project
            // and the GeneratedCode assembly is not loaded but it should be
            Assembly.Load("GeneratedCode");

            var connectionParameters = new ConnectionParameters
            {
                WorkerType = WorkerType,
                Network    =
                {
                    ConnectionType = NetworkConnectionType.Tcp
                }
            };

            using (var connection = ConnectWithReceptionist(args[1], Convert.ToUInt16(args[2]), args[3], connectionParameters))
            {
                var dispatcher  = new Dispatcher();
                var isConnected = true;

                dispatcher.OnDisconnect(op =>
                {
                    Console.Error.WriteLine("[disconnect] " + op.Reason);
                    isConnected = false;
                });

                dispatcher.OnLogMessage(op =>
                {
                    connection.SendLogMessage(op.Level, LoggerName, op.Message);
                    if (op.Level == LogLevel.Fatal)
                    {
                        Console.Error.WriteLine("Fatal error: " + op.Message);
                        Environment.Exit(ErrorExitStatus);
                    }
                });

                dispatcher.OnAddEntity(op =>
                {
                    pending_entities.Add(op.EntityId);
                });

                dispatcher.OnAddComponent <Tree>(op =>
                {
                    if (pending_entities.Contains(op.EntityId))
                    {
                        if (op.Data.Get().Value.burned == 0)
                        {
                            Tree.Update tupdate = new Tree.Update();
                            connection.SendComponentUpdate(op.EntityId, tupdate.SetBurned(flag_burned));
                        }
                        trees.Add(op.EntityId, new myTree(op.Data.Get().Value.burned));
                    }
                    else
                    {
                        throw new Exception();
                    }
                });

                dispatcher.OnComponentUpdate <Tree>(op =>
                {
                    if (trees.ContainsKey(op.EntityId))
                    {
                        if (op.Update.Get().burned.HasValue)
                        {
                            trees[op.EntityId].burned = op.Update.Get().burned.Value;
                        }
                    }
                    else
                    {
                        throw new Exception();
                    }
                });

                dispatcher.OnFlagUpdate(op =>
                {
                    if (op.Name == "improbable_burned")
                    {
                        flag_burned = int.Parse(op.Value.Value);
                        foreach (KeyValuePair <EntityId, myTree> tree in trees)
                        {
                            Tree.Update tupdate = new Tree.Update();
                            connection.SendComponentUpdate(tree.Key, tupdate.SetBurned(flag_burned));
                        }
                    }
                });

                IDictionary <EntityId, Entity> entities = CreateTrees();
                foreach (KeyValuePair <EntityId, Entity> entry in entities)
                {
                    connection.SendCreateEntityRequest(entry.Value, entry.Key, new Option <uint>());
                }

                //Thread.Sleep(20000);

                String burned_value;
                connection.GetWorkerFlag("improbable_burned").TryGetValue(out burned_value);
                int burned_default = Int32.Parse(burned_value);
                foreach (KeyValuePair <EntityId, Entity> entry in entities)
                {
                    Tree.Update tupdate = new Tree.Update();
                    connection.SendComponentUpdate(entry.Key, tupdate.SetBurned(burned_default));
                }

                while (isConnected)
                {
                    using (var opList = connection.GetOpList(GetOpListTimeoutInMilliseconds))
                    {
                        dispatcher.Process(opList);
                    }
                }
            }

            // This means we forcefully disconnected
            return(ErrorExitStatus);
        }
コード例 #47
0
        protected override void OnLoad(EventArgs e)
        {
            if (!this.DesignMode)
            {
                LogMessage("Loading frmTenderCount",
                           LSRetailPosis.LogTraceLevel.Trace,
                           this.ToString());

                TranslateLabels();


                // Check which amounts the POS will expect per tendertype
                // Start by checking which tender types to count....
                TenderData tenderData = new TenderData(
                    ApplicationSettings.Database.LocalConnection,
                    ApplicationSettings.Database.DATAAREAID);

                LoadFromTenderData(tenderData);

                LogMessage("Counting " + tendersToCount.Rows.Count + " tenders",
                           LSRetailPosis.LogTraceLevel.Trace,
                           this.ToString());

                gridSource = new System.Collections.Generic.List <TenderViewModel>();
                denominationDataSources = new Dictionary <int, List <DenominationViewModel> >();

                foreach (DataRow row in tendersToCount.Rows)
                {
                    ITender tmpTender = Dialog.InternalApplication.BusinessLogic.Utility.CreateTender();
                    tmpTender.TenderID       = row["TENDERTYPEID"].ToString();
                    tmpTender.TenderName     = row["NAME"].ToString();
                    tmpTender.PosisOperation = (PosisOperations)(row["POSOPERATION"]);

                    LSRetailPosis.ApplicationLog.Log(this.ToString(), "Counting: " + tmpTender.TenderID
                                                     + " " + tmpTender.TenderName + " "
                                                     + tmpTender.PosisOperation.ToString(),
                                                     LSRetailPosis.LogTraceLevel.Trace);

                    switch (tmpTender.PosisOperation)
                    {
                    case PosisOperations.PayCash:
                        cashCounted = true;

                        TenderViewModel cashRow = new TenderViewModel()
                        {
                            TenderTypeId        = tmpTender.TenderID,
                            TenderOperationType = tmpTender.PosisOperation,
                            TenderName          = tmpTender.TenderName,
                            DisplayName         = ApplicationLocalizer.Language.Translate(STRING_ID_TENDER_NAME, ApplicationSettings.Terminal.StoreCurrency),
                            Currency            = ApplicationSettings.Terminal.StoreCurrency
                        };

                        gridSource.Insert(0, cashRow);
                        break;

                    case PosisOperations.PayCurrency:
                        foreignCurrencyCounted = true;

                        ExchangeRateDataManager exchangeRateData = new ExchangeRateDataManager(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);
                        //Initialize with all number of currencies avialable
                        foreach (string currency in exchangeRateData.GetCurrencyPair(
                                     ApplicationSettings.Terminal.StoreCurrency,
                                     ApplicationSettings.Terminal.ExchangeRateType,
                                     ApplicationSettings.Terminal.StorePrimaryId))
                        {
                            TenderViewModel currencyRow = new TenderViewModel()
                            {
                                TenderTypeId        = tmpTender.TenderID,
                                TenderOperationType = tmpTender.PosisOperation,
                                TenderName          = tmpTender.TenderName,
                                DisplayName         = ApplicationLocalizer.Language.Translate(STRING_ID_TENDER_NAME, currency),
                                Currency            = currency
                            };

                            gridSource.Insert(gridSource.Count > 0 ? 1 : 0, currencyRow);
                        }
                        break;

                    default:
                        otherTendersCounted = true;
                        TenderViewModel otherRow = new TenderViewModel()
                        {
                            TenderTypeId        = tmpTender.TenderID,
                            TenderOperationType = tmpTender.PosisOperation,
                            TenderName          = tmpTender.TenderName,
                            DisplayName         = tmpTender.TenderName
                        };

                        gridSource.Add(otherRow);
                        break;
                    }
                }

                this.gridTenders.DataSource = gridSource;

                this.Text = lblHeader.Text = formHeadingText;
                this.gvTenders.Appearance.HeaderPanel.ForeColor = this.ForeColor;
                this.gvTenders.Appearance.Row.ForeColor         = this.ForeColor;

                UpdateTotalAmount();
            }

            base.OnLoad(e);
        }
コード例 #48
0
ファイル: CAT63.cs プロジェクト: tanxulong/MUAC
        // 1. Item presence
        // 2. Item description
        //
        // Based on the data item identifer


        public static void Intitialize()
        {
            I063DataItems.Clear();

            // 1 I063/010 Data Source Identifier
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("010")].ID          = "010";
            I063DataItems[ItemIDToIndex("010")].Description = "Data Source Identifier";
            I063DataItems[ItemIDToIndex("010")].IsPresent   = false;

            // 2 I063/015 Service Identification
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("015")].ID          = "015";
            I063DataItems[ItemIDToIndex("015")].Description = "Service Identification";
            I063DataItems[ItemIDToIndex("015")].IsPresent   = false;

            // 3. I063/030 Time of Message
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("030")].ID          = "030";
            I063DataItems[ItemIDToIndex("030")].Description = "Time of Message";
            I063DataItems[ItemIDToIndex("030")].IsPresent   = false;

            // 4. I063/050 Sensor Identifier
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("050")].ID          = "050";
            I063DataItems[ItemIDToIndex("050")].Description = "Sensor Identifier";
            I063DataItems[ItemIDToIndex("050")].IsPresent   = false;

            // 5. I063/060 Sensor Configuration and Status
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("060")].ID          = "060";
            I063DataItems[ItemIDToIndex("060")].Description = " Sensor Configuration and Status";
            I063DataItems[ItemIDToIndex("060")].IsPresent   = false;

            // 6. I063/070 Time Stamping Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("070")].ID          = "070";
            I063DataItems[ItemIDToIndex("070")].Description = "Time Stamping Bias";
            I063DataItems[ItemIDToIndex("070")].IsPresent   = false;

            // 7. I063/080 SSR/Mode S Range Gain and Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("080")].ID          = "080";
            I063DataItems[ItemIDToIndex("080")].Description = "SSR/Mode S Range Gain and Bias";
            I063DataItems[ItemIDToIndex("080")].IsPresent   = false;

            // 8. I063/081 SSR/Mode S Azimuth Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("081")].ID          = "081";
            I063DataItems[ItemIDToIndex("081")].Description = "SSR/Mode S Azimuth Bias";
            I063DataItems[ItemIDToIndex("081")].IsPresent   = false;

            // 9. I063/090 PSR Range Gain and Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("090")].ID          = "090";
            I063DataItems[ItemIDToIndex("090")].Description = "PSR Range Gain and Bias";
            I063DataItems[ItemIDToIndex("090")].IsPresent   = false;

            // 10. I063/091 PSR Azimuth Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("091")].ID          = "091";
            I063DataItems[ItemIDToIndex("091")].Description = "PSR Azimuth Bias ";
            I063DataItems[ItemIDToIndex("091")].IsPresent   = false;

            // 11. I063/092 PSR Elevation Bias
            I063DataItems.Add(new I063DataItem());
            I063DataItems[ItemIDToIndex("092")].ID          = "092";
            I063DataItems[ItemIDToIndex("092")].Description = "PSR Elevation Bias";
            I063DataItems[ItemIDToIndex("092")].IsPresent   = false;
        }
コード例 #49
0
        private void DoConcurrentTest(int numProcesses, int numLogs, string mode)
        {
            string tempPath    = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
            string archivePath = Path.Combine(tempPath, "Archive");

            try
            {
                Directory.CreateDirectory(tempPath);
                Directory.CreateDirectory(archivePath);

                string logFile = Path.Combine(tempPath, MakeFileName(numProcesses, numLogs, mode));
                if (File.Exists(logFile))
                {
                    throw new Exception($"file '{logFile}' already exists");
                }

                Process[] processes = new Process[numProcesses];

                for (int i = 0; i < numProcesses; ++i)
                {
                    processes[i] = ProcessRunner.SpawnMethod(
                        GetType(),
                        "Process",
                        i.ToString(),
                        logFile,
                        numLogs.ToString(),
                        mode);
                }

                // In case we'd like to capture stdout, we would need to drain it continuously.
                // StandardOutput.ReadToEnd() wont work, since the other processes console only has limited buffer.
                for (int i = 0; i < numProcesses; ++i)
                {
                    processes[i].WaitForExit();
                    Assert.Equal(0, processes[i].ExitCode);
                    processes[i].Dispose();
                    processes[i] = null;
                }

                var files = new System.Collections.Generic.List <string>(Directory.GetFiles(archivePath));
                files.Add(logFile);

                bool verifyFileSize = files.Count > 1;

                var recievedNumbersSet = new List <int> [numProcesses];
                for (int i = 0; i < numProcesses; i++)
                {
                    var recievedNumbers = new List <int>(numLogs);
                    recievedNumbersSet[i] = recievedNumbers;
                }

                //Console.WriteLine("Verifying output file {0}", logFile);
                foreach (var file in files)
                {
                    using (StreamReader sr = File.OpenText(file))
                    {
                        string line;
                        while ((line = sr.ReadLine()) != null)
                        {
                            string[] tokens = line.Split(' ');
                            Assert.Equal(2, tokens.Length);

                            int thread = Convert.ToInt32(tokens[0]);
                            int number = Convert.ToInt32(tokens[1]);
                            Assert.True(thread >= 0);
                            Assert.True(thread < numProcesses);
                            recievedNumbersSet[thread].Add(number);
                        }


                        if (verifyFileSize)
                        {
                            if (sr.BaseStream.Length > 100)
                            {
                                throw new InvalidOperationException(
                                          $"Error when reading file {file}, size {sr.BaseStream.Length} is too large");
                            }
                            else if (sr.BaseStream.Length < 35 && files[files.Count - 1] != file)
                            {
                                throw new InvalidOperationException(
                                          $"Error when reading file {file}, size {sr.BaseStream.Length} is too small");
                            }
                        }
                    }
                }

                var expected = Enumerable.Range(0, numLogs).ToList();

                int  currentProcess     = 0;
                bool?equalsWhenReorderd = null;
                try
                {
                    for (; currentProcess < numProcesses; currentProcess++)
                    {
                        var recievedNumbers = recievedNumbersSet[currentProcess];

                        var equalLength = expected.Count == recievedNumbers.Count;

                        var fastCheck = equalLength && expected.SequenceEqual(recievedNumbers);

                        if (!fastCheck)
                        //assert equals on two long lists in xUnit is lame. Not showing the difference.
                        {
                            if (equalLength)
                            {
                                var reodered = recievedNumbers.OrderBy(i => i);

                                equalsWhenReorderd = expected.SequenceEqual(reodered);
                            }

                            Assert.Equal(string.Join(",", expected), string.Join(",", recievedNumbers));
                        }
                    }
                }
                catch (Exception ex)
                {
                    var reoderProblem = equalsWhenReorderd == null ? "Dunno" : (equalsWhenReorderd == true ? "Yes" : "No");
                    throw new InvalidOperationException($"Error when comparing path {tempPath} for process {currentProcess}. Is this a recording problem? {reoderProblem}", ex);
                }
            }
            finally
            {
                try
                {
                    if (Directory.Exists(archivePath))
                    {
                        Directory.Delete(archivePath, true);
                    }
                    if (Directory.Exists(tempPath))
                    {
                        Directory.Delete(tempPath, true);
                    }
                }
                catch
                {
                }
            }
        }
コード例 #50
0
        public HttpResponseMessage BuscarPorMaterial(string p_material)
        {
            // CAD, CEN, EN, returnValue

            AccionReciclarRESTCAD accionReciclarRESTCAD = null;
            AccionReciclarCEN     accionReciclarCEN     = null;


            System.Collections.Generic.List <AccionReciclarEN> en;

            System.Collections.Generic.List <AccionReciclarDTOA> returnValue = null;

            try
            {
                SessionInitializeWithoutTransaction();
                string token = "";
                if (Request.Headers.Authorization != null)
                {
                    token = Request.Headers.Authorization.ToString();
                }
                int id = new UsuarioCEN().CheckToken(token);



                accionReciclarRESTCAD = new AccionReciclarRESTCAD(session);
                accionReciclarCEN     = new AccionReciclarCEN(accionReciclarRESTCAD);

                // CEN return



                en = accionReciclarCEN.BuscarPorMaterial(p_material).ToList();



                // Convert return
                if (en != null)
                {
                    returnValue = new System.Collections.Generic.List <AccionReciclarDTOA>();
                    foreach (AccionReciclarEN entry in en)
                    {
                        returnValue.Add(AccionReciclarAssembler.Convert(entry, session));
                    }
                }
            }

            catch (Exception e)
            {
                if (e.GetType() == typeof(HttpResponseException))
                {
                    throw e;
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) && e.Message.Equals("El token es incorrecto"))
                {
                    throw new HttpResponseException(HttpStatusCode.Forbidden);
                }
                else if (e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.ModelException) || e.GetType() == typeof(ReciclaUAGenNHibernate.Exceptions.DataLayerException))
                {
                    throw new HttpResponseException(HttpStatusCode.BadRequest);
                }
                else
                {
                    throw new HttpResponseException(HttpStatusCode.InternalServerError);
                }
            }
            finally
            {
                SessionClose();
            }

            // Return 204 - Empty
            if (returnValue == null || returnValue.Count == 0)
            {
                return(this.Request.CreateResponse(HttpStatusCode.NoContent));
            }
            // Return 200 - OK
            else
            {
                return(this.Request.CreateResponse(HttpStatusCode.OK, returnValue));
            }
        }
コード例 #51
0
        /// <summary>
        /// Insert a ChargeFee into the data store based on the primitive properties. This can be used as the
        /// insert method for an ObjectDataSource.
        /// </summary>
        /// <param name="unitPrice">unitPrice</param>
        /// <param name="startTime">startTime</param>
        /// <param name="endTypeID">endTypeID</param>
        /// <param name="addTime">addTime</param>
        /// <param name="chargeID">chargeID</param>
        /// <param name="changeUnitPrice">changeUnitPrice</param>
        /// <param name="changeStartTime">changeStartTime</param>
        /// <param name="isActive">isActive</param>
        /// <param name="cID">cID</param>
        /// <param name="endTime">endTime</param>
        /// <param name="sortOrder">sortOrder</param>
        /// <param name="remark">remark</param>
        /// <param name="chargeTypeCount">chargeTypeCount</param>
        /// <param name="helper">helper</param>
        internal static void InsertChargeFee(decimal @unitPrice, DateTime @startTime, int @endTypeID, DateTime @addTime, int @chargeID, decimal @changeUnitPrice, DateTime @changeStartTime, bool @isActive, int @cID, DateTime @endTime, int @sortOrder, string @remark, int @chargeTypeCount, SqlHelper @helper)
        {
            string commandText = @"
DECLARE @table TABLE(
	[ID] int,
	[UnitPrice] decimal(18, 4),
	[StartTime] datetime,
	[EndTypeID] int,
	[AddTime] datetime,
	[ChargeID] int,
	[ChangeUnitPrice] decimal(18, 3),
	[ChangeStartTime] datetime,
	[IsActive] bit,
	[CID] int,
	[EndTime] datetime,
	[SortOrder] int,
	[Remark] ntext,
	[ChargeTypeCount] int
);

INSERT INTO [dbo].[ChargeFee] (
	[ChargeFee].[UnitPrice],
	[ChargeFee].[StartTime],
	[ChargeFee].[EndTypeID],
	[ChargeFee].[AddTime],
	[ChargeFee].[ChargeID],
	[ChargeFee].[ChangeUnitPrice],
	[ChargeFee].[ChangeStartTime],
	[ChargeFee].[IsActive],
	[ChargeFee].[CID],
	[ChargeFee].[EndTime],
	[ChargeFee].[SortOrder],
	[ChargeFee].[Remark],
	[ChargeFee].[ChargeTypeCount]
) 
output 
	INSERTED.[ID],
	INSERTED.[UnitPrice],
	INSERTED.[StartTime],
	INSERTED.[EndTypeID],
	INSERTED.[AddTime],
	INSERTED.[ChargeID],
	INSERTED.[ChangeUnitPrice],
	INSERTED.[ChangeStartTime],
	INSERTED.[IsActive],
	INSERTED.[CID],
	INSERTED.[EndTime],
	INSERTED.[SortOrder],
	INSERTED.[Remark],
	INSERTED.[ChargeTypeCount]
into @table
VALUES ( 
	@UnitPrice,
	@StartTime,
	@EndTypeID,
	@AddTime,
	@ChargeID,
	@ChangeUnitPrice,
	@ChangeStartTime,
	@IsActive,
	@CID,
	@EndTime,
	@SortOrder,
	@Remark,
	@ChargeTypeCount 
); 

SELECT 
	[ID],
	[UnitPrice],
	[StartTime],
	[EndTypeID],
	[AddTime],
	[ChargeID],
	[ChangeUnitPrice],
	[ChangeStartTime],
	[IsActive],
	[CID],
	[EndTime],
	[SortOrder],
	[Remark],
	[ChargeTypeCount] 
FROM @table;
";

            System.Collections.Generic.List <SqlParameter> parameters = new System.Collections.Generic.List <SqlParameter>();
            parameters.Add(new SqlParameter("@UnitPrice", EntityBase.GetDatabaseValue(@unitPrice)));
            parameters.Add(new SqlParameter("@StartTime", EntityBase.GetDatabaseValue(@startTime)));
            parameters.Add(new SqlParameter("@EndTypeID", EntityBase.GetDatabaseValue(@endTypeID)));
            parameters.Add(new SqlParameter("@AddTime", EntityBase.GetDatabaseValue(@addTime)));
            parameters.Add(new SqlParameter("@ChargeID", EntityBase.GetDatabaseValue(@chargeID)));
            parameters.Add(new SqlParameter("@ChangeUnitPrice", EntityBase.GetDatabaseValue(@changeUnitPrice)));
            parameters.Add(new SqlParameter("@ChangeStartTime", EntityBase.GetDatabaseValue(@changeStartTime)));
            parameters.Add(new SqlParameter("@IsActive", @isActive));
            parameters.Add(new SqlParameter("@CID", EntityBase.GetDatabaseValue(@cID)));
            parameters.Add(new SqlParameter("@EndTime", EntityBase.GetDatabaseValue(@endTime)));
            parameters.Add(new SqlParameter("@SortOrder", EntityBase.GetDatabaseValue(@sortOrder)));
            parameters.Add(new SqlParameter("@Remark", EntityBase.GetDatabaseValue(@remark)));
            parameters.Add(new SqlParameter("@ChargeTypeCount", EntityBase.GetDatabaseValue(@chargeTypeCount)));

            @helper.Execute(commandText, CommandType.Text, parameters);
        }
コード例 #52
0
        public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
        {
            var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
            var methods = Efl.Eo.Globals.GetUserMethods(type);

            if (efl_canvas_proxy_source_get_static_delegate == null)
            {
                efl_canvas_proxy_source_get_static_delegate = new efl_canvas_proxy_source_get_delegate(source_get);
            }
            if (methods.FirstOrDefault(m => m.Name == "GetSource") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_get"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_get_static_delegate)
                    });
            }
            if (efl_canvas_proxy_source_set_static_delegate == null)
            {
                efl_canvas_proxy_source_set_static_delegate = new efl_canvas_proxy_source_set_delegate(source_set);
            }
            if (methods.FirstOrDefault(m => m.Name == "SetSource") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_set"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_set_static_delegate)
                    });
            }
            if (efl_canvas_proxy_source_clip_get_static_delegate == null)
            {
                efl_canvas_proxy_source_clip_get_static_delegate = new efl_canvas_proxy_source_clip_get_delegate(source_clip_get);
            }
            if (methods.FirstOrDefault(m => m.Name == "GetSourceClip") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_clip_get"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_clip_get_static_delegate)
                    });
            }
            if (efl_canvas_proxy_source_clip_set_static_delegate == null)
            {
                efl_canvas_proxy_source_clip_set_static_delegate = new efl_canvas_proxy_source_clip_set_delegate(source_clip_set);
            }
            if (methods.FirstOrDefault(m => m.Name == "SetSourceClip") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_clip_set"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_clip_set_static_delegate)
                    });
            }
            if (efl_canvas_proxy_source_events_get_static_delegate == null)
            {
                efl_canvas_proxy_source_events_get_static_delegate = new efl_canvas_proxy_source_events_get_delegate(source_events_get);
            }
            if (methods.FirstOrDefault(m => m.Name == "GetSourceEvents") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_events_get"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_events_get_static_delegate)
                    });
            }
            if (efl_canvas_proxy_source_events_set_static_delegate == null)
            {
                efl_canvas_proxy_source_events_set_static_delegate = new efl_canvas_proxy_source_events_set_delegate(source_events_set);
            }
            if (methods.FirstOrDefault(m => m.Name == "SetSourceEvents") != null)
            {
                descs.Add(new Efl_Op_Description()
                    {
                        api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(_Module.Module, "efl_canvas_proxy_source_events_set"), func = Marshal.GetFunctionPointerForDelegate(efl_canvas_proxy_source_events_set_static_delegate)
                    });
            }
            descs.AddRange(base.GetEoOps(type));
            return(descs);
        }
コード例 #53
0
 public override void GetContextMenuEntries(Mobile from, System.Collections.Generic.List <ContextMenuEntry> list)
 {
     base.GetContextMenuEntries(from, list);
     list.Add(new SevargasEntry(from, this));
 }
コード例 #54
0
ファイル: CheckBudget.aspx.cs プロジェクト: zxl881203/src
    private System.Collections.Generic.List <DataTable> GetData()
    {
        System.Collections.Generic.List <DataTable> list = new System.Collections.Generic.List <DataTable>();
        string text   = this.dropTaskType.SelectedValue;
        string value  = this.dropYear.SelectedValue;
        string value2 = this.dropMonth.SelectedValue;

        if (string.IsNullOrEmpty(text))
        {
            value  = string.Empty;
            value2 = string.Empty;
        }
        else
        {
            if (text == "Y")
            {
                value2 = string.Empty;
            }
        }
        if (string.IsNullOrEmpty(value))
        {
            text = string.Empty;
        }
        if (text == "M" && string.IsNullOrEmpty(value2))
        {
            text  = string.Empty;
            value = string.Empty;
        }
        DataTable allTable  = this.budTaskSer.GetAllTable(this.prjId);
        DataTable dataTable = new DataTable();

        dataTable.Columns.Add("序号");
        dataTable.Columns.Add("名称");
        dataTable.Columns.Add("编码");
        dataTable.Columns.Add("类型");
        dataTable.Columns.Add("单位");
        dataTable.Columns.Add("工程量");
        if (this.hfldIsWBSRelevance.Value == "1")
        {
            dataTable.Columns.Add("开始时间");
            dataTable.Columns.Add("结束时间");
        }
        dataTable.Columns.Add("综合单价");
        dataTable.Columns.Add("小计");
        dataTable.Columns.Add("备注");
        DataTable dataTable2 = new DataTable();

        dataTable2.Columns.Add("资源编号");
        dataTable2.Columns.Add("资源名称");
        dataTable2.Columns.Add("单位");
        dataTable2.Columns.Add("规格");
        dataTable2.Columns.Add("品牌");
        dataTable2.Columns.Add("型号");
        dataTable2.Columns.Add("技术参数");
        dataTable2.Columns.Add("单价");
        dataTable2.Columns.Add("数量");
        dataTable2.Columns.Add("损耗系数");
        dataTable2.Columns.Add("合计金额");
        dataTable2.Columns.Add("序号");
        for (int i = 0; i < allTable.Rows.Count; i++)
        {
            DataRow dataRow = dataTable.NewRow();
            dataRow["序号"]  = i + 1;
            dataRow["名称"]  = allTable.Rows[i]["TaskName"].ToString();
            dataRow["编码"]  = allTable.Rows[i]["TaskCode"].ToString();
            dataRow["类型"]  = allTable.Rows[i]["TypeName"].ToString();
            dataRow["单位"]  = allTable.Rows[i]["Unit"].ToString();
            dataRow["工程量"] = allTable.Rows[i]["Quantity"].ToString();
            if (this.hfldIsWBSRelevance.Value == "1")
            {
                dataRow["开始时间"] = allTable.Rows[i]["StartDate"].ToString();
                dataRow["结束时间"] = allTable.Rows[i]["EndDate"].ToString();
            }
            dataRow["综合单价"] = allTable.Rows[i]["UnitPrice"].ToString();
            dataRow["小计"]   = allTable.Rows[i]["Total2"].ToString();
            dataRow["备注"]   = allTable.Rows[i]["Note"].ToString();
            dataTable.Rows.Add(dataRow);
            if (allTable.Rows[i]["SubCount"].ToString() == "0")
            {
                string resourcesInfoByTaskId = BudTask.GetResourcesInfoByTaskId(allTable.Rows[i]["TaskId"].ToString());
                if (resourcesInfoByTaskId != string.Empty)
                {
                    string[] array = new string[0];
                    if (resourcesInfoByTaskId.Contains("⊙"))
                    {
                        array = resourcesInfoByTaskId.Split(new char[]
                        {
                            '⊙'
                        });
                    }
                    string[] array2 = array;
                    for (int j = 0; j < array2.Length; j++)
                    {
                        string text2 = array2[j];
                        if (text2 != string.Empty)
                        {
                            string[] array3 = text2.Split(new char[]
                            {
                                ','
                            });
                            DataRow dataRow2 = dataTable2.NewRow();
                            for (int k = 0; k < array3.Length; k++)
                            {
                                dataRow2[k] = array3[k];
                            }
                            dataRow2["序号"] = i + 1;
                            dataTable2.Rows.Add(dataRow2);
                        }
                    }
                }
            }
        }
        list.Add(dataTable);
        list.Add(dataTable2);
        return(list);
    }
コード例 #55
0
                    /// <summary>Gets the list of Eo operations to override.</summary>
                    /// <returns>The list of Eo operations to be overload.</returns>
                    public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
                    {
                        var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
                        var methods = Efl.Eo.Globals.GetUserMethods(type);

                        if (efl_ui_focus_composition_elements_get_static_delegate == null)
                        {
                            efl_ui_focus_composition_elements_get_static_delegate = new efl_ui_focus_composition_elements_get_delegate(composition_elements_get);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "GetCompositionElements") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_elements_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_elements_get_static_delegate)
                            });
                        }

                        if (efl_ui_focus_composition_elements_set_static_delegate == null)
                        {
                            efl_ui_focus_composition_elements_set_static_delegate = new efl_ui_focus_composition_elements_set_delegate(composition_elements_set);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "SetCompositionElements") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_elements_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_elements_set_static_delegate)
                            });
                        }

                        if (efl_ui_focus_composition_logical_mode_get_static_delegate == null)
                        {
                            efl_ui_focus_composition_logical_mode_get_static_delegate = new efl_ui_focus_composition_logical_mode_get_delegate(logical_mode_get);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "GetLogicalMode") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_logical_mode_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_logical_mode_get_static_delegate)
                            });
                        }

                        if (efl_ui_focus_composition_logical_mode_set_static_delegate == null)
                        {
                            efl_ui_focus_composition_logical_mode_set_static_delegate = new efl_ui_focus_composition_logical_mode_set_delegate(logical_mode_set);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "SetLogicalMode") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_logical_mode_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_logical_mode_set_static_delegate)
                            });
                        }

                        if (efl_ui_focus_composition_dirty_static_delegate == null)
                        {
                            efl_ui_focus_composition_dirty_static_delegate = new efl_ui_focus_composition_dirty_delegate(dirty);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "Dirty") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_dirty"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_dirty_static_delegate)
                            });
                        }

                        if (efl_ui_focus_composition_prepare_static_delegate == null)
                        {
                            efl_ui_focus_composition_prepare_static_delegate = new efl_ui_focus_composition_prepare_delegate(prepare);
                        }

                        if (methods.FirstOrDefault(m => m.Name == "Prepare") != null)
                        {
                            descs.Add(new Efl_Op_Description()
                            {
                                api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_focus_composition_prepare"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_focus_composition_prepare_static_delegate)
                            });
                        }

                        return(descs);
                    }
コード例 #56
0
ファイル: Node.cs プロジェクト: samcf111/unityMono5.5.0
        /// <summary>
        /// Matches the header collection against this subtree, adds any new matches for this node to
        /// matchList, and uses the matchList to augment the result.
        /// </summary>
        /// <param name="header">the header collection to evaluate (invariant)</param>
        /// <param name="result">the result of the match (might be changed if a match is found)</param>
        /// <param name="matchList">the matches to use to do substitutions,
        /// possibly including new matches for this node.</param>
        /// <returns>true iff this node or one of it's descendants matches</returns>
        private bool ProcessSubtree(System.Collections.Specialized.NameValueCollection header, nBrowser.Result result, System.Collections.Generic.List <Match> matchList)
        {
            //----------------------------------------------------------------------
            //This is just coded over from MS version since if you pass in an empty
            //string for the key it returns the UserAgent header as a response.
            //----------------------------------------------------------------------
            result.AddCapabilities("", header["User-Agent"]);

            if (RefId.Length == 0 && this.NameType != NodeType.DefaultBrowser)
            {
                //----------------------------------------------------------------------
                //BrowserIdentification adds all the Identifiction matches to the match
                //list if this node matches.
                //----------------------------------------------------------------------
                if (!BrowserIdentification(header, result, matchList))
                {
                    return(false);
                }
            }

            result.AddMatchingBrowserId(this.Id);
            #region Browser Identification Successfull
            //----------------------------------------------------------------------
            //By reaching this point, it either means there were no Identification
            //items to be processed or that all the Identification items have been
            //passed. So just for debuging I want to output this Groups unique ID.
            //----------------------------------------------------------------------
            result.AddTrack("[" + this.NameType + "]\t" + this.Id);

            //----------------------------------------------------------------------
            //Just adding all the Adapters to the current list.
            //----------------------------------------------------------------------
            if (Adapter != null)
            {
                LookupAdapterTypes();
                for (int i = 0; i <= Adapter.Count - 1; i++)
                {
                    result.AddAdapter(AdapterControlTypes [i], AdapterTypes [i]);
                }
            }

            //----------------------------------------------------------------------
            //Set the MarkupTextWriter in the result if set in this node.
            //----------------------------------------------------------------------
            if (MarkupTextWriterType != null && MarkupTextWriterType.Length > 0)
            {
                // Look for the type using a case-sensitive search
                result.MarkupTextWriter = Type.GetType(MarkupTextWriterType);
                // If we don't find it, try again using a case-insensitive search and throw
                // and exception if we can't find it.
                if (result.MarkupTextWriter == null)
                {
                    result.MarkupTextWriter = Type.GetType(MarkupTextWriterType, true, true);
                }
            }

            #endregion
            #region Capture
            if (Capture != null)
            {
                //----------------------------------------------------------------------
                //Adds all the sucessfull Capture matches to the matchList
                //----------------------------------------------------------------------
                for (int i = 0; i <= Capture.Length - 1; i++)
                {
                    //shouldn't happen often, the null should
                    //signal the end of the list, I keep procssing
                    //the rest just in case
                    if (Capture[i] == null)
                    {
                        continue;
                    }
                    Match m = null;
                    if (Capture[i].Group == "header")
                    {
                        m = Capture[i].GetMatch(header[Capture[i].Name]);
                    }
                    else if (Capture[i].Group == "capability")
                    {
                        m = Capture[i].GetMatch(result[Capture[i].Name]);
                    }
                    if (Capture[i].IsMatchSuccessful(m) && m.Groups.Count > 0)
                    {
                        matchList.Add(m);
                    }
                }
            }
            #endregion
            #region Capabilities
            if (Capabilities != null)
            {
                //----------------------------------------------------------------------
                //This section is what the whole exercise is about. Determining
                //the Browser Capabilities. We know already that the current
                //browser matches the criteria, now its a mater of updating
                //the results with the new Capabilties listed.
                //----------------------------------------------------------------------
                for (int i = 0; i <= Capabilities.Count - 1; i++)
                {
                    //----------------------------------------------------------------------
                    //We need to further process these Capabilities to
                    //insert the proper information.
                    //----------------------------------------------------------------------
                    string v = Capabilities[i];

                    //----------------------------------------------------------------------
                    //Loop though the list of Identifiction/Capture Matches
                    //in reverse order. Meaning the newest Items in the list
                    //get checked first, then working to the oldest. Often times
                    //Minor /Major revisition numbers will be listed multple times
                    //and only the newest one (most recent matches) are the ones
                    //we want to insert.
                    //----------------------------------------------------------------------
                    for (int a = matchList.Count - 1; a >= 0 && v != null && v.Length > 0 && v.IndexOf('$') > -1; a--)
                    {
                        // Don't do substitution if the match has no groups or was a nonMatch
                        if (matchList[a].Groups.Count == 0 || !matchList[a].Success)
                        {
                            continue;
                        }
                        v = matchList[a].Result(v);
                    }

                    //----------------------------------------------------------------------
                    //Checks to make sure we extract the result we where looking for.
                    //----------------------------------------------------------------------
                    if (v.IndexOf('$') > -1 || v.IndexOf('%') > -1)
                    {
                        //----------------------------------------------------------------------
                        //Microsoft has a nasty habbit of using capability items in regular expressions
                        //so I have to figure a nice way to working around it
                        // <capability name="msdomversion"		value="${majorversion}${minorversion}" />
                        //----------------------------------------------------------------------

                        //double checks the values against the current Capabilities. to
                        //find any last minute matches. that are not defined by regluar
                        //expressions
                        v = result.Replace(v);
                    }

                    result.AddCapabilities(Capabilities.Keys[i], v);
                }
            }
            #endregion

            //----------------------------------------------------------------------
            //Run the Default Children after the Parent Node is finished with
            //what it is doing
            //----------------------------------------------------------------------
            for (int i = 0; i <= DefaultChildren.Count - 1; i++)
            {
                string key  = DefaultChildrenKeys[i];
                Node   node = DefaultChildren[key];
                if (node.NameType == NodeType.DefaultBrowser)
                {
                    node.Process(header, result, matchList);
                }
            }
            //----------------------------------------------------------------------
            //processing all the children Browsers of this Parent if there are any.
            //----------------------------------------------------------------------
            //In nBrowser files, the Gateways should of been sorted so they are all
            //at the top so that they can be ran first.
            //----------------------------------------------------------------------
            //According to the msdn2 documentation Gateways are suppost to be
            //all processed first. before the browser objects.
            for (int i = 0; i <= Children.Count - 1; i++)
            {
                string key  = ChildrenKeys[i];
                Node   node = Children[key];
                if (node.NameType == NodeType.Gateway)
                {
                    node.Process(header, result, matchList);
                }
            }
            for (int i = 0; i <= Children.Count - 1; i++)
            {
                string key  = ChildrenKeys[i];
                Node   node = Children[key];
                if (node.NameType == NodeType.Browser &&
                    node.Process(header, result, matchList))
                {
                    break;
                }
            }

            return(true);
        }
コード例 #57
0
        public static void ImportDepositorOrders(string directory, string pubsuburl)
        {
            if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl))
            {
                throw new Exception("Arguments cannot be null");
            }
            bool skipheaders = true;

            string[] entries  = null;
            int      rowCount = 0;
            bool     fileerror;

            System.Collections.Generic.List <DepositorOrder> orders = new System.Collections.Generic.List <DepositorOrder>();
            System.Collections.Generic.List <char>           delim  = new System.Collections.Generic.List <char>();
            delim.Add('\r');
            delim.Add('\n');

            string[] files = System.IO.Directory.GetFiles(directory);

            foreach (var file in files)
            {
                if (!file.Contains("DLVRY"))
                {
                    continue;
                }
                skipheaders = true;
                foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.Split(';');
                        if ((skipheaders))
                        {
                            skipheaders = false;
                            continue;
                        }
                        if ((entries.Length > 0 && ((entries[0].Contains("Order")) == false) && ((entries[0].Contains("erdat")) == false)))
                        {
                            DepositorOrder order = orders?.FirstOrDefault((x) => x.DeliveryNo == entries[1]);
                            if (((entries[0] == null || entries[0] == "") || entries[0].Length != 8))
                            {
                                Console.WriteLine("Null creation date on " + file);
                                continue;
                            }
                            if ((entries[0] == "00000000"))
                            {
                                Console.WriteLine("bad data on file" + file);
                                continue;
                            }
                            if ((order == null))
                            {
                                order          = new DepositorOrder();
                                order.products = new List <Product>();
                                try
                                {
                                    order.CreationDate = DateTime.ParseExact(entries[0], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                }
                                catch (System.Exception x)
                                {
                                    Console.WriteLine(file + ": Error parsing CreationDate value: " + entries[0]);
                                    fileerror = true;
                                    continue;
                                }
                                order.DeliveryNo = entries[1];
                                try
                                {
                                    order.DeliveryDateFrom = DateTime.ParseExact(entries[2], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                }
                                catch (System.Exception x)
                                {
                                    Console.WriteLine(file + ": Error parsing DeliveryDateFrom value: " + entries[2]);
                                    continue;
                                    fileerror = true;
                                }
                                try
                                {
                                    order.DeliveryDateTo = DateTime.ParseExact(entries[3], "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                                }
                                catch (System.Exception x)
                                {
                                    Console.WriteLine(file + ": Error parsing DeliveryDateTo value: " + entries[3]);
                                    fileerror = true;
                                    continue;
                                }
                                order.WareHouse = entries[6];
                                Product product = new Product();
                                product.Code = entries[7].Trim();
                                try
                                {
                                    product.Quantity = int.Parse(entries[9]);
                                }
                                catch (System.Exception x)
                                {
                                    if (((entries[9] == null || entries[9] == "")))
                                    {
                                        Console.WriteLine(file + ": ProductQuantity is Null or Empty");
                                    }
                                    else
                                    {
                                        Console.WriteLine(file + ": product.Quantity:" + entries[9] + " failed to int parse");
                                    }
                                }
                                order.products.Add(product);
                                order.customer = new Customer();
                                order.customer.CustomerCode = entries[10];
                                order.Comments = entries[19];
                                order.Document = file;
                                if (((((entries[23] == null || entries[23] == "")) == false)))
                                {
                                    order.PayerCode = entries[23];
                                }
                                orders?.Add(order);
                            }
                            else
                            {
                                Product product = new Product();
                                product.Code     = entries[7].Trim();
                                product.Quantity = int.Parse(entries[9]);
                                order.products.Add(product);
                            }
                        }
                    }
                    if (orders.Count != 0)
                    {
                        string message = ConvertToPubSubMessage(orders);
                        PostMessage(message, "");
                        orders.Clear();
                    }
                }
            }
        }
コード例 #58
0
ファイル: Node.cs プロジェクト: samcf111/unityMono5.5.0
        /// <summary>
        ///
        /// </summary>
        /// <param name="header"></param>
        /// <param name="result"></param>
        /// <param name="matchList"></param>
        /// <returns>true iff this node is a match</returns>
        private bool BrowserIdentification(System.Collections.Specialized.NameValueCollection header, System.Web.Configuration.CapabilitiesResult result, System.Collections.Generic.List <Match> matchList)
        {
            if (Id.Length > 0 && RefId.Length > 0)
            {
                throw new nBrowser.Exception("Id and refID Attributes givin when there should only be one set not both");
            }
            if (Identification == null || Identification.Length == 0)
            {
                throw new nBrowser.Exception(String.Format("Missing Identification Section where one is required (Id={0}, RefID={1})", Id, RefId));
            }
            if (header == null)
            {
                throw new nBrowser.Exception("Null Value where NameValueCollection expected ");
            }
            if (result == null)
            {
                throw new nBrowser.Exception("Null Value where Result expected ");
            }

#if trace
            System.Diagnostics.Trace.WriteLine(string.Format("{0}[{1}]", ("[" + this.Id + "]").PadRight(45), this.ParentId));
#endif

            for (int i = 0; i <= Identification.Length - 1; i++)
            {
                //shouldn't happen often, the null should
                //signal the end of the list, I keep procssing
                //the rest just in case
                if (Identification[i] == null)
                {
                    continue;
                }
                string v = string.Empty;
                if (string.Compare(Identification[i].Group, "header", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    v = header[Identification[i].Name];
                }
                else if (string.Compare(Identification[i].Group, "capability", true, System.Globalization.CultureInfo.CurrentCulture) == 0)
                {
                    v = result[Identification[i].Name];
                }
                //Not all headers will be sent by all browsers.
                //so often a header search will return Null.
                if (v == null)
                {
                    v = string.Empty;
                }
                Match m = Identification[i].GetMatch(v);
                //----------------------------------------------------------------------
                //we exit this method return the orginal Result back to  the calling method.
                //----------------------------------------------------------------------
                if (Identification[i].IsMatchSuccessful(m) == false)
                {
#if trace
                    System.Diagnostics.Trace.WriteLine(string.Format("{0}{1}", "Failed:".PadRight(45), Identification[i].Pattern));
#endif
                    return(false);
                }
                else
                {
#if trace
                    System.Diagnostics.Trace.WriteLine(string.Format("{0}{1}", "Passed:".PadRight(45), Identification[i].Pattern));
#endif
                    if (m.Groups.Count > 0)
                    {
                        matchList.Add(m);
                    }
                }
            }
#if trace
            System.Diagnostics.Trace.WriteLine("");
#endif
            return(true);
        }
コード例 #59
0
ファイル: ClientServer.cs プロジェクト: ryik5/ClientServer2
        private System.Collections.Generic.List <ClientObject> clients = new System.Collections.Generic.List <ClientObject>(); // все подключения

        protected internal void AddConnection(ClientObject clientObject)
        {
            clients.Add(clientObject);
        }
コード例 #60
0
                /// <summary>Gets the list of Eo operations to override.</summary>
                /// <returns>The list of Eo operations to be overload.</returns>
                public override System.Collections.Generic.List <Efl_Op_Description> GetEoOps(System.Type type)
                {
                    var descs   = new System.Collections.Generic.List <Efl_Op_Description>();
                    var methods = Efl.Eo.Globals.GetUserMethods(type);

                    if (efl_ui_datepicker_min_get_static_delegate == null)
                    {
                        efl_ui_datepicker_min_get_static_delegate = new efl_ui_datepicker_min_get_delegate(min_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetMin") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_min_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_get_static_delegate)
                        });
                    }

                    if (efl_ui_datepicker_min_set_static_delegate == null)
                    {
                        efl_ui_datepicker_min_set_static_delegate = new efl_ui_datepicker_min_set_delegate(min_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetMin") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_min_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_min_set_static_delegate)
                        });
                    }

                    if (efl_ui_datepicker_max_get_static_delegate == null)
                    {
                        efl_ui_datepicker_max_get_static_delegate = new efl_ui_datepicker_max_get_delegate(max_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetMax") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_max_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_get_static_delegate)
                        });
                    }

                    if (efl_ui_datepicker_max_set_static_delegate == null)
                    {
                        efl_ui_datepicker_max_set_static_delegate = new efl_ui_datepicker_max_set_delegate(max_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetMax") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_max_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_max_set_static_delegate)
                        });
                    }

                    if (efl_ui_datepicker_date_get_static_delegate == null)
                    {
                        efl_ui_datepicker_date_get_static_delegate = new efl_ui_datepicker_date_get_delegate(date_get);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "GetDate") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_date_get"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_get_static_delegate)
                        });
                    }

                    if (efl_ui_datepicker_date_set_static_delegate == null)
                    {
                        efl_ui_datepicker_date_set_static_delegate = new efl_ui_datepicker_date_set_delegate(date_set);
                    }

                    if (methods.FirstOrDefault(m => m.Name == "SetDate") != null)
                    {
                        descs.Add(new Efl_Op_Description()
                        {
                            api_func = Efl.Eo.FunctionInterop.LoadFunctionPointer(Module.Module, "efl_ui_datepicker_date_set"), func = Marshal.GetFunctionPointerForDelegate(efl_ui_datepicker_date_set_static_delegate)
                        });
                    }

                    descs.AddRange(base.GetEoOps(type));
                    return(descs);
                }