public override void GetContacts(int recordsCount)
        {
            IList contacts = securedObjectSpace.CreateCollection(typeof(ContactType));

            securedObjectSpace.SetTopReturnedObjectsCount(contacts, recordsCount);

            foreach (var t in contacts)
            {
            }
            CheckCollectionCount(contacts, recordsCount);
        }
 protected override void SetupControl(WebControl control)
 {
     if (ViewEditMode == ViewEditMode.Edit)
     {
         //var tt = this.CurrentObject;
         if (this.CurrentObject != null)
         {
             //var lst = db.GetObjects(this.CurrentObject.GetType());
             IList <SortProperty> sortProps = new List <SortProperty>();
             sortProps.Add(new SortProperty("PropertyName", SortingDirection.Ascending));
             var lst = db.CreateCollection(this.CurrentObject.GetType(), null, sortProps);
             //var lst = db.GetObjects<DomainObject1>();
             var ttt = ((ASPxComboBox)control).Items;
             if (ttt.Count < lst.Count)
             {
                 ttt.Clear();
                 foreach (var item in lst)
                 {
                     try
                     {
                         //var t = ((ASPxComboBox)control);
                         ttt.Add(
                             //DataBinder.Eval(DateTime.Now, "TimeOfDay.Hours");
                             DataBinder.Eval(item, "PropertyName").ToString()
                             //item.PropertyName1
                             );
                     }
                     catch (Exception)
                     {
                     }
                 }
             }
         }
     }
 }
Beispiel #3
0
        private void simpleActionCncilr_Execute(object sender, DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs e)
        {
            if (View != null && View.ObjectSpace != null)
            {
                IObjectSpace       objectSpace = Application.CreateObjectSpace();
                CriteriaOperator[] operands    = new CriteriaOperator[1];
                operands[0] = new BinaryOperator("Concilia", true, BinaryOperatorType.NotEqual);

                SortProperty[] sortCollection = new SortProperty[1];
                sortCollection[0] = new SortProperty("FechaDoc", SortingDirection.Ascending);

                IList arr = objectSpace.CreateCollection(typeof(DocumentoSalida),
                                                         new GroupOperator(operands), sortCollection);
                Ventas vta = objectSpace.FindObject <Ventas>(null);

                foreach (string file in Directory.GetFiles(Directory.GetCurrentDirectory(), "*.xml"))
                {
                    XmlDocument xml = new XmlDocument();

                    xml.Load(file);
                    XmlNodeList nl = xml.GetElementsByTagName("tfd:TimbreFiscalDigital");
                    if (nl != null && nl.Count > 0)
                    {
                        XmlNode se = nl[0].Attributes.GetNamedItem("UUID");
                        XmlNode fe = nl[0].Attributes.GetNamedItem("FechaTimbrado");
                        if (se != null)
                        {
                            foreach (DocumentoSalida fac in arr)
                            {
                                if (!string.IsNullOrEmpty(fac.Uuid))
                                {
                                    if (se.Value == fac.Uuid)
                                    {
                                        string aux;

                                        /*
                                         * string aux = Directory.GetCurrentDirectory();
                                         * aux = Path.Combine(aux, "Pdfs");*/
                                        aux = Path.Combine(vta.VntCfdi.RutaPdfVnts, fac.Tipo.ToString());
                                        aux = NegocioAdmin.CreaDirs(aux, fac.FechaDoc);

                                        aux = Path.Combine(aux, Path.GetFileName(file));
                                        // string.Format("{0}-{1}.xml", it.ReciboN, it.Uuid));
                                        File.Move(file, aux);

                                        // CreaPdfImprime(false, true, objectSpace);
                                        // NegocioNom.ImprFto("ReciboItem", false, true, NegocioNom.NamePdf(it), it, objectSpace);
                                        fac.Concilia = true;
                                    }
                                }
                            }
                        }
                    }
                }
                objectSpace.CommitChanges();
            }
        }
