Пример #1
0
 public SupplierSearch()
 {
     try
     {
         InitializeComponent();
         _supplier = new SupplierObject();
         FindAll();
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #2
0
 public SupplierSearch()
 {
     try
     {
         InitializeComponent();
         _supplier = new SupplierObject();
         FindAll();
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #3
0
 public void Remove(SupplierObject supplier)
 {
     try
     {
         CheckTransaction();
         new SupplierDataService(Transaction).Remove(supplier);
         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 static SupplierObject SupplierRowToObject(DataRow supplier)
        {
            SupplierObject obj = null;

            try
            {
                if (supplier != null)
                {
                    if (RowFunctions.GetValueFromRowToGuid(supplier, SupplierObject.SUP_ID, false, DataRowVersion.Current) != Guid.Empty)
                    {
                        obj             = new SupplierObject();
                        obj.SupID       = RowFunctions.GetValueFromRowToGuid(supplier, SupplierObject.SUP_ID, true, DataRowVersion.Current);
                        obj.TranscID    = RowFunctions.GetValueFromRowToInteger(supplier, SupplierObject.TRANSC_ID, false, DataRowVersion.Current);
                        obj.TasID       = RowFunctions.GetValueFromRowToInteger(supplier, SupplierObject.TAS_ID, false, DataRowVersion.Current);
                        obj.Name        = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.NAME, false, DataRowVersion.Current);
                        obj.Name2       = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.NAME2, false, DataRowVersion.Current);
                        obj.Street      = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.STREET, false, DataRowVersion.Current);
                        obj.HouseNumber = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.HOUSE_NUMBER, false, DataRowVersion.Current);
                        obj.Zipcode     = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.ZIPCODE, false, DataRowVersion.Current);
                        obj.Town        = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.TOWN, false, DataRowVersion.Current);
                        obj.Country     = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.COUNTRY, false, DataRowVersion.Current);
                        obj.Vat         = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.VAT, false, DataRowVersion.Current);
                        obj.Phone       = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.PHONE, false, DataRowVersion.Current);
                        obj.Language    = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.LANGUAGE, false, DataRowVersion.Current);
                        obj.Currency    = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.CURRENCY, false, DataRowVersion.Current);
                        obj.Email       = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.EMAIL, false, DataRowVersion.Current);
                    }
                    return(obj);
                }
                obj = null;
            }
            catch (System.Exception exception1)
            {
                Exception innerException = exception1;
                throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
            }
            return(obj);
        }
Пример #5
0
 public static SupplierObject SupplierRowToObject(DataRow supplier)
 {
     SupplierObject obj = null;
     try
     {
         if (supplier != null)
         {
             if (RowFunctions.GetValueFromRowToGuid(supplier, SupplierObject.SUP_ID, false, DataRowVersion.Current) != Guid.Empty)
             {
                 obj = new SupplierObject();
                 obj.SupID = RowFunctions.GetValueFromRowToGuid(supplier, SupplierObject.SUP_ID, true, DataRowVersion.Current);
                 obj.TranscID = RowFunctions.GetValueFromRowToInteger(supplier, SupplierObject.TRANSC_ID, false, DataRowVersion.Current);
                 obj.TasID = RowFunctions.GetValueFromRowToInteger(supplier, SupplierObject.TAS_ID, false, DataRowVersion.Current);
                 obj.Name = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.NAME, false, DataRowVersion.Current);
                 obj.Name2 = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.NAME2, false, DataRowVersion.Current);
                 obj.Street = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.STREET, false, DataRowVersion.Current);
                 obj.HouseNumber = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.HOUSE_NUMBER, false, DataRowVersion.Current);
                 obj.Zipcode = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.ZIPCODE, false, DataRowVersion.Current);
                 obj.Town = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.TOWN, false, DataRowVersion.Current);
                 obj.Country = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.COUNTRY, false, DataRowVersion.Current);
                 obj.Vat = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.VAT, false, DataRowVersion.Current);
                 obj.Phone = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.PHONE, false, DataRowVersion.Current);
                 obj.Language = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.LANGUAGE, false, DataRowVersion.Current);
                 obj.Currency = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.CURRENCY, false, DataRowVersion.Current);
                 obj.Email = RowFunctions.GetValueFromRowToString(supplier, SupplierObject.EMAIL, false, DataRowVersion.Current);
             }
             return obj;
         }
         obj = null;
     }
     catch (System.Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     return obj;
 }
Пример #6
0
 private TaskPeopleObject ProcessSupplier(SupplierObject supplier)
 {
     try
     {
         TaskPeopleObject taskPeople = new TaskPeopleObject();
         taskPeople.Assignee = true;
         taskPeople.Reporter = false;
         taskPeople.Supplier = supplier;
         taskPeople.State = PROF_IT.Common.Enumerations.ObjectState.Created;
         return taskPeople;
     }
     catch (System.Exception exception1)
     {
         System.Exception innerException = exception1;
         throw new System.Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #7
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     try
     {
         if (gdvSupplier.FocusedRowHandle != DevExpress.XtraGrid.GridControl.AutoFilterRowHandle)
         {
             Supplier = (SupplierObject)gdvSupplier.GetRow(gdvSupplier.FocusedRowHandle);
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             this.Close();
         }
         else
         {
             DevExpress.XtraEditors.XtraMessageBox.Show("Please select first a supplier!", "Attention", MessageBoxButtons.OK);
             this.DialogResult = System.Windows.Forms.DialogResult.None;
         }
     }
     catch (System.Exception exception1)
     {
         System.Exception thisException = exception1;
         Management.ShowException(thisException);
     }
 }
Пример #8
0
 void IEditableObject.EndEdit()
 {
     try
     {
         if (inTxn)
         {
             _loadedTask = this.Task;
             _loadedEmployee = this.Employee;
             _loadedSupplier = this.Supplier;
             _loadedCustomer = this.Customer;
             _loadedUnknown = this.Unknown;
             _loadedAssignee = this.Assignee;
             _loadedReporter = this.Reporter;
             inTxn = false;
         }
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
 }
Пример #9
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);
     }
 }
Пример #10
0
        public SupplierObject GetSupplierByEmail(string email)
        {
            SupplierObject supplier = new SupplierObject();
            QueryBuilder builder;
            try
            {
                builder = new QueryBuilder();
                builder.Append(this.BaseQuery(false, 0));
                builder.AppendWhereString(SupplierObject.EMAIL, email, QueryBuilder.ComparisonOperators.Equal, QueryBuilder.ParameterLocation.FIRST_LAST);

                DataSet result = this.ExecuteDataSet(builder.Query, false);
                if (result.Tables[0].Rows.Count > 0)
                    supplier = SupplierConvertor.SupplierRowToObject(result.Tables[0].Rows[0]);
                else
                    return null;

            }
            catch (System.Exception exception1)
            {
                throw new Exception(MethodBase.GetCurrentMethod().Name, exception1);
            }
            return supplier;
        }
Пример #11
0
 public void Save(SupplierObject supplier)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Supplier_SAVE",
             CreateParameter("@supID", SqlDbType.UniqueIdentifier, supplier.SupID, ParameterDirection.InputOutput),
             CreateParameter("@transcID", SqlDbType.Int, supplier.TranscID),
             CreateParameter("@tasID", SqlDbType.Int, supplier.TasID),
             CreateParameter("@Name", SqlDbType.NChar, supplier.Name),
             CreateParameter("@Name2", SqlDbType.NChar, supplier.Name2),
             CreateParameter("@Street", SqlDbType.NChar, supplier.Street),
             CreateParameter("@HouseNumber", SqlDbType.NChar, supplier.HouseNumber),
             CreateParameter("@Zipcode", SqlDbType.NChar, supplier.Zipcode),
             CreateParameter("@Town", SqlDbType.NChar, supplier.Town),
             CreateParameter("@Country", SqlDbType.NChar, supplier.Country),
             CreateParameter("@VAT", SqlDbType.NChar, supplier.Vat),
             CreateParameter("@Phone", SqlDbType.NChar, supplier.Phone),
             CreateParameter("@Language", SqlDbType.NChar, supplier.Language),
             CreateParameter("@Currency", SqlDbType.NChar, supplier.Currency),
             CreateParameter("@Email", SqlDbType.NChar, supplier.Email)
             );
         supplier.SupID = (Guid)cmd.Parameters["@supID"].Value;
     }
     catch (Exception exception1)
     {
         Exception innerException = exception1;
         throw new Exception(MethodBase.GetCurrentMethod().Name, innerException);
     }
     finally
     {
         if (cmd != null)
         {
             cmd.Dispose();
         }
         cmd = null;
     }
 }
Пример #12
0
 public bool Remove(SupplierObject supplier)
 {
     SqlCommand cmd = null;
     try
     {
         ExecuteNonQuery(out cmd, false, "Supplier_DELETE",
             CreateParameter("@supID", SqlDbType.UniqueIdentifier, supplier.SupID, 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;
     }
 }