protected virtual void OnDoPostedData(object sender, PostProgressDoPostedDataEventArgs eventArgs) { if (this.DoPostedData != null) { this.DoPostedData(sender, eventArgs); } }
protected void ProcessGlobalCaculating(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { SCConditionCalculator calc = new SCConditionCalculator(); calc.GenerateAllUserAndContainerSnapshot(); SCCacheHelper.InvalidateAllCache(); e.Result.DataChanged = true; e.Result.CloseWindow = false; e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput(); }
protected void ProcessCaculating(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { SCConditionCalculator calc = new SCConditionCalculator(); calc.GenerateUserAndContainerSnapshot(new[] { (SCRole)SchemaObjectAdapter.Instance.Load(this.calcProgress.Tag) }); SCCacheHelper.InvalidateAllCache(); e.Result.DataChanged = true; e.Result.CloseWindow = false; e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput(); }
protected void Processing(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { ProcessProgress.Current.MinStep = 0; ProcessProgress.Current.MaxStep = ProcessProgress.Current.CurrentStep = 1; StepContext context = new StepContext(); try { string fromUnitID = (string)e.Steps[0]; string newName = (string)e.Steps[1]; string newCodeName = (string)e.Steps[2]; string toUnitID = (string)e.Steps[3]; bool copyRoleMembers = (bool)e.Steps[4]; bool copyScopeMembers = (bool)e.Steps[5]; bool copyScopeConditions = (bool)e.Steps[6]; var fromUnit = DbUtil.GetEffectiveObject <AU.AdminUnit>(fromUnitID); string schemaID = fromUnit.AUSchemaID; if (string.IsNullOrEmpty(schemaID)) { throw new AUObjectException("无法获取要复制单元的架构ID"); } var targetParent = toUnitID == schemaID ? null : DbUtil.GetEffectiveObject <AU.AdminUnit>(toUnitID); if (targetParent != null && fromUnit.AUSchemaID != targetParent.AUSchemaID) { throw new AU.AUObjectException("选择的目标父级单元与子级单元架构不同"); } DoCopyUnit(context, fromUnit, targetParent, newName, newCodeName, copyRoleMembers, copyScopeMembers, copyScopeConditions); } catch (AUObjectValidationException vex) { ProcessProgress.Current.Output.WriteLine(vex.Message); } catch (Exception ex) { ProcessProgress.Current.Output.WriteLine(ex.ToString()); } e.Result.ProcessLog = context.Logger.ToString(); ProcessProgress.Current.StatusText = "结束"; ProcessProgress.Current.Response(); SCCacheHelper.InvalidateAllCache(); e.Result.DataChanged = true; e.Result.CloseWindow = false; e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput(); }
protected void DoDeleteProgress(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { ProcessProgress.Current.MinStep = 0; ProcessProgress.Current.MaxStep = ProcessProgress.Current.CurrentStep = 1; if (e.Steps.Count > 0) { var objectsToDelete = DbUtil.GetEffectiveObjects((from string id in e.Steps select id).ToArray()); try { string message = null; message = string.Format("准备删除{0}个对象...", objectsToDelete.Count); ProcessProgress.Current.Output.WriteLine(message); ProcessProgress.Current.StatusText = message; ProcessProgress.Current.MaxStep = objectsToDelete.Count + 1; ProcessProgress.Current.CurrentStep = 1; foreach (AUSchema item in objectsToDelete) { message = string.Format("正在删除{0}", item.GetQualifiedName()); ProcessProgress.Current.Output.WriteLine(message); ProcessProgress.Current.StatusText = message; ProcessProgress.Current.Response(); Facade.InstanceWithPermissions.DeleteAdminSchema(item); ProcessProgress.Current.CurrentStep++; } ProcessProgress.Current.StatusText = "完毕"; ProcessProgress.Current.Output.WriteLine("完毕"); ProcessProgress.Current.Response(); } catch (Exception ex) { ProcessProgress.Current.Output.WriteLine(string.Format("操作遇到错误:\r\n{0}", ex.ToString())); ProcessProgress.Current.Response(); } } e.Result.CloseWindow = false; e.Result.ProcessLog = ProcessProgress.Current.GetDefaultOutput(); }
protected void postControl_DoPostedData(object sender, MCS.Web.WebControls.PostProgressDoPostedDataEventArgs e) { string unitID = e.ClientExtraPostedData; var unit = DbUtil.GetEffectiveObject <AU.AdminUnit>(unitID); var status = new UploadProgressStatus(); StringBuilder output = new StringBuilder(); try { status.MinStep = 1; status.MaxStep = e.Steps.Count + 1; status.CurrentStep = 1; AU.AUSchemaRole currentRole = null; foreach (Dictionary <string, object> item in e.Steps) { currentRole = DoAction(unit, status, output, currentRole, item); status.Response(); status.CurrentStep++; } } catch (Exception ex) { status.StatusText = ex.Message; output.AppendLine(ex.ToString()); status.Response(); } finally { output.AppendLine("结束"); e.Result.CloseWindow = false; e.Result.ProcessLog = output.ToString(); } }