Beispiel #4
0
        /// <summary>
        /// Finds the application object by replication key.
        /// </summary>
        /// <param name="classType">Type of the class.</param>
        /// <param name="reference">The reference.</param>
        /// <param name="objectSpace">The object space.</param>
        /// <returns>Application object</returns>
        private static object findApplicationObjectByReplicationKey(Type classType,
                                                                    IObjectReference reference, IObjectSpace objectSpace)
        {
            object result     = null;
            var    modelClass = XafDeltaModule.XafApp.FindModelClass(classType);

            if (modelClass != null && reference.ReplicationKey != null)
            {
                var replicationKeyMember             = ExtensionsHelper.GetReplicationKeyMember(modelClass.TypeInfo);
                var replicationKeyIsCaseInsensitive  = modelClass.ReplicationKeyIsCaseInsensitive();
                var replicationKeyIsSpaceInsensitive = modelClass.ReplicationKeyIsSpaceInsensitive();
                if (replicationKeyMember != null)
                {
                    CriteriaOperator opLeft  = new OperandProperty(replicationKeyMember.Name);
                    CriteriaOperator opRight = new OperandValue(reference.ReplicationKey);

                    if (replicationKeyIsCaseInsensitive)
                    {
                        opLeft  = new FunctionOperator(FunctionOperatorType.Upper, opLeft);
                        opRight = new FunctionOperator(FunctionOperatorType.Upper, opRight);
                    }

                    if (replicationKeyIsSpaceInsensitive)
                    {
                        opLeft = new FunctionOperator(FunctionOperatorType.Replace, opLeft,
                                                      new OperandValue(" "), new OperandValue(String.Empty));
                        opRight = new FunctionOperator(FunctionOperatorType.Replace, opRight,
                                                       new OperandValue(" "), new OperandValue(String.Empty));
                    }

                    var keyCriteria = new BinaryOperator(opLeft, opRight, BinaryOperatorType.Equal);
                    if (replicationKeyMember.MemberInfo.IsAliased)
                    {
                        var list = objectSpace.CreateCollection(modelClass.TypeInfo.Type);

                        result = (from c in list.Cast <object>()
                                  let objKeyValue = replicationKeyMember.MemberInfo.GetValue(c)
                                                    where keysMatches(objKeyValue, reference.ReplicationKey,
                                                                      replicationKeyIsCaseInsensitive, replicationKeyIsSpaceInsensitive)
                                                    select c).FirstOrDefault();
                    }
                    else
                    {
                        result = objectSpace.FindObject(classType, keyCriteria, true);
                    }
                }
            }
            return(result);
        }
Beispiel #5
0
        /// <summary>
        /// Finds the application object by replication key.
        /// </summary>
        /// <param name="classType">Type of the class.</param>
        /// <param name="reference">The reference.</param>
        /// <param name="objectSpace">The object space.</param>
        /// <returns>Application object</returns>
        private static object findApplicationObjectByReplicationKey(Type classType, 
            IObjectReference reference, IObjectSpace objectSpace)
        {
            object result = null;
            var modelClass = XafDeltaModule.XafApp.FindModelClass(classType);
            if (modelClass != null && reference.ReplicationKey != null)
            {
                var replicationKeyMember = ExtensionsHelper.GetReplicationKeyMember(modelClass.TypeInfo);
                var replicationKeyIsCaseInsensitive = modelClass.ReplicationKeyIsCaseInsensitive();
                var replicationKeyIsSpaceInsensitive = modelClass.ReplicationKeyIsSpaceInsensitive();
                if (replicationKeyMember != null)
                {

                    CriteriaOperator opLeft = new OperandProperty(replicationKeyMember.Name);
                    CriteriaOperator opRight = new OperandValue(reference.ReplicationKey);

                    if (replicationKeyIsCaseInsensitive)
                    {
                        opLeft = new FunctionOperator(FunctionOperatorType.Upper, opLeft);
                        opRight = new FunctionOperator(FunctionOperatorType.Upper, opRight);
                    }

                    if (replicationKeyIsSpaceInsensitive)
                    {
                        opLeft = new FunctionOperator(FunctionOperatorType.Replace, opLeft,
                            new OperandValue(" "), new OperandValue(String.Empty));
                        opRight = new FunctionOperator(FunctionOperatorType.Replace, opRight,
                            new OperandValue(" "), new OperandValue(String.Empty));
                    }

                    var keyCriteria = new BinaryOperator(opLeft, opRight, BinaryOperatorType.Equal);
                    if(replicationKeyMember.MemberInfo.IsAliased)
                    {
                        var list = objectSpace.CreateCollection(modelClass.TypeInfo.Type);

                        result = (from c in list.Cast<object>()
                                  let objKeyValue = replicationKeyMember.MemberInfo.GetValue(c)
                                  where keysMatches(objKeyValue, reference.ReplicationKey,
                                    replicationKeyIsCaseInsensitive, replicationKeyIsSpaceInsensitive)
                                  select c).FirstOrDefault();
                    }
                    else
                        result = objectSpace.FindObject(classType, keyCriteria, true);
                }
            }
            return result;
        }
