Esempio n. 1
0
        private void DataPortal_Fetch(CriteriaEx criteria)
        {
            string query = string.Empty;

            try
            {
                _base.Record.Oid = 0;
                SessionCode      = criteria.SessionCode;
                Childs           = criteria.Childs;
                query            = criteria.Query;

                if (nHMng.UseDirectSQL)
                {
                    PayrollBatch.DoLOCK(Session());
                    IDataReader reader = nHMng.SQLNativeSelect(query, Session());

                    if (reader.Read())
                    {
                        _base.CopyValues(reader);
                    }

                    if (Childs)
                    {
                        Payroll.DoLOCK(Session());
                        query    = Payrolls.SELECT(this);
                        reader   = nHMng.SQLNativeSelect(query);
                        _nominas = Payrolls.GetChildList(SessionCode, reader);

                        Expense.DoLOCK(Session());
                        query   = Expenses.SELECT(this);
                        reader  = nHMng.SQLNativeSelect(query);
                        _gastos = Expenses.GetChildList(SessionCode, reader);
                    }
                }

                CalculateTotal();

                MarkOld();
            }
            catch (Exception ex)
            {
                if (Transaction() != null)
                {
                    Transaction().Rollback();
                }
                iQExceptionHandler.TreatException(ex, new object[] { query });
            }
        }
Esempio n. 2
0
        internal void DeleteSelf(IAcreedor parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            // if we're new then don't update the database
            if (this.IsNew)
            {
                return;
            }

            PayrollBatchRecord obj = parent.Session().Get <PayrollBatchRecord>(Oid);

            obj.CopyValues(Base.Record);

            parent.Session().Update(obj);

            Expenses.DeleteItems(obj.Oid);

            MarkNew();
        }