Пример #1
0
        public static Agente Get(Type entityType, IAgenteHipatia hipatiaAgent, bool childs = false)
        {
            EntidadInfo entidad = EntidadInfo.Get(entityType);

            if (entidad.Oid != 0)
            {
                QueryConditions conditions = new QueryConditions()
                {
                    Entity        = entidad,
                    IHipatiaAgent = hipatiaAgent
                };

                Agente obj = Get(SELECT(conditions, false), childs);

                if (obj == null)
                {
                    throw new HipatiaException(String.Format(Resources.Messages.AGENTE_NOT_FOUND, hipatiaAgent.NombreHipatia), HipatiaCode.NO_AGENTE);
                }

                return(obj);
            }
            else
            {
                throw new HipatiaException(Resources.Messages.ENTIDAD_NOT_FOUND + entityType.ToString(), HipatiaCode.NO_ENTIDAD);
            }
        }
Пример #2
0
        public static DocumentViewModel New(DocumentoInfo source, IAgenteHipatia agent)
        {
            DocumentViewModel obj = new DocumentViewModel();

            obj.CopyFrom(source);
            obj.OidAgent = agent.Oid;
            return(obj);
        }
Пример #3
0
 public virtual void CopyFrom(EntidadInfo entity, IAgenteHipatia agent)
 {
     OidEntidad   = entity.Oid;
     OidAgenteExt = agent.Oid;
     Nombre       = agent.NombreHipatia;
     Fecha        = DateTime.Today;
     Entidad      = entity.Tipo;
 }
Пример #4
0
        public AgenteEditForm(Type tipoEntidad, IAgenteHipatia agenteH, Form parent)
            : base(-1, parent)
        {
            InitializeComponent();
            _entity = Agente.Get(tipoEntidad, agenteH);
            _entity.BeginEdit();
            SetFormData();

            this.Text = Resources.Labels.AGENTE_EDIT_TITLE + " " + Entity.Nombre.ToUpper();
            _mf_type  = ManagerFormType.MFEdit;
        }
Пример #5
0
        public static DocumentListViewModel Get(Documentos sourceList, IAgenteHipatia agent)
        {
            DocumentListViewModel list = new DocumentListViewModel();

            foreach (Documento item in sourceList)
            {
                list.Add(DocumentViewModel.New(item, agent));
            }

            return(list);
        }
Пример #6
0
        public AgenteAddForm(EntidadInfo entity, IAgenteHipatia agent, Form parent)
            : base(-1, parent)
        {
            InitializeComponent();

            _entity.CopyFrom(entity, agent);
            _entity.Codigo = _entity.GetCode();
            SetFormData();

            _mf_type  = ManagerFormType.MFAdd;
            this.Text = Resources.Labels.AGENTE_ADD_TITLE;
        }
Пример #7
0
        public static DocumentoList GetListByAgente(IAgenteHipatia agente)
        {
            CriteriaEx criteria = Documento.GetCriteria(Documento.OpenSession());

            criteria.Childs = true;

            QueryConditions conditions = new QueryConditions {
                IHipatiaAgent = agente
            };

            criteria.Query = DocumentoList.SELECT_BY_AGENTE(conditions);

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

            CloseSession(criteria.SessionCode);
            return(list);
        }
Пример #8
0
        public static Agente New(Type entityType, IAgenteHipatia agent)
        {
            if (!CanAddObject())
            {
                throw new System.Security.SecurityException(Resources.Messages.USER_NOT_ALLOWED);
            }

            EntidadInfo entity = EntidadInfo.Get(entityType);

            if (entity.Oid != 0)
            {
                Agente obj = DataPortal.Create <Agente>(new CriteriaCs(-1));
                obj.CopyFrom(entity, agent);
                return(obj);
            }
            else
            {
                throw new HipatiaException(Resources.Messages.ENTIDAD_NOT_FOUND + entityType.ToString(), HipatiaCode.NO_ENTIDAD);
            }
        }
        public override void UpdateList()
        {
            /*switch (_current_action)
             * {
             *  case molAction.Add:
             *      if (_entity == null) return;
             *      List.AddItem(_entity.GetInfo(false));
             *      if (FilterType == IFilterType.Filter)
             *      {
             *          AgenteList listA = AgenteList.GetList(_filter_results);
             *          listA.AddItem(_entity.GetInfo(false));
             *          _filter_results = listA.GetSortedList();
             *      }
             *      break;
             *
             *  case molAction.Edit:
             *  case molAction.Lock:
             *  case molAction.Unlock:
             *      if (_entity == null) return;
             *      ActiveItem.CopyFrom(_entity);
             *      break;
             *
             *  case molAction.Delete:
             *      if (ActiveItem == null) return;
             *      List.RemoveItem(ActiveOID);
             *      if (FilterType == IFilterType.Filter)
             *      {
             *          AgenteList listD = AgenteList.GetList(_filter_results);
             *          listD.RemoveItem(ActiveOID);
             *          _filter_results = listD.GetSortedList();
             *      }
             *      break;
             * }*/

            _entity = null;
            RefreshSources();
        }
Пример #10
0
 public AgenteEditForm(Type tipoEntidad, IAgenteHipatia agenteH)
     : this(tipoEntidad, agenteH, null)
 {
 }
Пример #11
0
 public static string GetCode(EntidadInfo entidad, IAgenteHipatia agente_h)
 {
     return("GD#" + entidad.Oid.ToString("00") + agente_h.Oid.ToString("00000"));
 }
Пример #12
0
 public AgenteAddForm(Type tipoEntidad, IAgenteHipatia agente_h)
     : this(tipoEntidad, agente_h, null)
 {
 }