public ICloudBlobMessageEnvelope Read(Guid blobId)
        {
            var container = Pool.Take(_overflowBlobContainerName);
            try
            {
                var reference = container.GetBlobReferenceFromServer(blobId.ToString("N"));
                reference.FetchAttributes();

                var contentType = reference.Metadata[BlobMetaData.ContentType];
                var messageId = new Guid(reference.Metadata[BlobMetaData.MessageId]);
                var time = XmlConvert.ToDateTimeOffset(reference.Metadata[BlobMetaData.Time]);

                var expectedLength = int.Parse(reference.Metadata[BlobMetaData.ContentLength],
                    CultureInfo.InvariantCulture);
                var content = new byte[expectedLength];
                var actualLength = reference.DownloadToByteArray(content, 0);
                Trace.Assert(content.Length == actualLength,
                    string.Format(
                        "The expected content length ({0}) and actual content length ({1}) of blob {2} must match.",
                        content.Length, actualLength, blobId.ToString("N")));

                return new CloudBlobMessageEnvelope().
                    SetBlobId(blobId).
                    SetMessageId(messageId).
                    SetContentType(contentType).
                    SetContent(content).
                    SetTime(time);
            }
            finally
            {
                Pool.Return(container);
            }
        }
		public JsonResult DownloadPackageFiles(Guid kitGuid)
		{
			var repo = global::umbraco.cms.businesslogic.packager.repositories.Repository.getByGuid(RepoGuid);
            if (repo == null)
            {
                return Json(new { success = false, error = "No repository found with id " + RepoGuid });
            }
			if (!repo.HasConnection())
			{
				return Json(new {success = false, error = "cannot_connect"});
			}
			var installer = new global::umbraco.cms.businesslogic.packager.Installer();

			var tempFile = installer.Import(repo.fetch(kitGuid.ToString()));
			installer.LoadConfig(tempFile);
			var pId = installer.CreateManifest(tempFile, kitGuid.ToString(), RepoGuid);
			return Json(new
				{
					success = true,
					manifestId = pId,
					packageFile = tempFile,
					percentage = 10,
					message = "Downloading starter kit files..."
				});
		}
Ejemplo n.º 3
0
		public void Guid_to_Etag_conversion()
		{
			var guid = new Guid("01234567-8901-2345-6789-012345678901");
			var nullableGuid = (Guid?)guid;
			Assert.Equal(guid.ToString(), ((Raven.Abstractions.Data.Etag)guid).ToString());
			Assert.Equal(guid.ToString(), ((Raven.Abstractions.Data.Etag)nullableGuid).ToString());
		}
Ejemplo n.º 4
0
        public static SharedBuffer CreateBuffer(Guid id, Type elementType, long bufferSize)
        {
            var sb = new SharedBuffer();
            sb.Id = id;
            sb.ElementTypeString = elementType.FullName;
            sb.ElementSize = Marshal.SizeOf(elementType);
            sb.ElementCount = bufferSize;

            if (_blockPath != string.Empty)
            {
                var fileStream = System.IO.File.Create(string.Format(@"{0}\{1}", _blockPath, id.ToString()), 
                    (int)(bufferSize * sb.ElementSize), System.IO.FileOptions.DeleteOnClose);

                var mmf = MemoryMappedFile.CreateFromFile(fileStream, id.ToString(), 
                    (int)(bufferSize * sb.ElementSize),
                    MemoryMappedFileAccess.ReadWrite, null, System.IO.HandleInheritability.None, false);

                _cacheBuffers.TryAdd(id, sb);
                _cacheMmfs.TryAdd(id, mmf);
                _cacheFileStreams.TryAdd(id, fileStream);
            }
            else
            { 
                var mmf = MemoryMappedFile.CreateNew(id.ToString(), 
                    bufferSize * sb.ElementSize);
                _cacheBuffers.TryAdd(id, sb);
                _cacheMmfs.TryAdd(id, mmf);
            }

            return sb;
        }
        private void AddSourceNodeToRoot(Guid source, TreeNodeCollection coll)
        {
            var node = new TreeNode
                           {
                               Name = source.ToString(),
                               Text = source.ToString()
                           };

            node.ContextMenu = new ContextMenu(
                new[]
                    {
                        new MenuItem("Delete",
                                     (sender, args) =>
                                         {
                                             var senderNode = ((sender as MenuItem).Parent.Tag as TreeNode);
                                             if (senderNode.Nodes.Count > 0)
                                             {
                                                 MessageBox.Show("Nodes containing events cannot be deleted.");
                                                 return;
                                             }
                                             store.RemoveEmptyEventSource(Guid.Parse(node.Name));
                                             senderNode.Remove();
                                         }
                            )
                    }
                ) { Tag = node };

            coll.Add(node);

            var events = store.GetAllEvents(source);
            foreach (var evt in events)
            {
                AddEvtNodeToSourceNode(evt, node);
            }
        }
        public void SaveData(Guid networkId, string profileToSwitch, string profileFolder)
        {
            Settings[networkId.ToString() + "_ProfileToSwitch"] = profileToSwitch;
            Settings[networkId.ToString() + "_ProfileFolder"] = profileFolder;

            OnSettingsChanged();
        }
Ejemplo n.º 7
0
	public void TestCtor1 ()
	{
		Guid g =  new Guid (new byte[] {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f});
		bool exception;
		
		if (BitConverter.IsLittleEndian) {
			AssertEquals ("A1", "03020100-0504-0706-0809-0a0b0c0d0e0f", g.ToString ());
		}
		else {
			AssertEquals ("A1", "00010203-0405-0607-0809-0a0b0c0d0e0f", g.ToString ());
		}

		try {
			Guid g1 = new Guid ((byte[]) null);
			exception = false;
		}
		catch (ArgumentNullException) {
			exception = true;
		}
		Assert ("A2", exception);

		try {
			Guid g1 = new Guid (new byte[] {0x00, 0x01, 0x02});
			exception = false;
		}
		catch (ArgumentException) {
			exception = true;
		}
		Assert ("A3", exception);
	}
Ejemplo n.º 8
0
        public override void Activate(Guid networkId, string networkName)
        {
            string script = this.Settings[networkId.ToString() + "_ScriptPath"];
            if (String.IsNullOrEmpty(script))
                return;

            bool withParameter = false;
            bool.TryParse(this.Settings[networkId.ToString() + "_ScriptWithParameter"], out withParameter);

            bool asAdmin = false;
            bool.TryParse(this.Settings[networkId.ToString() + "_ScriptAsAdmin"], out asAdmin);

            ProcessStartInfo startInfo = new ProcessStartInfo(Environment.ExpandEnvironmentVariables(script));

            if (withParameter)
            {
                bool withNetworkNameInsteadofId = false;
                bool.TryParse(this.Settings[networkId.ToString() + "_ScriptWithParameterName"], out withNetworkNameInsteadofId);

                if (withNetworkNameInsteadofId)
                    startInfo.Arguments = networkName;
                else
                    startInfo.Arguments = networkId.ToString();
            }

            if (asAdmin)
                startInfo.Verb = "runas";

            Process.Start(startInfo);
        }
        public void CRITERIA01_SimpleExpressionSerializeTest()
        {
            // Arrange
            Guid baseId = new Guid("{b3e98851-27ab-4d70-bb10-3cf71c80d838}");
            string knownGood = "{\"Id\":\"" + TypeProjectionConstants.User.Id.ToString("D") + "\",\"Criteria\":{\"Base\":{\"Expression\":{\"SimpleExpression\":{\"ValueExpressionLeft\":{\"GenericProperty\":\"Id\"},\"Operator\":\"Equal\",\"ValueExpressionRight\":{\"Value\":\"" + baseId.ToString("D") + "\"}}}}}}";

            QueryCriteriaExpression expr = new QueryCriteriaExpression
            {
                PropertyName = "Id",
                PropertyType = QueryCriteriaPropertyType.GenericProperty,
                Operator = QueryCriteriaExpressionOperator.Equal,
                Value = baseId.ToString("D")
            };

            QueryCriteria criteria = new QueryCriteria(TypeProjectionConstants.User.Id)
            {
                GroupingOperator = QueryCriteriaGroupingOperator.SimpleExpression
            };

            criteria.Expressions.Add(expr);

            // Act
            string testSerialize = criteria.ToString();

            // Assert
            Assert.AreEqual(knownGood, testSerialize);
        }
Ejemplo n.º 10
0
 // Analysis disable once FunctionNeverReturns
 public static void Daemon(ushort port, Array uri, Guid serverID)
 {
     Raw raw = new Raw (port);
     SimpleDiscovery sd = new SimpleDiscovery (raw);
     HTTPRequest httpRequest = new HTTPRequest ();
     Dictionary<string, object> args = new Dictionary<string, object> ();
     args.Add ("URI", uri);
     args.Add ("SERVERID", serverID.ToString ());
     httpRequest.Arguments = args;
     sd.SetMessageInformation (httpRequest.Arguments);
     sd.DiscoverMessageReceived += (sender, e) => {
         try {
             if ((string)(e.Request.Arguments ["SERVERID"]) != serverID.ToString ())
                 Console.Error.WriteLine ("Another daemon is running on the network.");
         } catch {
             Console.Error.WriteLine ("Another program is using our port.");
         }
     };
     try {
         while (true)
             System.Threading.Thread.Sleep (1000);
     } finally {
         raw.Stop ();
     }
 }
