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;
            }

            try
            {
                SessionCode = parent.SessionCode;
                Session().Delete(Session().Get <ProductoProveedorRecord>(Oid));
            }
            catch (Exception ex)
            {
                iQExceptionHandler.TreatException(ex);
            }

            MarkNew();
        }
예제 #2
0
        public static void Edit(ProviderViewModel source, HttpRequestBase request = null)
        {
            IAcreedor item = null;

            switch (source.ETipoAcreedor)
            {
            case ETipoAcreedor.Proveedor:
            case ETipoAcreedor.Acreedor:
            case ETipoAcreedor.Partner:
                item = Proveedor.Get(source.OidAcreedor, source.ETipoAcreedor);
                break;

            case ETipoAcreedor.Naviera:
                item = Naviera.Get(source.OidAcreedor);
                break;

            case ETipoAcreedor.Despachante:
                item = Despachante.Get(source.OidAcreedor);
                break;

            case ETipoAcreedor.TransportistaDestino:
            case ETipoAcreedor.TransportistaOrigen:
                item = Transporter.Get(source.OidAcreedor, source.ETipoAcreedor);
                break;
            }

            source.CopyTo(item, request);
            item.ISave();
        }
 public InvoicePaymentAddForm(Form parent, IAcreedor acreedor)
     : base(parent, acreedor)
 {
     InitializeComponent();
     SetFormData(acreedor);
     this.Text = Resources.Labels.PAGO_ADD_TITLE;
 }
예제 #4
0
        public void CopyTo(IAcreedor dest, HttpRequestBase request = null)
        {
            foreach (PropertyInfo item in this.GetType().GetProperties())
            {
                if (item == null)
                {
                    continue;
                }
                if (item.Name == "Oid")
                {
                    continue;
                }
                if (request != null && request[item.Name] == null)
                {
                    continue;
                }

                try
                {
                    PropertyInfo propdest = typeof(IAcreedor).GetProperty(item.Name);
                    if (propdest != null)
                    {
                        propdest.SetValue(dest, item.GetValue(this, null), null);
                    }
                }
                catch { }
            }
        }
예제 #5
0
 public CustomAgentForm(IAcreedor item, bool isModal, Form parent)
     : base(item.Oid, new object[1] {
     item
 }, isModal, parent)
 {
     InitializeComponent();
 }
