Пример #1
0
        public bool Remove(MaterialTypeObject materialType)
        {
            SqlCommand cmd = null;

            try
            {
                ExecuteNonQuery(out cmd, false, "MaterialType_DELETE",
                                CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialType.MatTypID, 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;
            }
        }
Пример #2
0
        public void Save(MaterialTypeObject materialType)
        {
            SqlCommand cmd = null;

            try
            {
                ExecuteNonQuery(out cmd, false, "MaterialType_SAVE",
                                CreateParameter("@mattypID", SqlDbType.UniqueIdentifier, materialType.MatTypID, ParameterDirection.InputOutput),
                                CreateParameter("@matcatID", SqlDbType.UniqueIdentifier, materialType.MaterialCategory.MatcatID),
                                CreateParameter("@Type", SqlDbType.VarChar, materialType.Type)
                                );
                materialType.MatTypID = (Guid)cmd.Parameters["@mattypID"].Value;
            }
            catch (Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            finally
            {
                if (cmd != null)
                {
                    cmd.Dispose();
                }
                cmd = null;
            }
        }
Пример #3
0
 public void Save(MaterialTypeObject materialType)
 {
     try
     {
         CheckTransaction();
         new MaterialTypeDataService(Transaction).Save(materialType);
         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();
         }
     }
 }
Пример #4
0
        public void Remove(MaterialTypeObject materialType)
        {
            try
            {
                CheckTransaction();
                foreach (MaterialSubTypeObject subtype in materialType.SubTypes)
                {
                    new MaterialSubType(Transaction).Remove(subtype);
                }
                Revision blREv = new Revision(Transaction);
                blREv.RemoveAll(materialType.Revisions);

                new MaterialTypeDataService(Transaction).Remove(materialType);
                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();
                }
            }
        }
Пример #5
0
 private void gdvType_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;
             }
             MaterialTypeObject type = (MaterialTypeObject)view.GetRow(rowHandle);
             if (type != null)
             {
                 new BL.Internal.MaterialType().Save(type);
             }
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception thisException = exception1;
         Management.ShowException(thisException);
     }
 }
Пример #6
0
        public MaterialCateogry(PROF_IT.Common.Enumerations.TypeForm typeForm, MaterialTypeObject materialType)
        {
            try
            {
                InitializeComponent();

                MaterialTypeMember = materialType;
                _typeForm          = typeForm;
                if (_typeForm == PROF_IT.Common.Enumerations.TypeForm.NewForm)
                {
                    throw new NotImplementedException();
                }
                else
                {
                    Initialize();
                    InitializePropertyFormMaterialType();
                    SetPermissions();
                }
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
        }
Пример #7
0
 public void AddChilds(MaterialTypeObject materialType)
 {
     try
     {
         MaterialSubType bl = new MaterialSubType();
         materialType.SubTypes    = bl.GetSubTypesByType(materialType);
         materialType.ChildsAdded = true;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #8
0
        public RevisionObjectCollection GetByMaterialType(MaterialTypeObject materialType)
        {
            RevisionObjectCollection revisions;

            try
            {
                revisions = new RevisionDataService().GetByMaterialType(materialType);
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(revisions);
        }
Пример #9
0
        public MaterialSubTypeObjectCollection GetSubTypesByType(MaterialTypeObject type)
        {
            MaterialSubTypeObjectCollection materialSubTypes;

            try
            {
                materialSubTypes = new MaterialSubTypeDataService().GetSubTypeByType(type);
            }
            catch (System.Exception exception1)
            {
                System.Exception innerException = exception1;
                throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(materialSubTypes);
        }
Пример #10
0
 private void louType_EditValueChanged(object sender, EventArgs e)
 {
     try
     {
         if (louType.EditValue != null)
         {
             MaterialTypeObject type = (MaterialTypeObject)louType.EditValue;
             louSubType.Properties.DataSource = new BL.Internal.MaterialSubType().GetSubTypesByType(type);
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception thisException = exception1;
         Management.ShowException(thisException);
     }
 }
Пример #11
0
 private void gdvType_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         GridView           view = (GridView)sender;
         MaterialTypeObject obj  = (MaterialTypeObject)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);
     }
 }
Пример #12
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);
            }
        }
Пример #13
0
 void IEditableObject.BeginEdit()
 {
     try
     {
         if (!_inTxn)
         {
             _loadedMaterialType = MaterialType;
             _loadedSubType      = SubType;
             //Child members
             _loadedRevisions = Revisions;
             _inTxn           = true;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #14
0
        private void gdvType_InitNewRow(object sender, InitNewRowEventArgs e)
        {
            try
            {
                GridView               view     = (GridView)sender;
                MaterialTypeObject     type     = (MaterialTypeObject)view.GetRow(e.RowHandle);
                MaterialCategoryObject category = (MaterialCategoryObject)gdvCategory.GetRow(gdvCategory.FocusedRowHandle);
                type.Type             = " ";
                type.MaterialCategory = category;
                type.SubTypes         = new DL.Internal.MaterialSubType.MaterialSubTypeObjectCollection();

                new BL.Internal.MaterialType().Save(type);
            }
            catch (System.Exception exception1)
            {
                System.Exception thisException = exception1;
                Management.ShowException(thisException);
            }
        }
Пример #15
0
        public RevisionObjectCollection GetByMaterialType(MaterialTypeObject materialType)
        {
            RevisionObjectCollection revisions = new RevisionObjectCollection();
            QueryBuilder             builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString(RevisionObject.MATTYP_ID, materialType.MatTypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
                builder.Append("AND " + RevisionObject.MATTYP_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);
        }
Пример #16
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);
     }
 }
        public MaterialSubTypeObjectCollection GetSubTypeByType(MaterialTypeObject type)
        {
            MaterialSubTypeObjectCollection materialSubTypes = new MaterialSubTypeObjectCollection();
            QueryBuilder builder;

            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString(MaterialSubTypeObject.MATTYP_ID, type.MatTypID.ToString(), QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST);
                builder.Append("AND " + MaterialSubTypeObject.MATTYP_ID + " is not null ");
                builder.AppendOrderBy(MaterialSubTypeObject.SUBTYPE, QueryBuilder.OrderByType.ASC, QueryBuilder.ParameterLocation.FIRST_LAST);
                materialSubTypes = MaterialSubTypeConvertor.DataTableToCollection(this.ExecuteDataSet(builder.Query, false).Tables[0]);
            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return(materialSubTypes);
        }
Пример #18
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);
     }
 }