public place[] getPlacesByKeyword(string str)
        {
            String sql = "from place p where ";
            int    id  = 1;

            {
                string       cats = HttpUtility.UrlDecode(str);
                IList <tags> c    = ActiveRecordBase <tags> .FindAllByProperty("name", cats);

                if (c.Count > 0)
                {
                    sql += " :p" + id + " in elements(p.tags) ";
                    id   = id + 1;
                    sql += " or ";
                }
            }
            sql += " 1=0 ";
            sql += " ORDER BY p.prime_name ASC ";
            SimpleQuery <place> q = new SimpleQuery <place>(typeof(place), sql);

            id = 1;
            {
                string       cats = HttpUtility.UrlDecode(str);
                IList <tags> c    = ActiveRecordBase <tags> .FindAllByProperty("name", cats);

                if (c.Count > 0)
                {
                    q.SetParameter("p" + id, c[0]);
                    id = id + 1;
                }
            }
            place[] items = q.Execute();
            return(items);
        }
Ejemplo n.º 2
0
        public bool Perform(ExecuteWhen exec, IEngineContext context, IController controller, IControllerContext controllerContext)
        {
            var controllerBase = controller as ControllerBase;

            if (controllerBase == null)
            {
                throw new InvalidOperationException("The controller must derive from ControllerBase to use the AuthenticationFilter.");
            }

            var token = context.Session["token"] as Guid?;

            if (token.HasValue)
            {
                User user = ActiveRecordBase <User> .FindAllByProperty("Token", token).FirstOrDefault();

                if (user != null)
                {
                    controllerBase.CurrentUser = user;
                    controllerBase.PropertyBag["currentUser"] = user;
                    return(true);
                }
            }

            context.Flash["notice"] = "You have been logged out due to inactivity.";
            context.Response.Redirect("Sessions", "New");
            return(false);
        }