Ejemplo n.º 11
0
        public async void AddPremiumPlayerAsync(string ip, Guid guid)
        {
            await Connection.OpenAsync();

            // Check if the player already has an entry
            SQLiteCommand command = new SQLiteCommand("SELECT COUNT(*) FROM premium WHERE GUID = $guid");
            command.Parameters.AddWithValue("$guid", guid.ToString("N"));

            long count = (long)await ExecuteScalarAsync(command);

            if (count == 1)
            {
                command = new SQLiteCommand("UPDATE premium SET ip = $ip, timestamp = datetime('now') WHERE GUID = $guid");
                command.Parameters.AddWithValue("$guid", guid.ToString("N"));
                command.Parameters.AddWithValue("$ip", ip);
                command.Connection = Connection;
                await command.ExecuteNonQueryAsync();
            }
            else
            {
                command = new SQLiteCommand("INSERT INTO premium(IP, GUID) VALUES ($ip, $guid)");
                command.Parameters.AddWithValue("$guid", guid.ToString("N"));
                command.Parameters.AddWithValue("$ip", ip);
                command.Connection = Connection;
                await command.ExecuteNonQueryAsync();
            }

            Connection.Close();
        }
        public virtual void SignIn(Guid userId, bool createPersistentCookie)
        {
            var now = DateTime.Now;

            var ticket = new FormsAuthenticationTicket(
                1,
                userId.ToString("N"),
                now,
                now.Add(this.expirationTimeSpan),
                createPersistentCookie,
                userId.ToString("N"),
                FormsAuthentication.FormsCookiePath);

            var encryptedTicket = FormsAuthentication.Encrypt(ticket);

            var cookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket);
            cookie.HttpOnly = true;
            if (ticket.IsPersistent)
            {
                cookie.Expires = ticket.Expiration;
            }
            cookie.Secure = FormsAuthentication.RequireSSL;
            cookie.Path = FormsAuthentication.FormsCookiePath;
            if (FormsAuthentication.CookieDomain != null)
            {
                cookie.Domain = FormsAuthentication.CookieDomain;
            }

            this.httpContext.Response.Cookies.Add(cookie);
            this.cachedAccountId = userId;
        }
Ejemplo n.º 13
0
        public ActionResult AddComment(string text, string userId, Guid photoId)
        {
            var user = Session.Query<User>().Where(x => x.Id == SecurityManager.AuthenticatedUser.Id).FirstOrDefault();
            if (user == null)
            {
                throw new InvalidOperationException();
            }

            var photo = Session.Query<Photo>().Where(x => x.Id == photoId).FirstOrDefault();
            if (photo == null)
            {
                throw new InvalidOperationException();
            }
            var model = new PreviewViewModel();
            model.Photo = photo;
            model.CanLike = !model.Photo.Likes.Any(x => x.Liker.Id == SecurityManager.AuthenticatedUser.Id);
            if (string.IsNullOrEmpty(text.Trim()))
            {
                return Redirect("/Preview/?id=" + photoId.ToString());
            }

            var comment = new Comment(Guid.NewGuid(), text.Trim(), DateTime.Now, user, photo);
            Session.Save(comment);
            photo.Comments.Add(comment);
            return Redirect("/Preview/?id=" + photoId.ToString());
        }
Ejemplo n.º 14
0
        public static string SyncOpenId(Guid sid)
        {
            WxOpenIds openIds = ElegantWM.WeiXin.Common.GetFanList(sid.ToString(), "");
            string fails = "ErrorList:";
            foreach (string oid in openIds.data.openid)
            {
                if (WMFactory.WXFans.GetCount(f => f.AccountId == sid && f.OpenId == oid) <= 0)
                {
                    WxFans wf = ElegantWM.WeiXin.Common.GetFanInfo(sid.ToString(), oid);
                    WX_Fans fan = new WX_Fans();
                    fan.OpenId = oid;
                    fan.AccountId = sid;
                    fan.NickName = wf.nickname;
                    fan.Sex = wf.sex;
                    fan.City = wf.city;
                    fan.Province = wf.province;
                    fan.Avatar = wf.headimgurl;
                    fan.CreateUser = "******";
                    if (!WMFactory.WXFans.Insert(fan))
                    {
                        fails += oid + ",";
                    }
                }
            }

            if (openIds.total <= openIds.count)
            {
                //说明没有更多了
            }

            return fails;
        }
Ejemplo n.º 15
0
        public User(string partitionKey, Guid id)
        {
            this.PartitionKey = partitionKey;
            this.RowKey = id.ToString();

            this.Id = id.ToString();
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Get MediaType be the guid 
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static MediaTypes GetMediaType(Guid id)
 {
     if (id.ToString().ToLower() == "22258901-AD26-42F0-BC1B-C902FD542562".ToLower())
     {
         return MediaTypes.Image;
     }
     else if (id.ToString().ToLower() == "D1D0F4A5-1795-43A9-9B4F-6120261BA1B0".ToLower())
     {
         return MediaTypes.Video;
     }
     else if (id.ToString().ToLower() == "50727BB2-CD08-4C78-9C02-F514D40EB148".ToLower())
     {
         return MediaTypes.Audio;
     }
     else if (id.ToString().ToLower() == "8CBAF86D-8D55-450D-8BE0-187081A42F7B".ToLower())
     {
         return MediaTypes.Photosynth;
     }
     else if (id.ToString().ToLower() == "DA810942-8569-4B84-9590-E2FDAD61F0C9".ToLower())
     {
         return MediaTypes.PDF;
     }
     else
     {
         return MediaTypes.Other;
     }
 }
        public void CRITERIA02_CompoundExpressionSerializeTest()
        {
            // Arrange
            Guid typeGuid = new Guid("{2bc63f3a-a7a1-4ded-a727-b14f7b2cef69}");
            string poNumber = "Testing123";
            string knownGood = "{\"Id\":\"f27daae2-280c-dd8b-24e7-9bdb5120d6d2\",\"Criteria\":{\"Base\":{\"Expression\":{\"And\":{\"Expression\":[{\"SimpleExpression\":{\"ValueExpressionLeft\":{\"Property\":\"$Context/Property[Type='2afe355c-24a7-b20f-36e3-253b7249818d']/PurchaseOrderType$\"},\"Operator\":\"Equal\",\"ValueExpressionRight\":{\"Value\":\"" + typeGuid.ToString("B") + "\"}}},{\"SimpleExpression\":{\"ValueExpressionLeft\":{\"Property\":\"$Context/Property[Type='2afe355c-24a7-b20f-36e3-253b7249818d']/PurchaseOrderNumber$\"},\"Operator\":\"Equal\",\"ValueExpressionRight\":{\"Value\":\"" + poNumber + "\"}}}]}}}}}";

            QueryCriteriaExpression expr1 = new QueryCriteriaExpression
            {
                PropertyName = (new PropertyPathHelper(ClassConstants.PurchaseOrder.Id, "PurchaseOrderType")).ToString(),
                PropertyType = QueryCriteriaPropertyType.Property,
                Operator = QueryCriteriaExpressionOperator.Equal,
                Value = typeGuid.ToString("B")
            };

            QueryCriteriaExpression expr2 = new QueryCriteriaExpression
            {
                PropertyName = (new PropertyPathHelper(ClassConstants.PurchaseOrder.Id, "PurchaseOrderNumber")).ToString(),
                PropertyType = QueryCriteriaPropertyType.Property,
                Operator = QueryCriteriaExpressionOperator.Equal,
                Value = poNumber
            };

            QueryCriteria criteria = new QueryCriteria(TypeProjectionConstants.PurchaseOrder.Id);
            criteria.GroupingOperator = QueryCriteriaGroupingOperator.And;
            criteria.Expressions.Add(expr1);
            criteria.Expressions.Add(expr2);

            // Act
            string testSerialize = criteria.ToString();

            // Assert
            Assert.AreEqual(knownGood, testSerialize);
        }
Ejemplo n.º 18
0
        private void ReplaceMarker()
        {
            _projectGuid = Guid.NewGuid();

            _form1File = _form1File.Replace("$safeprojectname$", Options.AssemblyName);
            _form1File = _form1File.Replace("$usingItems$", this.GetNetOfficeProjectUsingItems());

            _form1DesignerFile = _form1DesignerFile.Replace("$safeprojectname$", Options.AssemblyName);

            _ressourceDesignerFile = _ressourceDesignerFile.Replace("$safeprojectname$", Options.AssemblyName);

            _settingsDesignerFile = _settingsDesignerFile.Replace("$safeprojectname$", Options.AssemblyName);

            _programFile = _programFile.Replace("$safeprojectname$", Options.AssemblyName);

            _solutionFile = _solutionFile.Replace("$safeprojectname$", Options.AssemblyName);
            _solutionFile = _solutionFile.Replace("$projectguid$", _projectGuid.ToString().ToUpper());
            _solutionFile = _solutionFile.Replace("$solutionformat$", this.SolutionFormats[Options.IDE]);
            _solutionFile = _solutionFile.Replace("$ideversion$", this.Environments[Options.IDE, Options.Language]);

            _projectFile = _projectFile.Replace("$safeprojectname$", Options.AssemblyName);
            _projectFile = _projectFile.Replace("$projectguid$", _projectGuid.ToString().ToUpper());
            _projectFile = _projectFile.Replace("$toolsversion$", this.Tools[Options.IDE]);
            _projectFile = _projectFile.Replace("$targetframeworkversion$", this.Runtimes[Options.NetRuntime]);
            _projectFile = _projectFile.Replace("$assemblyReferences$", this.GetNetOfficeProjectReferenceItems());

            _assemblyFile = _assemblyFile.Replace("$safeprojectname$", Options.AssemblyName);
            _assemblyFile = _assemblyFile.Replace("$safeprojectdescription$", Options.AssemblyDescription);
            _assemblyFile = _assemblyFile.Replace("$assemblyguid$", Guid.NewGuid().ToString().ToUpper());
        }
Ejemplo n.º 19
0
        public ActionResult ConfirmUser(Guid confirmationId)
        {
            if (string.IsNullOrEmpty(confirmationId.ToString()) || (!Regex.IsMatch(confirmationId.ToString(),
                   @"[0-9a-f]{8}\-([0-9a-f]{4}\-){3}[0-9a-f]{12}")))
            {
                TempData["EpostaOnayMesaj"] = "Hesap geçerli değil. Lütfen e-posta adresinizdeki linke tekrar tıklayınız.";

                return View();
            }
            else
            {
                var user = _userService.FindByConfirmationId(confirmationId);

                if (!user.IsConfirmed)
                {
                    user.IsConfirmed = true;
                    _userService.Update(user);
                    _uow.SaveChanges();

                    FormsAuthentication.SetAuthCookie(user.UserName, true);
                    TempData["EpostaOnayMesaj"] = "E-posta adresinizi onayladığınız için teşekkürler. Artık sitemize üyesiniz.";

                    return RedirectToAction("Wellcome");
                }
                else
                {
                    TempData["EpostaOnayMesaj"] = "E-posta adresiniz zaten onaylı. Giriş yapabilirsiniz.";

                    return RedirectToAction("GirisYap");
                }
            }
        }
Ejemplo n.º 20
0
        public string SearchVipScore(Guid sid, string oid)
        {
            string vipname = "";
            string centum = "";
            string viptel = "";

            //查找这个微信号是否绑定会员
            //var list = WMFactory.WXLKRegMemberFans.FindByConditions(o => o.OrderByDescending(x => x.Id), f => f.AccountId == sid);

            IEnumerable<WX_LK_RegMemberFans> fans = WMFactory.WXLKRegMemberFans.FindByConditions(null, f => f.AccountId == sid && f.OpenId == oid && f.IsUsing == 0);
            if (fans == null || fans.Count() <= 0)
            {
                return "请您先绑定,<a href='http://it.hwafashion.com/NPaia/VIP/CreateVip?sid=" + sid.ToString() + "&oid=" + oid + "'>点击绑定</a>";
            }
            else
            {
                viptel = fans.First().Telphone;
                DataTable dtpCentum = WMFactory.Wsrr.GetUserCentumInfo(viptel);

                if (dtpCentum.Rows[0]["mobtel"].ToString() == "")
                {
                    return "异常,请重新绑定,<a href='http://it.hwafashion.com/NPaia/VIP/CreateVip?sid=" + sid.ToString() + "&oid=" + oid + "'>点击绑定</a>";
                }
                else
                {
                    vipname = dtpCentum.Rows[0]["vipname"].ToString();
                    viptel = dtpCentum.Rows[0]["mobtel"].ToString();
                    centum = dtpCentum.Rows[0]["centum"].ToString();
                    return "会员姓名:" + vipname + "\r\n" + "注册手机:" + viptel + "\r\n" + "当前积分:" + centum;
                }
            }
        }
Ejemplo n.º 21
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="contact_id"></param>
        /// <returns></returns>
        private bool checkAuth(string contact_id)
        {
            try {
                Guid id = new Guid(contact_id);

                if (id.ToString().Length > 0) { // Make sure the id is a valid contact id

                    JobBoardDataContext db = new JobBoardDataContext();

                    Contact contact = db.Contacts.Where(x => x.id == id && x.level != "DISABLED").FirstOrDefault<Contact>();
                    if (contact == null) { throw new Exception(); }
                    ViewBag.user = contact;

                    Session["contact_id"] = id;

                    HttpCookie contactID = new HttpCookie("contact_id");
                    contactID.Value = id.ToString();
                    contactID.Expires = DateTime.Now.AddDays(30);
                    Response.Cookies.Add(contactID);

                    return true;
                } else {
                    return false;
                }

            } catch (Exception) {
                return false;
            }
        }
        public static WorkflowSubscription MakeListId(this WorkflowSubscription workflowSubscription, Guid listId)
        {
            workflowSubscription.SetProperty("ListId", listId.ToString());
            workflowSubscription.SetProperty("Microsoft.SharePoint.ActivationProperties.ListId", listId.ToString());

            return workflowSubscription;
        }
        public ConvertStorageDomainToDs3TargetSpectraS3Request(Guid convertToDs3Target, string storageDomain)
        {
            this.StorageDomain = storageDomain;
            this.ConvertToDs3Target = convertToDs3Target.ToString();

            this.QueryParams.Add("convert_to_ds3_target", convertToDs3Target.ToString());
        }
Ejemplo n.º 24
0
        private string GetLinkByGuid(Guid id)
        {
            string pageRelUrl = CommonLinkUtility.GetEmployees(_productID) + "&";

            string pageUrl = string.Empty;
            if (Request["deplist"] == null)
            {
                pageUrl = string.Format("{0}depID={1}&search=&page=1&sort={2}{3}", pageRelUrl,
                    id == Guid.Empty ? string.Empty : id.ToString(),
                    Request["sort"], Request["list"] == null ? string.Empty : "&list=" + Request["list"]);
            }
            else
            {
                if (id == Guid.Empty)
                {
                    pageUrl = string.Format("{0}deplist={1}", pageRelUrl, Request["list"] == null ? string.Empty : "&list=" + Request["list"]);
                }
                else
                {
                    pageUrl = string.Format("{0}deplist={1}&search=&page=1&sort={2}{3}", pageRelUrl, id.ToString(),
                        Request["sort"], Request["list"] == null ? string.Empty : "&list=" + Request["list"]);
                }

            }

            return ResolveUrl(UrlQueryManager.AddDefaultParameters(Request, pageUrl));
        }
Ejemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!string.IsNullOrEmpty(Request["guid"])){

                Guid guid = new Guid(Request["guid"]);

                if (this.repo.HasConnection())
                {
                    Installer installer = new Installer();
                    string tempDir = installer.Import(this.repo.fetch(guid.ToString()));
                    installer.LoadConfig(tempDir);
                    int packageId = installer.CreateManifest(tempDir, guid.ToString(), this.repoGuid);
                    installer.InstallFiles(packageId, tempDir);
                    installer.InstallBusinessLogic(packageId, tempDir);
                    installer.InstallCleanUp(packageId, tempDir);
                    library.RefreshContent();

                    if (cms.businesslogic.skinning.Skinning.IsPackageInstalled(new Guid(Request["guid"])) ||
                    cms.businesslogic.skinning.Skinning.IsPackageInstalled(Request["name"]))
                    {
                       Response.Write(cms.businesslogic.skinning.Skinning.GetModuleAlias(Request["name"]));
                    }
                    else
                    {
                        Response.Write("error");
                    }

                }
                else
                {
                    Response.Write("error");
                }
            }
        }
        public void GetByIdShouldReturnTheSameUser()
        {
            Guid guid = new Guid("50d3ebaa-eea3-453f-8e8b-b835605b3e85");
            ApplicationUser user = new ApplicationUser()
            {
                UserName = "******",
                Id = guid.ToString(),
                FirstName = "Ivan",
                LastName = "jorkov"
            };

           // 
            var usersRepoMock = new Mock<IRepository<ApplicationUser>>();

            usersRepoMock.Setup(x => x.GetById(guid.ToString())).Returns(user);


            var uofMock = new Mock<IUnitOfWorkData>();
            uofMock.Setup(x => x.Users).Returns(usersRepoMock.Object);
           
            var controller = new UserController(uofMock.Object);

            var viewResult = controller.Details(guid.ToString()) as ViewResult;
            Assert.IsNotNull(viewResult, "Index action returns null.");

            var model = viewResult.Model as UserViewModel;
            Assert.IsNotNull(model, "The model is null.");
            Assert.AreEqual(user.LastName, model.LastName);
            Assert.AreEqual(user.FirstName, model.FirstName);
            Assert.AreEqual(user.Id, model.Id);            
        }
        public EjectStorageDomainSpectraS3Request(Guid storageDomainId)
        {
            this.StorageDomainId = storageDomainId.ToString();
            this.QueryParams.Add("operation", "eject");

            this.QueryParams.Add("storage_domain_id", storageDomainId.ToString());
        }
 public static void CheckandAddEntry(SPList configurationList, Guid ProjectGuid, Project Project_Svc)
 {
     try
     {
         // Checking whether the project id is already available.
         var query = new SPQuery
         {
             Query =
                 @"<Where><Eq><FieldRef Name='" + ProjectUIDFieldName + "' /><Value Type='Text'>" + ProjectGuid.ToString() + "</Value></Eq></Where>"
         };
         var ProjectItemCollection = configurationList.GetItems(query);
         if (ProjectItemCollection.Count == 0)
         {
             configurationList.ParentWeb.Site.RootWeb.AllowUnsafeUpdates = true;
             SPListItem item = configurationList.Items.Add();
             //first project name
             item["Title"] = Project_Svc.GetProjectNameFromProjectUid(ProjectGuid, DataStoreEnum.WorkingStore);
             item[GroupFieldName] = DefaultGroupValue;
             item[ProjectUIDFieldName] = ProjectGuid.ToString();
             item.Update();
             configurationList.ParentWeb.Site.RootWeb.Update();
         }
     }
     catch (Exception ex)
     {
         ErrorLog("Error at adding configuration item to the list due to " + ex.Message, EventLogEntryType.Error);
     }
 }
Ejemplo n.º 29
0
		internal static void StoreCallbackState(HttpContextBase context, Guid callbackId, object state, DateTime expirationTime)
		{
			if (context == null)
			{
				throw new ArgumentNullException("context");
			}

			if (Guid.Empty.Equals(callbackId))
			{
				throw new ArgumentNullException("callbackId");
			}

			if (context.Cache == null)
			{
				return;
			}

			if (state == null)
			{
				RemoveFromCache(context, callbackId.ToString());
				return;
			}

			AddToCache(context, callbackId.ToString(), state, expirationTime);
		}
