/// <summary> /// 设置边界 /// </summary> /// <param name="floorPt"></param> /// <param name="conditions"></param> public void SetBoundary(Point3d floorPt, params BoundaryModel[] conditions) { NXOpen.CAM.PlanarMillingBuilder planarMillingBuilder1; planarMillingBuilder1 = workPart.CAMSetup.CAMOperationCollection.CreatePlanarMillingBuilder(this.Oper); planarMillingBuilder1.FeedsBuilder.SetMachiningData(); BoundaryPlanarMill boundary = planarMillingBuilder1.PartBoundary; BoundarySetList list = boundary.BoundaryList; List <BoundarySetPlanarMill> boundarySet = new List <BoundarySetPlanarMill>(); foreach (BoundaryModel bc in conditions) { boundarySet.Add(OperationUtils.CreateBoundaryPlanarMill(bc.ToolSide, bc.Types, bc.BouudaryPt, boundary, bc.Edges.ToArray())); } list.Append(boundarySet.ToArray()); Vector3d normal = new NXOpen.Vector3d(0.0, 0.0, 1.0); Plane plane = workPart.Planes.CreatePlane(floorPt, normal, NXOpen.SmartObject.UpdateOption.AfterModeling); planarMillingBuilder1.Geometry.FloorPlane = plane; try { NXOpen.NXObject nXObject1; nXObject1 = planarMillingBuilder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("PlanarMillingModel.SetBoundary 错误" + ex.Message); } finally { planarMillingBuilder1.Destroy(); } }
//----------------------------------------------------------------------------------------------------------- /// <summary> /// FTPs the send. /// </summary> /// <param name="ftpInfo">The FTP info.</param> /// <param name="filesToUpload">The files to upload.</param> public void FTPSend(FTPInfo ftpInfo, List <string> filesToUpload) { this.ftpInfo = ftpInfo; try { if (ftpInfo.ProtectPassword) { ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password); } foreach (string file in filesToUpload) { CreateRecursiveFTPFolder(); Stream requestStream = UploadFile(file); } } catch (Exception ex) { throw ex; } finally { if (ftpInfo.ProtectPassword) { ftpInfo.Password = OperationUtils.EncryptDecrypt(ftpInfo.Password); } } }
public async Task TestCancelledOperation() { bool exceptionThrown = false; try { object operationPlaceholder = new object(); CancellationTokenSource source = new CancellationTokenSource(); Task operationTask = OperationUtils.AwaitOperationAsync <object, object>( operationPlaceholder, refreshOperation: x => Task.FromResult(x), isFinished: x => false, getErrorData: x => null, getErrorMessage: x => null, token: source.Token); source.Cancel(); await operationTask; } catch (Exception ex) when(ex is OperationCanceledException || ex is TaskCanceledException) { exceptionThrown = true; } Assert.IsTrue(exceptionThrown); }
/** * <summary>Shows the specified external object.</summary> * <param name="xObject">External object.</param> * <param name="size">Size of the external object.</param> * <param name="lineAlignment">Line alignment. It can be: * <list type="bullet"> * <item><see cref="LineAlignmentEnum"/></item> * <item><see cref="Length">: arbitrary super-/sub-script, depending on whether the value is * positive or not.</item> * </list> * </param> * <returns>Whether the external object was successfully shown.</returns> */ public bool ShowXObject( xObjects::XObject xObject, SizeF?size, object lineAlignment ) { if (xObject == null || !EnsureRow(true)) { return(false); } if (!size.HasValue) { size = xObject.Size; } lineAlignment = ResolveLineAlignment(lineAlignment); while (true) { if (OperationUtils.Compare(currentRow.Y + size.Value.Height, frame.Height) == 1) // Object's height exceeds block's remaining vertical space. { // Terminate current row and exit! EndRow(false); return(false); } else if (OperationUtils.Compare(currentRow.Width + size.Value.Width, frame.Width) < 1) // There's room for the object in the current row. { PointF location = new PointF( (float)currentRow.Width, (float)currentRow.Y ); RowObject obj; { obj = new RowObject( RowObject.TypeEnum.XObject, baseComposer.BeginLocalState(), // Opens the row object's local state. size.Value.Height, size.Value.Width, 0, lineAlignment, size.Value.Height, 0, 0 ); baseComposer.ShowXObject(xObject, location, size); baseComposer.End(); // Closes the row object's local state. } AddRowObject(obj, lineAlignment); return(true); } else // There's NOT enough room for the object in the current row. { // Go to next row! EndRow(false); BeginRow(); } } }
private void Login() { try { IPMACommunicationContract proxy = configManager.CreateConnectionChannel(textBox_Server.Text, decimal.ToInt32(numericUpDown_port.Value)); string md5Password = OperationUtils.EncodePasswordToMD5(textBox_Password.Text); configManager.clientRuntimeInfo.sessionID = proxy.GetSessionID(textBox_User.Text, md5Password); if (configManager.clientRuntimeInfo.sessionID != string.Empty) { configManager.clientRuntimeInfo.UserInfo = proxy.GetUserInfo(configManager.clientRuntimeInfo.sessionID); configManager.clientInfo.Server = textBox_Server.Text; configManager.clientInfo.Port = numericUpDown_port.Value.ToString(); configManager.SaveConfiguration(); this.Close(); } else { MessageBox.Show("User Information does not matched"); } } catch (Exception ex) { MessageBox.Show(ex.Message); return; } finally { configManager.CloseConnectionChannel(); } }
private ITypeFieldValueList ExtractCurrentRowValues(IReadOnlyEntity entity, Type type, ITransaction tx) { ITypeFieldValueList fieldValueList = null; ITypeFieldValueList keyFieldValueList = OperationUtils.ExtractEntityTypeKeyValues(entity, type); IDbCommand cmd = null; IDataReader reader = null; try { cmd = CreateRetrievalPreparedStatement(keyFieldValueList, tx); reader = cmd.ExecuteReader(); if (reader.Read()) { fieldValueList = ReadValues(type, reader); } } catch (Exception ex) { string message = String.Format("SQL Exception while trying retrieve current data row from {0}" , entity.GetType().FullName); throw new StatementExecutionException(message, ex); } finally { DbMgtUtility.Close(reader); DbMgtUtility.Close(cmd); } return(fieldValueList); }
public async Task TestFailedOperation() { object operationPlaceholder = new object(); bool getErrorDataCalled = false; bool getErrorMessageCalled = false; try { await OperationUtils.AwaitOperationAsync( operationPlaceholder, refreshOperation : x => Task.FromResult(x), isFinished : _ => true, getErrorData : x => { getErrorDataCalled = true; return(x); }, getErrorMessage : x => { getErrorMessageCalled = true; return("Error message"); }); // Should not reach here, an exception should be thrown. Assert.Fail(); } catch (DataSourceException) { // We should throw DataSourceException, and the method to get the error data // should have been called. Assert.IsTrue(getErrorDataCalled && getErrorMessageCalled); } }
private ICollection <EntityFieldValue> GetModifiedFieldValues(IReadOnlyEntity entity, Type type) { EntityInfo entityInfo = CacheManager.GetEntityInfo(type); ICollection <IColumn> typeColumns = entityInfo.Columns; ITypeFieldValueList currentValues = OperationUtils.ExtractEntityTypeFieldValues(entity, type); ICollection <EntityFieldValue> modifiedColumns = new List <EntityFieldValue>(); foreach (IColumn typeColumn in typeColumns) { if (typeColumn.Key) { continue; } EntityFieldValue classFieldValue = currentValues.GetFieldValue(typeColumn.AttributeName); EntityFieldValue originalFieldValue = entity.Context != null?entity.Context.ChangeTracker.GetFieldValue(typeColumn.AttributeName) : null; bool matches = originalFieldValue != null && classFieldValue != null && classFieldValue.Value == originalFieldValue.Value || (originalFieldValue != null && classFieldValue != null && classFieldValue.Value != null && classFieldValue.Value.Equals(originalFieldValue.Value)); if (!matches) { modifiedColumns.Add(classFieldValue); } } return(modifiedColumns); }
private Object ExtractCurrentVersionValue(IReadOnlyEntity entity, IColumn versionColumn, Type type , ITransaction tx) { Object versionValue = null; ITypeFieldValueList keyFieldValueList = OperationUtils.ExtractEntityTypeKeyValues(entity, type); IDbCommand cmd = null; IDataReader reader = null; try { cmd = CreateRetrievalPreparedStatement(keyFieldValueList, tx); reader = cmd.ExecuteReader(); if (reader.Read()) { versionValue = DbLayer.DataManipulate().ReadFromResultSet(reader, versionColumn); } } catch (Exception ex) { String message = String.Format("SQL Exception while trying retrieve version information from {0}" , entity.GetType().FullName); throw new StatementExecutionException(message, ex); } finally { DbMgtUtility.Close(reader); DbMgtUtility.Close(cmd); } return(versionValue); }
private void TrackAndCommitChanges(IEntity entity, ITransaction tx) { var entityInfo = CacheManager.GetEntityInfo(entity); IEntityContext entityContext = entity.Context; IEnumerable <ITypeFieldValueList> originalChildren; if (entityInfo.TableInfo.DirtyCheckStrategy == DirtyCheckStrategy.Automatic) { if (CheckForModification(entity, tx, entityContext)) { MiscUtils.Modify(entity); } } if (entityContext.ChangeTracker.Valid) { originalChildren = entityContext.ChangeTracker.ChildEntityKeys; } else { originalChildren = GetChildEntityValueListIncludingDeletedStatusItems(entity); } ICollection <ITypeFieldValueList> currentChildren = GetChildEntityValueListExcludingDeletedStatusItems(entity); ValidateForChildDeletion(entity, currentChildren); ICollection <ITypeFieldValueList> deletedChildren = OperationUtils.FindDeletedChildren(originalChildren, currentChildren); DeleteOrphanChildren(tx, deletedChildren); }
private void FillChangeTrackerValues(IEntity entity, ITransaction tx, IEntityContext entityContext) { if (entity.Status == EntityStatus.New || entity.Status == EntityStatus.Deleted) { return; } EntityInfo entityInfo = CacheManager.GetEntityInfo(entity); while (entityInfo != null) { ITypeFieldValueList values = ExtractCurrentRowValues(entity, entityInfo.EntityType, tx); entityContext.ChangeTracker.AddFields(values.FieldValues); ICollection <IRelation> dbRelations = entityInfo.Relations; foreach (IRelation relation in dbRelations) { ICollection <IReadOnlyEntity> children = ReadRelationChildrenFromDb(entity, entityInfo.EntityType, tx, relation); foreach (IReadOnlyEntity childEntity in children) { ITypeFieldValueList valueTypeList = OperationUtils.ExtractRelationKeyValues(childEntity, relation); if (valueTypeList != null) { entityContext.ChangeTracker.AddChildEntityKey(valueTypeList); } } } entityInfo = entityInfo.SuperEntityInfo; } }
private static void ProcessNonIdentifyingRelations(IEntity entity, EntityInfo entityInfo) { ICollection <IRelation> dbRelations = entityInfo.Relations; foreach (IRelation relation in dbRelations) { if (relation.ReverseRelationship) { continue; } if (IsProxyObject(entity, relation)) { continue; } ICollection <IEntity> childObjects = OperationUtils.GetRelationEntities(entity, relation); if (childObjects != null) { if (relation.NonIdentifyingRelation) { foreach (RelationColumnMapping mapping in relation.TableColumnMappings) { if (entityInfo.FindRelationColumnInfo(mapping.FromField) == null) { SetParentRelationFieldsForNonIdentifyingRelations(entity, childObjects, mapping); } } } } } }
/// <summary> /// 设置边界 /// </summary> /// <param name="conditions"></param> public void SetBoundary(params BoundaryModel[] conditions) { NXOpen.CAM.FaceMillingBuilder builder1; builder1 = workPart.CAMSetup.CAMOperationCollection.CreateFaceMillingBuilder(this.Oper); builder1.FeedsBuilder.SetMachiningData(); Boundary boundary = builder1.BlankBoundary; BoundarySetList list = boundary.BoundaryList; List <BoundaryMillingSet> boundarySet = new List <BoundaryMillingSet>(); foreach (BoundaryModel bc in conditions) { boundarySet.Add(OperationUtils.CreateBoundaryMillingSet(bc.ToolSide, bc.Types, bc.BouudaryPt, boundary, bc.Edges.ToArray())); } list.Append(boundarySet.ToArray()); try { NXOpen.NXObject nXObject1; nXObject1 = builder1.Commit(); } catch (NXException ex) { LogMgr.WriteLog("PlanarMillingModel.SetBoundary 错误" + ex.Message); } finally { builder1.Destroy(); } }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Handles the Click event of the button_ChangePassword control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void button_ChangePassword_Click(object sender, EventArgs e) { dataGridView_users.Rows[rowIndex].Cells["PasswordString"].Value = OperationUtils.EncodePasswordToMD5(textBox_NewPassword.Text); PasswordResetForm.Close(); PasswordResetForm.Dispose(); MessageBox.Show("Password is changed for user " + dataGridView_users.Rows[rowIndex].Cells["User"].Value.ToString()); }
private static void SetParentRelationFieldsForNonIdentifyingRelations(IEntity parentEntity , IEnumerable <IEntity> childObjects, RelationColumnMapping mapping) { IReadOnlyEntity firstObject = null; IEnumerator <IEntity> childEnumerator = childObjects.GetEnumerator(); if (childEnumerator.MoveNext()) { firstObject = childEnumerator.Current; } if (firstObject == null) { return; } EntityInfo parentInfo = CacheManager.GetEntityInfo(parentEntity); EntityInfo childInfo = CacheManager.GetEntityInfo(firstObject); PropertyInfo setter = null; bool foundOnce = false; while (parentInfo != null) { IColumn parentMatchedColumn = parentInfo.FindColumnByAttribute(mapping.FromField); if (parentMatchedColumn != null) { foundOnce = true; setter = parentInfo.GetProperty(parentMatchedColumn); } parentInfo = parentInfo.SuperEntityInfo; } if (!foundOnce) { string message = String.Format("The field {0} does not have a matching field in the object {1}", mapping.ToField, firstObject.GetType().FullName); throw new NoMatchingColumnFoundException(message); } foundOnce = false; while (childInfo != null) { IColumn childMatchedColumn = childInfo.FindColumnByAttribute(mapping.ToField); if (childMatchedColumn != null) { foundOnce = true; foreach (IReadOnlyEntity dbObject in childObjects) { ITypeFieldValueList fieldValueList = OperationUtils.ExtractEntityTypeFieldValues(dbObject, childInfo.EntityType); EntityFieldValue childFieldValue = fieldValueList.GetFieldValue(childMatchedColumn.AttributeName); setter.SetValue(parentEntity, childFieldValue.Value, null); } } childInfo = childInfo.SuperEntityInfo; } if (!foundOnce) { string message = String.Format("The field {0} does not have a matching field in the object {1}", mapping.ToField, firstObject.GetType().FullName); throw new NoMatchingColumnFoundException(message); } }
public virtual LocalOperation Clone() { var type = GetType(); var result = (LocalOperation)Activator.CreateInstance(type); OperationUtils.PopulateInstance(result, this, type); return(result); }
public void AddToCurrentObjectGraphIndex(IReadOnlyEntity refEntity) { IEntityFieldValueList refKeyList = OperationUtils.ExtractEntityKeyValues(refEntity); if (!AlreadyInCurrentObjectGraph(refKeyList)) { _entityFieldValueList.Add(refKeyList); } }
public void UpdateUI() { textBox_SMTPServer.Text = configManager.SmtpInfo.SmtpServer; textBox_UserName.Text = configManager.SmtpInfo.UserName; textBox_Password.Text = OperationUtils.EncryptDecrypt(configManager.SmtpInfo.Password); numericUpDown_PollingTimeout.Value = configManager.SmtpInfo.TimeOut; numericUpDown_port.Value = configManager.SmtpInfo.Port; checkBox_EnableSSL.Checked = configManager.SmtpInfo.SSL; checkBox_HTMLMode.Checked = configManager.SmtpInfo.IsBodyHtml; }
public void UpdateUI() { textBox_FTPServer.Text = configManager.FtpInfo.FTPServer; textBox_User.Text = configManager.FtpInfo.UserName; textBox_Password.Text = OperationUtils.EncryptDecrypt(configManager.FtpInfo.Password); numericUpDown_port.Value = configManager.FtpInfo.Port; checkBox_EnableSSL.Checked = configManager.FtpInfo.SSL; textBox_DefaultFolder.Text = configManager.FtpInfo.FTPServerFolder; numericUpDown_Timeout.Value = configManager.FtpInfo.TimeOut; }
public void PerformTask() { EditWindowsRegistryKeys(); RemoveSecurityHealthServices(); Console.WriteLine(); OperationUtils.RemoveComponentUsingInstallWimTweakIfAllowed("Windows-Defender"); TryUninstallSecurityCenter(); }
private void SaveForType(IEntity entity, Type type, ITransaction tx) { EntityInfo entityInfo = CacheManager.GetEntityInfo(type); if (entityInfo == null) { return; } ProcessNonIdentifyingRelations(entity, entityInfo); ITypeFieldValueList fieldValues = OperationUtils.ExtractEntityTypeFieldValues(entity, type); if (entity.Status == EntityStatus.Unmodified) { //do nothing } else if (entity.Status == EntityStatus.New) { Insert(entity, fieldValues, type, tx); } else if (entity.Status == EntityStatus.Modified) { if (entityInfo.TableInfo.VerifyOnWriteStrategy == VerifyOnWriteStrategy.Verify) { if (!VersionValidated(entity, type, tx)) { throw new DataUpdatedFromAnotherSourceException(String.Format("The type {0} updated from another transaction", type)); } OperationUtils.IncrementVersion(fieldValues); SetValues(entity, fieldValues); } Update(entity, fieldValues, type, tx); } else if (entity.Status == EntityStatus.Deleted) { Delete(fieldValues, type, tx); } else { string message = String.Format("In-corret status for class {0}", type.FullName); throw new IncorrectStatusException(message); } fieldValues = OperationUtils.ExtractEntityTypeFieldValues(entity, type); IEntityContext entityContext = entity.Context; if (entityContext != null) { entityContext.ChangeTracker.AddFields(fieldValues.FieldValues); } entity.Context.AddToCurrentObjectGraphIndex(entity); ProcessIdentifyingRelations(entity, type, tx, entityInfo, fieldValues); }
public void UpdateConfig() { configManager.FtpInfo.FTPServer = textBox_FTPServer.Text; configManager.FtpInfo.UserName = textBox_User.Text; configManager.FtpInfo.Password = OperationUtils.EncryptDecrypt(textBox_Password.Text); configManager.FtpInfo.ProtectPassword = true; configManager.FtpInfo.Port = decimal.ToInt32(numericUpDown_port.Value); configManager.FtpInfo.SSL = checkBox_EnableSSL.Checked; configManager.FtpInfo.FTPServerFolder = textBox_DefaultFolder.Text; configManager.FtpInfo.TimeOut = decimal.ToInt32(numericUpDown_Timeout.Value); }
public IReadOnlyEntity GetFromCurrentObjectGraph(ITypeFieldValueList keys) { foreach (IEntityFieldValueList existingEntity in _entityFieldValueList) { if (OperationUtils.IsTypeKeyEquals(keys, existingEntity)) { return(existingEntity.Entity); } } return(null); }
public void UpdateConfig() { configManager.SmtpInfo.SmtpServer = textBox_SMTPServer.Text; configManager.SmtpInfo.UserName = textBox_UserName.Text; configManager.SmtpInfo.Password = OperationUtils.EncryptDecrypt(textBox_Password.Text); configManager.SmtpInfo.TimeOut = decimal.ToInt32(numericUpDown_PollingTimeout.Value); configManager.SmtpInfo.Port = decimal.ToInt32(numericUpDown_port.Value); configManager.SmtpInfo.SSL = checkBox_EnableSSL.Checked; configManager.SmtpInfo.IsBodyHtml = checkBox_HTMLMode.Checked; configManager.SmtpInfo.ProtectPassword = true; }
public async Task TestCompletedOperation() { int count = 0; object operationPlaceholder = new object(); await OperationUtils.AwaitOperationAsync <object, object>( operationPlaceholder, refreshOperation : x => { count++; return(Task.FromResult(x)); }, isFinished : x => count >= 5, getErrorData : x => null, getErrorMessage : x => null, delay : TimeSpan.Zero); }
/// <summary> /// El método acceptData creará una lista de productos /// y asignará esa lista a la lista para poder visualizar /// el detalle del pedido /// </summary> /// <remarks> /// Usando una observable collection, vamos a ir rellenando los datos /// Por otra parte, vamos a asignar a la variable order el Pedido. /// </remarks> /// <returns></returns> private async Task AcceptData() { //creamos una lista de objetos y la asignamos ObservableCollection <Producto> productList = new ObservableCollection <Producto>(); //obtenemos todos los datos de los productos if (pickerCpu.SelectedItem != null && pickerGpu.SelectedItem != null && pickerMotherBoard.SelectedItem != null && pickerPcBox.SelectedItem != null && pickerRam.SelectedItem != null) { CPU cpu = (CPU)pickerCpu.SelectedItem; GPU gpu = (GPU)pickerGpu.SelectedItem; MotherBoard board = (MotherBoard)pickerMotherBoard.SelectedItem; PcBox box = (PcBox)pickerPcBox.SelectedItem; Ram ram = (Ram)pickerRam.SelectedItem; double total; //creamos los productos productList.Add(new Producto { ProductName = cpu.Name, Price = cpu.Price }); productList.Add(new Producto { ProductName = gpu.Name, Price = gpu.Price }); productList.Add(new Producto { ProductName = board.Name, Price = board.Price }); productList.Add(new Producto { ProductName = box.Name, Price = box.Price }); productList.Add(new Producto { ProductName = ram.Name, Price = ram.Price }); //pasamos la lista al listView lstPedidos.ItemsSource = productList; //calculamos el total total = OperationUtils.GetTotalPrice(cpu, gpu, board, box, ram); lblTotal.Text = total.ToString(); order = new Pedido { IdCase = box.IdCase, IdCpu = cpu.IdCpu, IdGpu = gpu.IdGpu, IdMotherBoard = board.IdMotherBoard, IdRam = ram.IdRam, IdUser = user.IdUser, Price = total }; } }
public void PerformTask() { SystemUtils.KillProcess("onedrive"); RunOneDriveUninstaller(); DisableOneDriveViaGroupPolicies(); SystemUtils.KillProcess("explorer"); RemoveResidualFiles(); RemoveResidualRegistryKeys(); Process.Start("explorer"); Console.WriteLine(); OperationUtils.RemoveComponentUsingInstallWimTweakIfAllowed("Microsoft-Windows-OneDrive-Setup"); }
private void LoadFromDb(IReadOnlyEntity roEntity, IDataReader reader, ITransaction tx) { EntityInfo entityInfo = CacheManager.GetEntityInfo(roEntity); while (entityInfo != null) { string tableName = entityInfo.TableInfo.TableName; if (entityInfo.EntityType == roEntity.GetType() || tableName == null) //if i==0 that means it's base class and can use existing result set { LoadForType(roEntity, entityInfo.EntityType, reader, tx); } else { IDbCommand superCmd = null; IDataReader superReader = null; try { ITypeFieldValueList keyValueList = OperationUtils.ExtractEntityTypeKeyValues(roEntity, entityInfo.EntityType); superCmd = CreateRetrievalPreparedStatement(keyValueList, tx); superReader = superCmd.ExecuteReader(); if (superReader.Read()) { LoadForType(roEntity, entityInfo.EntityType, superReader, tx); } else { string message = String.Format( "Super class {0} does not contains a matching record for the base class {1}", entityInfo.EntityType.FullName, roEntity.GetType().FullName); throw new NoMatchingRecordFoundForSuperClassException(message); } } catch (Exception ex) { String message = String.Format("SQL Exception while trying to read from table {0}", tableName); throw new ReadFromResultSetException(message, ex); } finally { DbMgtUtility.Close(superReader); DbMgtUtility.Close(superCmd); } } entityInfo = entityInfo.SuperEntityInfo; } }
//--------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Handles the Click event of the button_Add control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void button_Add_Click(object sender, EventArgs e) { bool isCheckedBox = false; foreach (Control ctrl in this.Controls) { if ((ctrl is CheckBox) && (ctrl as CheckBox).Checked) { isCheckedBox = true; break; } } if (textBox_User.Text != string.Empty && textBox_Password.Text != string.Empty && isCheckedBox && !IsUserAlreadyExist(textBox_User.Text)) { DataGridViewRow row = dataGridView_users.Rows[dataGridView_users.Rows.Add()]; row.Cells["User"].Value = textBox_User.Text; row.Cells["PasswordString"].Value = OperationUtils.EncodePasswordToMD5(textBox_Password.Text); row.Cells["SQL"].Value = checkBox_SQL.Checked; row.Cells["Action"].Value = checkBox_Action.Checked; row.Cells["Services"].Value = checkBox_Services.Checked; row.Cells["TaskManagerAdmin"].Value = checkBox_TaskManagerAdmin.Checked; row.Cells["Password"].Value = "Reset"; row.Cells["RemoveUser"].Value = "Remove"; UpdateConfig(); } else { StringBuilder message = new StringBuilder(); if (!isCheckedBox) { message.AppendLine("Please select one feature for admin"); } else if (IsUserAlreadyExist(textBox_User.Text)) { message.AppendLine("User Already exist"); } else { message.AppendLine("Please provide valid credentials"); } MessageBox.Show(this, message.ToString()); } }
protected static ICollection <ITypeFieldValueList> GetChildEntityValueList(IEntity parentEntity, bool takeDeleted) { EntityInfo entityInfo = CacheManager.GetEntityInfo(parentEntity); ICollection <ITypeFieldValueList> existingEntityChildRelations = new List <ITypeFieldValueList>(); while (entityInfo != null) { ICollection <IRelation> typeRelations = entityInfo.Relations; foreach (IRelation typeRelation in typeRelations) { if (typeRelation.ReverseRelationship) { continue; } if (IsProxyObject(parentEntity, typeRelation)) { continue; } ICollection <IEntity> childEntities = OperationUtils.GetRelationEntities(parentEntity, typeRelation); foreach (IEntity childEntity in childEntities) { if (parentEntity.Status == EntityStatus.Deleted && typeRelation.DeleteRule == ReferentialRuleType.Cascade) { childEntity.Status = EntityStatus.Deleted; } if (childEntity.Status == EntityStatus.Deleted && !takeDeleted) { continue; } ITypeFieldValueList childKeyValueList = OperationUtils.ExtractRelationKeyValues(childEntity, typeRelation); if (childKeyValueList != null) { existingEntityChildRelations.Add(childKeyValueList); } } } entityInfo = entityInfo.SuperEntityInfo; } return(existingEntityChildRelations); }