Ejemplo n.º 3
0
        public void natetest()
        {
            //Authentication.authenticate();
            users user = userService.getUserFull();
            // IList<place> places = user.getUserPlaces(1, 5);
            // PropertyBag["places"] = places;


            IList <place> temp = new List <place>();

            place[] erroredPlaces = ActiveRecordBase <place> .FindAllByProperty("outputError", true);

            PropertyBag["erroredPlaces"] = erroredPlaces;



            //  PropertyBag["user"] = user;
            IList <users> activeUser = new List <users>();

            users[] _authors = ActiveRecordBase <users> .FindAllByProperty("loggedin", true);

            foreach (users _author in _authors)
            {
                if (_author != null && _author.LastActive > DateTime.Today.AddHours(-1))
                {
                    activeUser.Add(_author);
                }
            }
            PropertyBag["activeUsers"] = activeUser;
            RenderView("../admin/splash");
        }
        public static object[] alias_exsits(String alias, String typeName)
        {
            object[] temp = new object[] { };
            try {
                /*
                 * the switch should be replaced.  There has to be a way to
                 * make the class for ActiveRecordBase<> be called by
                 * (string)name
                 */
                string type = typeName.Replace("Controller", "");
                switch (type)
                {
                case "place": {
                    temp = ActiveRecordBase <place> .FindAllByProperty("alias", alias); break;
                }

                case "styles": {
                    temp = ActiveRecordBase <styles> .FindAllByProperty("alias", alias); break;
                }

                case "view": {
                    temp = ActiveRecordBase <map_views> .FindAllByProperty("alias", alias); break;
                }

                case "geometrics": {
                    temp = ActiveRecordBase <geometrics> .FindAllByProperty("alias", alias); break;
                }
                }
            } catch { }

            return(temp);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Retrieves the list of character relations of a character
 /// </summary>
 /// <param name="charLowId">The character Id</param>
 /// <returns>The list of relations of the character.</returns>
 public static BaseRelation[] GetByCharacterId(uint charLowId)
 {
     return(ActiveRecordBase <CharacterRelationRecord> .FindAllByProperty(
                "_characterId", (long)charLowId)
            .Select(
                crr => RelationMgr.CreateRelation(crr))
            .ToArray());
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Retrieves the list of character relations of a character
 /// </summary>
 /// <param name="charLowId">The character Id</param>
 /// <returns>The list of relations of the character.</returns>
 public static BaseRelation[] GetByCharacterId(uint charLowId)
 {
     return(((IEnumerable <CharacterRelationRecord>)ActiveRecordBase <CharacterRelationRecord> .FindAllByProperty(
                 "_characterId", (object)(long)charLowId))
            .Select <CharacterRelationRecord, BaseRelation>(
                (Func <CharacterRelationRecord, BaseRelation>)(crr => RelationMgr.CreateRelation(crr)))
            .ToArray <BaseRelation>());
 }
        /// <summary>
        /// Finds records based on a property value - automatically converts null values to IS NULL style queries.
        /// </summary>
        /// <param name="orderByColumn">The column name to be ordered ASC</param>
        /// <param name="property">A property name (not a column name)</param>
        /// <param name="value">The value to be equals to</param>
        /// <returns></returns>
        public T[] FindAllByProperty(String orderByColumn, String property, object value)
        {
            DetachedCriteria crit = DetachedCriteria.For <T>();

            FiltraEmpresaEstab(crit);
            crit.Add(Expression.Eq(property, value));
            crit.AddOrder(Order.Asc(orderByColumn));
            return(ActiveRecordBase <T> .FindAllByProperty(orderByColumn, property, value));
        }
Ejemplo n.º 8
0
        public static Asda2FishingBook[] LoadAll(Character chr)
        {
            Asda2FishingBook[] allByProperty =
                ActiveRecordBase <Asda2FishingBook> .FindAllByProperty("OwnerId", (object)chr.EntityId.Low);

            foreach (Asda2FishingBook asda2FishingBook in allByProperty)
            {
                asda2FishingBook.InitAfterLoad();
            }
            return(allByProperty);
        }
Ejemplo n.º 9
0
        public static void Registro()
        {
            foreach (var archivo in ActiveRecordBase <ConsumoDto> .FindAllByProperty("Procesado", false))
            {
                var documento = HelperPersona.GetPersona(
                    archivo.Cuit, archivo.TipoCliente,
                    archivo.RazonSocial, archivo.NombrePersona,
                    archivo.NroDocumento, archivo.Empresa);

                var cliente = HelperCuenta.GetCuenta(
                    archivo.Cuit, archivo.NroDocumento, archivo.Empresa);

                using (var transac = new TransactionScope())
                    try
                    {
                        var puntos = HelperPuntos.GetPuntos(archivo.Empresa, archivo.FechaHoraComprobante,
                                                            archivo.ImportePesosNetoImpuestos);

                        double acelerador = Double.Parse(archivo.Coeficiente) / 100;
                        puntos = acelerador > 0 ? acelerador * puntos : puntos;

                        var cuenta = new CuentaCorrienteDto
                        {
                            FechaCompra = archivo.FechaHoraComprobante.Date,
                            HoraCompra  = DateTime.Now,
                            Key         = new KeyCuenta
                            {
                                CodEmpresa        = archivo.Empresa,
                                NumeroComprobante = archivo.NroComprobante
                            },
                            MontoCompra     = archivo.ImportePesosNetoImpuestos,
                            Movimiento      = puntos >= 0 ? HelperMovimiento.FindMovimiento("Suma De Puntos") : HelperMovimiento.FindMovimiento("Anulación Carga"),
                            NumeroDocumento = documento,
                            NumeroCuenta    = cliente,
                            Puntos          = puntos,
                            Sucursal        = HelperSucursal.GetSucursal(),
                            Usuario         = "web",
                            Programa        = archivo.Programa,
                            Secretaria      = archivo.Secretaria,
                            Coeficiente     = archivo.Coeficiente
                        };
                        cuenta.Save();
                        transac.VoteCommit();
                    }
                    catch (Exception ex)
                    {
                        archivo.Error = ex.Message;
                        Log.Fatal(ex);
                        transac.VoteRollBack();
                    }
                archivo.Procesado = true;
                archivo.Save();
            }
        }
Ejemplo n.º 10
0
        public static Asda2PetRecord[] LoadAll(Character owner)
        {
            Asda2PetRecord[] allByProperty =
                ActiveRecordBase <Asda2PetRecord> .FindAllByProperty("OwnerId", (object)owner.EntityId.Low);

            foreach (Asda2PetRecord asda2PetRecord in allByProperty)
            {
                asda2PetRecord.Init(owner);
            }
            return(allByProperty);
        }
Ejemplo n.º 11
0
        public static Asda2MailMessage[] LoadAll(Character chr)
        {
            Asda2MailMessage[] allByProperty =
                ActiveRecordBase <Asda2MailMessage> .FindAllByProperty("RecieverId", (object)chr.EntityId.Low);

            foreach (Asda2MailMessage asda2MailMessage in allByProperty)
            {
                asda2MailMessage.Init();
            }
            return(allByProperty);
        }
Ejemplo n.º 12
0
        public static FunctionItemBuff[] LoadAll(Character chr)
        {
            FunctionItemBuff[] allByProperty =
                ActiveRecordBase <FunctionItemBuff> .FindAllByProperty("OwnerId", (object)chr.EntityId.Low);

            foreach (FunctionItemBuff functionItemBuff in allByProperty)
            {
                functionItemBuff.InitAfterLoad();
            }
            return(allByProperty);
        }
Ejemplo n.º 13
0
 public static SummonedPetRecord[] LoadSummonedPetRecords(uint ownerId)
 {
     try
     {
         return(ActiveRecordBase <SummonedPetRecord> .FindAllByProperty("_OwnerLowId", (object)(int)ownerId));
     }
     catch (Exception ex)
     {
         RealmDBMgr.OnDBError(ex);
         return(ActiveRecordBase <SummonedPetRecord> .FindAllByProperty("_OwnerLowId", (object)(int)ownerId));
     }
 }
Ejemplo n.º 14
0
 public static Asda2DonationItem[] LoadAll(Character chr)
 {
     Asda2DonationItem[] array =
         ((IEnumerable <Asda2DonationItem>)ActiveRecordBase <Asda2DonationItem> .FindAllByProperty("RecieverId",
                                                                                                   (object)chr.EntryId)).Where <Asda2DonationItem>((Func <Asda2DonationItem, bool>)(d => !d.Recived))
         .ToArray <Asda2DonationItem>();
     foreach (Asda2DonationItem asda2DonationItem in array)
     {
         asda2DonationItem.Init();
     }
     return(array);
 }
Ejemplo n.º 15
0
        /// <summary>Init a loaded Rank</summary>
        internal void InitRank()
        {
            this.m_BankTabRights =
                ActiveRecordBase <GuildBankTabRights> .FindAllByProperty("m_GuildRankId", (object)this._id);

            int length = this.m_BankTabRights.Length;

            Array.Resize <GuildBankTabRights>(ref this.m_BankTabRights, 6);
            for (int tabId = length; tabId < this.m_BankTabRights.Length; ++tabId)
            {
                this.m_BankTabRights[tabId] = new GuildBankTabRights(tabId, (uint)this._id);
            }
        }
Ejemplo n.º 16
0
        /// <summary>Init a loaded Rank</summary>
        internal void InitRank()
        {
            m_BankTabRights =
                ActiveRecordBase <GuildBankTabRights> .FindAllByProperty("m_GuildRankId", _id);

            int length = m_BankTabRights.Length;

            Array.Resize(ref m_BankTabRights, 6);
            for (int tabId = length; tabId < m_BankTabRights.Length; ++tabId)
            {
                m_BankTabRights[tabId] = new GuildBankTabRights(tabId, (uint)_id);
            }
        }
Ejemplo n.º 17
0
        public static List <Asda2FriendshipRecord> LoadAll(uint characterId)
        {
            Asda2FriendshipRecord[] allByProperty1 =
                ActiveRecordBase <Asda2FriendshipRecord> .FindAllByProperty("FirstCharacterAccId", (object)characterId);

            Asda2FriendshipRecord[] allByProperty2 =
                ActiveRecordBase <Asda2FriendshipRecord> .FindAllByProperty("SecondCharacterAccId", (object)characterId);

            List <Asda2FriendshipRecord> friendshipRecordList = new List <Asda2FriendshipRecord>();

            friendshipRecordList.AddRange((IEnumerable <Asda2FriendshipRecord>)allByProperty1);
            friendshipRecordList.AddRange((IEnumerable <Asda2FriendshipRecord>)allByProperty2);
            return(friendshipRecordList);
        }
        private static ParentescoDto GetParentesco(string desc)
        {
            var parentesco = ActiveRecordBase <ParentescoDto>
                             .FindAllByProperty("Descripccion", desc);

            if (parentesco.Length > 0)
            {
                return(parentesco[0]);
            }
            var nuevo = new ParentescoDto(desc);

            nuevo.Save();
            return(nuevo);
        }
Ejemplo n.º 19
0
        /// <summary> </summary>
        public static appuser setUser()
        {
            String  uname = getNid();
            appuser user  = null;

            if (!String.IsNullOrWhiteSpace(uname))
            {
                try {
                    user = ActiveRecordBase <appuser> .FindAllByProperty("nid", uname).FirstOrDefault();
                } catch { return(null); }
            }
            //HttpContext.Current.Session["you"] = user;
            return(user);
        }
        public void aliasCheck(String alias)
        {
            IList <map_views> c = ActiveRecordBase <map_views> .FindAllByProperty("alias", alias);

            if (c.Count > 0)
            {
                RenderText("false");
            }
            else
            {
                RenderText("true");
            }
            return;
        }
Ejemplo n.º 21
0
        public static List <Asda2SoulmateRelationRecord> GetSoulmateRecords(uint accId)
        {
            List <Asda2SoulmateRelationRecord> soulmateRelationRecordList = new List <Asda2SoulmateRelationRecord>();

            Asda2SoulmateRelationRecord[] allByProperty1 =
                ActiveRecordBase <Asda2SoulmateRelationRecord> .FindAllByProperty("AccId", accId);

            Asda2SoulmateRelationRecord[] allByProperty2 =
                ActiveRecordBase <Asda2SoulmateRelationRecord> .FindAllByProperty("RelatedAccId", accId);

            soulmateRelationRecordList.AddRange(allByProperty1);
            soulmateRelationRecordList.AddRange(allByProperty2);
            return(soulmateRelationRecordList);
        }
        public bool placesExistByType(string type)
        {
            List <AbstractCriterion> baseEx = new List <AbstractCriterion>();

            baseEx.Add(Expression.Eq("Status", ActiveRecordBase <status> .Find(3)));
            baseEx.Add(Expression.Gt("placeType", ActiveRecordBase <place_types> .FindAllByProperty("Name", type)));
            place[] places = ActiveRecordBase <place> .FindAll(baseEx.ToArray());

            if (places.Length > 0)
            {
                return(true);
            }
            return(false);
        }
        public static MovimientoDto FindMovimiento(string desc)
        {
            var movimiento = ActiveRecordBase <MovimientoDto>
                             .FindAllByProperty("Descripccion", desc);

            if (movimiento.Length > 0)
            {
                return(movimiento[0]);
            }

            var nuevo = new MovimientoDto(desc);

            nuevo.Save();
            return(nuevo);
        }
Ejemplo n.º 24
0
        /// <summary> </summary>
        public void admin()
        {
            appuser user = userService.getUserFull();

            if (user != null)
            {
                IList <posting> events = user.getUserPostings(5);
                PropertyBag["events"] = events;

                IList <posting> temp = new List <posting>();

                posting[] erroredEvents = ActiveRecordBase <posting> .FindAll().Where(x => x.outputError != null).ToArray();

                PropertyBag["erroredEvents"] = erroredEvents;

                //PropertyBag["user"] = user;
                IList <appuser> activeUser = new List <appuser>();
                appuser[]       _users     = ActiveRecordBase <appuser> .FindAllByProperty("logedin", true);

                if (_users.ToList().Count > 0)
                {
                    foreach (appuser _user in _users)
                    {
                        if (_user != null && _user.last_active > DateTime.Today.AddHours(-1))
                        {
                            activeUser.Add(_user);
                        }
                    }
                    PropertyBag["activeUsers"] = activeUser;
                }

                /*ExchangeService _service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);
                 * _service.Credentials = new WebCredentials("jeremy.bass", "bA03s17s82!");
                 * _service.AutodiscoverUrl("*****@*****.**");*/
                IList <Appointment> tmp = new List <Appointment>();

                /*CalendarView calendarView = new CalendarView(DateTime.Now, DateTime.Now.AddDays(5));
                 * foreach (Appointment appointment in _service.FindAppointments(WellKnownFolderName.Calendar, calendarView)) {
                 *  tmp.Add(appointment);
                 * }*/
                PropertyBag["ExchangeService"] = tmp;
                PropertyBag["activeUsers"]     = activeUser;
                //PropertyBag["analytics"] = seoService.getGAAnalytics();
            }
            //switch to the theme based one so there is customized dashboard
            RenderView("../admin/splash");
        }
Ejemplo n.º 25
0
        /// <summary>Gets the characters for the given account.</summary>
        /// <param name="account">the account</param>
        /// <returns>a collection of character objects of the characters on the given account</returns>
        public static CharacterRecord[] FindAllOfAccount(int accId)
        {
            CharacterRecord[] allByProperty;
            try
            {
                allByProperty =
                    ActiveRecordBase <CharacterRecord> .FindAllByProperty("Created", "AccountId", (object)accId);

                foreach (CharacterRecord characterRecord in allByProperty)
                {
                    characterRecord.LoadItems();
                }
            }
            catch (Exception ex)
            {
                RealmDBMgr.OnDBError(ex);
                allByProperty =
                    ActiveRecordBase <CharacterRecord> .FindAllByProperty("Created", "AccountId", (object)accId);
            }

            return(allByProperty);
        }
Ejemplo n.º 26
0
        /// <summary>
        ///
        /// </summary>
        internal GuildBank(Guild guild, bool isNew)
        {
            this.Guild   = guild;
            this.BankLog = new GuildBankLog(this);
            if (isNew)
            {
                this.bankTabs = new GuildBankTab[1]
                {
                    new GuildBankTab(this)
                    {
                        BankSlot = 0,
                        Icon     = "",
                        Name     = "Slot 0",
                        Text     = ""
                    }
                };
            }
            else
            {
                this.bankTabs = ActiveRecordBase <GuildBankTab> .FindAllByProperty("_guildId", (object)(int)guild.Id);

                this.BankLog.LoadLogs();
            }
        }
Ejemplo n.º 27
0
 public static GuildEventLogEntry[] FindAll(Guild guild)
 {
     return(ActiveRecordBase <GuildEventLogEntry> .FindAllByProperty("m_GuildId", (object)(int)guild.Id));
 }
Ejemplo n.º 28
0
 public static SpellRecord[] LoadAllRecordsFor(uint lowId)
 {
     return(ActiveRecordBase <SpellRecord> .FindAllByProperty("m_ownerId", (object)(int)lowId));
 }
        public void Update([ARDataBind("advertisement", Validate = true, AutoLoad = AutoLoadBehavior.NewInstanceIfInvalidKey)] advertisement advertisement,
                           [ARDataBind("tags", Validate = true, AutoLoad = AutoLoadBehavior.NewInstanceIfInvalidKey)] tags[] tags, String[] newtag,
                           [ARDataBind("images", Validate = true, AutoLoad = AutoLoadBehavior.NewInstanceIfInvalidKey)] media_repo[] images)
        {
            if (advertisement.HtmlText == null && (advertisement.Url == null && images.Length == 0))
            {
                Flash["error"] = "You may not set a empty advertisment";
                RedirectToReferrer();
                return;
            }
            //string output = JsonConvert.SerializeObject(advertisement.limitAds);

            advertisement.Tags.Clear();
            advertisement.Images.Clear();
            try
            {
                if (newtag != null)
                {
                    foreach (String oneTag in newtag)
                    {
                        if (oneTag != "")
                        {
                            tags t = new tags();
                            t.name = oneTag;
                            tags[] temp = ActiveRecordBase <tags> .FindAllByProperty("Name", oneTag);

                            if (temp.Length == 0)
                            {
                                ActiveRecordMediator <tags> .Save(t);

                                advertisement.Tags.Add(t);
                            }
                        }
                    }
                }



                foreach (tags tag in tags)
                {
                    if (tag.id > 0)
                    {
                        advertisement.Tags.Add(tag);
                    }
                }

                foreach (media_repo image in images)
                {
                    if (image.id > 0)
                    {
                        advertisement.Images.Add(image);
                    }
                }

                /*if (advertisement.Location.id == 0)
                 * {
                 *  advertisement.Location.id = 2;
                 * }*/

                ActiveRecordMediator <advertisement> .Save(advertisement);
            }


            catch (Exception ex)
            {
                Flash["error"]         = ex.Message;
                Flash["advertisement"] = advertisement;
            }
            RedirectToAction("list");
        }
Ejemplo n.º 30
0
 public static PersistentSpellCategoryCooldown[] LoadCategoryCooldownsFor(uint lowId)
 {
     return(ActiveRecordBase <PersistentSpellCategoryCooldown> .FindAllByProperty("_charId", (object)(int)lowId));
 }