Ejemplo n.º 30
0
        public static TracingSession GetTracingSession(this IConnection @this, Guid tracingId)
        {
            string queryEvents = "select * from system_traces.events where session_id=" + tracingId.ToString();
            List<TracingEvent> tracingEvents = new List<TracingEvent>();
            IDataMapperFactory factory = new DataMapperFactory(null);
            foreach (IDictionary<string, object> mapEvents in CQLCommandHelpers.Query(@this, queryEvents, ConsistencyLevel.ONE, factory, ExecutionFlags.None).Result)
            {
                TracingEvent tracingEvent = new TracingEvent((string) mapEvents["activity"],
                                                             (Guid) mapEvents["event_id"],
                                                             (IPAddress) mapEvents["source"],
                                                             (int) mapEvents["source_elapsed"],
                                                             (string) mapEvents["thread"]);
                tracingEvents.Add(tracingEvent);
            }
            tracingEvents.Sort(CompareTracingEvent);
            TracingEvent[] events = tracingEvents.ToArray();

            string querySession = "select * from system_traces.sessions where session_id=" + tracingId.ToString();
            IDictionary<string, object> mapSession =
                    (IDictionary<string, object>)
                    CQLCommandHelpers.Query(@this, querySession, ConsistencyLevel.ONE, factory, ExecutionFlags.None).Result.Single();
            TracingSession tracingSession = new TracingSession((IPAddress) mapSession["coordinator"],
                                                               (int) mapSession["duration"],
                                                               (IDictionary<string, string>) mapSession["parameters"],
                                                               (string) mapSession["request"],
                                                               (Guid) mapSession["session_id"],
                                                               (DateTime) mapSession["started_at"],
                                                               events);

            return tracingSession;
        }
Ejemplo n.º 31
0
    //Create a new creature from editor
    public void init()
    {
        //If the guid is all 0 then we know this Creature has never been initialized.
        if (uid.ToString().Equals("00000000-0000-0000-0000-000000000000"))
        {
            //Generate permanent details
            uid          = System.Guid.NewGuid();
            nature       = null; //Todo
            scaleFactors = null; //Todo

            //Initialize stats
            totalExp = (int)((species.getStats()[7] / 100f) * Mathf.Pow(startLevel, 3));
            currentCriticalHealth = getMaxCriticalHealth();
            currentActiveHealth   = getMaxActiveHealth();
            currentMana           = getMaxMana();
        }
    }
    /// <summary>
    /// Configures the application, loads assets etc. Called only once when application started.
    /// </summary>
    void Start()
    {
        DontDestroyOnLoad(this.gameObject);

        sessionguid = System.Guid.NewGuid();
        GameObject.Find("txt_guid").GetComponent <Text>().text = sessionguid.ToString();

        gameCamera = GameObject.Find("Main Camera").GetComponent <Camera>();

        logManager          = gameObject.GetComponent <LogManager>();
        fileTransferManager = gameObject.GetComponent <FileTransferManager>();

        faceObject        = GameObject.Find("FaceObject").GetComponent <FaceObjectController>();
        selectedAssetType = AssetType.None;

        // Load Assets
        InitAssets("FaceObject/fo_faceshape/", AssetType.HeadShape, AssetGender.NoGender);
        InitAssets("FaceObject/fo_hair/", AssetType.Hair, AssetGender.NoGender);
        InitAssets("FaceObject/fo_ears/", AssetType.Ears, AssetGender.NoGender);
        InitAssets("FaceObject/fo_eyes/", AssetType.Eyes, AssetGender.NoGender);
        InitAssets("FaceObject/fo_eyebrows/", AssetType.Eyebrows, AssetGender.NoGender);
        InitAssets("FaceObject/fo_glasses/", AssetType.Glasses, AssetGender.NoGender);
        InitAssets("FaceObject/fo_facedetail/", AssetType.FaceTexture, AssetGender.NoGender);
        InitAssets("FaceObject/fo_nose/", AssetType.Nose, AssetGender.NoGender);
        InitAssets("FaceObject/fo_moustache/", AssetType.Moustache, AssetGender.NoGender);
        InitAssets("FaceObject/fo_beard/", AssetType.Beard, AssetGender.NoGender);
        InitAssets("FaceObject/fo_mouth/", AssetType.Mouth, AssetGender.NoGender);
        InitAssets("FaceObject/fo_body/", AssetType.Body, AssetGender.NoGender);
        InitAssets("FaceObject/fo_specialbody/", AssetType.SpecialBody, AssetGender.Female);
        InitAssets("FaceObject/fo_ghutra/", AssetType.Ghutra, AssetGender.Male);
        InitAssets("UI/bg_patterns/", AssetType.BackgroundTexture, AssetGender.NoGender);

        // Set the default selected category as Body.
        GameObject.Find("btn_body").GetComponent <UIAssetCategoryButtonController>().OnButtonClick();

        // Color palette management.
        defaultColorPalette = GameObject.Find("colorpalette_default").transform;
        defaultColorPalette.gameObject.SetActive(false);
        skinColorPalette = GameObject.Find("colorpalette_skin").transform;
        skinColorPalette.gameObject.SetActive(false);
        FillColorPalette();

        // Random avatar generation on the first run.
        faceObject.GenerateRandomAvatar();
    }
Ejemplo n.º 33
0
 // Use this for initialization
 void Start()
 {
     //初回起動時useridを設定
     if (PlayerPrefs.GetString("userid") == "")
     {
         System.Guid guid = System.Guid.NewGuid();
         string      uuid = guid.ToString();
         PlayerPrefs.SetString("userid", uuid);
     }
     else
     {
         //Debug.Log(PlayerPrefs.GetString(PPKey.userid.ToString()));
     }
     PlayerPrefs.SetInt("maxStage", 72);
     //PlayerPrefs.SetInt("reachStage",0);
     /* ランキングに保存 */
     ranking.GetComponent <CreateRanking>().WriteRanking();
 }
Ejemplo n.º 34
0
    // Use this for initialization
    void Start()
    {
        uuid = PlayerPrefs.GetString("uuid");
        if (uuid.Length < 36)
        {
            System.Guid guid     = System.Guid.NewGuid();
            string      new_uuid = guid.ToString();
            PlayerPrefs.SetString("uuid", new_uuid);
            PlayerPrefs.Save();
        }
        nextTime   = Time.time;
        titleScale = 200.0f;

/* //
 *              PlayerPrefs.SetInt("item",0);
 *              PlayerPrefs.SetInt("playcount",0);
 */
    }
Ejemplo n.º 35
0
    void Start()
    {
        isMouseDragging = false;

        gameObject.tag = "Box";
        System.Guid myGUID = System.Guid.NewGuid();

        gameObject.name = "Box-" + myGUID.ToString();

        if (gameObject.GetComponent <LineRenderer>() == null)
        {
            line = gameObject.AddComponent <LineRenderer>();

            line.material = new Material(Shader.Find("Sprites/Default"));

            line.widthMultiplier = 0.1f;

            line.positionCount = lengthOfLineRenderer;

            line.SetPosition(0, gameObject.transform.position);
        }

        if (OtherGameObject == null)
        {
            Debug.LogWarning("Please Attach Other GameObject in inspector");
            return;
        }
        line = GetComponent <LineRenderer>();

        AnimationCurve curve = new AnimationCurve();

        curve.AddKey(0, lineWidth);
        curve.AddKey(1, lineWidth);

        line.widthCurve = curve;


        line.useWorldSpace = true;

        line.positionCount = 2;

        line.SetPosition(0, gameObject.transform.position);
        line.SetPosition(1, OtherGameObject.transform.position);
    }
        public void TestDotNetGuidSortOrder()
        {
            if (!EsentVersion.SupportsWindows8Features)
            {
                return;
            }

            // Create table with GUID column and index over GUID column.
            this.CreatePopulateAndTestTable();

            Api.JetCloseDatabase(this.sesId, this.databaseId, CloseDatabaseGrbit.None);
            Api.JetDetachDatabase(this.sesId, this.database);

#if !MANAGEDESENT_ON_WSA // Not exposed in MSDK
            EseInteropTestHelper.ConsoleWriteLine("Compact database.");
            Api.JetAttachDatabase(this.sesId, this.database, Windows8Grbits.PurgeCacheOnAttach);
            Api.JetCompact(this.sesId, this.database, Path.Combine(this.directory, "defragged.edb"), null, null, CompactGrbit.None);
            Api.JetDetachDatabase(this.sesId, this.database);

            this.database = Path.Combine(this.directory, "defragged.edb");
            Assert.IsTrue(EseInteropTestHelper.FileExists(this.database));
#endif // !MANAGEDESENT_ON_WSA
            Api.JetAttachDatabase(this.sesId, this.database, Windows8Grbits.PurgeCacheOnAttach);

            Api.JetOpenDatabase(this.sesId, this.database, null, out this.databaseId, OpenDatabaseGrbit.None);
            Api.JetOpenTable(this.sesId, this.databaseId, this.tableName, null, 0, OpenTableGrbit.None, out this.tableId);

            Api.JetBeginTransaction(this.sesId);
            EseInteropTestHelper.ConsoleWriteLine("Insert more values in index.");
            for (int i = 0; i < 10000; i++)
            {
                if ((i % 2000) == 0)
                {
                    EseInteropTestHelper.ConsoleWriteLine("Added another 2000 Guids.");
                }

                Api.JetCommitTransaction(this.sesId, CommitTransactionGrbit.None);
                Api.JetBeginTransaction(this.sesId);
                this.InsertRecord(this.tableId, System.Guid.NewGuid());
            }

            Api.JetCommitTransaction(this.sesId, CommitTransactionGrbit.None);
            EseInteropTestHelper.ConsoleWriteLine("Finished inserting more values in index.");

            // validate order after having closed the database and restarted
            Guid guidPrev;
            Guid guidCur;
            Api.JetMove(this.sesId, this.tableId, JET_Move.First, MoveGrbit.None);
            int    bytesRead;
            byte[] data = new byte[16];
            Api.JetRetrieveColumn(this.sesId, this.tableId, this.columnIdKey1, data, data.Length, out bytesRead, 0, null);
            guidPrev = new System.Guid(data);
            for (int i = 1; i < 10000; i++)
            {
                Api.JetMove(this.sesId, this.tableId, JET_Move.Next, MoveGrbit.None);
                Api.JetRetrieveColumn(this.sesId, this.tableId, this.columnIdKey1, data, data.Length, out bytesRead, 0, null);
                guidCur = new System.Guid(data);
                Assert.IsTrue(guidCur.CompareTo(guidPrev) > 0);
                guidPrev = guidCur;
            }

            EseInteropTestHelper.ConsoleWriteLine("Validated order.");

            // retrieve newly inserted GUID from index and compare values
            // to test denormalization logic
            Guid guidT = System.Guid.NewGuid();
            EseInteropTestHelper.ConsoleWriteLine("Allocate random GUID...");
            EseInteropTestHelper.ConsoleWriteLine(guidT.ToString());
            this.InsertRecord(this.tableId, guidT);
            Api.JetSetCurrentIndex(this.sesId, this.tableId, this.secIndexName);
            EseInteropTestHelper.ConsoleWriteLine("Guid inserted is....");
            EseInteropTestHelper.ConsoleWriteLine("{0}", guidT);
            byte[] keyArray = guidT.ToByteArray();
            Api.JetMakeKey(this.sesId, this.tableId, keyArray, keyArray.Length, MakeKeyGrbit.NewKey);
            Api.JetSeek(this.sesId, this.tableId, SeekGrbit.SeekEQ);

            Api.JetSetCurrentIndex(this.sesId, this.tableId, this.secIndexName);
            keyArray = guidT.ToByteArray();
            Api.JetMakeKey(this.sesId, this.tableId, keyArray, keyArray.Length, MakeKeyGrbit.NewKey);
            Api.JetSeek(this.sesId, this.tableId, SeekGrbit.SeekEQ);
            JET_wrn err = Api.JetRetrieveColumn(this.sesId, this.tableId, this.columnIdKey1, data, data.Length, out bytesRead, RetrieveColumnGrbit.RetrieveFromIndex, null);
            Assert.AreEqual(data.Length, bytesRead);
            EseInteropTestHelper.ConsoleWriteLine("Found random GUID in index...");
            Guid guidTT = new System.Guid(data);
            Assert.AreEqual(guidT, guidTT);
            EseInteropTestHelper.ConsoleWriteLine("Found specific GUID in index");

            // check retrieve from index for denormalization
            // by comparing guid inserted.  They should match.
            Api.JetRetrieveColumn(this.sesId, this.tableId, this.columnIdKey1, data, data.Length, out bytesRead, RetrieveColumnGrbit.RetrieveFromIndex, null);
            guidCur = new System.Guid(data);
            EseInteropTestHelper.ConsoleWriteLine("Retrieved Guid is:");
            EseInteropTestHelper.ConsoleWriteLine(guidCur.ToString());
            Assert.IsTrue(guidCur.CompareTo(guidT) == 0);
            EseInteropTestHelper.ConsoleWriteLine("Retrieve from index matches inserted GUID");

            Api.JetCloseTable(this.sesId, this.tableId);

            this.TestTempTableWithGuidDotNetSortOrder();
        }
Ejemplo n.º 37
0
    public void OnPreprocessBuild(BuildReport report)
    {
#if UNITY_ANDROID && !(USING_XR_SDK && UNITY_2019_3_OR_NEWER)
        // Generate error when Vulkan is selected as the perferred graphics API, which is not currently supported in Unity XR
        if (!PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.Android))
        {
            GraphicsDeviceType[] apis = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);
            if (apis.Length >= 1 && apis[0] == GraphicsDeviceType.Vulkan)
            {
                throw new BuildFailedException("The Vulkan Graphics API does not support XR in your configuration. To use Vulkan, you must use Unity 2019.3 or newer, and the XR Plugin Management.");
            }
        }
#endif

#if UNITY_ANDROID
        bool useOpenXR = OVRPluginUpdater.IsOVRPluginOpenXRActivated();
#if USING_XR_SDK
        if (useOpenXR)
        {
            UnityEngine.Debug.LogWarning("Oculus Utilities Plugin with OpenXR is being used, which is under experimental status");

            if (PlayerSettings.colorSpace != ColorSpace.Linear)
            {
                throw new BuildFailedException("Oculus Utilities Plugin with OpenXR only supports linear lighting. Please set 'Rendering/Color Space' to 'Linear' in Player Settings");
            }
        }
#else
        if (useOpenXR)
        {
            throw new BuildFailedException("Oculus Utilities Plugin with OpenXR only supports XR Plug-in Managmenent with Oculus XR Plugin.");
        }
#endif
#endif

#if UNITY_ANDROID && USING_XR_SDK && !USING_COMPATIBLE_OCULUS_XR_PLUGIN_VERSION
        if (PlayerSettings.Android.targetArchitectures != AndroidArchitecture.ARM64)
        {
            throw new BuildFailedException("Your project is using an Oculus XR Plugin version with known issues. Please navigate to the Package Manager and upgrade the Oculus XR Plugin to the latest verified version. When performing the upgrade" +
                                           ", you must first \"Remove\" the Oculus XR Plugin package, and then \"Install\" the package at the verified version. Be sure to remove, then install, not just upgrade.");
        }
#endif

        buildStartTime = System.DateTime.Now;
        buildGuid      = System.Guid.NewGuid();

        if (!report.summary.outputPath.Contains("OVRGradleTempExport"))
        {
            OVRPlugin.SetDeveloperMode(OVRPlugin.Bool.True);
            OVRPlugin.AddCustomMetadata("build_type", "standard");
        }

        OVRPlugin.AddCustomMetadata("build_guid", buildGuid.ToString());
        OVRPlugin.AddCustomMetadata("target_platform", report.summary.platform.ToString());
#if !UNITY_2019_3_OR_NEWER
        OVRPlugin.AddCustomMetadata("scripting_runtime_version", UnityEditor.PlayerSettings.scriptingRuntimeVersion.ToString());
#endif
        if (report.summary.platform == UnityEditor.BuildTarget.StandaloneWindows ||
            report.summary.platform == UnityEditor.BuildTarget.StandaloneWindows64)
        {
            OVRPlugin.AddCustomMetadata("target_oculus_platform", "rift");
        }
#if BUILDSESSION
        StreamWriter writer = new StreamWriter("build_session", false);
        UnityEngine.Debug.LogFormat("Build Session: {0}", buildGuid.ToString());
        writer.WriteLine(buildGuid.ToString());
        writer.Close();
#endif
    }
Ejemplo n.º 38
0
 protected void btnDelete_Click(object sender, System.EventArgs e)
 {
     try
     {
         System.Guid guid      = new System.Guid(this.hfldCheckedIds.Value);
         string      text      = "089";
         string      text2     = "001";
         string      sqlString = "select LinkTable,KeyWord,StateField,BusinessName from WF_BusinessCode  where BusinessCode=" + text;
         DataTable   dataTable = publicDbOpClass.DataTableQuary(sqlString);
         string      text3     = dataTable.Rows[0]["LinkTable"].ToString();
         string      text4     = dataTable.Rows[0]["KeyWord"].ToString();
         dataTable.Rows[0]["StateField"].ToString();
         string text5 = dataTable.Rows[0]["BusinessName"].ToString();
         string text6 = " Begin ";
         object obj   = text6;
         text6 = string.Concat(new object[]
         {
             obj,
             " delete from WF_Instance where ID IN (SELECT ID FROM WF_Instance_Main WHERE BusinessCode=",
             text,
             " AND BusinessClass=",
             text2,
             " AND InstanceCode='",
             guid,
             "')"
         });
         object obj2 = text6;
         text6 = string.Concat(new object[]
         {
             obj2,
             " DELETE  FROM WF_Instance_Main WHERE BusinessCode=",
             text,
             " AND BusinessClass=",
             text2,
             " AND InstanceCode='",
             guid,
             "'"
         });
         string    sqlString2 = "select FatherId, TableName, line, linkLine,linkTable from WF_supperDelete where BusinessCode=" + text + " and  BussinessClass=" + text2;
         DataTable dataTable2 = publicDbOpClass.DataTableQuary(sqlString2);
         if (dataTable2.Rows.Count > 0)
         {
             if (dataTable2.Rows.Count == 1)
             {
                 string text7  = dataTable2.Rows[0]["TableName"].ToString();
                 string text8  = dataTable2.Rows[0]["line"].ToString();
                 string text9  = dataTable2.Rows[0]["linkLine"].ToString();
                 string text10 = dataTable2.Rows[0]["linkTable"].ToString();
                 object obj3   = text6;
                 text6 = string.Concat(new object[]
                 {
                     obj3,
                     " delete from ",
                     text7,
                     " where ",
                     text8,
                     " in (select ",
                     text9,
                     " from ",
                     text10,
                     " where ",
                     text4,
                     "= '",
                     guid,
                     "')"
                 });
             }
             else
             {
                 int arg_2A7_0 = dataTable2.Rows.Count;
                 for (int i = 0; i < dataTable2.Rows.Count; i++)
                 {
                     string text11 = dataTable2.Rows[i]["TableName"].ToString();
                     string text12 = dataTable2.Rows[i]["line"].ToString();
                     string text13 = dataTable2.Rows[i]["linkLine"].ToString();
                     string text14 = dataTable2.Rows[0]["linkTable"].ToString();
                     string a      = dataTable2.Rows[0]["Fatherid"].ToString();
                     if (a == "1")
                     {
                         object obj4 = text6;
                         text6 = string.Concat(new object[]
                         {
                             obj4,
                             " delete from ",
                             text11,
                             " where ",
                             text12,
                             " in (select ",
                             text13,
                             " from ",
                             text14,
                             " where ",
                             text4,
                             "= '",
                             guid,
                             "')"
                         });
                     }
                     text6 += " ";
                 }
             }
         }
         object obj5 = text6;
         text6 = string.Concat(new object[]
         {
             obj5,
             " DELETE  FROM ",
             text3,
             " where ",
             text4,
             "= '",
             guid,
             "' "
         });
         text6 += " ";
         text6 += "end";
         string str = "删除失败!";
         if (publicDbOpClass.ExecuteSQL(text6) >= 1)
         {
             str = "删除成功";
         }
         myxml.SetTwoPWDlog(this.Session["yhdm"].ToString(), this.Page.Request.UserHostAddress.ToString(), text5.ToString(), guid.ToString(), "");
         base.Response.Redirect(base.Request.Url.ToString());
         this.Page.RegisterStartupScript("", "<script>alert('" + str + "');</script>");
     }
     catch
     {
         this.Page.RegisterStartupScript("", "<script>alert('删除失败!');</script>");
     }
 }
Ejemplo n.º 39
0
        private static int AddPartToProject(PipingProject prjpart, string strSpec, ObjectId partId, PartRep.SpecPart specPart)
        {
            Autodesk.ProcessPower.DataObjects.PnPDatabase db = prjpart.DataLinksManager.GetPnPDatabase();
            PartsRepository rep = PartsRepository.AttachedRepository(db, false);

            // Create new part in project
            Autodesk.ProcessPower.PartsRepository.Part part = rep.NewPart(specPart.PartType);
            rep.AutoAccept = false;

            // Assign property values in project
            StringCollection props = specPart.PropertyNames;

            for (int i = 0; i < props.Count; ++i)
            {
                PartProperty prop = rep.GetPartProperty(specPart.PartType, props[i], false);
                if (prop == null || prop.IsExpression)
                {
                    continue;   // can't be assigned
                }
                try
                {
                    part[props[i]] = specPart[props[i]];
                }
                catch (Autodesk.AutoCAD.Runtime.Exception ex)
                {
                    // display exception on the command line
                    Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                    ed.WriteMessage(ex.ToString());
                }
            }

            // assign special spec property
            //
            try
            {
                part["Spec"] = strSpec;
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                // display exception on the command line
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(ex.ToString());
            }

            // add reference to spec record only if it is not set yet
            //
            try
            {
                if (part["SpecRecordId"] == System.DBNull.Value)
                {
                    part["SpecRecordId"] = specPart.PartId;
                }
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex)
            {
                // display exception on the command line
                Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                ed.WriteMessage(ex.ToString());
            }


            // Ok now deal with the ports
            //
            Autodesk.ProcessPower.PartsRepository.PortCollection ports          = specPart.Ports;
            Autodesk.ProcessPower.PartsRepository.Port           principal_port = ports[0];

            foreach (Autodesk.ProcessPower.PartsRepository.Port port in ports)
            {
                System.Guid sizeRecId = System.Guid.Empty;
                if (string.Compare(port.Name, principal_port.Name) != 0)
                {
                    sizeRecId = (System.Guid)port["SizeRecordId"];
                }

                Autodesk.ProcessPower.PartsRepository.Port newPort = null;
                bool bNew        = true;
                bool bNeedAccept = false;

                // Principal port is embedded.
                //
                if (sizeRecId != System.Guid.Empty)
                {
                    newPort     = part.NewPortBySizeRecordId(port.Name, sizeRecId.ToString(), out bNew);
                    bNeedAccept = true;
                }
                else
                {
                    newPort = part.NewPort(port.Name);
                }

                if (bNew)
                {
                    foreach (string prop in port.PropertyNames)
                    {
                        if (string.Compare(prop, "PortName", true) == 0)
                        {
                            continue;   // dont copy port name
                        }
                        try
                        {
                            newPort[prop] = port[prop];
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception ex)
                        {
                            // display exception on the command line
                            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                            ed.WriteMessage(ex.ToString());
                        }
                    }

                    if (bNeedAccept)
                    {
                        try
                        {
                            rep.CommitPort(newPort);
                        }
                        catch (Autodesk.AutoCAD.Runtime.Exception ex)
                        {
                            // display exception on the command line
                            Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
                            ed.WriteMessage(ex.ToString());
                        }
                    }
                }

                part.Ports.Add(newPort);
            }

            // Add new part to the project database
            rep.AddPart(part);

            // Transform properties sentitive to current project's unit settings
            switch (prjpart.ProjectUnitsType)
            {
            case ProjectUnitsType.eMetric:
                part.TransformPropertiesToUnits(Units.Mm, Units.Mm);
                break;

            case ProjectUnitsType.eMixedMetric:
                part.TransformPropertiesToUnits(Units.Mm, Units.Inch);
                break;

            case ProjectUnitsType.eImperial:
                part.TransformPropertiesToUnits(Units.Inch, Units.Inch);
                break;
            }

            int cacheId = part.PartId;

            // Finally now we can link entity to row in project
            if (cacheId != -1)
            {
                Autodesk.ProcessPower.DataLinks.DataLinksManager dlm = prjpart.DataLinksManager;
                try
                {
                    dlm.Link(partId, cacheId);
                }
                catch
                {
                    cacheId = -1;;
                }
            }

            return(cacheId); // -1 for error
        }
Ejemplo n.º 40
0
        private void createImages(jsonAttribute eachatt, Transaction tr, ObjectId lyid)
        {
            Editor ed = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument.Editor;

            //produce the bitmap of the signature from base64 string
            string imgPath = "temp.png";

            try
            {
                //remove the header of the base64
                var    base64str = eachatt.imgbase64.Replace("data:image/png;base64,", "");
                byte[] arr       = Convert.FromBase64String(base64str);
                using (MemoryStream ms = new MemoryStream(arr))
                {
                    System.Drawing.Image streamImage = System.Drawing.Image.FromStream(ms);

                    streamImage.Save(imgPath, ImageFormat.Png);
                }
            }
            catch (System.Exception ex)
            {
                ed.WriteMessage("\nBase64StringToImage failed :" + ex.Message);
                return;
            }


            try
            {
                //get block table and model space
                Database         db    = HostApplicationServices.WorkingDatabase;
                BlockTable       bt    = tr.GetObject(db.BlockTableId, OpenMode.ForWrite) as BlockTable;
                BlockTableRecord msBtr = tr.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite) as BlockTableRecord;

                //get the position of this attribute
                string[] split = eachatt.position.Split(new Char[] { ',' });
                double   posX  = Convert.ToDouble(split[0]);
                double   posY  = Convert.ToDouble(split[1]);
                double   posZ  = Convert.ToDouble(split[2]);

                //get the range of this attribute
                double fieldheight    = Convert.ToDouble(eachatt.height);
                double fieldwidth     = Convert.ToDouble(eachatt.width_ratio) * fieldheight;
                double field_center_x = posX + fieldwidth / 2;
                double field_center_y = posY + fieldheight / 2;

                //read the signature image

                System.Drawing.Bitmap operateimage = new System.Drawing.Bitmap(imgPath);

                System.Drawing.Color c;

                double maxX = 0, minX = operateimage.Width;
                double maxY = 0, minY = operateimage.Height;

                ed.WriteMessage("\nbegin create block def for image");
                ObjectId blkRecId = ObjectId.Null;

                using (BlockTableRecord signatureBlkDef = new BlockTableRecord())
                {
                    System.Guid guid = System.Guid.NewGuid();

                    //block definition name
                    signatureBlkDef.Name = "sigblk" + guid.ToString();
                    ArrayList ptArr = new ArrayList();

                    //each pixel color
                    for (int y = 0; y < operateimage.Height; y++)
                    {
                        for (int x = 0; x < operateimage.Width; x++)
                        {
                            c = operateimage.GetPixel(x, y);

                            if (c.R == 0 && c.G == 0 && c.B == 0 && c.A == 255)
                            {
                                Autodesk.AutoCAD.Geometry.Point3d pt = new Autodesk.AutoCAD.Geometry.Point3d(x, operateimage.Height - y, 0);

                                minY = y < minY ? y : minY;
                                maxY = y > maxY ? y : maxY;

                                minX = x < minX ? x : minX;
                                maxX = x > maxX ? x : maxX;

                                var sol =
                                    new Solid(
                                        new Point3d(pt.X, pt.Y, 0),
                                        new Point3d(pt.X + 1, pt.Y, 0),
                                        new Point3d(pt.X, pt.Y + 1, 0),
                                        new Point3d(pt.X + 1, pt.Y + 1, 0)
                                        );

                                //set the solid to the specific layer
                                sol.LayerId = lyid;
                                signatureBlkDef.AppendEntity(sol);
                            }
                        }
                    }

                    ed.WriteMessage("\ncreate and add block def");

                    signatureBlkDef.Origin = new Point3d((maxX + minX) / 2, operateimage.Height - (maxY + minY) / 2, 0);
                    bt.Add(signatureBlkDef);
                    tr.AddNewlyCreatedDBObject(signatureBlkDef, true);

                    //set the block definition to the specific layer
                    blkRecId = signatureBlkDef.Id;

                    ed.WriteMessage("\nend creating block def");
                }

                operateimage.Dispose();
                //scale the signature to fit the field along X, Y

                double blkscaleY = fieldheight / (maxY - minY) * 2;
                double blkscaleX = (maxX - minX) / (maxY - minY) * blkscaleY;

                ed.WriteMessage("\nto begin create block ref");

                using (BlockReference acBlkRef = new BlockReference(new Point3d(field_center_x, field_center_y, 0), blkRecId))
                {
                    acBlkRef.ScaleFactors = new Scale3d(blkscaleY, blkscaleY, 1);
                    acBlkRef.LayerId      = lyid;
                    msBtr.AppendEntity(acBlkRef);
                    tr.AddNewlyCreatedDBObject(acBlkRef, true);
                }

                ed.WriteMessage("\nend of creating block ref");
            }
            catch (Autodesk.AutoCAD.Runtime.Exception ex) {
                ed.WriteMessage("\nfailed to produce the image: " + ex.ToString());
            }
        }
Ejemplo n.º 41
0
        // Forwarded from XlCall
        // Loads the RTD server with temporary ProgId.
        public static object RTD(string progId, string server, params string[] topics)
        {
            // Check if this is any of our business.
            if (!string.IsNullOrEmpty(server) || !registeredRtdServerTypes.ContainsKey(progId))
            {
                // Just pass on to Excel.
                return(CallRTD(progId, null, topics));
            }

            // Check if already loaded.
            if (loadedRtdServers.ContainsKey(progId))
            {
                // Call Excel using the synthetic RtdSrv.xxx (or actual from attribute) ProgId
                return(CallRTD(loadedRtdServers[progId], null, topics));
            }

            // Not loaded already - need to get the Rtd server loaded
            // TODO: Need to reconsider registration here.....
            //       Sometimes need stable ProgIds.
            Type   rtdServerType = registeredRtdServerTypes[progId];
            object rtdServer     = Activator.CreateInstance(rtdServerType);

            ExcelRtdServer excelRtdServer = rtdServer as ExcelRtdServer;

            if (excelRtdServer != null)
            {
                // Set ProgId so that it can be 'unregistered' (removed from loadedRtdServers) when the RTD sever terminates.
                excelRtdServer.RegisteredProgId = progId;
            }
            else
            {
                // Make a wrapper if we are not an ExcelRtdServer
                // (ExcelRtdServer implements exception-handling and XLCall supension itself)
                rtdServer = new RtdServerWrapper(rtdServer, progId);
            }

            // We pick a new Guid as ClassId for this add-in...
            CLSID clsId = Guid.NewGuid();

            // ... (bad idea - this will cause Excel to try to load this RTD server while it is not registered.)
            // Guid typeGuid = GuidUtilit.CreateGuid(..., DnaLibrary.XllPath + ":" + rtdServerType.FullName);
            // string progIdRegistered = "RtdSrv." + typeGuid.ToString("N");

            // by making a fresh progId, we are sure Excel will try to load when we are ready.
            string progIdRegistered = "RtdSrv." + clsId.ToString("N");

            Debug.Print("RTD - Using ProgId: {0} for type: {1}", progIdRegistered, rtdServerType.FullName);

            try
            {
                using (new SingletonClassFactoryRegistration(rtdServer, clsId))
                    using (new ProgIdRegistration(progIdRegistered, clsId))
                        using (new ClsIdRegistration(clsId, progIdRegistered))
                        {
                            object result;
                            if (TryCallRTD(out result, progIdRegistered, null, topics))
                            {
                                // Mark as loaded - ServerTerminate in the wrapper will remove.
                                // TODO: Consider multithread race condition...
                                loadedRtdServers[progId] = progIdRegistered;
                            }
                            return(result);
                        }
            }
            catch (UnauthorizedAccessException secex)
            {
                Logging.LogDisplay.WriteLine("The RTD server of type {0} required by add-in {1} could not be registered.\r\nThis may be due to restricted permissions on the user's HKCU\\Software\\Classes key.\r\nError message: {2}", rtdServerType.FullName, DnaLibrary.CurrentLibrary.Name, secex.Message);
                return(ExcelErrorUtil.ToComError(ExcelError.ExcelErrorValue));
            }
        }
Ejemplo n.º 42
0
        void Awake()
        {
            DontDestroyOnLoad(this);
            #if DISABLE_GOEDLE
            tracking_enabled = false;
            Debug.LogWarning("Your Unity version does not support native plugins. Disabling goedle.io.");
            #endif
            System.Guid user_id     = System.Guid.NewGuid();
            string      app_version = Application.version;

            if (tracking_enabled && gio_interface == null)
            {
                gio_interface = new goedle_sdk.detail.GoedleAnalytics(api_key, app_key, user_id.ToString("D"), app_version);
            }
        }
Ejemplo n.º 43
0
 public ProgIdRegistration(string progId, CLSID clsId)
 {
     _progId = progId;
     // Register the ProgId for CLSIDFromProgID.
     Registry.SetValue(@"HKEY_CURRENT_USER\Software\Classes\" + _progId + @"\CLSID", null, clsId.ToString("B").ToUpperInvariant(), RegistryValueKind.String);
 }
Ejemplo n.º 44
0
 internal static void ScopeEnter(
     out IntPtr hScp,
     string fmtPrintfW,
     System.Int32 a1,
     [BidArgumentType(typeof(String))] System.Guid a2)
 {
     if ((modFlags & ApiGroup.Scope) != 0 && modID != NoData)
     {
         NativeMethods.ScopeEnter(modID, UIntPtr.Zero, UIntPtr.Zero, out hScp, fmtPrintfW, a1, a2.ToString());
     }
     else
     {
         hScp = NoData;
     }
 }
Ejemplo n.º 45
0
        public void PrintBill()
        {
            try
            {
                int UserId = 0;
                Int32.TryParse(ddlUser.SelectedValue, out UserId);
                List <ProductInvoice_Master> _Pro = ProductInvoice_MasterCollection.GetAll().FindAll(x => x.BILL_ID == billid);
                #region Company
                string CompanyName    = USERPROFILEMASTER.GetByUser_Name("OMHRD").First_Name;
                string CompanyAddress = USERPROFILEMASTER.GetByUser_Name("OMHRD").Address;
                string CompanyState   = USERPROFILEMASTER.GetByUser_Name("OMHRD").StateName;
                string CompanyCity    = USERPROFILEMASTER.GetByUser_Name("OMHRD").CityName;
                string ZipCode        = USERPROFILEMASTER.GetByUser_Name("OMHRD").ZipCode;
                string CompanyGST     = USERPROFILEMASTER.GetByUser_Name("OMHRD").GstinVerified;
                string CompanyContact = USERPROFILEMASTER.GetByUser_Name("OMHRD").ContactNumber;
                #endregion
                #region Seller
                string ShipName  = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string ShipAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).Address;
                string ShipAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).AddressLine2;
                string ShipState = USERPROFILEMASTER.GetByRegistration_ID(UserId).StateName;
                string ShipCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).CityName;
                string ShipZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ZipCode;
                string Contry    = USERPROFILEMASTER.GetByRegistration_ID(UserId).COUNTRY;

                string BillName       = USERPROFILEMASTER.GetByRegistration_ID(UserId).First_Name + " " + USERPROFILEMASTER.GetByRegistration_ID(UserId).Last_Name;
                string PermanentAdd1  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddress;
                string PermanentAdd2  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingAddressLine2;
                string PermanentState = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippStateName;
                string PermanentCity  = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShipCityName;
                string PermanentZip   = USERPROFILEMASTER.GetByRegistration_ID(UserId).ShippingZip;
                string Gstin          = USERPROFILEMASTER.GetByRegistration_ID(UserId).GstinVerified;
                #endregion
                #region PickUp
                int    PicupId       = int.Parse(Session["PickupID"].ToString());
                string PickUpName    = PickupMaster.GetByPickupID(PicupId).FirstName + " " + PickupMaster.GetByPickupID(PicupId).LastName;
                string PickUpAddress = PickupMaster.GetByPickupID(PicupId).Address;
                string PickUpContact = PickupMaster.GetByPickupID(PicupId).ContactNo;
                string CenterName    = PickupMaster.GetByPickupID(PicupId).CenterName;
                string CenterCode    = PickupMaster.GetByPickupID(PicupId).CenterCode;
                #endregion
                #region BillDetail
                System.Guid guid      = System.Guid.NewGuid();
                String      id        = guid.ToString();
                string      OrderId   = id;
                DateTime    dt        = System.DateTime.Today;
                string      InvoiNo   = ProductBill_Master.GetByBILL_ID(billid).BILLNO;
                string      InvoiDate = dt.ToString();
                string      Phone     = USERPROFILEMASTER.GetByRegistration_ID(UserId).ContactNumber;
                string      Email     = USERPROFILEMASTER.GetByRegistration_ID(UserId).Email;

                #endregion
                decimal totamt = Math.Round(ProductBill_Master.GetByBILL_ID(billid).TOTAL, 0);
                var     values = totamt.ToString(CultureInfo.InvariantCulture).Split('.');
                Int64   rup    = Convert.ToInt64(values[0]);
                Int64   paise  = 0;
                if (values.Length == 2)
                {
                    paise = Convert.ToInt64(values[1]);
                }
                string rupee = string.Empty;
                string pa    = string.Empty;
                if (paise != 0)
                {
                    pa    = Rupees(paise) + "Paise Only";
                    rupee = Rupees(rup) + "Rupees and " + pa;
                }
                else
                {
                    rupee = Rupees(rup) + "Rupees Only";
                }
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                this.ReportViewer1.LocalReport.EnableExternalImages = true;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("/Report/PickUpSale.rdlc");
                ReportDataSource  datasource = new ReportDataSource("BillGenrate", _Pro);
                ReportParameter[] rpt        = new ReportParameter[33];
                rpt[0]  = new ReportParameter("CompanyName", CompanyName);
                rpt[1]  = new ReportParameter("CompanyAddress", CompanyAddress);
                rpt[2]  = new ReportParameter("CompanyState", CompanyState);
                rpt[3]  = new ReportParameter("CompanyCity", CompanyCity);
                rpt[4]  = new ReportParameter("ZipCode", ZipCode);
                rpt[5]  = new ReportParameter("CompanyGST", CompanyGST);
                rpt[6]  = new ReportParameter("CompanyContact", CompanyContact);
                rpt[7]  = new ReportParameter("ShipName", ShipName);
                rpt[8]  = new ReportParameter("ShipAdd1", ShipAdd1);
                rpt[9]  = new ReportParameter("ShipAdd2", ShipAdd2);
                rpt[10] = new ReportParameter("ShipCity", ShipCity);
                rpt[11] = new ReportParameter("ShipState", ShipState);
                rpt[12] = new ReportParameter("ShipZip", ShipZip);
                rpt[13] = new ReportParameter("Contry", Contry);
                rpt[14] = new ReportParameter("BillName", BillName);
                rpt[15] = new ReportParameter("PermanentAdd1", PermanentAdd1);
                rpt[16] = new ReportParameter("PermanentAdd2", PermanentAdd2);
                rpt[17] = new ReportParameter("PermanentCity", PermanentCity);
                rpt[18] = new ReportParameter("PermanentState", PermanentState);
                rpt[19] = new ReportParameter("PermanentZip", PermanentZip);
                rpt[20] = new ReportParameter("Gstin", Gstin);
                rpt[21] = new ReportParameter("OrderId", OrderId);
                rpt[22] = new ReportParameter("InvoiNo", InvoiNo);
                rpt[23] = new ReportParameter("InvoiDate", InvoiDate);
                rpt[24] = new ReportParameter("Phone", Phone);
                rpt[25] = new ReportParameter("Email", Email);
                rpt[26] = new ReportParameter("TotalAmountWord", rupee);

                rpt[27] = new ReportParameter("PaymentMod", PaymentMod);
                rpt[28] = new ReportParameter("PickUpName", PickUpName);
                rpt[29] = new ReportParameter("PickUpAddress", PickUpAddress);
                rpt[30] = new ReportParameter("PickUpContact", PickUpContact);
                rpt[31] = new ReportParameter("CenterName", CenterName);
                rpt[32] = new ReportParameter("CenterCode", CenterCode);
                this.ReportViewer1.LocalReport.SetParameters(rpt);
                this.ReportViewer1.LocalReport.DataSources.Clear();
                this.ReportViewer1.LocalReport.DataSources.Add(datasource);
                this.ReportViewer1.LocalReport.Refresh();
            }
            catch (Exception ex)
            { }
        }
