public Material(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialObject material) { try { InitializeComponent(); _material = material; _materialOriginal = material.Clone(); _typeForm = typeForm; if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm) { throw new NotImplementedException(); } else { Initialize(); InitializePropertyForm(); SetPermissions(); } } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public Material(PROF_IT.Common.Enumerations.TypeForm typeForm, VehicleObject vehicle) { try { InitializeComponent(); _typeForm = typeForm; _material = new MaterialObject(); if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm) { Initialize(); louVehicle.EditValue = vehicle; SetPermissions(); } else { throw new NotImplementedException(); } } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public int Add(MaterialObject value) { try { return(List.Add(value)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void Remove(MaterialObject value) { try { List.Remove(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
// Called by MaterialObject when it changes internal void MaterialObjectChanged(MaterialObject Material) { try { int index = List.IndexOf(Material); OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void AddChilds(MaterialObject material) { try { material.Memos = new BL.Internal.Memo().GetMemosByMaterialID(material); material.Maintenances = new BL.Internal.Maintenance().GetMaintenancesByMaterialID(material); material.ChildsAdded = true; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public MaintenanceObjectCollection GetMaintenancesByMaterialID(MaterialObject material) { MaintenanceObjectCollection maintenances; try { maintenances = new MaintenanceDataService().GetMemosByMaintenanceID(material); } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } return maintenances; }
protected override void OnRemoveComplete(int index, object value) { try { MaterialObject Material = (MaterialObject)value; Material.Parent = this; OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index)); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
// Methods. object IBindingList.AddNew() { try { MaterialObject Material = new MaterialObject(); List.Add(Material); return(Material); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public MemoObjectCollection GetMemosByMaintenanceID(MaterialObject material) { MemoObjectCollection memos = new MemoObjectCollection(); QueryBuilder builder; try { builder = new QueryBuilder(); builder.Append(this.BaseQuery(false, 0)); builder.AppendWhereString(MemoObject.MAT_ID, material.MatID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST); builder.Append("AND " + MemoObject.MAT_ID + " is not null "); memos = MemoConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]); } catch (System.Exception exception1) { throw new Exception(MethodBase.GetCurrentMethod().Name, exception1); } return memos; }
public void Remove(MaterialObject material) { try { CheckTransaction(); new MaterialDataService(Transaction).Remove(material); if (IsOwner) Transaction.Commit(); } catch (Exception exception1) { if (IsOwner) Transaction.Rollback(); Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (IsOwner) Connection.Close(); } }
public static MaterialObject MaterialRowToObject(DataRow Material) { MaterialObject obj = new MaterialObject(); try { if (Material != null) { if (RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.MatID = RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, true, DataRowVersion.Current); obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(Material, ""); obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(Material, ""); obj.MaterialSubType = MaterialSubTypeConvertor.MaterialSubTypeRowToObject(Material, ""); obj.EmployeeCreator = EmployeeConvertor.EmployeeRowToObject(Material, "Creator"); obj.EmployeeResponsable = EmployeeConvertor.EmployeeRowToObject(Material, "Responsable"); obj.Vehicle = VehicleConvertor.VehicleRowToObject(Material); obj.Supplier = SupplierConvertor.SupplierRowToObject(Material); obj.Name = RowFunctions.GetValueFromRowToString(Material, MaterialObject.NAME, false, DataRowVersion.Current); obj.Description = RowFunctions.GetValueFromRowToString(Material, MaterialObject.DESCRIPTION, false, DataRowVersion.Current); obj.Type = (TIS.Framework.Common.Enumeration.Material.Type)RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.TYPE, false, DataRowVersion.Current); obj.SerieNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.SERIE_NUMBER, false, DataRowVersion.Current); obj.InternalNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.INTERNAL_NUMBER, false, DataRowVersion.Current); obj.PurchasedOn = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.PURCHASEDON, false, DataRowVersion.Current), false); obj.Price = RowFunctions.GetValueFromRowToDecimal(Material, MaterialObject.PRICE, false, DataRowVersion.Current); obj.NextMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.NEXT_MAINTENANCE, false, DataRowVersion.Current), false); obj.MaintenanceFrequency = RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.MAINTENANCE_FREQUENCY, false, DataRowVersion.Current); obj.Broken = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.BROKEN, false, DataRowVersion.Current); obj.Active = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.ACTIVE, false, DataRowVersion.Current); } return(obj); } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return(obj); }
protected override void OnSetComplete(int index, object oldValue, object newValue) { try { if (oldValue != newValue) { MaterialObject oldMaterial = (MaterialObject)oldValue; MaterialObject newMaterial = (MaterialObject)newValue; oldMaterial.Parent = null; newMaterial.Parent = this; OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index)); } } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public static MaterialObject MaterialRowToObject(DataRow Material) { MaterialObject obj = new MaterialObject(); try { if (Material != null) { if (RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, false, DataRowVersion.Current) != Guid.Empty) { obj.MatID = RowFunctions.GetValueFromRowToGuid(Material, MaterialObject.MAT_ID, true, DataRowVersion.Current); obj.MaterialCategory = MaterialCategoryConvertor.MaterialCategoryRowToObject(Material, ""); obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(Material, ""); obj.MaterialSubType = MaterialSubTypeConvertor.MaterialSubTypeRowToObject(Material, ""); obj.EmployeeCreator = EmployeeConvertor.EmployeeRowToObject(Material, "Creator"); obj.EmployeeResponsable = EmployeeConvertor.EmployeeRowToObject(Material, "Responsable"); obj.Vehicle = VehicleConvertor.VehicleRowToObject(Material); obj.Supplier = SupplierConvertor.SupplierRowToObject(Material); obj.Name = RowFunctions.GetValueFromRowToString(Material, MaterialObject.NAME, false, DataRowVersion.Current); obj.Description = RowFunctions.GetValueFromRowToString(Material, MaterialObject.DESCRIPTION, false, DataRowVersion.Current); obj.Type = (TIS.Framework.Common.Enumeration.Material.Type)RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.TYPE, false, DataRowVersion.Current); obj.SerieNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.SERIE_NUMBER, false, DataRowVersion.Current); obj.InternalNumber = RowFunctions.GetValueFromRowToString(Material, MaterialObject.INTERNAL_NUMBER, false, DataRowVersion.Current); obj.PurchasedOn = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.PURCHASEDON, false, DataRowVersion.Current), false); obj.Price = RowFunctions.GetValueFromRowToDecimal(Material, MaterialObject.PRICE, false, DataRowVersion.Current); obj.NextMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Material, MaterialObject.NEXT_MAINTENANCE, false, DataRowVersion.Current), false); obj.MaintenanceFrequency = RowFunctions.GetValueFromRowToInteger(Material, MaterialObject.MAINTENANCE_FREQUENCY, false, DataRowVersion.Current); obj.Broken = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.BROKEN, false, DataRowVersion.Current); obj.Active = RowFunctions.GetValueFromRowToBoolean(Material, MaterialObject.ACTIVE, false, DataRowVersion.Current); } return obj; } obj = null; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } return obj; }
public Maintenance(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialObject material) { try { InitializeComponent(); _typeForm = typeForm; if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm) { Material = material; Initialize(); } else { throw new NotImplementedException(); } } catch (System.Exception exception1) { System.Exception innerException = exception1; throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
void IEditableObject.EndEdit() { try { if (_inTxn) { _loadedMaintenanceVehicle = MaintenanceVehicle; _loadedMaterial = Material; _loadedExecutor = Executor; _loadedRemark = Remark; _loadedStartMaintenance = StartMaintenance; _loadedMaterialRevisions = MaterialRevisions; _inTxn = true; } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public bool Remove(MaterialObject material) { SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Material_DELETE", CreateParameter("@matID", SqlDbType.UniqueIdentifier, material.MatID, ParameterDirection.Input) ); return true; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
void IEditableObject.EndEdit() { try { if (_inTxn) { _loadedMaterial = Material; _loadedMemo = Memo; _loadedDateTime = DateTime; _inTxn = true; } } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public void Save(MaterialObject material) { string test = ""; if (material.PurchasedOn == DateTime.MinValue) test = PROF_IT.Common.Convert.DateFunctions.DateToStrDate(material.PurchasedOn); SqlCommand cmd = null; try { ExecuteNonQuery(out cmd, false, "Material_SAVE", CreateParameter("@matID", SqlDbType.UniqueIdentifier, material.MatID, ParameterDirection.InputOutput), CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, material.MaterialCategory == null ? Guid.Empty : material.MaterialCategory.MatcatID), CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, material.MaterialType == null ? Guid.Empty : material.MaterialType.MatTypID), CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, material.MaterialSubType == null ? Guid.Empty : material.MaterialSubType.MatStypID), CreateParameter("@empIDCreator", SqlDbType.UniqueIdentifier, material.EmployeeCreator == null ? Guid.Empty : material.EmployeeCreator.EmpID), CreateParameter("@empIDResponsable", SqlDbType.UniqueIdentifier, material.EmployeeResponsable == null ? Guid.Empty : material.EmployeeResponsable.EmpID), CreateParameter("@vehID", SqlDbType.UniqueIdentifier, material.Vehicle == null ? Guid.Empty : material.Vehicle.VehID), CreateParameter("@supID", SqlDbType.UniqueIdentifier, material.Supplier == null ? Guid.Empty : material.Supplier.SupID), CreateParameter("@Name", SqlDbType.NChar, material.Name), CreateParameter("@Description", SqlDbType.VarChar, material.Description), CreateParameter("@Type", SqlDbType.Int, (int)material.Type), CreateParameter("@SerieNumber", SqlDbType.NChar, material.SerieNumber), CreateParameter("@InternalNumber", SqlDbType.NChar, material.InternalNumber), CreateParameter("@PurchasedOn", SqlDbType.VarChar, material.PurchasedOn == DateTime.MinValue ? null : PROF_IT.Common.Convert.DateFunctions.DateToStrDate(material.PurchasedOn)), CreateParameter("@Price", SqlDbType.Decimal, material.Price), CreateParameter("@NextMaintenance", SqlDbType.VarChar, material.NextMaintenance == DateTime.MinValue ? null : PROF_IT.Common.Convert.DateFunctions.DateToStrDate(material.NextMaintenance)), CreateParameter("@MaintenanceFrequency", SqlDbType.Int, material.MaintenanceFrequency), CreateParameter("@Broken", SqlDbType.Bit, material.Broken), CreateParameter("@Active", SqlDbType.Bit, material.Active) ); material.MatID = (Guid)cmd.Parameters["@matID"].Value; } catch (Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } finally { if (cmd != null) { cmd.Dispose(); } cmd = null; } }
private void btnCancel_Click(object sender, EventArgs e) { try { MaterialMember = _materialOriginal; this.Close(); } catch (System.Exception exception1) { System.Exception thisException = exception1; Management.ShowException(thisException); } }
// Methods. object IBindingList.AddNew() { try { MaterialObject Material = new MaterialObject(); List.Add(Material); return Material; } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }
public int Add(MaterialObject value) { try { return List.Add(value); } catch (System.Exception exception1) { Exception innerException = exception1; throw new Exception(MethodBase.GetCurrentMethod().Name, innerException); } }