Exemplo n.º 1
0
        public static MaintenanceObject MaintenanceRowToObject(DataRow Maintenance)
        {
            MaintenanceObject obj = new MaintenanceObject();

            try
            {
                if (Maintenance != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MaintID = RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, true, DataRowVersion.Current);
                        //obj.Material = MaterialConvertor.MaterialRowToObject(Maintenance);
                        //obj.MaintenanceVehicle = TIS.DL.Internal.MaintenanceVehicle.MaintenanceVehicleConvertor.MaintenanceVehicleRowToObject(Maintenance);
                        obj.Executor         = EmployeeConvertor.EmployeeRowToObject(Maintenance, "");
                        obj.StartMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.START_MAINTENANCE, false, DataRowVersion.Current), false);
                        obj.Remark           = RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.REMARK, false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Exemplo n.º 2
0
 public static MaintenanceObject MaintenanceRowToObject(DataRow Maintenance)
 {
     MaintenanceObject obj = new MaintenanceObject();
     try
     {
         if (Maintenance != null)
         {
             if (RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, false, DataRowVersion.Current) != Guid.Empty)
             {
                 obj.MaintID = RowFunctions.GetValueFromRowToGuid(Maintenance, MaintenanceObject.MAINT_ID, true, DataRowVersion.Current);
                 //obj.Material = MaterialConvertor.MaterialRowToObject(Maintenance);
                 //obj.MaintenanceVehicle = TIS.DL.Internal.MaintenanceVehicle.MaintenanceVehicleConvertor.MaintenanceVehicleRowToObject(Maintenance);
                 obj.Executor = EmployeeConvertor.EmployeeRowToObject(Maintenance,"");
                 obj.StartMaintenance = PROF_IT.Common.Convert.DateFunctions.DBDateToDate(RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.START_MAINTENANCE, false, DataRowVersion.Current), false);
                 obj.Remark = RowFunctions.GetValueFromRowToString(Maintenance, MaintenanceObject.REMARK, false, DataRowVersion.Current);
             }
             return obj;
         }
         obj = null;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return obj;
 }
