internal ReplicationCursor(DirectoryServer server, string partition, Guid guid, long filter) { this.partition = partition; this.invocationID = guid; this.USN = filter; this.server = server; }
public bool IsProfileAllreadyExist(Guid UserId, string WPUserId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to Check if FacebookUser is Exist in database or not by UserId and FbuserId. // And Set the reuired paremeters to find the specific values. List<Domain.Socioboard.Domain.WordpressAccount> alst = session.CreateQuery("from WordpressAccount where UserId = :userid and WpUserId = :WpUserId") .SetParameter("userid", UserId) .SetParameter("WpUserId", WPUserId) .List<Domain.Socioboard.Domain.WordpressAccount>() .ToList<Domain.Socioboard.Domain.WordpressAccount>(); if (alst.Count == 0 || alst == null) return false; else return true; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return true; } }//End Transaction }//End session }
public Domain.Socioboard.Domain.WordpressAccount GetWordpressAccountById(Guid id, string wpid) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { //After Session creation, start Transaction. using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { //Proceed action, to Check if FacebookUser is Exist in database or not by UserId and FbuserId. // And Set the reuired paremeters to find the specific values. NHibernate.IQuery query = session.CreateQuery("from WordpressAccount where UserId = :userid and WpUserId = :WpUserId"); query.SetParameter("userid", id); query.SetParameter("WpUserId", wpid); return (Domain.Socioboard.Domain.WordpressAccount)query.UniqueResult(); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return null; } }//End Transaction }//End session }
static void Main() { CreateRoles(); using (WorkflowRuntime workflowRuntime = new WorkflowRuntime()) { workflowRuntime.StartRuntime(); // Load the workflow type. Type type = typeof(PurchaseOrderWorkflow); ExternalDataExchangeService dataService = new ExternalDataExchangeService(); workflowRuntime.AddService(dataService); poImpl = new StartPurchaseOrder(); dataService.AddService(poImpl); workflowRuntime.WorkflowCompleted += OnWorkflowCompleted; workflowRuntime.WorkflowTerminated += OnWorkflowTerminated; WorkflowInstance instance = workflowRuntime.CreateWorkflow(type); workflowInstanceId = instance.InstanceId; instance.Start(); SendPORequestMessage(); waitHandle.WaitOne(); workflowRuntime.StopRuntime(); } }
public TaskEventArgs(Guid instanceId, string id, string assignee, string text) :base(instanceId) { this.idValue = id; this.assigneeValue = assignee; this.textValue = text; }
/// <summary> /// Gets the draft data for the media entity with the given id. /// </summary> /// <param name="id">The id</param> /// <param name="type">The media type</param> /// <returns>The draft media data, null if the data wasn't found</returns> public virtual byte[] GetDraft(Guid id, MediaType type = MediaType.Media) { var path = GetPath(id, true, type); if (File.Exists(path)) return File.ReadAllBytes(path); return null; }
/// <summary> /// Generates the manifest and metadata information file used by the .epub reader /// (content.opf). For more information, refer to <see cref="http://www.idpf.org/doc_library/epub/OPF_2.0.1_draft.htm#Section2.0"/> /// </summary> /// <param name="projInfo">Project information</param> /// <param name="contentFolder">Content folder (.../OEBPS)</param> /// <param name="bookId">Unique identifier for the book we're generating.</param> public void CreateOpf(PublicationInformation projInfo, string contentFolder, Guid bookId) { XmlWriter opf = XmlWriter.Create(Common.PathCombine(contentFolder, "content.opf")); opf.WriteStartDocument(); // package name opf.WriteStartElement("package", "http://www.idpf.org/2007/opf"); opf.WriteAttributeString("version", "2.0"); opf.WriteAttributeString("unique-identifier", "BookId"); // metadata - items defined by the Dublin Core Metadata Initiative: Metadata(projInfo, bookId, opf); StartManifest(opf); if (_parent.EmbedFonts) { ManifestFontEmbed(opf); } string[] files = Directory.GetFiles(contentFolder); ManifestContent(opf, files, "epub2"); Spine(opf, files); Guide(projInfo, opf, files, "epub2"); opf.WriteEndElement(); // package opf.WriteEndDocument(); opf.Close(); }
public void CloseById(Guid id) { var delAllocation = _unitOfWork.OtherDispatchAllocationRepository.Get().FirstOrDefault(allocation => allocation.OtherDispatchAllocationID == id); if (delAllocation != null) delAllocation.IsClosed = true; _unitOfWork.OtherDispatchAllocationRepository.Add(delAllocation); _unitOfWork.Save(); }
public Tracker(string accountName, string keyValue) { _applicationId = IdUtil.ApplicationId(); _deviceId = IdUtil.DeviceId(); _anid = IdUtil.GetAnidFromOs(); _appTitle = IdUtil.ApplicationName(); _adsRefreshRate = 3; _pubCenterAdsId = new List<string>(); _adsReady = false; // Due to Disallowed key in RowKey, /, \, #, ? needs to be removed // And excel cannot allow "=" at the beginning foreach (var s in _invalidRowKeyChar) { _deviceId = _deviceId.Replace(s, string.Empty); if (_deviceId.Substring(0, 1) == "=") { _deviceId = "x" + _deviceId; } } GetAdAssemblyVersion(); RefreshIpInfo(); _storageCredentials = new StorageCredentials(accountName, keyValue); _storageAccount = new CloudStorageAccount(_storageCredentials, false); _tableClient = _storageAccount.CreateCloudTableClient(); EnsureTablesCreated(); }
/// <summary> /// Initializes a new instance of the Task data contract class given its required properties. /// </summary> /// <param name="clickGuid">Click Guid</param> /// <param name="facilityGuid">Facility Guid</param> /// <param name="listingTypeGuid">Listing Type Guid</param> /// <param name="timeStamp">Time Stamp</param> public Click(Guid clickGuid, Guid facilityGuid, Guid listingTypeGuid, DateTime timeStamp) { _clickGuid = clickGuid; _facilityGuid = facilityGuid; _listingTypeGuid = listingTypeGuid; _timeStamp = timeStamp; }
public ActionResult Article(Guid id) { foreach (News item in newsManagement.news) if (item.Id == id) return View(item); return Redirect("/error"); }
private void EnsureDocumentEtagMatchInTransaction(string key, Guid? etag) { Api.JetSetCurrentIndex(session, DocumentsModifiedByTransactions, "by_key"); Api.MakeKey(session, DocumentsModifiedByTransactions, key, Encoding.Unicode, MakeKeyGrbit.NewKey); Guid existingEtag; if (Api.TrySeek(session, DocumentsModifiedByTransactions, SeekGrbit.SeekEQ)) { if (Api.RetrieveColumnAsBoolean(session, DocumentsModifiedByTransactions, tableColumnsCache.DocumentsModifiedByTransactionsColumns["delete_document"]) == true) return; // we ignore etags on deleted documents existingEtag = Api.RetrieveColumn(session, DocumentsModifiedByTransactions, tableColumnsCache.DocumentsModifiedByTransactionsColumns["etag"]).TransfromToGuidWithProperSorting(); } else { existingEtag = Api.RetrieveColumn(session, Documents, tableColumnsCache.DocumentsColumns["etag"]).TransfromToGuidWithProperSorting(); } if (existingEtag != etag && etag != null) { throw new ConcurrencyException("PUT attempted on document '" + key + "' using a non current etag") { ActualETag = etag.Value, ExpectedETag = existingEtag }; } }
public static int Add( Guid pollGuid, Guid siteGuid, String question, bool anonymousVoting, bool allowViewingResultsBeforeVoting, bool showOrderNumbers, bool showResultsWhenDeactivated, bool active, DateTime activeFrom, DateTime activeTo) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Insert", 10); sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid); sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid); sph.DefineSqlParameter("@Question", SqlDbType.NVarChar, 255, ParameterDirection.Input, question); sph.DefineSqlParameter("@AnonymousVoting", SqlDbType.Bit, ParameterDirection.Input, anonymousVoting); sph.DefineSqlParameter("@AllowViewingResultsBeforeVoting", SqlDbType.Bit, ParameterDirection.Input, allowViewingResultsBeforeVoting); sph.DefineSqlParameter("@ShowOrderNumbers", SqlDbType.Bit, ParameterDirection.Input, showOrderNumbers); sph.DefineSqlParameter("@ShowResultsWhenDeactivated", SqlDbType.Bit, ParameterDirection.Input, showResultsWhenDeactivated); sph.DefineSqlParameter("@Active", SqlDbType.Bit, ParameterDirection.Input, active); sph.DefineSqlParameter("@ActiveFrom", SqlDbType.DateTime, ParameterDirection.Input, activeFrom); sph.DefineSqlParameter("@ActiveTo", SqlDbType.DateTime, ParameterDirection.Input, activeTo); int rowsAffected = sph.ExecuteNonQuery(); return rowsAffected; }
public static bool Delete(Guid pollGuid) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_Polls_Delete", 1); sph.DefineSqlParameter("@PollGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, pollGuid); int rowsAffected = sph.ExecuteNonQuery(); return (rowsAffected > 0); }
public User Get(Guid id) { using (var db = base.NewDB()) { return db.Users.Get(id); } }
public static bool HasValidSignature(string fileName) { try { if (_isValidCache.Contains(fileName)) { return true; } var wtd = new WinTrustData(fileName); var guidAction = new Guid(WINTRUST_ACTION_GENERIC_VERIFY_V2); WinVerifyTrustResult result = WinTrust.WinVerifyTrust(INVALID_HANDLE_VALUE, guidAction, wtd); bool ret = (result == WinVerifyTrustResult.Success); if (ret) { _isValidCache.Add(fileName); } #if COAPP_ENGINE_CORE var response = Event<GetResponseInterface>.RaiseFirst(); if( response != null ) { response.SignatureValidation(fileName, ret, ret ? Verifier.GetPublisherInformation(fileName)["PublisherName"] : null); } #endif return ret; } catch (Exception) { return false; } }
public ActionResult ChangeName(Guid id, string name, int version) { var command = new RenameInventoryItem(id, name, version); _bus.Send(command); return RedirectToAction("Index"); }
public async Task<NotificationMovementsSummary> GetById(Guid notificationId) { await notificationAuthorization.EnsureAccessAsync(notificationId); var summaryData = await context.NotificationApplications .GroupJoin( context.ShipmentInfos, notification => notification.Id, shipment => shipment.NotificationId, (notification, shipments) => new { Notification = notification, Shipment = shipments.FirstOrDefault() }) .Join(context.NotificationAssessments, x => x.Notification.Id, na => na.NotificationApplicationId, (x, na) => new { x.Notification, x.Shipment, NotificationAssessment = na }) .Select(x => new { NotificationId = x.Notification.Id, x.Notification.NotificationType, x.Notification.NotificationNumber, NumberOfShipments = x.Shipment == null ? 0 : x.Shipment.NumberOfShipments, Quantity = x.Shipment == null ? 0 : x.Shipment.Quantity, Units = x.Shipment == null ? ShipmentQuantityUnits.Tonnes : x.Shipment.Units, NotificationStatus = x.NotificationAssessment.Status, x.Notification.CompetentAuthority }) .SingleAsync(x => x.NotificationId == notificationId); var totalMovements = await context.Movements .Where(m => m.NotificationId == notificationId) .CountAsync(); var currentActiveLoads = await context.Movements .Where(m => m.NotificationId == notificationId && (m.Status == MovementStatus.Submitted || m.Status == MovementStatus.Received) && m.Date < SystemTime.UtcNow) .CountAsync(); var financialGuaranteeCollection = await context.FinancialGuarantees.SingleAsync(x => x.NotificationId == notificationId); var financialGuarantee = financialGuaranteeCollection.GetCurrentApprovedFinancialGuarantee() ?? financialGuaranteeCollection.GetLatestFinancialGuarantee(); return NotificationMovementsSummary.Load(summaryData.NotificationId, summaryData.NotificationNumber, summaryData.NotificationType, summaryData.NumberOfShipments, totalMovements, financialGuarantee == null ? 0 : financialGuarantee.ActiveLoadsPermitted.GetValueOrDefault(), currentActiveLoads, summaryData.Quantity, (await quantity.Received(notificationId)).Quantity, summaryData.Units, financialGuarantee == null ? FinancialGuaranteeStatus.AwaitingApplication : financialGuarantee.Status, summaryData.CompetentAuthority, summaryData.NotificationStatus); }
/// <summary> /// Inserts a row in the mp_ContentWorkflow table. Returns rows affected count. /// </summary> /// <param name="guid"> guid </param> /// <param name="siteGuid"> siteGuid </param> /// <param name="moduleGuid"> moduleGuid </param> /// <param name="createdDateUtc"> createdDateUtc </param> /// <param name="userGuid"> userGuid </param> /// <param name="status"> status </param> /// <param name="contentText"> contentText </param> /// <param name="customData"> customData </param> /// <param name="customReferenceNumber"> customReferenceNumber </param> /// <param name="customReferenceGuid"> customReferenceGuid </param> /// <returns>int</returns> public static int Create( Guid guid, Guid siteGuid, Guid moduleGuid, Guid userGuid, DateTime createdDateUtc, string contentText, string customData, int customReferenceNumber, Guid customReferenceGuid, string status) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetWriteConnectionString(), "mp_ContentWorkflow_Insert", 10); sph.DefineSqlParameter("@Guid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, guid); sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid); sph.DefineSqlParameter("@ModuleGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, moduleGuid); sph.DefineSqlParameter("@CreatedDateUtc", SqlDbType.DateTime, ParameterDirection.Input, createdDateUtc); sph.DefineSqlParameter("@UserGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, userGuid); sph.DefineSqlParameter("@Status", SqlDbType.NVarChar, 20, ParameterDirection.Input, status); sph.DefineSqlParameter("@ContentText", SqlDbType.NVarChar, -1, ParameterDirection.Input, contentText); sph.DefineSqlParameter("@CustomData", SqlDbType.NVarChar, -1, ParameterDirection.Input, customData); //object customReferenceNumberVal = customReferenceNumber.HasValue ? (object)customReferenceNumber.Value : DBNull.Value; sph.DefineSqlParameter("@CustomReferenceNumber", SqlDbType.Int, ParameterDirection.Input, customReferenceNumber); //object customReferenceGuidVal = customReferenceGuid.HasValue ? (object)customReferenceGuid.Value : DBNull.Value; sph.DefineSqlParameter("@CustomReferenceGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, customReferenceGuid); int rowsAffected = sph.ExecuteNonQuery(); return rowsAffected; }
public UpdateCommitteeEvent(Guid committeeId, Guid departmentId, string name, string mandate) { CommitteeId = committeeId; DepartmentId = departmentId; Name = name; Mandate = mandate; }
public HttpResponseMessageWrapper<Suggestion> GetSuggestion(HttpRequestMessage req, Guid id) { Operation operation = null; HttpStatusCode code = AuthenticateUser(req); if (code != HttpStatusCode.OK) { // user not authenticated return ReturnResult<Suggestion>(req, operation, code); } try { Suggestion suggestion = this.SuggestionsStorageContext.Suggestions.Single<Suggestion>(s => s.ID == id); if (!ValidateEntityOwnership(suggestion.EntityID, suggestion.EntityType)) { // entity associated with suggestions does not belong to the authenticated user, return 403 Forbidden TraceLog.TraceError("Associated entity does not belong to current user)"); return ReturnResult<Suggestion>(req, operation, HttpStatusCode.Forbidden); } var response = ReturnResult<Suggestion>(req, operation, suggestion, HttpStatusCode.OK); response.Headers.CacheControl = new CacheControlHeaderValue() { NoCache = true }; return response; } catch (Exception ex) { // suggestion not found - return 404 Not Found TraceLog.TraceException("Resource not found", ex); return ReturnResult<Suggestion>(req, operation, HttpStatusCode.NotFound); } }
public Core.Business.OperateSort Select(Guid id) { SqlServerUtility sql = new SqlServerUtility(); sql.AddParameter("@Id", SqlDbType.UniqueIdentifier, id); SqlDataReader reader = sql.ExecuteSPReader("usp_SelectOperateSort"); if (reader != null && !reader.IsClosed && reader.Read()) { Core.Business.OperateSort operateSort = new Core.Business.OperateSort(); if (!reader.IsDBNull(0)) operateSort.Id = reader.GetGuid(0); if (!reader.IsDBNull(1)) operateSort.OperateSortName = reader.GetString(1); reader.Close(); return operateSort; } else { if (reader != null && !reader.IsClosed) reader.Close(); return null; } }
public AccountRegisteredEvent(Guid accountId, string name, string email, int initialBalance) { AccountId = accountId; Name = name; Email = email; InitialBalance = initialBalance; }
/// <summary> /// Constructor with all fields except primary key fields /// </summary> public BusinessAccount(Guid id, int businessAccountTypeId, string fullName, string shortName, Guid updatedByUserId, string updatedDatetime) { this.Id = id; this.BusinessAccountTypeId = businessAccountTypeId; this.FullName = fullName; this.ShortName = shortName; }
public bool checkTwitterFeedExists(string Id, Guid Userid, string messageId) { using (NHibernate.ISession session = SessionFactory.GetNewSession()) { using (NHibernate.ITransaction transaction = session.BeginTransaction()) { try { NHibernate.IQuery query = session.CreateQuery("from TwitterFeed where UserId = :userid and ProfileId = :Twtuserid and MessageId = :messid"); query.SetParameter("userid", Userid); query.SetParameter("Twtuserid", Id); query.SetParameter("messid", messageId); var result = query.UniqueResult(); if (result == null) return false; else return true; } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return true; } } } }
public static object MakeGuidParam(Guid? d) { if (d == null || d == Guid.Empty) return DBNull.Value; else return d; }
public Boolean addSkillToRecruitee(Guid RecruiteeId, String SkillId) { RecruiteeManager mgr = new RecruiteeManager(); Recruitee rec = Recruitee.createRecruitee(RecruiteeId, null, 0, "", "", "", "", "", "", ""); Recruitee obj = mgr.selectRecruiteeById(rec); return mgr.addSkillToRecruitee(obj, SkillId); }
private Subtree CreateSubTreeFromCode(Guid guid, string code) { CodeBlockNode commentCode; var cbn = GraphToDSCompiler.GraphUtilities.Parse(code, out commentCode) as CodeBlockNode; var subtree = null == cbn ? new Subtree(null, guid) : new Subtree(cbn.Body, guid); return subtree; }
public static IDataReader GetActivePolls(Guid siteGuid) { SqlParameterHelper sph = new SqlParameterHelper(ConnectionString.GetReadConnectionString(), "mp_Polls_SelectActive", 2); sph.DefineSqlParameter("@SiteGuid", SqlDbType.UniqueIdentifier, ParameterDirection.Input, siteGuid); sph.DefineSqlParameter("@CurrentTime", SqlDbType.DateTime, ParameterDirection.Input, DateTime.UtcNow); return sph.ExecuteReader(); }
public ActionResult Edit(Guid id) { var service = new RestServiceClient<Cat_SkillModel>(UserLogin); service.SetCookies(this.Request.Cookies, _hrm_Hr_Service); var result = service.Get(_hrm_Hr_Service, "api/Cat_Skill/", id); return View(result); }