/// <summary> /// Try to revert changes to the model, i.e. restores the original state of the model. /// </summary> /// <param name="disposeController">If set to <c>true</c>, the controller should release all temporary resources, since the controller is not needed anymore.</param> /// <returns> /// <c>True</c> if the revert operation was successfull; <c>false</c> if the revert operation was not possible (i.e. because the controller has not stored the original state of the model). /// </returns> public virtual bool Revert(bool disposeController) { foreach (var subControllerItem in GetSubControllers()) { if (null != subControllerItem.Controller) { subControllerItem.Controller.Revert(disposeController); } } bool reverted = false; if (null != _clonedCopyOfDoc && !object.ReferenceEquals(_doc, _clonedCopyOfDoc)) { CopyHelper.Copy(ref _doc, _clonedCopyOfDoc); reverted = true; } if (disposeController) { Dispose(); } else // not disposing means we have to show the reverted data { var viewTmp = ViewObject; // store view ViewObject = null; // detach view temporarily Initialize(true); // initialize data ViewObject = viewTmp; // attach view again } return(reverted); }
public override bool CopyFrom(object obj) { bool isCopied = base.CopyFrom(obj); if (isCopied && !object.ReferenceEquals(this, obj)) { var from = obj as FloatingScale; if (null != from) { _cachedPath = null; _scaleSpanValue = from._scaleSpanValue; _scaleSpanType = from._scaleSpanType; _scaleNumber = from._scaleNumber; _scaleSegmentType = from._scaleSegmentType; CopyHelper.Copy(ref _tickSpacing, from._tickSpacing); CopyHelper.Copy(ref _axisStyle, from._axisStyle); _backgroundPadding = from._backgroundPadding; CopyHelper.Copy(ref _background, from._background); } } return(isCopied); }
public GitInstallationState ExtractGit(GitInstallationState state) { var tempZipExtractPath = SPath.CreateTempDirectory("git_zip_extract_zip_paths"); if (state.GitZipExists && !state.GitIsValid) { var gitExtractPath = tempZipExtractPath.Combine("git").CreateDirectory(); var unzipTask = new UnzipTask(Token, installDetails.GitZipPath, gitExtractPath, sharpZipLibHelper, environment.FileSystem) .Progress(progressReporter.UpdateProgress) .Catch(e => { LogHelper.Trace(e, "Failed to unzip " + installDetails.GitZipPath); return(true); }); unzipTask.RunSynchronously(); var target = state.GitInstallationPath; if (unzipTask.Successful) { Logger.Trace("Moving Git source:{0} target:{1}", gitExtractPath.ToString(), target.ToString()); UpdateTask("Copying git", 100); CopyHelper.Copy(gitExtractPath, target); UpdateTask("Copying git", 100); state.GitIsValid = true; state.IsCustomGitPath = state.GitExecutablePath != installDetails.GitExecutablePath; } } tempZipExtractPath.DeleteIfExists(); return(state); }
public static async Task <IEnumerable <ContentLogSummaryModel> > GetContentAuditSummary(DashboardSearchModel searchModel) { List <ContentLogSummaryModel> modelResult = new List <ContentLogSummaryModel>(); ContentLogSummaryModel report = null; if (searchModel != null) { object[] param = new object[] { searchModel.OrganizationUrl, searchModel.SearchTerm, searchModel.PageNumber, searchModel.PageSize }; var result = await ColligoO365RMOManager <ContentAuditSummary> .ExecuteSqlQueryAsync(Procedure.UspReportContentAuditSummary, param); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(ContentAuditSummary); Type destination = typeof(ContentLogSummaryModel); foreach (var item in result) { report = new ContentLogSummaryModel(); CopyHelper.Copy(source, item, destination, report); modelResult.Add(report); } } } return(modelResult); }
public static async Task <IEnumerable <EventSummaryModel> > GetEventSummary(DashboardSearchModel searchModel) { List <EventSummaryModel> modelResult = new List <EventSummaryModel>(); EventSummaryModel report = null; if (searchModel != null) { object[] param = new object[] { searchModel.OrganizationUrl, searchModel.StartDate, searchModel.EndDate }; var result = await ColligoO365RMOManager <DashboardChartData> .ExecuteSqlQueryAsync(Procedure.UspReportChartData, param); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(DashboardChartData); Type destination = typeof(EventSummaryModel); foreach (var item in result) { report = new EventSummaryModel(); CopyHelper.Copy(source, item, destination, report); modelResult.Add(report); } } } return(modelResult); }
/// <summary> /// Copies from another instance. /// </summary> /// <param name="obj">The object to copy from.</param> /// <returns><c>True</c> if anything could be copied from the object, otherwise <c>false</c>.</returns> public bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } var from = obj as ConvertXYVToMatrixDataSource; if (null != from) { using (var token = SuspendGetToken()) { ConvertXYVToMatrixOptions dataSourceOptions = null; DataTableMultipleColumnProxy inputData = null; IDataSourceImportOptions importOptions = null; CopyHelper.Copy(ref importOptions, from._importOptions); CopyHelper.Copy(ref dataSourceOptions, from._processOptions); CopyHelper.Copy(ref inputData, from._processData); DataSourceOptions = dataSourceOptions; ImportOptions = importOptions; InputData = inputData; return(true); } } return(false); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">The object to copy from.</param> /// <remarks>Only clones the references to the data columns, not the columns itself.</remarks> public XYZMeshedColumnPlotData(XYZMeshedColumnPlotData from) { CopyHelper.Copy(ref _matrixProxy, from._matrixProxy); _matrixProxy.ParentObject = this; SetXBoundsFromTemplate(new FiniteNumericalBoundaries()); SetYBoundsFromTemplate(new FiniteNumericalBoundaries()); SetVBoundsFromTemplate(new FiniteNumericalBoundaries()); }
public static async Task <string> SaveContentLog(List <SpContentLogModel> logs, long eventSettingId) { string result = "success"; if (logs != null && logs.Count > 0) { List <ContentLog> contentLogs = new List <ContentLog>(); Type source = typeof(SpContentLogModel); Type destination = typeof(ContentLog); foreach (var item in logs) { ContentLog obj = new ContentLog(); CopyHelper.Copy(source, item, destination, obj); obj.ModifiedBy = obj.CreatedBy; obj.ModifiedOn = DateTime.Now.ToUniversalTime(); contentLogs.Add(obj); } int count = await ColligoO365RMOManager <ContentLog> .SaveAsync(contentLogs); if (count > 0) { //update settings with last execution date result = await EventSettingManager.UpdateEventSetting(eventSettingId, logs[0].CreatedBy, logs[0].ExecutionTime, true); //filter data for ADG process List <ADGAgent> agent = new List <ADGAgent>(); Type agentsource = typeof(ADGAgent); foreach (var item in contentLogs) { if (!string.IsNullOrEmpty(item.ComplianceTag) && item.EventColumnValue != null) { ADGAgent obj = new ADGAgent(); CopyHelper.Copy(destination, item, agentsource, obj); obj.EventColumnValue = item.EventColumnValue.Value; obj.IsProcessed = false; agent.Add(obj); //agent.Add(new ADGAgent() //{ // ContentLogId = item.ContentLogId, // ComplainceAssetId=item.ComplainceAssetId, // ComplianceTag=item.ComplianceTag, // ContentType=item.ContentType //}); } } if (agent.Count > 0) { count = await ColligoO365RMOManager <ADGAgent> .SaveAsync(agent); } } } return(result); }
private void btn_attach_Click(object sender, EventArgs e) { HHI_HandIn hi = GetCurrentHandIn(); HHI_Prefix prefix = GetCurrentHandInsPrefix(); string name; string studentIndex; string srcPath; if (hi.IsSubItemFolder) { folderBrowserDialog1.ShowDialog(); srcPath = folderBrowserDialog1.SelectedPath; name = folderBrowserDialog1.SelectedPath.Substring(folderBrowserDialog1.SelectedPath.LastIndexOf('\\') + 1); } else { openFileDialog1.ShowDialog(); srcPath = openFileDialog1.FileName; name = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf('\\') + 1); } if (srcPath == "") { return; } if (!HHI_Module.IndexExist(name, prefix, out studentIndex)) { return; } if (!ListHelper.IsIn(HHI_Module.GetUnAttachedWorkIndexs(hi, prefix), Convert.ToInt32(studentIndex))) { if (MessageBox.Show("学号: " + studentIndex + " 已经提交,是否要覆盖?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { // Yes CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder); } else { // No return; } } else { CopyHelper.Copy(srcPath, hi.Path, hi.IsSubItemFolder); } ReloadList(); m_output += "\n" + "[" + System.DateTime.Now.ToString() + "]" + "学号为: " + studentIndex + " 的同学,已提交作业!\n"; MessageBox.Show(m_output); m_log += m_output; }
public override bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } var from = obj as LinearTickSpacing; if (null == from) { return(false); } using (var suspendToken = SuspendGetToken()) { CopyHelper.Copy(ref _cachedMajorMinor, from._cachedMajorMinor); _userDefinedMajorSpan = from._userDefinedMajorSpan; _userDefinedMinorTicks = from._userDefinedMinorTicks; _targetNumberOfMajorTicks = from._targetNumberOfMajorTicks; _targetNumberOfMinorTicks = from._targetNumberOfMinorTicks; _zeroLever = from._zeroLever; _orgGrace = from._orgGrace; _endGrace = from._endGrace; _snapOrgToTick = from._snapOrgToTick; _snapEndToTick = from._snapEndToTick; ChildCopyToMember(ref _suppressedMajorTicks, from._suppressedMajorTicks); ChildCopyToMember(ref _suppressedMinorTicks, from._suppressedMinorTicks); ChildCopyToMember(ref _additionalMajorTicks, from._additionalMajorTicks); ChildCopyToMember(ref _additionalMinorTicks, from._additionalMinorTicks); _transformationOffset = from._transformationOffset; _transformationDivider = from._transformationDivider; _transformationOperationIsMultiply = from._transformationOperationIsMultiply; _majorTicks = new List <double>(from._majorTicks); _minorTicks = new List <double>(from._minorTicks); EhSelfChanged(); suspendToken.Resume(); } return(true); }
public void Paste(IToolContext context) { if (_shapesToCopy != null) { lock (context.Renderer.Selected) { this.DeHover(context); context.Renderer.Selected.Clear(); CopyHelper.Copy(context.CurrentContainer, _shapesToCopy, context.Renderer); context.Invalidate?.Invoke(); this.CurrentState = State.None; } } }
public static async Task <UserModel> GetUserDetailByUserId(string userEmail) { try { VwOrganizationUser userDetail = await ColligoO365RMOManager <VwOrganizationUser> .FirstOrDefaultAsync(p => p.EmailAddress == userEmail && p.IsOrganizationActive); if (userDetail != null) { Type source = typeof(VwOrganizationUser); Type destination = typeof(UserModel); UserModel obj = new UserModel(); CopyHelper.Copy(source, userDetail, destination, obj); return(obj); } return(null); } catch { throw; } }
public static async Task <string> SaveEventSetting(EventSettingModel eventSetup) { EventSetting setting = null; if (eventSetup.EventSettingId > 0) { setting = await ColligoO365RMOManager <EventSetting> .FirstOrDefaultAsync(p => p.EventSettingId == eventSetup.EventSettingId); } if (setting == null) { setting = new EventSetting() { CreatedOn = DateTime.Now } } ; Type source = typeof(EventSettingModel); Type destination = typeof(EventSetting); List <string> excludeProperties = new List <string>() { "CreatedOn" }; CopyHelper.Copy(source, eventSetup, destination, setting, excludeProperties); string result = "success"; int count = 0; //update settings with last execution date if (setting.EventSettingId > 0) { setting.ModifiedBy = eventSetup.CreatedBy; setting.ModifiedOn = DateTime.Now; count = await ColligoO365RMOManager <EventSetting> .SaveAsync(null, setting); } else { count = await ColligoO365RMOManager <EventSetting> .SaveAsync(setting); } if (count == 0) { result = "fail"; } return(result); }
/// <summary> /// get eventsetting models /// </summary> /// <param name="notCompleted"></param> /// <returns></returns> public static async Task <IEnumerable <EventSettingModel> > GetAllEventSettingByOrganization(string organizationUrl, bool includeAll = true) { List <EventSettingModel> activities = new List <EventSettingModel>(); var result = await ColligoO365RMOManager <VwEventSetting> .FindAsync(x => x.ContentSiteUrl.ToLower() == organizationUrl.ToLower() && x.UserIsActive && (x.IsActive || includeAll), false); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(VwEventSetting); Type destination = typeof(EventSettingModel); foreach (var item in result) { EventSettingModel obj = new EventSettingModel(); CopyHelper.Copy(source, item, destination, obj); activities.Add(obj); } } return(activities); }
public override bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } var from = obj as DateTimeTickSpacing; if (null == from) { return(false); } using (var suspendToken = SuspendGetToken()) { CopyHelper.Copy(ref _cachedMajorMinor, from._cachedMajorMinor); _userDefinedMajorSpan = from._userDefinedMajorSpan; _userDefinedMinorTicks = from._userDefinedMinorTicks; _targetNumberOfMajorTicks = from._targetNumberOfMajorTicks; _targetNumberOfMinorTicks = from._targetNumberOfMinorTicks; _orgGrace = from._orgGrace; _endGrace = from._endGrace; _snapOrgToTick = from._snapOrgToTick; _snapEndToTick = from._snapEndToTick; ChildCopyToMember(ref _suppressedMajorTicks, from._suppressedMajorTicks); ChildCopyToMember(ref _suppressedMinorTicks, from._suppressedMinorTicks); ChildCopyToMember(ref _additionalMajorTicks, from._additionalMajorTicks); ChildCopyToMember(ref _additionalMinorTicks, from._additionalMinorTicks); _majorTicks = new List <AltaxoVariant>(from._majorTicks); _minorTicks = new List <AltaxoVariant>(from._minorTicks); EhSelfChanged(); suspendToken.Resume(); } return(true); }
public static async Task <IEnumerable <ADGAgentModel> > GetADGActivity(bool notCompleted = true) { List <ADGAgentModel> activities = new List <ADGAgentModel>(); var result = await ColligoO365RMOManager <VwADGAgent> .FindAsync(x => x.IsProcessed == !notCompleted, false); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(VwADGAgent); Type destination = typeof(ADGAgentModel); foreach (var item in result) { ADGAgentModel obj = new ADGAgentModel(); CopyHelper.Copy(source, item, destination, obj); activities.Add(obj); } } return(activities); }
public virtual bool CopyFrom(object obj) { if (object.ReferenceEquals(this, obj)) { return(true); } var from = obj as AxisLabelStyle; if (null == from) { return(false); } using (var suspendToken = SuspendGetToken()) { _cachedAxisStyleInfo = from._cachedAxisStyleInfo; _font = from._font; CopyHelper.Copy(ref _stringFormat, from._stringFormat); _horizontalAlignment = from._horizontalAlignment; _verticalAlignment = from._verticalAlignment; ChildCopyToMember(ref _brush, from._brush); _automaticRotationShift = from._automaticRotationShift; _xOffset = from._xOffset; _yOffset = from._yOffset; _rotation = from._rotation; ChildCopyToMember(ref _backgroundStyle, from._backgroundStyle); ChildCopyToMember(ref _labelFormatting, from._labelFormatting); _labelSide = from._labelSide; _prefixText = from._prefixText; _postfixText = from._postfixText; ChildCopyToMember(ref _suppressedLabels, from._suppressedLabels); EhSelfChanged(EventArgs.Empty); suspendToken.Resume(); } return(true); }
public static async Task <IEnumerable <EventMappingModel> > GetEventSettingCount(string organizationUrl) { List <EventMappingModel> modelResult = new List <EventMappingModel>(); EventMappingModel report = null; var result = await ColligoO365RMOManager <EventSettingCount> .ExecuteSqlQueryAsync(Procedure.UspEventSettingGetMappingCount, new object[] { organizationUrl }); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(EventSettingCount); Type destination = typeof(EventMappingModel); foreach (var item in result) { report = new EventMappingModel(); CopyHelper.Copy(source, item, destination, report); modelResult.Add(report); } } return(modelResult); }
protected virtual bool ApplyEnd(bool applyResult, bool disposeController) { if (applyResult == true) { if (!object.ReferenceEquals(_doc, _originalDoc)) { if (_doc is ICloneable) { var orgDoc = (ICloneable)_originalDoc; CopyHelper.Copy(ref orgDoc, (ICloneable)_doc); _originalDoc = (TModel)orgDoc; } } if (disposeController) { Dispose(); } } return(applyResult); }
public static async Task <EventReportModel> GetEventReport(DashboardSearchModel searchModel) { EventReportModel report = null; if (searchModel != null) { object[] param = new object[] { searchModel.OrganizationUrl, searchModel.StartDate, searchModel.EndDate, searchModel.Status }; var result = await ColligoO365RMOManager <DashboardResult> .ExecuteSqlQueryAsync(Procedure.UspReportADGAgent, param); //converT data to framework model if (result != null && result.Any()) { Type source = typeof(DashboardResult); Type destination = typeof(EventReportModel); foreach (var item in result) { report = new EventReportModel(); CopyHelper.Copy(source, item, destination, report); break; } } } return(report); }