Ejemplo n.º 1
0
 public ActionResult search(int? count, int? intend, string fields)
 {
     List<string> fieldsArray = new List<string>();
     if (fields != null)
         fieldsArray = fields.Split(',').ToList();
     DataBase.Users.CheckFields(null, fieldsArray); ;
     var us = DataBase.Users.search(count, intend, fieldsArray);
     return Json(us, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 2
0
 public ActionResult getbyid(int[] id, string fields)
 {
     List<string> fieldsArray = new List<string>();
     if(fields!=null)
         fieldsArray = fields.Split(',').ToList();
     if (!DataBase.Users.CheckFields(id, fieldsArray))
         return BadRequest("Check your parameters.");
     var us = DataBase.Users.getbyid(id, fieldsArray);
     if (us.Count() == 1 && us.Count()!=0)
         return Json(us.ElementAt(0), JsonRequestBehavior.AllowGet);
     return Json(us, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 3
0
Archivo: List.cs Proyecto: kioltk/mvc
        public static IEnumerable<SelectListItem> SelectCity(int lid, int? selectedCity)
        {
            List<SelectListItem> requestedList = new List<SelectListItem>();
            var requestedCities = Server.DataBase.City.Get().Select(x => new CityView(x) { lid = lid });

            requestedList.Add(new SelectListItem() { Value = "", Text = GlobalRes.City, Selected = true });
            foreach (var city in requestedCities)
            {
                requestedList.Add(new SelectListItem() { Value = city.id.ToString(), Text = city.name, Selected = false });
            }

            if (selectedCity.HasValue)
            {

                SelectListItem selectedCityItem = requestedList.Find(x => x.Value == selectedCity.Value.ToString());
                if (selectedCityItem != null)
                    selectedCityItem.Selected = true;

            }

            return requestedList;
        }
Ejemplo n.º 4
0
Archivo: List.cs Proyecto: kioltk/mvc
        public static IEnumerable<SelectListItem> SelectLanguage(int? selectedLanguage)
        {
            List<SelectListItem> requestedList = new List<SelectListItem>();
            var requestedLanguages = Server.DataBase.Languages.Get();

            requestedList.Add(new SelectListItem() { Value = "", Text = GlobalRes.Language, Selected = true });
            foreach (var language in requestedLanguages)
            {
                requestedList.Add(new SelectListItem() { Value = language.LCID.ToString(), Text = language.name, Selected = false });
            }

            if (selectedLanguage.HasValue)
            {

                SelectListItem selectedLanguageItem = requestedList.Find(x => x.Value == selectedLanguage.Value.ToString());
                if (selectedLanguageItem != null)
                    selectedLanguageItem.Selected = true;

            }

            return requestedList;
        }
 public UpdateSummary()
 {
     ErrorAsins = new List<string>();
 }
Ejemplo n.º 6
0
 public DialogView()
 {
     List = new List<MessageView>();
 }
Ejemplo n.º 7
0
            public static IEnumerable<User> getbyid(int[] ids, List<string> fields)
            {
                var us = context.users.Where(x => ids.Contains(x.ID));

                return us.Select(u => new User(u, fields)).ToArray();
            }
Ejemplo n.º 8
0
 public ActionResult getbyid(int[] id, string fields)
 {
     List<string> fieldsArray = new List<string>();
     if (fields != null)
         fieldsArray = fields.Split(',').ToList();
     if (!DataBase.Missions.CheckFields(id, fieldsArray))
         return Forbidden("");
     var qs = DataBase.Missions.getbyid(id, fieldsArray);
     if (id.Count() == 1 && qs.Count()!=0)
         return Json(qs.ElementAt(0), JsonRequestBehavior.AllowGet);
     return Json(qs, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 9
0
 public Mission(mission m, List<string> fields)
 {
     _m = m;
     _fields.AddRange(fields) ;
 }
Ejemplo n.º 10
0
            public static IEnumerable<Mission> getbyuid(int uid, int? count, int? indent, List<string> fields)
            {
                var miss = context.mission.Where(x => x.ID == uid);
                miss.Skip(indent.GetValueOrDefault()).Take(count.GetValueOrDefault(20));

                return miss.Select(q => new Mission(q, fields));
            }
Ejemplo n.º 11
0
 public static IEnumerable<Mission> getbyid(int[] ids, List<string> fields)
 {
     var miss = context.mission.Where(x => ids.Contains(x.ID));
     return miss.Select(q => new Mission(q, fields));
 }
Ejemplo n.º 12
0
 public static IEnumerable<Mission> getbydate(int date, int? count, int? indent, List<string> fields)
 {
     var miss = context.mission.TakeWhile(x => x.date > date);
     miss.Skip(indent.GetValueOrDefault()).Take(count.GetValueOrDefault(20));
     return miss.Select(q => new Mission(q, fields));
 }
Ejemplo n.º 13
0
            public static void CorrectFields(List<string> fields)
            {
                var cfields = fields.ToArray();

                if (fields == null)
                    fields = new List<string>();
                else
                    foreach (string field in cfields)
                    {
                        if (!permissed_fields.Contains(field))
                        {
                            if (!string.IsNullOrWhiteSpace(field))
                                fields.Remove(field);
                        }
                    }
            }
Ejemplo n.º 14
0
 public static bool CheckFields(int[] id, List<string> fields)
 {
     if ((id == null) || (id.Count() < 1))
         return false;
     CorrectFields(fields);
     return true;
 }
Ejemplo n.º 15
0
            public static IEnumerable<User> search(int? count, int? intend, List<string> fields)
            {
                var us = context.users;
                us.Skip(intend.GetValueOrDefault()).Take(count.GetValueOrDefault(20));

                return us.Select(u => new User(u, fields));
            }
Ejemplo n.º 16
0
Archivo: User.cs Proyecto: kioltk/mvc
 public User(users u, List<string> fields)
 {
     _u = u;
     _fields.AddRange(fields);
 }
        private List<Product> GetProductsByIds(BagsContext dbContext, List<int> ids)
        {
            try
            {
                return dbContext.Products
                                .Include(p => p.AmazonProduct)
                                .Where(pr => ids.Contains(pr.Id))//gets converted to IN clause
                                .ToList();

            }
            catch (Exception ex)
            {
                _telemetryClient.TrackException(ex, new Dictionary<string, string>()
                {
                    {"Source", "GetProductsByIds" },
                    {"Update#" ,_updatesCount.ToString()}
                });

                return null;
            }
        }
Ejemplo n.º 18
0
 public DialogsView()
 {
     List = new List<DialogView>();
 }
Ejemplo n.º 19
0
 public ActionResult getbycategory(int cid, int? count, int? indent, string fields)
 {
     List<string> fieldsArray = new List<string>();
     if (fields != null)
         fieldsArray = fields.Split(',').ToList();
     DataBase.Missions.CorrectFields(fieldsArray);
     var qs = DataBase.Missions.getbycid(cid, count, indent, fieldsArray);
     return Json(qs, JsonRequestBehavior.AllowGet);
 }
Ejemplo n.º 20
0
 public InvitesWeb(List<Models.Invites> list)
 {
     users = list.Select(x => x.email).ToArray();
     referals = list.Select(x => x.refer).ToArray();
     counts = new int[users.Count()];
     for (int i = 0; i < users.Count(); i++)
     {
         int size = referals.Count(x => x == users[i]);
        /* string color = "#000000";
         switch (list[i].lang)
         {
             case "en":
                 color = "#" + (size * 45 + 16).ToString("X") + "0000";
                 break;
             case "ru":
                 color = "#" + "00" + (size * 45 + 16).ToString("X") + "00";
                 break;
             case "he":
                 color = "#" + "0000" + (size * 45 + 16).ToString("X");
                 break;
         }*/
         counts[i] = size + 1;
     }
 }