예제 #6
0
        public void Update(IAcreedor parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (Payment obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            // no se usa un foreach porque puede variar la cantidad de elementos
            // si se ha cambiado alguno de fecha ya que se crea uno nuevo y se anula el anterior
            for (int i = 0; i < Items.Count; i++)
            {
                Payment obj = Items[i];

                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
예제 #7
0
 internal static string SELECT(IAcreedor source)
 {
     return(SELECT(new QueryConditions()
     {
         Acreedor = source.IGetInfo()
     }));
 }
예제 #8
0
        internal void Update(IAcreedor parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            //Debe obtener la sesion del padre pq el objeto es padre a su vez
            SessionCode = parent.SessionCode;

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

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

            obj.CopyValues(Base.Record);
            parent.Session().Update(obj);

            UpdateAssociatedExpenses();

            MarkOld();
        }
예제 #9
0
 public EmployeeForm(IAcreedor item, Form parent)
     : base(item.Oid, new object[1] {
     item
 }, true, parent)
 {
     InitializeComponent();
 }
예제 #10
0
 public SupplierForm(IAcreedor item, bool isModal, Form parent)
     : base(item.Oid, new object[2] {
     item.ETipoAcreedor, item
 }, isModal, parent)
 {
     InitializeComponent();
 }
        public PaymentRpt GetDetailReport(Payment item,
                                          IAcreedor acreedor,
                                          InputInvoiceList facturas)
        {
            if (item == null)
            {
                return(null);
            }

            PaymentRpt doc = new PaymentRpt();

            List <PaymentPrint>            pList     = new List <PaymentPrint>();
            List <TransactionPaymentPrint> pagosList = new List <TransactionPaymentPrint>();

            foreach (TransactionPayment pagoFactura in item.Operations)
            {
                pagosList.Add(TransactionPaymentPrint.New(pagoFactura.GetInfo(), facturas.GetItem(pagoFactura.OidOperation)));
            }

            //Si no existen conceptos, no tiene sentido un informe detallado. Además, falla en Crystal Reports
            if (pagosList.Count <= 0)
            {
                return(null);
            }

            pList.Add(PaymentPrint.New(item.GetInfo(false), acreedor, false));

            doc.SetDataSource(pList);
            doc.Subreports["Cuerpo"].SetDataSource(pagosList);
            doc.SetParameterValue("Empresa", Schema.Name);

            return(doc);
        }
예제 #12
0
 public TransporterForm(IAcreedor item, Form parent)
     : base(item.Oid, new object[2] {
     item.ETipoAcreedor, item
 }, true, parent)
 {
     InitializeComponent();
 }
 public EmployeeAddForm(IAcreedor entity, Form parent)
     : base(entity, parent)
 {
     InitializeComponent();
     SetFormData();
     _mf_type = ManagerFormType.MFAdd;
 }
        public void Update(IAcreedor parent)
        {
            this.RaiseListChangedEvents = false;

            // update (thus deleting) any deleted child objects
            foreach (ProductoProveedor obj in DeletedList)
            {
                obj.DeleteSelf(parent);
            }

            // now that they are deleted, remove them from memory too
            DeletedList.Clear();

            // add/update any current child objects
            foreach (ProductoProveedor obj in this)
            {
                if (obj.IsNew)
                {
                    obj.Insert(parent);
                }
                else
                {
                    obj.Update(parent);
                }
            }

            this.RaiseListChangedEvents = true;
        }
 public ShippingCompanyForm(IAcreedor item, Form parent)
     : base(item.Oid, new object[1] {
     item
 }, true, parent)
 {
     InitializeComponent();
 }
예제 #16
0
        internal void Insert(IAcreedor parent)
        {
            // if we're not dirty then don't update the database
            if (!this.IsDirty)
            {
                return;
            }

            //Debe obtener la sesion del padre pq el objeto es padre a su vez
            SessionCode = parent.SessionCode;

            GetNewCode();
            UpdateAssociatedExpenses();

            ValidationRules.CheckRules();

            if (!IsValid)
            {
                throw new iQValidationException(moleQule.Resources.Messages.GENERIC_VALIDATION_ERROR);
            }

            parent.Session().Save(Base.Record);

            MarkOld();
        }
예제 #17
0
        /// <summary>
        /// Guarda en la bd el objeto actual
        /// </summary>
        protected override bool SaveObject()
        {
            using (StatusBusy busy = new StatusBusy(moleQule.Face.Resources.Messages.SAVING))
            {
                this.Datos.RaiseListChangedEvents = false;

                IAcreedor temp = _entity.IClone();
                temp.ApplyEdit();

                // do the save
                try
                {
                    _entity = temp.ISave();
                    _entity.ApplyEdit();

                    return(true);
                }
                catch (Exception ex)
                {
                    PgMng.ShowInfoException(iQExceptionHandler.GetAllMessages(ex));
                    return(false);
                }
                finally
                {
                    this.Datos.RaiseListChangedEvents = true;
                }
            }
        }
예제 #18
0
        public static ProviderBase New(IAcreedor source)
        {
            ProviderBase obj = new ProviderBase();

            obj.CopyValues(source);

            return(obj);
        }
        protected void SetFormData(IAcreedor source)
        {
            _holder.LoadChilds(typeof(Payment), true);
            _entity = _holder.Pagos.NewItem(source, ETipoPago.Factura);
            _entity.CopyFrom(source, ETipoPago.Factura);

            base.SetFormData();
        }
 public EmployeeEditForm(IAcreedor item, Form parent)
     : base(item, parent)
 {
     InitializeComponent();
     SetFormData();
     this.Text = string.Format(Resources.Labels.EMPLOYEE_TITLE, _entity.NombreCompleto);
     _mf_type  = ManagerFormType.MFEdit;
 }
        public static ProductoProveedores GetChildList(IAcreedor parent, bool childs)
        {
            CriteriaEx criteria = ProductoProveedor.GetCriteria(parent.SessionCode);

            criteria.Query  = ProductoProveedores.SELECT(parent);
            criteria.Childs = childs;

            return(DataPortal.Fetch <ProductoProveedores>(criteria));
        }
예제 #22
0
		public static string SELECT(IAcreedor acreedor)
		{
			QueryConditions conditions = new QueryConditions { Acreedor = acreedor.IGetInfo() };
			conditions.TipoAcreedor[0] = acreedor.ETipoAcreedor;
            if (acreedor.ETipoAcreedor == ETipoAcreedor.Empleado)
                return Employee.SELECT_PAGOS_NOMINAS();
            else
                return SELECT_BASE(conditions);
		}
예제 #23
0
        public void ChangeState(EEstado status, Payment item, IAcreedor parent)
        {
            Payment obj = GetItem(item.Oid);

            if (obj != null)
            {
                obj.ChangeEstado(status);
                //parent.UpdateCredito();
            }
        }
예제 #24
0
        public virtual void CopyValues(IAcreedor source)
        {
            if (source == null)
            {
                return;
            }

            _record.CopyValues(source.ProviderBase.Record);
            CopyCommonValues(source);
        }
 public ProveedorEditForm(IAcreedor item, Form parent)
     : base(item, parent)
 {
     InitializeComponent();
     if (_entity != null)
     {
         SetFormData();
     }
     _mf_type = ManagerFormType.MFEdit;
 }
예제 #26
0
        public static PaymentSummary Get(IAcreedor acreedor)
        {
            CriteriaEx criteria = Expedient.GetCriteria(Expedient.OpenSession());

            if (nHManager.Instance.UseDirectSQL)
                criteria.Query = PaymentSummary.SELECT(acreedor);

            Expedient.BeginTransaction(criteria.Session);

            return DataPortal.Fetch<PaymentSummary>(criteria);
        }
예제 #27
0
        public static Payments GetChildList(IAcreedor parent, bool childs)
        {
            CriteriaEx criteria = Payment.GetCriteria(parent.SessionCode);

            criteria.Query  = SELECT(parent);
            criteria.Childs = childs;

            Payments list = DataPortal.Fetch <Payments>(criteria);

            return(list);
        }
예제 #28
0
        public InvoicePaymentEditForm(Form parent, IAcreedor acreedor, Payment pago, bool locked)
            : base(parent, acreedor)
        {
            InitializeComponent();

            _locked = locked;
            _entity = pago;

            SetFormData();
            this.Text = Resources.Labels.PAGO_DETAIL_TITLE;
        }
        public static string SELECT(IAcreedor item)
        {
            QueryConditions conditions = new QueryConditions
            {
                TipoAcreedor = new ETipoAcreedor[1] {
                    item.ETipoAcreedor
                },
                Acreedor = item.IGetInfo()
            };

            return(SELECT(conditions));
        }
예제 #30
0
        public TransactionPayment GetItemByAgenteExpediente(IAcreedor agente, long oid_expediente)
        {
            foreach (TransactionPayment item in this)
            {
                if ((item.OidExpediente == oid_expediente) && (item.ETipoAcreedor == agente.ETipoAcreedor))
                {
                    return(item);
                }
            }

            return(null);
        }