Beispiel #6
0
        private void popupWindowShowActionPresupuestoReal_Execute(object sender, DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs e)
        {
            PresupuestoFiltro obj = e.PopupWindowViewCurrentObject as PresupuestoFiltro;

            if (obj != null)
            {
                IObjectSpace       objectSpace = Application.CreateObjectSpace();
                List <MovimientoB> lista;
                GroupOperator      fil  = new GroupOperator();
                Presupuesto        prsu = objectSpace.FindObject <Presupuesto>(null);

                if (prsu != null)
                {
                    decimal suma;
                    foreach (ConceptoP cp in prsu.Partidas)
                    {
                        if (cp.Concepto != null)
                        {
                            fil.Operands.Clear();
                            fil.Operands.Add(CriteriaOperator.And(new BinaryOperator("FechaAplicacion", obj.FchIncl, BinaryOperatorType.GreaterOrEqual),
                                                                  new BinaryOperator("FechaAplicacion", obj.FchFnl, BinaryOperatorType.LessOrEqual)));
                            fil.Operands.Add(new BinaryOperator("Concepto", cp.Concepto));

                            IList col = objectSpace.CreateCollection(typeof(MovimientoB), fil);
                            lista = col.Cast <MovimientoB>().ToList();
                            if (lista != null && lista.Count > 0)
                            {
                                suma     = lista.Sum(item => item.Monto);
                                cp.MntRl = suma;
                            }
                            else
                            {
                                cp.MntRl = 0;
                            }
                        }
                    }

                    IList lis = objectSpace.CreateCollection(typeof(ConceptoB));
                    foreach (ConceptoB cpt in lis)
                    {
                        prsu.Partidas.Filter = new BinaryOperator("Concepto", cpt);
                        if (prsu.Partidas.Count == 0)
                        {
                            fil.Operands.Clear();
                            fil.Operands.Add(CriteriaOperator.And(new BinaryOperator("FechaAplicacion", obj.FchIncl, BinaryOperatorType.GreaterOrEqual),
                                                                  new BinaryOperator("FechaAplicacion", obj.FchFnl, BinaryOperatorType.LessOrEqual)));
                            fil.Operands.Add(new BinaryOperator("Concepto", cpt));

                            IList col = objectSpace.CreateCollection(typeof(MovimientoB), fil);
                            lista = col.Cast <MovimientoB>().ToList();
                            if (lista != null && lista.Count > 0)
                            {
                                suma = lista.Sum(item => item.Monto);

                                ConceptoP cp = objectSpace.CreateObject <ConceptoP>();
                                cp.Concepto = cpt;
                                cp.MntRl    = suma;

                                prsu.Partidas.Add(cp);
                            }
                        }
                    }

                    objectSpace.CommitChanges();
                    View.Refresh(true);
                }
            }
        }