Exemplo n.º 3
0
 public int Add(MaintenanceObject value)
 {
     try
     {
         return(List.Add(value));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 4
0
 public void Remove(MaintenanceObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 5
0
 // Called by MaintenanceObject when it changes
 internal void MaintenanceObjectChanged(MaintenanceObject Maintenance)
 {
     try
     {
         int index = List.IndexOf(Maintenance);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 6
0
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaintenanceObject Maintenance = new MaintenanceObject();
         List.Add(Maintenance);
         return(Maintenance);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 7
0
 protected override void OnRemoveComplete(int index, object value)
 {
     try
     {
         MaintenanceObject Maintenance = (MaintenanceObject)value;
         Maintenance.Parent = this;
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 8
0
 public MaterialRevisionObjectCollection GetByMaintenance(MaintenanceObject maintenance)
 {
     MaterialRevisionObjectCollection materialRevisions;
     try
     {
         materialRevisions = new MaterialRevisionDataService().GetByMaintenance(maintenance);
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return materialRevisions;
 }
 public MaterialRevisionObjectCollection GetByMaintenance(MaintenanceObject maintenance)
 {
     MaterialRevisionObjectCollection materialRevisions = new MaterialRevisionObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(MaterialRevisionObject.MAINT_ID, maintenance.MaintID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + MaterialRevisionObject.MAINT_ID + " is not null ");
         materialRevisions = MaterialRevisionConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return materialRevisions;
 }
Exemplo n.º 10
0
 public MaintenanceObject GetNewest()
 {
     try
     {
         MaintenanceObject maintenance = new MaintenanceObject();
         foreach (MaintenanceObject obj in this.GetActive())
         {
             if (obj.StartMaintenance > maintenance.StartMaintenance)
             {
                 maintenance = obj;
             }
         }
         return(maintenance);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 11
0
        protected override void OnSetComplete(int index, object oldValue, object newValue)
        {
            try
            {
                if (oldValue != newValue)
                {
                    MaintenanceObject oldMaintenance = (MaintenanceObject)oldValue;
                    MaintenanceObject newMaintenance = (MaintenanceObject)newValue;
                    oldMaintenance.Parent = null;
                    newMaintenance.Parent = this;

                    OnListChanged(new ListChangedEventArgs(ListChangedType.ItemAdded, index));
                }
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Exemplo n.º 12
0
 public void Remove(MaintenanceObject maintenance)
 {
     try
     {
         CheckTransaction();
         if (maintenance.MaterialRevisions.Count != 0)
             new BL.Internal.MaterialRevision(Transaction).RemoveAll(maintenance.MaterialRevisions);
         new MaintenanceDataService(Transaction).Remove(maintenance);
         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();
     }
 }
Exemplo n.º 13
0
 public Maintenance(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialObject material, MaintenanceObject maintenance)
 {
     try
     {
         InitializeComponent();
         _material    = material;
         _maintenance = maintenance;
         _typeForm    = typeForm;
         if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
         {
             throw new NotImplementedException();
         }
         else
         {
             InitializePropertyForm();
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 14
0
 public Maintenance(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialObject material, MaintenanceObject maintenance)
 {
     try
     {
         InitializeComponent();
         _material = material;
         _maintenance = maintenance;
         _typeForm = typeForm;
         if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
         {
             throw new NotImplementedException();
         }
         else
         {
             InitializePropertyForm();
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 15
0
 public void Save(MaintenanceObject maintenance)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Maintenance_SAVE",
             CreateParameter("@maintID", SqlDbType.UniqueIdentifier, maintenance.MaintID, ParameterDirection.InputOutput),
             CreateParameter("@maintvehID", SqlDbType.UniqueIdentifier, maintenance.MaintenanceVehicle == null? Guid.Empty : maintenance.MaintenanceVehicle.MaintVehID),
             CreateParameter("@matID", SqlDbType.UniqueIdentifier, maintenance.Material.MatID),
             CreateParameter("@empIDExecutor", SqlDbType.UniqueIdentifier, maintenance.Executor == null ? Guid.Empty : maintenance.Executor.EmpID),
             CreateParameter("@Remark", SqlDbType.VarChar, maintenance.Remark),
             CreateParameter("@StartMaintenance", SqlDbType.VarChar, PROF_IT.Common.Convert.DateFunctions.DateToLongStrDate(maintenance.StartMaintenance))
             );
         maintenance.MaintID = (Guid)cmd.Parameters["@maintID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Exemplo n.º 16
0
 public bool Remove(MaintenanceObject maintenance)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Maintenance_DELETE",
             CreateParameter("@maintID", SqlDbType.UniqueIdentifier, maintenance.MaintID, 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;
     }
 }
 // Called by MaintenanceObject when it changes
 internal void MaintenanceObjectChanged(MaintenanceObject Maintenance)
 {
     try
     {
         int index = List.IndexOf(Maintenance);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaintenanceObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaintenanceObject Maintenance = new MaintenanceObject();
         List.Add(Maintenance);
         return Maintenance;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public MaintenanceObject GetNewest()
 {
     try
     {
         MaintenanceObject maintenance = new MaintenanceObject();
         foreach (MaintenanceObject obj in this.GetActive())
         {
             if (obj.StartMaintenance > maintenance.StartMaintenance)
                 maintenance = obj;
         }
         return maintenance;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public int Add(MaintenanceObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 22
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedAnswer = Answer;
             _loadedMaintenance = Maintenance;
             _loadedRevision = Revision;
             _loadedCategory = Category;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Exemplo n.º 23
0
 public void Save(MaintenanceObject maintenance)
 {
     try
     {
         CheckTransaction();
         new MaintenanceDataService(Transaction).Save(maintenance);
         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();
     }
 }
Exemplo n.º 24
0
 public void Initialize()
 {
     try
     {
         MaintenanceMember = new MaintenanceObject();
         MaintenanceMember.Material = Material;
         CreateNewMaterialRevisions();
         gdcRevision.DataSource = MaterialRevisions;
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }