Esempio n. 1
0
        private void gdvSubTypes_RowUpdated(object sender, RowObjectEventArgs e)
        {
            try
            {
                GridView view = (GridView)sender;

                if (view.FocusedRowHandle != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle)
                {
                    int rowHandle;
                    if (view.FocusedRowHandle == DevExpress.XtraGrid.GridControl.NewItemRowHandle)
                    {
                        rowHandle = view.DataRowCount - 1;
                    }
                    else
                    {
                        rowHandle = view.FocusedRowHandle;
                    }
                    MaterialSubTypeObject subType = (MaterialSubTypeObject)view.GetRow(rowHandle);
                    if (subType != null)
                    {
                        new BL.Internal.MaterialSubType().Save(subType);
                    }
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception thisException = exception1;
                Management.ShowException(thisException);
            }
        }
Esempio n. 2
0
        public void Remove(MaterialSubTypeObject materialSubType)
        {
            try
            {
                CheckTransaction();
                new MaterialSubTypeDataService(Transaction).Remove(materialSubType);

                Revision blREv = new Revision(Transaction);
                blREv.RemoveAll(materialSubType.Revisions);

                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 void Save(MaterialSubTypeObject materialSubType)
        {
            SqlCommand cmd = null;

            try
            {
                ExecuteNonQuery(out cmd, false, "MaterialSubType_SAVE",
                                CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, materialSubType.MatStypID, ParameterDirection.InputOutput),
                                CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialSubType.MaterialType.MatTypID),
                                CreateParameter("@SubType", SqlDbType.VarChar, materialSubType.SubType)
                                );
                materialSubType.MatStypID = (Guid)cmd.Parameters["@matstypID"].Value;
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
                cmd = null;
            }
        }
        public bool Remove(MaterialSubTypeObject materialSubType)
        {
            SqlCommand cmd = null;

            try
            {
                ExecuteNonQuery(out cmd, false, "MaterialSubType_DELETE",
                                CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, materialSubType.MatStypID, 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;
            }
        }
        public static MaterialSubTypeObject MaterialSubTypeRowToObject(DataRow MaterialSubType, string alias)
        {
            MaterialSubTypeObject obj = new MaterialSubTypeObject();
            try
            {
                if (MaterialSubType != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.MATSTYP_ID, alias), false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj.MatStypID = RowFunctions.GetValueFromRowToGuid(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.MATSTYP_ID, alias), true, DataRowVersion.Current);
                        obj.MaterialType = MaterialTypeConvertor.MaterialTypeRowToObject(MaterialSubType, alias);
                        obj.SubType = RowFunctions.GetValueFromRowToString(MaterialSubType, MaterialSubTypeObject.ConvertColumnToAlias(MaterialSubTypeObject.SUBTYPE, alias), false, DataRowVersion.Current);
                        return obj;
                    }
                    else
                        return null;

                }
                return null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Esempio n. 6
0
        public MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialSubTypeObject materialSubType)
        {
            try
            {
                InitializeComponent();

                MaterialSubTypeMember = materialSubType;
                _typeForm             = typeForm;
                if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    Initialize();
                    InitializePropertyFormMaterialSubType();
                    SetPermissions();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Esempio n. 7
0
 public RevisionObjectCollection GetByMaterialSubType(MaterialSubTypeObject materialSubType)
 {
     RevisionObjectCollection revisions;
     try
     {
         revisions = new RevisionDataService().GetByMaterialSubType(materialSubType);
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return revisions;
 }
Esempio n. 8
0
        public RevisionObjectCollection GetByMaterialSubType(MaterialSubTypeObject materialSubType)
        {
            RevisionObjectCollection revisions;

            try
            {
                revisions = new RevisionDataService().GetByMaterialSubType(materialSubType);
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(revisions);
        }
Esempio n. 9
0
        private void gdvSubTypes_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            try
            {
                GridView view = (GridView)sender;

                MaterialSubTypeObject subType = (MaterialSubTypeObject)view.GetRow(e.RowHandle);
                MaterialTypeObject    type    = (MaterialTypeObject)view.ParentView.GetRow(view.SourceRowHandle);
                subType.SubType      = " ";
                subType.MaterialType = type;
                new BL.Internal.MaterialSubType().Save(subType);
            }
            catch (System.Exception exception1)
            {
                System.Exception thisException = exception1;
                Management.ShowException(thisException);
            }
        }
Esempio n. 10
0
 private void gdvSubTypes_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         GridView view             = (GridView)sender;
         MaterialSubTypeObject obj = (MaterialSubTypeObject)view.GetRow(view.FocusedRowHandle);
         TIS.Client.Material.MaterialCateogry materialCategory = new TIS.Client.Material.MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm.PropertyForm, obj);
         if (materialCategory.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             obj.State = PROF_IT.Common.Enumerations.ObjectState.Modified;
         }
     }
     catch (System.Exception excepion1)
     {
         System.Exception thisException = excepion1;
         Management.ShowException(thisException);
     }
 }
Esempio n. 11
0
        public RevisionObjectCollection GetByMaterialSubType(MaterialSubTypeObject materialSubType)
        {
            RevisionObjectCollection revisions = new RevisionObjectCollection();
            QueryBuilder             builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString(RevisionObject.MATSTYP_ID, materialSubType.MatStypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
                builder.Append("AND " + RevisionObject.MATSTYP_ID + " is not null ");
                revisions = RevisionConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return(revisions);
        }
Esempio n. 12
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedMaterialCategory = MaterialCategory;
             _loadedMaterialType     = MaterialType;
             _loadedMaterialSubType  = MaterialSubType;
             _loadedRevision         = Revision;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 13
0
        public void Remove(MaterialSubTypeObject materialSubType)
        {
            try
            {
                CheckTransaction();
                new MaterialSubTypeDataService(Transaction).Remove(materialSubType);

                Revision blREv = new Revision(Transaction);
                blREv.RemoveAll(materialSubType.Revisions);

                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();
            }
        }
Esempio n. 14
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedMaterialCategory    = MaterialCategory;
             _loadedMaterialType        = MaterialType;
             _loadedMaterialSubType     = MaterialSubType;
             _loadedEmployeeCreator     = EmployeeCreator;
             _loadedEmployeeResponsable = EmployeeResponsable;
             _loadedVehicle             = Vehicle;
             _loadedSupplier            = Supplier;
             _loadedName                 = Name;
             _loadedDescription          = Description;
             _loadedType                 = Type;
             _loadedSerieNumber          = SerieNumber;
             _loadedInternalNumber       = InternalNumber;
             _loadedPurchasedOn          = PurchasedOn;
             _loadedPrice                = Price;
             _loadedNextMaintenance      = NextMaintenance;
             _loadedMaintenanceFrequency = MaintenanceFrequency;
             _loadedActive               = Active;
             _loadedBroken               = Broken;
             //Child members
             _loadedMemos        = Memos;
             _loadedMaintenances = Maintenances;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Save(MaterialSubTypeObject materialSubType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialSubType_SAVE",
             CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, materialSubType.MatStypID, ParameterDirection.InputOutput),
             CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialSubType.MaterialType.MatTypID),
             CreateParameter("@SubType", SqlDbType.VarChar, materialSubType.SubType)
             );
         materialSubType.MatStypID = (Guid)cmd.Parameters["@matstypID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
 public bool Remove(MaterialSubTypeObject materialSubType)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "MaterialSubType_DELETE",
             CreateParameter("@matstypID", SqlDbType.UniqueIdentifier, materialSubType.MatStypID, 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;
     }
 }
Esempio n. 17
0
        public MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialSubTypeObject materialSubType)
        {
            try
            {
                InitializeComponent();

                MaterialSubTypeMember = materialSubType;
                _typeForm = typeForm;
                if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    Initialize();
                    InitializePropertyFormMaterialSubType();
                    SetPermissions();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
 public int Add(MaterialSubTypeObject value)
 {
     try
     {
         return List.Add(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Methods.
 object IBindingList.AddNew()
 {
     try
     {
         MaterialSubTypeObject MaterialSubType = new MaterialSubTypeObject();
         List.Add(MaterialSubType);
         return MaterialSubType;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 // Called by MaterialSubTypeObject when it changes
 internal void MaterialSubTypeObjectChanged(MaterialSubTypeObject MaterialSubType)
 {
     try
     {
         int index = List.IndexOf(MaterialSubType);
         OnListChanged(new ListChangedEventArgs(ListChangedType.ItemChanged, index));
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
 public void Remove(MaterialSubTypeObject value)
 {
     try
     {
         List.Remove(value);
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Esempio n. 22
0
 public RevisionObjectCollection GetByMaterialSubType(MaterialSubTypeObject materialSubType)
 {
     RevisionObjectCollection revisions = new RevisionObjectCollection();
     QueryBuilder builder;
     try
     {
         builder = new QueryBuilder();
         builder.Append(this.BaseQuery(false, 0));
         builder.AppendWhereString(RevisionObject.MATSTYP_ID, materialSubType.MatStypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
         builder.Append("AND " + RevisionObject.MATSTYP_ID + " is not null ");
         revisions = RevisionConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
     }
     catch (System.Exception exception1)
     {
         throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
     }
     return revisions;
 }
Esempio n. 23
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (_inTxn)
         {
             _loadedMaterialCategory = MaterialCategory;
             _loadedMaterialType = MaterialType;
             _loadedMaterialSubType = MaterialSubType;
             _loadedEmployeeCreator = EmployeeCreator;
             _loadedEmployeeResponsable = EmployeeResponsable;
             _loadedVehicle = Vehicle;
             _loadedSupplier = Supplier;
             _loadedName = Name;
             _loadedDescription = Description;
             _loadedType = Type;
             _loadedSerieNumber = SerieNumber;
             _loadedInternalNumber = InternalNumber;
             _loadedPurchasedOn = PurchasedOn;
             _loadedPrice = Price;
             _loadedNextMaintenance = NextMaintenance;
             _loadedMaintenanceFrequency = MaintenanceFrequency;
             _loadedActive = Active;
             _loadedBroken = Broken;
             //Child members
             _loadedMemos = Memos;
             _loadedMaintenances = Maintenances;
             _inTxn = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }