/// <summary> /// Looks up a TypedEntity or EntitySchema Id in the queue or the index based on the id /// </summary> /// <param name="id"></param> /// <param name="idsinQueue">The ids already in the queue</param> /// <returns></returns> private string GetItem(string id, IEnumerable <string> idsinQueue) { var foundInQueue = idsinQueue.SingleOrDefault(x => x == id); if (foundInQueue != null) { return(foundInQueue); } var typedEntity = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Must().EntityType <TypedEntity>() .Must().Id(id, FixedIndexedFields.EntityId).Compile()); if (typedEntity.Any()) { return(typedEntity.Last().Fields[FixedIndexedFields.EntityId]); } var schema = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Must().EntityType <EntitySchema>() .Must().Id(id).Compile()); if (schema.Any()) { return(schema.Last().Id); } return(null); }
void Pager1_onLoadPageIndexChaning(int pageIndex) { try { PagedDataSource pds = new PagedDataSource(); pds.DataSource = ExamineManager.SearchExamineByType(ddlTyep.SelectedItem.Text); Pager1.DataCount = pds.Count; pds.AllowPaging = true; pds.PageSize = 5; // if (pageIndex == Pager1.PageCount) //{ // pageIndex--; //} pds.CurrentPageIndex = pageIndex; Pager1.PageCount = pds.PageCount; gvExamine.DataSourceID = null; gvExamine.DataSource = pds; gvExamine.DataBind(); } catch (Exception) { return; } }
/// <summary> /// Method to add delete queue items for each schema association since we're not tracking /// revisions with schemas, we need to first remove the associations like groups/attribute defs and then re-add them /// with the up-to-date info. /// </summary> /// <param name="schema"></param> /// <param name="manager"></param> /// <param name="transaction"></param> internal static void RemoveSchemaAssociations(EntitySchema schema, ExamineManager manager, ExamineTransaction transaction) { //find all associations previously added to the transaction queue transaction.RemoveSchemaAssociations(schema); //if there's no id already assigned to the schema, then we can't look it up if (schema.Id.IsNullValueOrEmpty()) { return; } //lookup all associated: AttributeGroup, AttributeDefinition that already exist in the index var toRemove = manager.Search( manager.CreateSearchCriteria() .Must().EntityType <AttributeGroup>() .Must().HiveId(schema.Id, FixedIndexedFields.SchemaId).Compile()) .Concat(manager.Search(manager.CreateSearchCriteria() .Must().EntityType <AttributeDefinition>() .Must().HiveId(schema.Id, FixedIndexedFields.SchemaId).Compile())); foreach (var r in toRemove) { //need to copy to closure var r1 = r; transaction.EnqueueIndexOperation(new LinearHiveIndexOperation { Id = new Lazy <string>(() => r1.Id), OperationType = IndexOperationType.Delete }); } }
public override void Compose(Composition composition) { base.Compose(composition); // populators are not a collection: one cannot remove ours, and can only add more // the container can inject IEnumerable<IIndexPopulator> and get them all composition.Register <MemberIndexPopulator>(Lifetime.Singleton); composition.Register <ContentIndexPopulator>(Lifetime.Singleton); composition.Register <PublishedContentIndexPopulator>(Lifetime.Singleton); composition.Register <MediaIndexPopulator>(Lifetime.Singleton); composition.Register <IndexRebuilder>(Lifetime.Singleton); composition.RegisterUnique <IUmbracoIndexesCreator, UmbracoIndexesCreator>(); composition.RegisterUnique <IPublishedContentValueSetBuilder>(factory => new ContentValueSetBuilder( factory.GetInstance <PropertyEditorCollection>(), factory.GetInstance <UrlSegmentProviderCollection>(), factory.GetInstance <IUserService>(), true)); composition.RegisterUnique <IContentValueSetBuilder>(factory => new ContentValueSetBuilder( factory.GetInstance <PropertyEditorCollection>(), factory.GetInstance <UrlSegmentProviderCollection>(), factory.GetInstance <IUserService>(), false)); composition.RegisterUnique <IValueSetBuilder <IMedia>, MediaValueSetBuilder>(); composition.RegisterUnique <IValueSetBuilder <IMember>, MemberValueSetBuilder>(); //We want to manage Examine's AppDomain shutdown sequence ourselves so first we'll disable Examine's default behavior //and then we'll use MainDom to control Examine's shutdown - this MUST be done in Compose ie before ExamineManager //is instantiated, as the value is used during instantiation ExamineManager.DisableDefaultHostingEnvironmentRegistration(); }
public ExamineTransaction(ExamineManager examineManager, ProviderMetadata providerMetadata, IFrameworkContext frameworkContext) { _providerMetadata = providerMetadata; _frameworkContext = frameworkContext; ExamineManager = examineManager; //create a new queue _itemsToIndex = new List <LinearHiveIndexOperation>(); }
/// <summary> /// Initializes a new instance of the <see cref="ExamineHelper"/> class. /// </summary> /// <param name="examineManager">The examine manager.</param> /// <param name="frameworkContext">The framework context.</param> /// <param name="useCache">Whether or not to use Scoped and Application cache, generally only set to false for unit tests</param> public ExamineHelper(ExamineManager examineManager, IFrameworkContext frameworkContext, bool useCache = true) { Mandate.ParameterNotNull(examineManager, "examineManager"); Mandate.ParameterNotNull(frameworkContext, "frameworkContext"); ExamineManager = examineManager; _frameworkContext = frameworkContext; _useCache = useCache; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) //如果不是回传加载数据 { // 加载菜单 // treeMenu.DataSource = XmlDataSource1; // treeMenu.DataBind(); AjaxPro.Utility.RegisterTypeForAjax(typeof(indexs));//将本类的类型注册到ajaxPro中 好在js中调用该类的方法 rptPending.DataSource = ExamineManager.SearchPending("已办", "会议申请"); rptPending.DataBind(); if (Session["user"] == null) { Response.Redirect("login.aspx"); } else { UserInfo user = Session["user"] as UserInfo; uid = user.UID; log.Info(string.Format("{0}进入系统", user.Name)); if (user.Sex == "男") { lblLoginName.Text = user.Name + " 先生"; } else { lblLoginName.Text = user.Name + " 女士"; } //获取上次登录时间 lblTime.Text = Request.Cookies["LoginTime"].Value; lblCount.Text = Application["Count"].ToString(); InitTree(user.Name); //清除没有子节点的根节点 // ClearNodes(); try { log.Info("这是hansong的LOG INFO测试!"); log.Debug("这是hansong的LOG DEBUG测试!"); throw new Exception("这是hansong的LOG ERROR测试!"); } catch (Exception er) { log.Error("错误日志", er); } } } }
/// <summary> /// ReIndex the Umbraco content, media and members of the supplied ids in all Examine and Look indexes /// </summary> /// <param name="examineManager"></param> /// <param name="ids"></param> public static void ReIndex(this ExamineManager examineManager, IEnumerable <int> ids) { var umbracoHelper = new UmbracoHelper(UmbracoContext.Current); var nodes = ids .Select(x => umbracoHelper.GetIPublishedContent(x)) .Where(x => x != null); examineManager.ReIndex(nodes); }
protected void btnNo_Click(object sender, EventArgs e) { try { ExamineManager.ModifyApplicationById("会议申请", id); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('会议申请终结成功');window.location='../PedingMatter/Matter.aspx'</script>"); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('会议申请终结失败')</script>"); } }
internal void ExecuteCommit() { //need to send Examine all of the stuff to index for this unit of work //we need to 'stagger' the operations as it will be much faster to send all of the "Adds" to Examine at once and then each "Delete" one at a time. //because of the way Examine works, we also need to 'stagger' the index categories as well using (DisposableTimer.TraceDuration <ExamineTransaction>("Start adding indexes to Examine queue", "End adding indexes to Examine queue")) { var examineOperations = new List <IndexOperation>(); //we track the TypedEntity revisions committed for 2 reasons (we're tracking the TypedEntity item in the revision): // 1: see below notes // 2: we need to update the status changed date if the status has in fact 'changed' since we need to reference in-memory objects as well var revisionsCommitted = new List <Tuple <TypedEntity, RevisionData> >(); //this will get all of the lazy ids generated so we can use the values // to lookup some entities. var ids = _itemsToIndex.Where(x => x.OperationType == IndexOperationType.Add).Select(x => x.Id.Value) .Concat(_itemsToIndex .Where(x => x.Fields.ContainsKey(FixedIndexedFields.EntityId) && x.OperationType == IndexOperationType.Add) .Select(x => x.Fields[FixedIndexedFields.EntityId].FieldValue.ToString())) .Distinct() .ToArray(); while (_itemsToIndex.Any()) { var op = _itemsToIndex.Last(); examineOperations.Add(_frameworkContext.TypeMappers.Map <IndexOperation>(op)); //if its a typed entity revision: // - track it so we can perform index cleanup on revisions // - check status changed dates so we can ensure they are correct if (op.IsRevision()) { revisionsCommitted.Add( EnsureCorrectStatusChangedDate(op, revisionsCommitted)); } EnsureRelationEntities(op, ids); //'dequeue' the item from the list _itemsToIndex.RemoveAt(_itemsToIndex.Count - 1); } //now we have all of the indexing operations ready, lets do it ExamineManager.PerformIndexing(examineOperations.ToArray()); //do some cleanup of the index data CleanupIndexedRevisions(revisionsCommitted); } }
/// <summary> /// Initializes a new instance of the <see cref="ProviderBootstrapper"/> class if sufficient configuration information has been supplied by the user. /// </summary> /// <param name="existingConfig">The existing config.</param> /// <param name="examineManager"></param> /// <param name="frameworkContext"></param> /// <remarks></remarks> public ProviderBootstrapper(ProviderConfigurationSection existingConfig, ExamineManager examineManager, IFrameworkContext frameworkContext) { _existingConfig = existingConfig; _examineManager = examineManager; _frameworkContext = frameworkContext; //bind to all of the Examine events foreach (var i in _examineManager.IndexProviderCollection.OfType <BaseIndexProvider>()) { i.IndexingError += (sender, e) => LogHelper.Error <Exception>("[Examine] " + e.Message, e.InnerException); i.IndexDeleted += (sender, e) => LogHelper.TraceIfEnabled <ExamineManager>("[Examine] Item {0} has been removed from the index", () => e.DeletedTerm.Value); i.NodeIndexed += (sender, e) => LogHelper.TraceIfEnabled <ExamineManager>("[Examine] Item {0} has been indexed", () => e.Item.Id); } }
public MSDUmbracoHelper(ILog logger) { _umbracoContext = UmbracoContext.Current; if (_umbracoContext != null && _umbracoContext.PublishedContentRequest != null) { CurrentPage = _umbracoContext.PublishedContentRequest.PublishedContent; _umbracoHelper = new UmbracoHelper(_umbracoContext, CurrentPage); } _umbracoMemberService = _umbracoContext.Application.Services.MemberService; _umbracoExamineManager = ExamineManager.Instance; _umbracoMembershipHelper = new MembershipHelper(_umbracoContext); _logger = logger; }
public override void Compose(Composition composition) { if (ConfigurationManager.AppSettings["examine:ElasticSearch.Debug"] == "True") { if (ElasticSearchConfig.DebugConnectionConfiguration == null) { ElasticSearchConfig.DebugConnectionConfiguration = new ElasticSearchConfig(); } } base.Compose(composition); //composition.Register(typeof(ElasticIndexCreator)); composition.Components().Remove <ExamineComponent>(); composition.Register <Novicell.Examine.ElasticSearch.Populators.ContentIndexPopulator>(Lifetime.Singleton); composition.Register <Novicell.Examine.ElasticSearch.Populators.PublishedContentIndexPopulator>( Lifetime.Singleton); composition.Register <Novicell.Examine.ElasticSearch.Populators.MediaIndexPopulator>(Lifetime.Singleton); // the container can inject IEnumerable<IIndexPopulator> and get them all composition.Register <Novicell.Examine.ElasticSearch.Populators.MemberIndexPopulator>(Lifetime.Singleton); composition.Register <IndexRebuilder>(Lifetime.Singleton); // composition.RegisterUnique<IUmbracoIndexesCreator, UmbracoIndexesCreator>(); composition.RegisterUnique <ElasticIndexCreator>(); composition.RegisterUnique <IPublishedContentValueSetBuilder>(factory => new ContentValueSetBuilder( factory.GetInstance <PropertyEditorCollection>(), factory.GetInstance <UrlSegmentProviderCollection>(), factory.GetInstance <IUserService>(), true)); composition.RegisterUnique <IContentValueSetBuilder>(factory => new ContentValueSetBuilder( factory.GetInstance <PropertyEditorCollection>(), factory.GetInstance <UrlSegmentProviderCollection>(), factory.GetInstance <IUserService>(), false)); composition.RegisterUnique <IValueSetBuilder <IMedia>, MediaValueSetBuilder>(); composition.RegisterUnique <IValueSetBuilder <IMember>, MemberValueSetBuilder>(); //We want to manage Examine's AppDomain shutdown sequence ourselves so first we'll disable Examine's default behavior //and then we'll use MainDom to control Examine's shutdown - this MUST be done in Compose ie before ExamineManager //is instantiated, as the value is used during instantiation ExamineManager.DisableDefaultHostingEnvironmentRegistration(); }
/// <summary> /// Called during the initialize operation of the boot manager process /// </summary> public void Initialize() { //We want to manage Examine's appdomain shutdown sequence ourselves so first we'll disable Examine's default behavior //and then we'll use MainDom to control Examine's shutdown ExamineManager.DisableDefaultHostingEnvironmentRegistration(); //we want to tell examine to use a different fs lock instead of the default NativeFSFileLock which could cause problems if the appdomain //terminates and in some rare cases would only allow unlocking of the file if IIS is forcefully terminated. Instead we'll rely on the simplefslock //which simply checks the existence of the lock file DirectoryTracker.DefaultLockFactory = d => { var simpleFsLockFactory = new NoPrefixSimpleFsLockFactory(d); return(simpleFsLockFactory); }; //This is basically a hack for this item: http://issues.umbraco.org/issue/U4-5976 // when Examine initializes it will try to rebuild if the indexes are empty, however in many cases not all of Examine's // event handlers will be assigned during bootup when the rebuilding starts which is a problem. So with the examine 0.1.58.2941 build // it has an event we can subscribe to in order to cancel this rebuilding process, but what we'll do is cancel it and postpone the rebuilding until the // boot process has completed. It's a hack but it works. ExamineManager.Instance.BuildingEmptyIndexOnStartup += OnInstanceOnBuildingEmptyIndexOnStartup; //let's deal with shutting down Examine with MainDom var examineShutdownRegistered = _appCtx.MainDom.Register(() => { using (_profilingLogger.TraceDuration <ExamineStartup>("Examine shutting down")) { //Due to the way Examine's own IRegisteredObject works, we'll first run it with immediate=false and then true so that //it's correct subroutines are executed (otherwise we'd have to run this logic manually ourselves) ExamineManager.Instance.Stop(false); ExamineManager.Instance.Stop(true); } }); if (examineShutdownRegistered) { _profilingLogger.Logger.Debug <ExamineStartup>("Examine shutdown registered with MainDom"); } else { _profilingLogger.Logger.Debug <ExamineStartup>("Examine shutdown not registered, this appdomain is not the MainDom"); //if we could not register the shutdown examine ourselves, it means we are not maindom! in this case all of examine should be disabled //from indexing anything on startup!! _disableExamineIndexing = true; Suspendable.ExamineEvents.SuspendIndexers(); } }
protected void gvExamine_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); try { ExamineManager.DeleteEXamine(id); this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除成功!')", true); Pager1_onLoadPageIndexChaning(Pager1.PageIndex); } catch (Exception) { this.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('删除失败!')", true); return; } }
/// <summary> /// 点击按钮激发事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void gvPending_RowCommand(object sender, GridViewCommandEventArgs e) { int id = Convert.ToInt32(e.CommandArgument); LinkButton lblState = e.CommandSource as LinkButton; Label lblType = lblState.Parent.Parent.FindControl("lblType") as Label; //办理 if (e.CommandName == "State") { if (lblType.Text == "会议申请") { Response.Redirect("~/MeetingManager/MeetingExamine.aspx?id=" + id.ToString()); } else if (lblType.Text == "用车申请") { Response.Redirect("~/CarManager/ByapplyCaparticular.aspx?op=2&id=" + id.ToString()); } else if (lblType.Text == "资源借用") { Response.Redirect("~/ResourceManager/ApplyBorrowInfo.aspx?id=" + id.ToString()); } else if (lblType.Text == "资源采购") { Response.Redirect("~/ResourceManager/ApplyStockInfo.aspx?id=" + id.ToString()); } else if (lblType.Text == "任务申请") { Response.Redirect("~/TaskManager/UpdateAssignTask.aspx?Id=" + id.ToString()); } } else //终结 { try { ExamineManager.ModifyApplicationById(lblType.Text, id); Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("<script>alert('{0}终结成功')</script>", lblType.Text)); Bind(); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("<script>alert('{0}终结失败')</script>", lblType.Text)); } } }
private void Bind() { try { PagedDataSource pds = new PagedDataSource(); pds.AllowPaging = true; pds.DataSource = ExamineManager.SearchPending(ddlState.SelectedValue, ddlType.SelectedItem.Text); Pager1.DataCount = pds.Count; pds.CurrentPageIndex = Pager1.PageIndex; pds.PageSize = 5; Pager1.PageCount = pds.PageCount; gvPending.DataSourceID = null; gvPending.DataSource = pds; gvPending.DataBind(); } catch (Exception) { return; } }
/// <summary> /// Need to do a bit of cleanup now for Revision entries to ensure that we keep the records flagged as IsLatest to a minimum. /// To do this we'll lookup all revisions in the index that are marked as IsLatest that have Ids of revisions that we've just committed /// that have a UtcModified date of less than the ones we've just committed... thankfully, Lucene has a Range query that we can /// use to do this cleanup /// </summary> /// <param name="revisionsCommitted">The revisions committed during this transaction</param> private void CleanupIndexedRevisions(IEnumerable <Tuple <TypedEntity, RevisionData> > revisionsCommitted) { foreach (var r in revisionsCommitted) { //TODO: Figure out how Lucene is dealing with DateTime and UTC... currently were putting it back a day // but if we can do an Hour that would be better, just need to figure out what it is storing. var criteria = ExamineManager.CreateSearchCriteria() .Must().EntityType <TypedEntity>() .Must().HiveId(r.Item1.Id, FixedIndexedFields.EntityId) .Must().Field(FixedRevisionIndexFields.IsLatest, "1".Escape()) .Must().Range(FixedIndexedFields.UtcModified, DateTime.MinValue, r.Item1.UtcModified.UtcDateTime.AddDays(-1)); foreach (var i in ExamineManager.Search(criteria.Compile())) { //convert the fields returned var fields = i.Fields.ToDictionary(f => f.Key, f => new ItemField(f.Value)); //remove the flag fields[FixedRevisionIndexFields.IsLatest] = new ItemField(0) { DataType = FieldDataType.Int }; //now we need to update the index item to not be latest var updateOp = new IndexOperation { Operation = IndexOperationType.Add, Item = new IndexItem { Fields = fields, Id = i.Id, ItemCategory = i.Fields[LuceneIndexer.IndexCategoryFieldName] } }; //do the update ExamineManager.PerformIndexing(updateOp); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { Examine em = new Examine(); em.RequisitionID = requisitionID; em.RequisitionType = requisitionType; em.ExamineUID = Convert.ToInt32(lblUID.Text.Trim()); em.ExamineIdea = this.txtCause.Text; em.EndTime = Convert.ToDateTime(txtTime.Value); em.IsApproved = rdoAccess.SelectedValue == "未过" ? "未过" : "通过"; if (ExamineManager.AddExamine(em) > 0) { //根据实际完成金额更新任务总体完成进度 if (requisitionType == "任务下达") { try { TaskManager.UpdateTaskNowStatus(requisitionID);//更新任务状态 //更新任务的完成比例 TaskManager.UpdateTaskFinshStatus(requisitionID); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('更新任务状态失败!');", true); return; } } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); // Response.Redirect(""); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); } }
/// <summary> /// ReIndex all the supplied nodes in all Examine and Look indexes /// </summary> /// <param name="examineManager"></param> /// <param name="nodes"></param> public static void ReIndex(this ExamineManager examineManager, IEnumerable <IPublishedContent> nodes) { var examineIndexers = examineManager .IndexProviderCollection .Select(x => x as BaseUmbracoIndexer) // UmbracoContentIndexer, UmbracoMemberIndexer .Where(x => x != null); foreach (var examineIndexer in examineIndexers) { foreach (var node in nodes) { switch (node.ItemType) { case PublishedItemType.Content: examineIndexer.ReIndexNode(new Document(node.Id).ToXDocument(false).Root, IndexTypes.Content); break; case PublishedItemType.Media: examineIndexer.ReIndexNode(new Media(node.Id).ToXDocument(false).Root, IndexTypes.Media); break; case PublishedItemType.Member: examineIndexer.ReIndexNode(new Member(node.Id).ToXDocument(false).Root, IndexTypes.Member); break; } } } var lookIndexers = examineManager .IndexProviderCollection .Select(x => x as LookIndexer) .Where(x => x != null); foreach (var lookIndexer in lookIndexers) { lookIndexer.ReIndex(nodes); } }
void Start() { if (UnlockCode > 999 || UnlockCode == 000) { Debug.LogError("Wrong UnlockCode format!"); return; } examineManager = ScriptManager.Instance.GetComponent <ExamineManager>(); foreach (var digit in GetComponentsInChildren <NumberPadlockDigits>()) { digit.numberPadlock = this; } examineManager.onDropObject += delegate { if (isUnlocked) { gameObject.SetActive(false); } }; }
/// <summary> /// Determines if the status is changing for the entity passed in /// </summary> /// <param name="rev"></param> /// <returns></returns> private SearchResult GetLatestEntry <T>(Revision <T> rev) where T : class, IVersionableEntity { //get all latest versions of the typed entity var found = ExamineManager.Search( ExamineManager.CreateSearchCriteria() .Must().EntityType <TypedEntity>() .Must().HiveId(rev.Item.Id, FixedIndexedFields.EntityId) .Must().Range(FixedRevisionIndexFields.IsLatest, 1, 1) .Compile()); //if nothing found, then its brand new if (!found.Any()) { return(null); } //get the very latest version var latest = found.OrderBy(x => x.Fields[FixedIndexedFields.UtcModified]).Last(); //return the latest entry return(latest); }
public RenderContentController(ExamineManager examineManager, ITypedPublishedContentQuery contentQuery) { _examineManager = examineManager; _contentQuery = contentQuery; }
/// <summary> /// 添加审批记录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSubmit_Click(object sender, EventArgs e) { Examine em = new Examine(); em.RequisitionID = Convert.ToInt32(txtApplicationId.Text); em.RequisitionType = txtType.Text; em.ExamineUID.UID = Convert.ToInt32(((UserInfo)Session["user"]).UID); em.ExamineIdea = this.txtCause.Text; em.EndTime = Convert.ToDateTime(txtTime.Value); em.IsApproved = rdoAccess.SelectedValue == "未过" ? "未过" : "通过"; //不管是否通过,都在审批记录表中添加一条审批记录 if (ExamineManager.AddExamine(em) > 0) { //判断审批是否通过, if (rdoAccess.SelectedValue == "通过") { if (txtType.Text == "会议申请") { try { MeetingApplication ma = MeetingApplicationManager.GetMeetingApplicationById(Convert.ToInt32(txtApplicationId.Text)); //获取所有与会人员, string applicationMan = ma.WithinEnlistMan; LeaveWord lw = new LeaveWord(); lw.MsgTitle = ma.MeetTitle; //会议标题 lw.MsgContent = ma.MeetContent; //会议内容 lw.MsgSendTime = Convert.ToDateTime(DateTime.Now.ToShortDateString()); //发送时间 lw.MsgState = "未读"; lw.MsgTypeId.Id = 1; //1代表会议申请 lw.SenderUser = user; //发送者 lw.MeetingBeginTime = ma.BeginTime; //开会时间 lw.MeetingAddr = ma.RoomInfo.RomeAddr; //会议地点 lw.ChargeMan = ma.Compere; //会议负责人 lw.MeetingType = ma.MeetType; //用“,”号分割与会人员 string[] array = applicationMan.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { int uid = UserInfoManager.GetLeaveIDByMName(array[i]); lw.ReceiverUser.UID = uid; int flag = LeaveWordManager.AddLeaveWord(lw); } //更新会议申请的状态 MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "已办"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); return; } } else if (txtType.Text == "用车申请") { try { //更新用车申请状态 int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "已办"); Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); return; } } } else //不通过,终结申请 { if (txtType.Text == "会议申请") { MeetingApplicationManager.ModifyMeetingState(Convert.ToInt32(txtApplicationId.Text), "终结"); } else if (txtType.Text == "用车申请") { //终结用车申请 int flag = CarByapplyManager.UpadteByapplySate(Convert.ToInt32(txtApplicationId.Text), "终结"); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert('已终结!');window.location='Matter.aspx'</script>", true); } if (txtType.Text == "任务申请") //根据实际完成金额更新任务总体完成进度 { try { if (em.IsApproved == "通过") { TaskManager.UpdateTaskNowStatus(Convert.ToInt32(txtApplicationId.Text));//更新任务状态 //更新任务的完成比例 TaskManager.UpdateTaskFinshStatus(Convert.ToInt32(txtApplicationId.Text)); //更新申请单状态为通过 new RolePowerManager().UpdatePaddingStatus("已办", Convert.ToInt32(txtApplicationId.Text.Trim())); } else { //更新申请单状态为终结 new RolePowerManager().UpdatePaddingStatus("终结", Convert.ToInt32(txtApplicationId.Text.Trim())); } } catch (Exception) { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('更新任务状态失败!');", true); return; } } if (txtType.Text == "资源采购") { StockApplication stock = StockApplicationManager.Get((int)em.RequisitionID); if (em.IsApproved == "通过") { stock.IsExamine = "已办"; IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(2, stock.SAID); foreach (ApplicationResourseInfo item in items) { item.Resource.Number += item.Number; ResourceInfoManager.UpdateResourceInfo(item.Resource); } } else { stock.IsExamine = "终结"; } StockApplicationManager.Update(stock); } else if (txtType.Text == "资源借用") { BorrowApplication borrow = BorrowApplicationManager.Get((int)em.RequisitionID); if (em.IsApproved == "通过") { borrow.IsExamine = "已办"; IList <ApplicationResourseInfo> items = ApplicationResourceManager.GetAllApplicationResource(1, borrow.BAID); foreach (ApplicationResourseInfo item in items) { item.Resource.Number -= item.Number; ResourceInfoManager.UpdateResourceInfo(item.Resource); } } else { borrow.IsExamine = "终结"; } BorrowApplicationManager.Update(borrow); } Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('已审核!');location.href='CheckNote.aspx'", true); // Response.Redirect(""); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('审核失败!');", true); } }
public ExamineQueryVisitor(ExamineManager manager) { _manager = manager; }
public ExamineTestSetupHelper(FakeFrameworkContext frameworkContext = null, bool isPassthrough = false) { var examineWorkingFolder = new DirectoryInfo(Path.Combine(Common.CurrentAssemblyDirectory, "Examine", Guid.NewGuid().ToString() + Thread.CurrentThread.ManagedThreadId)); if (!examineWorkingFolder.Exists) { Directory.CreateDirectory(examineWorkingFolder.FullName); } //clear out old folders var parentFolder = examineWorkingFolder.Parent; foreach (var f in parentFolder.GetDirectories().Where(x => x.CreationTimeUtc < DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(5)))) { try { Directory.Delete(f.FullName, true); } catch (IOException) { //ignore } } LogHelper.TraceIfEnabled <ExamineTestSetupHelper>("Index setup in folder {0}", () => examineWorkingFolder.FullName); //var disk = new Lucene.Net.Store.RAMDirectory(); var disk = new Lucene.Net.Store.SimpleFSDirectory(examineWorkingFolder); Indexer = new UmbracoExamineIndexer( new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), SynchronizationType.Synchronized, disk); _fakeFrameworkContext = frameworkContext ?? new FakeFrameworkContext(); Searcher = new LuceneSearcher(new StandardAnalyzer(Lucene.Net.Util.Version.LUCENE_29), disk); ExamineManager = new ExamineManager(new[] { Searcher }, new[] { Indexer }, Searcher); ExamineHelper = new ExamineHelper(ExamineManager, _fakeFrameworkContext, false); //false to not use cache var examineMapper = new ExamineModelMapper(ExamineHelper, _fakeFrameworkContext); _fakeFrameworkContext.SetTypeMappers(new FakeTypeMapperCollection(new AbstractMappingEngine[] { examineMapper, new FrameworkModelMapper(_fakeFrameworkContext) })); var providerMetadata = new ProviderMetadata("r-examine-unit-tester", new Uri("tester://"), true, isPassthrough); var revisionSchemaSessionFactory = new NullProviderRevisionRepositoryFactory <EntitySchema>(providerMetadata, FrameworkContext); var revisionRepositoryFactory = new RevisionRepositoryFactory(providerMetadata, FrameworkContext, ExamineHelper); //var revisionRepositoryFactory = new NullProviderRevisionSessionFactory<TypedEntity>(providerMetadata, FrameworkContext); var schemaRepositoryFactory = new SchemaRepositoryFactory(providerMetadata, revisionSchemaSessionFactory, FrameworkContext, ExamineHelper); var entityRepositoryFactory = new EntityRepositoryFactory(providerMetadata, revisionRepositoryFactory, schemaRepositoryFactory, FrameworkContext, ExamineHelper); var readUnitFactory = new ReadonlyProviderUnitFactory(entityRepositoryFactory); var unitFactory = new ProviderUnitFactory(entityRepositoryFactory); ProviderSetup = new ProviderSetup(unitFactory, providerMetadata, FrameworkContext, null, 0); ReadonlyProviderSetup = new ReadonlyProviderSetup(readUnitFactory, providerMetadata, FrameworkContext, null, 0); //ensure that the index exists Indexer.CreateIndex(true); }