Ejemplo n.º 46
0
 /// <summary>
 /// 生成GUID
 /// </summary>
 /// <returns></returns>
 public static string GetGuid()
 {
     System.Guid g = System.Guid.NewGuid();
     return(g.ToString());
 }
Ejemplo n.º 47
0
 public static Guid CreateNewGuid()
 {
     System.Guid guid = System.Guid.NewGuid();
     return(new Guid(guid.ToString()));
 }
Ejemplo n.º 48
0
 public void DoWork()
 {
     Console.WriteLine("SingleID:" + g.ToString());
 }
Ejemplo n.º 49
0
 public static string ToFhirId(this System.Guid me)
 {
     return(me.ToString("n"));
 }
 public MessageBusableResponseTemplate()
     : base()
 {
     System.Guid guid = System.Guid.NewGuid();
     response_guid = guid.ToString();
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Sets the driver to the driver with the GUID provided.
 /// </summary>
 /// <param name="driverGUID"> Driver GUID in question. </param>
 public void SetAudioDriver(System.Guid driverGUID)
 {
     SetAudioDriver(driverGUID.ToString());
 }
Ejemplo n.º 52
0
 public static string GetFeedRegistryKeyString(System.Guid _GUID)
 {
     return(@"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Workspaces\Feeds\{" + _GUID.ToString() + "}");
 }
Ejemplo n.º 53
0
 public override string ToString()
 {
     return("Knowledge: (" + id.ToString() + ", " + parameter.ToString() + ")");
 }
Ejemplo n.º 54
0
 public void SetAttribute(string name, System.Guid value)
 {
     internalElement.SetAttribute(name, value.ToString());
 }
Ejemplo n.º 55
0
 public static string GetUniqueIdentifier()
 {
     System.Guid uid = System.Guid.NewGuid();
     return(uid.ToString());
 }
Ejemplo n.º 56
0
        /// <summary>
        /// 根据模块ID 获取该模块下的所有打印报表。
        /// </summary>
        /// <param name="moduleID"></param>
        /// <returns></returns>
        public MB.WinPrintReport.Model.PrintTempleteContentInfo GetPrintTemplete(System.Guid templeteID)
        {
            string fileName  = string.Format(PRINT_TEMPLETE_PATH + PRINT_TEMPLETE_NAME, _ModuleID, templeteID.ToString());
            string xmlString = MB.Util.MyFileStream.Instance.StreamReader(fileName);

            if (string.IsNullOrEmpty(xmlString))
            {
                return(null);
            }

            var xmlSerializer = new MB.Util.Serializer.EntityXmlSerializer <MB.WinPrintReport.Model.PrintTempleteContentInfo>();

            return(xmlSerializer.SingleDeSerializer(xmlString, SAVE_ROOT_PATH));
        }
Ejemplo n.º 57
0
    private void DataCollectorManager()
    {
        if ((SceneManager.GetActiveScene().name == ID.SceneNames[(int)ID.Scenes.Login]) && !_GetLoginSceneGameObjects)
        {
            _Name       = GameObject.FindWithTag("_Name");
            _NameText   = _Name.GetComponent <Text>();
            _Age        = GameObject.FindWithTag("_Age");
            _AgeText    = _Age.GetComponent <Text>();
            _Gender     = GameObject.FindWithTag("_Gender");
            _GenderText = _Gender.GetComponent <Text>();
            _Local      = GameObject.FindWithTag("_Local");
            _LocalBool  = _Local.GetComponent <Toggle>();

            _GetLoginSceneGameObjects = true;
        }
        else
        {
            _GetLoginSceneGameObjects = false;
        }
        if ((SceneManager.GetActiveScene().name == ID.SceneNames[(int)ID.Scenes.ARAdd]) && !_GetARAddSceneGameObjects)
        {
            _NewARAdd     = GameObject.FindWithTag("_NewARAdd");
            _ARAddManager = _NewARAdd.GetComponent <ARAddManager>();

            _GetARAddSceneGameObjects = true;
        }
        else
        {
            _GetARAddSceneGameObjects = false;
        }

        // DATA
        if (triggerDataCollector && (SceneManager.GetActiveScene().name == ID.SceneNames[(int)ID.Scenes.Login]))
        {
            _GUID    = System.Guid.NewGuid();
            _counter = 0;
            writeNewUser(_GUID.ToString(), _NameText.text, _AgeText.text, _GenderText.text, _LocalBool.ToString());
            triggerDataCollector = false;
        }
        else if (triggerDataCollector && (SceneManager.GetActiveScene().name == ID.SceneNames[(int)ID.Scenes.ARAdd]))
        {
            _ARAdd            = _ARAddManager.ARAdd;
            _GPSLocalitation  = GameObject.FindWithTag("_GPSLocalitation");
            _GPSLocalitation_ = _GPSLocalitation.GetComponent <GPSLocalitation>();
            if (_ARAdd.tag == "_ARAdd_DataText")
            {
                _NewARAdd_     = GameObject.FindWithTag("_ARAddText");
                _NewARAdd_Text = _NewARAdd_.GetComponent <Text>();
                writeNewARAddData(_GUID.ToString(), _ARAdd.name, _ARAdd.transform.position.ToString(), _GPSLocalitation_.Latitude.ToString(), _GPSLocalitation_.Longitude.ToString(), _NewARAdd_Text.text);
            }
            else if (_ARAdd.tag == "_ARAddTarget")
            {
                //Score
            }
            else if ((_ARAdd.tag != "_ARAdd_DataText") && (_ARAdd.tag != "_ARAddTarget"))
            {
                writeNewARAddData(_GUID.ToString(), _ARAdd.name, _ARAdd.transform.position.ToString(), _GPSLocalitation_.Latitude.ToString(), _GPSLocalitation_.Longitude.ToString());
            }
            triggerDataCollector = false;
        }
    }
Ejemplo n.º 58
0
        public string RegSimulationHost(string LoginID, string UserName, string hostName, string hostIP, string simulationType, string licensePath, string simulationPath, string hostKey)
        {
            this.LoginID = LoginID;

            string simulationHostID = string.Empty;

            // 检查权限

            // 检查是否存在
            string sqlCheck = string.Format("select * from SimulationHostInfo where HostIP='{0}' and SimulationType='{1}'", hostIP, simulationType);

            try
            {
                DataTable dtHost = CenterService.DB.ExecuteDataTable(sqlCheck);

                if (dtHost != null && dtHost.Rows.Count > 0)
                {
                    simulationHostID = dtHost.Rows[0]["ID"].ToString();
                }
            }
            catch (System.Exception ex)
            {
            }

            string sql = string.Empty;

            if (simulationHostID == string.Empty)
            {
                System.Guid HostID = System.Guid.NewGuid();
                simulationHostID = HostID.ToString();

                // 注册模拟器主机
                sql = string.Format("insert into SimulationHostInfo (ID, UserName, RegDate, HostName, HostIP, SimulationType, LicensePath, SimulationPath, HostKey) values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')",
                                    simulationHostID, UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), hostName, hostIP, simulationType, licensePath, simulationPath, hostKey);
            }
            else
            {
                // 更新模拟器主机
                sql = string.Format("update SimulationHostInfo set UserName='******', RegDate='{1}', HostName='{2}', HostIP='{3}', LicensePath='{4}', SimulationPath='{5}', HostKey='{6}' where ID = '{7}'",
                                    UserName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), hostName, hostIP, licensePath, simulationPath, hostKey, simulationHostID);
            }

            int ret = 0;

            try
            {
                ret = CenterService.DB.ExecuteNonQuery(sql);
                if (ret > 0)
                {
                    return("success");
                }
            }
            catch (System.Exception ex)
            {
                return(ex.Message);
            }
            finally
            {
            }
            return("failed");
        }
Ejemplo n.º 59
0
 public void OnBeforeSerialize()
 {
     _guid = ParameterId.ToString();
 }
Ejemplo n.º 60
0
 public static string GetGuidName()
 {
     System.Guid guid = Guid.NewGuid();
     return(guid.ToString());
 }