예제 #1
0
        public async void GetSy()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                WebClientClass wc = new WebClientClass();
                // http://live.bilibili.com/area/liveList?area=/movie&order=online&page=1
                string results = await wc.GetResults(new Uri("http://live.bilibili.com/area/liveList?area=mobile-game&order=online&page=1"));

                InfoModel data = JsonConvert.DeserializeObject <InfoModel>(results);
                //JObject json = JObject.Parse(results);
                List <InfoModel> model = JsonConvert.DeserializeObject <List <InfoModel> >(data.data.ToString());
                foreach (InfoModel item in model)
                {
                    live_Sy.Items.Add(item);
                }
                Sy = true;
            }
            catch (Exception)
            {
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
예제 #2
0
        public IHttpActionResult Get() {

            var model = new InfoModel {
                InMemoryDbInitialised = _connectionManager.InMemoryDbInitialised
            };
            return Ok(model);
        }
예제 #3
0
        public async Task GetYCRank()
        {
            try
            {
                wc = new WebClientClass();
                string results = await wc.GetResults(new Uri("http://www.bilibili.com/index/rank/origin-03.json"));

                InfoModel        model  = JsonConvert.DeserializeObject <InfoModel>(results);
                InfoModel        model1 = JsonConvert.DeserializeObject <InfoModel>(model.rank.ToString());
                List <InfoModel> ls     = JsonConvert.DeserializeObject <List <InfoModel> >(model1.list.ToString());
                List <InfoModel> ReList = new List <InfoModel>();
                for (int i = 0; i < 30; i++)
                {
                    if (i < 3)
                    {
                        ls[i].forColor = bg;
                    }
                    ls[i].num = i + 1;
                    ReList.Add(ls[i]);
                }
                QQ_Rank_YC.ItemsSource = ReList;
            }
            catch (Exception ex)
            {
                MessageDialog md = new MessageDialog(ex.Message);
                await md.ShowAsync();
            }
        }
예제 #4
0
        // Scanner Listener
        public void OnFileScanned(InfoModel report)
        {
            // Check not send reports
            List <NetScanJob> netScanJobs = new List <NetScanJob>();

            foreach (string file in Directory.EnumerateFiles(FileHandler.REPORT_ARCHIVE))
            {
                try
                {
                    byte[]     encReport  = FileHandler.ReadTextFromFile(file);
                    byte[]     decReport  = DataProtection.Unprotect(encReport);
                    string     content    = Encoding.UTF8.GetString(decReport);
                    InfoModel  infoModel  = JsonConvert.DeserializeObject <InfoModel>(content);
                    NetScanJob netScanJob = new NetScanJob(report);
                    netScanJobs.Add(netScanJob);
                    FileHandler.DeleteFile(file);
                }
                catch (Exception ex)
                {
                }
            }

            netScanJobs.Add(new NetScanJob(report));
            foreach (NetScanJob job in netScanJobs)
            {
                mNetworking.ExecuteAsync(job);
            }
        }
예제 #5
0
        public async Task GetYCRank()
        {
            try
            {
                WebClientClass wc      = new WebClientClass();
                string         results = await wc.GetResults(new Uri("http://api.bilibili.com/list?appkey=422fd9d7289a1dd9&order=hot&original=1&page=1&pagesize=20"));

                InfoModel model = new InfoModel();
                model = JsonConvert.DeserializeObject <InfoModel>(results);
                JObject json = JObject.Parse(model.list.ToString());
                QQ_Rank_YC.Items.Clear();
                List <InfoModel> ReList = new List <InfoModel>();
                for (int i = 0; i < 20; i++)
                {
                    ReList.Add(new InfoModel
                    {
                        aid          = (string)json[i.ToString()]["aid"],
                        title        = (string)json[i.ToString()]["title"],
                        pic          = (string)json[i.ToString()]["pic"],
                        author       = (string)json[i.ToString()]["author"],
                        play         = (string)json[i.ToString()]["play"],
                        video_review = (string)json[i.ToString()]["video_review"],
                        num          = i + 1
                    });
                }
                QQ_Rank_YC.ItemsSource = ReList;
            }
            catch (Exception ex)
            {
                MessageDialog md = new MessageDialog(ex.Message);
                await md.ShowAsync();
            }
        }
예제 #6
0
        public HttpResponseMessage GetInfo()
        {
            SalaAccess sala = new SalaAccess();

            ErrorReader errorReader = new ErrorReader();

            string userId = RequestContext.Principal.Identity.GetUserId();

            int idSala = sala.GetIdSala(userId);

            if (idSala == 0)
            {
                var       message = string.Format(errorReader.GetErrorMessage(9));
                HttpError err     = new HttpError(message);
                return(Request.CreateResponse(errorReader.GetError(9), err));
            }
            else
            {
                string nomeSala = sala.GetNomeSala(idSala);
                bool   isOnwer  = sala.IsOwner(idSala, userId);

                InfoModel model = new InfoModel();
                model.Id      = idSala;
                model.Nome    = nomeSala;
                model.isOwner = isOnwer;

                return(Request.CreateResponse(HttpStatusCode.OK, model));
            }
        }
        public ActionResult Delete(string username)
        {
            MembershipUserModel user = membershipUserRepository.Repository.FirstOrDefault(x => x.UserName == username);
            if (user != null)
            {
                DeleteObjectByName model = new DeleteObjectByName();
                model.Description = "Czy napewno chcesz usunąć użytkownika: " + user.UserName + "?";
                model.Name = user.UserName;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("MembershipUser/_MembershipUserDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany użytkownik nie istnieje",
                    Action = "Index",
                    Controller = "MembershipUser"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
예제 #8
0
        public async Task <IActionResult> Index(InfoModel model)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var       userId  = _db._httpContextAccessor.HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                    InfoModel dbModel = await _db.InfoModels.FindAsync(model.Id);



                    if (dbModel == null)
                    {
                        //create new
                        _db.InfoModels.Add(model);
                    }
                    else
                    {
                        var FromDb = await _db.InfoModels.FindAsync(model.Id);

                        FromDb.Name     = model.Name;
                        FromDb.Email    = model.Email;
                        FromDb.uID      = userId;
                        FromDb.Location = model.Location;
                    }

                    await _db.SaveChangesAsync();
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View(model));
            }
        }
예제 #9
0
 public async Task GetQZRank()
 {
     try
     {
         
             WebClientClass wc = new WebClientClass();
             string results = await wc.GetResults(new Uri("http://api.bilibili.cn/list?appkey=84b739484c36d653&order=hot&original=0&page=1&pagesize=20"));
             InfoModel model = new InfoModel();
             model = JsonConvert.DeserializeObject<InfoModel>(results);
             JObject json = JObject.Parse(model.list.ToString());
             QQ_Rank_QZ.Items.Clear();
             List<InfoModel> ReList = new List<InfoModel>();
             for (int i = 0; i < 20; i++)
             {
                 ReList.Add(new InfoModel
                 {
                     aid = (string)json[i.ToString()]["aid"],
                     title = (string)json[i.ToString()]["title"],
                     pic = (string)json[i.ToString()]["pic"],
                     author = (string)json[i.ToString()]["author"],
                     play = (string)json[i.ToString()]["play"],
                     video_review = (string)json[i.ToString()]["video_review"],
                     num = i + 1
                 });
             }
             QQ_Rank_QZ.ItemsSource = ReList;
     }
     catch (Exception ex)
     {
         MessageDialog md = new MessageDialog(ex.Message);
         await md.ShowAsync();
     }
 }
예제 #10
0
        /// <summary>
        ///     检查用户信息输入合法性
        /// </summary>
        /// <param name="info">用户信息模型</param>
        /// <param name="checkContactUsed">是否检查手机号重复</param>
        /// <param name="password">注册和修改时检查密码</param>
        /// <exception cref="Exception">问题字段</exception>
        public static void InfoCheck(InfoModel info, bool checkContactUsed, string password = null)
        {
            try
            {
                if (info.Contact != null)
                {
                    IsHandset(info.Contact);
                    if (checkContactUsed)
                    {
                        HandsetUsed(info.Contact);
                    }
                }

                if (info.Gender != null)
                {
                    IsValidGender(info.Gender);
                }
                if (info.Name != null)
                {
                    IsValidUsername(info.Name);
                }
                if (password != null)
                {
                    IsValidPassword(password);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #11
0
        private TPConnector initConnector(InfoModel info)
        {
            var headers = new Dictionary <String, String>();

            headers.Add("Authorization", info.ApiKey);
            return(new TPConnector(TPConnector.developerEndpoint, headers));
        }
예제 #12
0
        protected JsonModel GetException(Exception ex)
        {
            JsonModel resultModel = new JsonModel()
            {
                Code = -1
            };
            InfoModel errormodel = new InfoModel()
            {
                Title = "错误", Code = -1
            };
            var wcfException = ex as FaultException <ExceptionDetail>;

            if (wcfException != null)
            {
                errormodel.Message = GetWcfExceptionDetail(wcfException.Detail);
                errormodel.Type    = wcfException.Detail.HelpLink;
                string notepad = FormmatException(wcfException.StackTrace, wcfException.Message);
            }
            if (HttpContext.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
            {
                JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                resultModel.Data = "createDialog('" + Url.Content("~/base/exception") + "'," + jsonSerializer.Serialize(errormodel) + ")";
            }
            else
            {
                JavaScriptSerializer jsonSerializer = new JavaScriptSerializer();
                resultModel.Data = "redirected('" + Url.Content("~/Views/Template/ExceptionPage.cshtml") + "'," + jsonSerializer.Serialize(errormodel) + ")";
            }
            return(resultModel);
        }
예제 #13
0
        public ActionResult Display(string ip, int port)
        {
            System.Net.IPAddress p;
            if (System.Net.IPAddress.TryParse(ip, out p) == false)
            {
                // Load Travel
                ViewBag.Filename  = ip;
                ViewBag.Frequency = port;

                return(View("LoadTravel"));
            }
            //get it by the else
            else
            {
                // Display
                InfoModel infoModel = InfoModel.Instance;
                infoModel.Connect(ip, port);

                ViewBag.Coordinate = infoModel.GetCoordinate();

                infoModel.Disconnect();

                return(View());
            }
        }
        public async Task <IActionResult> Put(int id, [FromBody] InfoModel info)
        {
            if (info.IdPersona == 0)
            {
                info.IdPersona = id;
            }

            if (info.IdPersona != id)
            {
                return(BadRequest(ErrorsHelp.RespuestaHttp(400, "Error al enviar la petición")));
            }
            if (!await agendactx.DboInfos.Where(x => x.IdPersona == info.IdPersona).AsNoTracking().AnyAsync())
            {
                return(NotFound(ErrorsHelp.RespuestaHttp(404, $"El curso {info.IdPersona} no existe")));
            }
            if (await agendactx.DboInfos.Where(x => x.Email == info.Email && x.IdPersona != info.IdPersona).AsNoTracking().AnyAsync())
            {
                return(BadRequest(ErrorsHelp.RespuestaHttp(400, $"El código {info.Email} ya existe")));
            }
            if (!ModelState.IsValid)
            {
                return(BadRequest(ErrorsHelp.ModelStateErrors(ModelState)));
            }

            agendactx.Entry(info).State = EntityState.Modified;
            await agendactx.SaveChangesAsync();

            return(NoContent());
        }
예제 #15
0
        public void Generate(InfoModel info)
        {
            string fileName = string.Format(_fileName, Guid.NewGuid().ToString());

            fileName = Path.Combine(DefaultTempPath, fileName);

            using (var document = DocX.Create(fileName))
            {
                document.InsertParagraph(info.OwnerFamily + " " + info.OwnerName + " " + info.OwnerSname).FontSize(15d).SpacingAfter(20d).Alignment = Alignment.center;
                document.InsertParagraph(GetAttribute(nameof(info.OwnerSex)) + ": " + info.OwnerSex);
                document.InsertParagraph(GetAttribute(nameof(info.OwnerBdate)) + ": " + info.OwnerBdate);
                document.InsertParagraph(GetAttribute(nameof(info.OwnerBplace)) + ": " + info.OwnerBplace).SpacingAfter(5d);

                document.InsertParagraph(GetAttribute(nameof(info.PoliceNumber)) + ": " + info.PoliceNumber);
                document.InsertParagraph(GetAttribute(nameof(info.PoliceDate)) + ": " + info.PoliceDate);
                document.InsertParagraph(GetAttribute(nameof(info.PoliceLong)) + ": " + info.PoliceLong);
                document.InsertParagraph(GetAttribute(nameof(info.PoliceSnils)) + ": " + info.PoliceSnils).SpacingAfter(5d);

                document.InsertParagraph(GetAttribute(nameof(info.Gcode)) + ": " + info.Gcode);
                document.InsertParagraph(GetAttribute(nameof(info.Gtext)) + ": " + info.Gtext).SpacingAfter(5d);

                document.InsertParagraph(GetAttribute(nameof(info.SmoRegion)) + ": " + info.SmoRegion);
                document.InsertParagraph(GetAttribute(nameof(info.SmoName)) + ": " + info.SmoName);
                document.InsertParagraph(GetAttribute(nameof(info.SmoOgrn)) + ": " + info.SmoOgrn);
                document.InsertParagraph(GetAttribute(nameof(info.SmoOkato)) + ": " + info.SmoOkato);
                document.InsertParagraph(GetAttribute(nameof(info.SmoBegin)) + ": " + info.SmoBegin);
                document.InsertParagraph(GetAttribute(nameof(info.SmoEnd)) + ": " + info.SmoEnd);

                document.Save();
            }
            _temporaryDocuments.Add(fileName);
            Process.Start(fileName);
        }
        public void OnSuccess(Object result)
        {
            var snapshot = (QuerySnapshot)result;

            if (!snapshot.IsEmpty)
            {
                var documents = snapshot.Documents;

                listOfInfos.Clear();
                foreach (var item in documents)
                {
                    InfoModel info = new InfoModel();

                    string typeToSet = item.Get("Type") != null?item.Get("Type").ToString() : "default Type";

                    info.Type = $"Type : {typeToSet}";
                    string breedToSet = item.Get("Breed") != null?item.Get("Breed").ToString() : "default Breed";

                    info.Breed = $"Breed : {breedToSet}";
                    string nameToSet = item.Get("Name") != null?item.Get("Name").ToString() : "default Name";

                    info.Name = $"Name : {nameToSet}";
                    string InfoToSet = item.Get("Info") != null?item.Get("Info").ToString() : "default Info";

                    info.Info = $"Info : {InfoToSet}";

                    listOfInfos.Add(info);
                }
            }
        }
예제 #17
0
        public async void GetDzj()
        {
            try
            {
                pr_Load.Visibility = Visibility.Visible;
                WebClientClass wc      = new WebClientClass();
                string         results = await wc.GetResults(new Uri("http://live.bilibili.com/e-sports?page=1&ajax=1"));

                InfoModel data = JsonConvert.DeserializeObject <InfoModel>(results);
                //JObject json = JObject.Parse(results);
                List <InfoModel> model = JsonConvert.DeserializeObject <List <InfoModel> >(data.data.ToString());
                foreach (InfoModel item in model)
                {
                    live_Dzj.Items.Add(item);
                }
                dzjz = true;
            }
            catch (Exception)
            {
            }
            finally
            {
                pr_Load.Visibility = Visibility.Collapsed;
            }
        }
예제 #18
0
 /*
  * public static List<Apps> listApps()
  * {
  *  List<AppInfo> mFileList = new List<AppInfo>();
  *  SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(context);
  *  Resources res = context.getResources();
  *  AssetManager am = res.getAssets();
  *  string appList[], iconList[];
  *  try
  *  {
  *      appList = am.list("Apps");
  *      iconList = am.list("Icons");
  *      if (appList != null)
  *      {
  *          for (int i = 0; i < appList.length; i++)
  *          {
  *              AppInfo app = new AppInfo();
  *              app.Name = (appList[i].substring(0, appList[i].indexOf(".buildmlearn")));
  *              if (!SP.contains(app.Name))
  *              {
  *                  SharedPreferences.Editor editor1 = SP.edit();
  *                  editor1.putBoolean(app.Name, false);
  *                  editor1.commit(); continue;
  *              }
  *              if (!SP.getBoolean(app.Name, false)) continue;
  *
  *              app.AppIcon = BitmapFactory.decodeStream(am.open("Icons/" + iconList[i]));
  *              BufferedReader br = new BufferedReader(new InputStreamReader(context.getAssets().open("Apps/" + appList[i])));
  *              string type = br.readLine();
  *              if (type.contains("InfoTemplate")) app.Type = 0;
  *              else if (type.contains("QuizTemplate")) app.Type = 2;
  *              else if (type.contains("FlashCardsTemplate")) app.Type = 1;
  *              else if (type.contains("SpellingTemplate")) app.Type = 3;
  *              br.readLine();
  *              type = br.readLine();
  *              int x = type.indexOf("<name>") + 6;
  *              int y = type.indexOf("<", x + 1);
  *              app.Author = type.substring(x, y);
  *              mFileList.add(app);
  *          }
  *      }
  *  }
  *  catch (IOException e)
  *  {
  *      e.printStackTrace();
  *  }
  *  AppList = mFileList;
  *  return mFileList;
  * }
  */
 /// <summary>
 /// It reads the Info App-Template, from the .buildmlearn file.
 /// </summary>
 /// <param name="fileName">Name of the file</param>
 public static void readInfoFile(string fileName)
 {
     try
     {
         InfoModel     model               = InfoModel.getInstance();
         List <string> infoTitleList       = new List <string>();
         List <string> infoDescriptionList = new List <string>();
         XmlDocument   doc = new XmlDocument();
         doc.LoadXml(XDocument.Load("Assets/Apps/" + fileName + ".xml").ToString());
         model.setInfoName(doc.GetElementsByTagName("title").ElementAt(0).InnerText.Trim());
         model.setInfoDescription(doc.GetElementsByTagName("description").ElementAt(0).InnerText.Trim());
         string[] author = doc.GetElementsByTagName("author").ElementAt(0).InnerText.Split('\n');
         model.setInfoAuthor(author[1].Trim());
         model.setInfoAuthorEmail(author[2].Trim());
         model.setInfoVersion(doc.GetElementsByTagName("version").ElementAt(0).InnerText.Trim());
         XmlNodeList info_title       = doc.GetElementsByTagName("item_title");
         XmlNodeList info_description = doc.GetElementsByTagName("item_description");
         for (int i = 0; i < info_title.Length; i++)
         {
             infoTitleList.Add(info_title.ElementAt(i).InnerText.Trim());
             infoDescriptionList.Add(info_description.ElementAt(i).InnerText.Trim());
         }
         model.setInfoTitleList(infoTitleList);
         model.setInfoDescriptionList(infoDescriptionList);
     }
     catch (Exception e)
     { }
 }
예제 #19
0
 public ViewResult Exception(Models.InfoModel model)
 {
     if (model == null)
     {
         model = new InfoModel();
     }
     return(View("~/Views/Template/Exception.cshtml", model));
 }
예제 #20
0
        public string GetLocation()
        {
            string   ip   = Request["ip"];
            int      port = int.Parse(Request["port"]);
            Location loc  = InfoModel.GetLocation(ip, port);

            return(loc.ToJSON());
        }
예제 #21
0
        public void Info(string traceId, string caller, object content, string description)
        {
            var info = new InfoModel {
                Content = content, Caller = caller, Description = description, TraceId = traceId
            };

            this._logger.LogInformation(JsonConvert.SerializeObject(info));
        }
예제 #22
0
        public IActionResult CreateMinorModel(InfoModel infoModel)
        {
            InfoModelViewModel viewModel = new InfoModelViewModel {
                InfoModel = infoModel
            };

            return(View(viewModel));
        }
예제 #23
0
        public void OnActionExecuting(ActionExecutingContext context)
        {
            var model = new InfoModel {
                Time = DateTime.Now, Message = context.HttpContext.Request.Path.ToString()
            };

            _info.Clients.All.SendAsync("ReciveInfo", JsonConvert.SerializeObject(model));
        }
예제 #24
0
 /// <summary>
 ///the constructor of InfoViewModel.
 /// </summary>
 public InfoViewModel(InfoModel im)
 {
     this.imodel = im;
     this.imodel.PropertyChanged += delegate(Object sender, PropertyChangedEventArgs e)
     {
         NotifyPropertyChanged("VM_" + e.PropertyName);
     };
 }
예제 #25
0
        public ActionResult FormularioHibrido(InfoModel info)
        {
            TPConnector connector = initConnector(info);

            executeSendAuthorizeRequest(connector, info);

            return(View(info));
        }
예제 #26
0
 public IActionResult Create(InfoModel model)
 {
     if (ModelState.IsValid)
     {
         var newCat = _infoService.Insert(base.UserId, model);
     }
     return(Ok());
 }
예제 #27
0
 public IActionResult Update(string id, InfoModel model)
 {
     if (ModelState.IsValid)
     {
         var updateCat = _infoService.Update(base.UserId, id, model);
     }
     return(Ok());
 }
예제 #28
0
        private async Task GetInfoData()
        {
            var json = await new HttpClient().GetStringAsync("http://openapi.airkorea.or.kr/openapi/services/rest/ArpltnInforInqireSvc/getCtprvnRltmMesureDnsty?serviceKey=ng%2FLijSMgnWyRTRqAAQMqwcyEEt5yqOqnkeEGn1oMGfqIEaP492zeRvX4%2BBnK9Zn4woeMLrSj21o6WToZ%2BOpxQ%3D%3D&numOfRows=10&pageNo=1&sidoName=%EC%9D%B8%EC%B2%9C&ver=1.3&_returnType=json");
            var data = InfoModel.FromJson(json);

            //var jdata = (JArray)data["list"];
            DataList = new List <InfoModel>(data);
        }
예제 #29
0
        public HttpResponseMessage Get()
        {
            var layers = mapRepository.GetLayers();
            var panels = mapRepository.GetControlPanels();
            var info   = new InfoModel(layers, panels);
            var json   = JsonConvert.SerializeObject(info);

            return(Request.CreateResponse(HttpStatusCode.OK, json, new MediaTypeHeaderValue("application/json")));
        }
예제 #30
0
        void ShowDetailWindow(InfoOptType type, InfoModel info = null)
        {
            bool rst = (bool)new DetailInfoWindow(type, info).ShowDialog();

            if (rst == true)
            {
                GetInfos();
            }
        }
예제 #31
0
        public void InfoModel_Empty_Url()
        {
            var request = new InfoModel(string.Empty);

            var result = Validate(request);

            Assert.IsTrue(result.Count == 1);
            Assert.IsTrue(result[0].ErrorMessage.Equals(nameof(LocalizationKeys.EmptyUrlField)));
        }
예제 #32
0
        public Task Invoke(HttpContext httpContext)
        {
            var model = new InfoModel {
                Time = DateTime.Now, Message = httpContext.Request.Path.ToString()
            };

            _info.Clients.All.SendAsync("ReciveInfo", JsonConvert.SerializeObject(model));
            return(_next(httpContext));
        }
예제 #33
0
        public ActionResult About()
        {
            //ViewBag.Message = "Your application description page.";

            var model = new InfoModel();

            model.Name     = "Kevin Santacruz";
            model.Location = "Gye, Ecuador";
            return(View(model));
        }
        public ActionResult Edit(int id)
        {
            Kind kind = kindRepository.Repository.FirstOrDefault(x => x.id == id);

            if (kind != null)
            {
                if (Request.IsAjaxRequest())
                {
                    return PartialView("Kind/_KindEdit", kind);
                }
                return View("Kind", kind);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany rodzaj nie istnieje",
                    Action = "Index",
                    Controller = "Kind"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Delete(int id)
        {
            Device device = deviceRepository.Repository.FirstOrDefault(x => x.id == id);
            if (device != null)
            {
                DeleteObjectById model = new DeleteObjectById();
                model.Description = "Czy napewno chcesz usunąć urządzenie: " + device.id +  "?";
                model.Id = id;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Device/_DeviceDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podane urządzenie nie istnieje",
                    Action = "Index",
                    Controller = "Device"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Delete(string ShortName)
        {
            Section section = sectionRepository.Repository.FirstOrDefault(x => x.short_name == ShortName);
            if (section != null)
            {
                DeleteObjectByName model = new DeleteObjectByName();
                model.Description = "Czy napewno chcesz usunąć sekcje: " + section.short_name + "?";
                model.Name = ShortName;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Section/_SectionDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podana sekcja nie istnieje",
                    Action = "Index",
                    Controller = "Section"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Edit(int id)
        {
            Subgroup subgroup = subgroupRepository.Repository.FirstOrDefault(x => x.id == id);

            if (subgroup != null)
            {
                if (Request.IsAjaxRequest())
                {
                    return PartialView("Subgroup/_SubgroupEdit", subgroup);
                }
                return View("Subgroup", subgroup);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podana grupa nie istnieje",
                    Action = "Index",
                    Controller = "Subgroup"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Delete(int id)
        {
            Subgroup subgroup = subgroupRepository.Repository.FirstOrDefault(x => x.id == id);
            if (subgroup != null)
            {
                DeleteObjectById model = new DeleteObjectById();
                model.Description = "Czy napewno chcesz usunąć grupę: " + subgroup.name + "?";
                model.Id = id;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Subgroup/_SubgroupDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podana grupa nie istnieje",
                    Action = "Index",
                    Controller = "Subgroup"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Edit(string ShortName)
        {
            Section model = sectionRepository.Repository.FirstOrDefault(x => x.short_name == ShortName);

            if (model != null)
            {
                SectionModel sm = CreateSectionModelFromSection(model);
                if (Request.IsAjaxRequest())
                {
                    return PartialView("Section/_SectionEdit", sm);
                }
                return View("Edit", sm);
            }
            else
            {
                InfoModel inf_model = new InfoModel()
                {
                    Description = "Podana sekcja nie istnieje",
                    Action = "Index",
                    Controller = "Section"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", inf_model);
                }
                return View("Info", inf_model);
            }
        }
 public ActionResult Edit(string RoleName)
 {
     MembershipRoleModel model = membershipRoleRepository.Repository.FirstOrDefault(x => x.Name == RoleName);
     model.LoadCheckBoxList();
     if (model != null)
     {
         if (Request.IsAjaxRequest())
         {
             return PartialView("MembershipRole/_MembershipRoleEdit", model);
         }
         return View(model);
     }
     else
     {
         InfoModel info_model = new InfoModel()
         {
             Description = "Rola nie istnieje",
             Action = "Index",
             Controller = "MembershipRole"
         };
         if (Request.IsAjaxRequest())
         {
             return PartialView("_Info", info_model);
         }
         return View("Info", info_model);
     }
 }
예제 #41
0
        public async Task GetSSRank()
        {
            try
            {
                using (hc = new HttpClient())
                {
                    HttpResponseMessage hr = await hc.GetAsync(new Uri("http://api.bilibili.cn/list?appkey=84b739484c36d653&order=hot&original=0&page=1&pagesize=20&tid=155"));
                    hr.EnsureSuccessStatusCode();
                    string results = await hr.Content.ReadAsStringAsync();
                    InfoModel model = new InfoModel();
                    model = JsonConvert.DeserializeObject<InfoModel>(results);
                    JObject json = JObject.Parse(model.list.ToString());
                    QQ_Rank_SS.Items.Clear();
                    List<InfoModel> ReList = new List<InfoModel>();
                    for (int i = 0; i < 20; i++)
                    {
                        ReList.Add(new InfoModel
                        {
                            aid = (string)json[i.ToString()]["aid"],
                            title = (string)json[i.ToString()]["title"],
                            pic = (string)json[i.ToString()]["pic"],
                            author = (string)json[i.ToString()]["author"],
                            play = (string)json[i.ToString()]["play"],
                            video_review = (string)json[i.ToString()]["video_review"],
                            num = i + 1
                        });
                    }
                    QQ_Rank_SS.ItemsSource = ReList;
                }
            }
            catch (Exception ex)
            {
                MessageDialog md = new MessageDialog(ex.Message);
                await md.ShowAsync();
            }

        }
        public ActionResult Delete(string RoleName)
        {
            MembershipRoleModel role = membershipRoleRepository.Repository.FirstOrDefault(x => x.Name == RoleName);
            if (role != null)
            {
                DeleteObjectByName model = new DeleteObjectByName();
                model.Description = "Czy napewno chcesz usunąć role: " + role.Name + "?";
                model.Name = role.Name;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("MembershipRole/_MembershipRoleDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Rola nie istnieje",
                    Action = "Index",
                    Controller = "MembershipRole"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
 public ActionResult Details(int id)
 {
     Licence model = licenceRepository.Repository.FirstOrDefault(x => x.id_number == id);
     if (model != null)
     {
         if (Request.IsAjaxRequest())
         {
             return PartialView("Licence/_LicenceDetails", model);
         }
         return View("Details", model);
     }
     else
     {
         InfoModel inf_model = new InfoModel()
         {
             Description = "Licencja nie istnieje",
             Action = "Index",
             Controller = "Licence"
         };
         if (Request.IsAjaxRequest())
         {
             return PartialView("_Info", inf_model);
         }
         return View("Info", inf_model);
     }
 }
        public ActionResult Delete(int id)
        {
            Licence kind = licenceRepository.Repository.FirstOrDefault(x => x.id_number == id);
            if (kind != null)
            {
                DeleteObjectById model = new DeleteObjectById();
                model.Description = "Czy napewno chcesz usunąć licencje: " + kind.name + "?";
                model.Id = id;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Licence/_LicenceDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podana licencja nie istnieje",
                    Action = "Index",
                    Controller = "Licence"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
 public ActionResult Details(int id)
 {
     PeripheralDevice model = peripheralDeviceRepository.Repository.FirstOrDefault(x => x.id == id);
     if (model != null)
     {
         if (Request.IsAjaxRequest())
         {
             return PartialView("PeripheralDevice/_PeripheralDeviceDetails", model);
         }
         return View("Details", model);
     }
     else
     {
         InfoModel inf_model = new InfoModel()
         {
             Description = "Podane urządzenie peryferyjne nie istnieje",
             Action = "Index",
             Controller = "PeripheralDevice"
         };
         if (Request.IsAjaxRequest())
         {
             return PartialView("_Info", inf_model);
         }
         return View("Info", inf_model);
     }
 }
        public ActionResult Edit(int id)
        {
            Licence licence = licenceRepository.Repository.FirstOrDefault(x => x.id_number == id);

            if (licence != null)
            {
                if (Request.IsAjaxRequest())
                {
                    return PartialView("Licence/_LicenceEdit", licence);
                }
                return View("Licence", licence);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podana licencja nie istnieje",
                    Action = "Index",
                    Controller = "Licence"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Edit(int id)
        {
            Person person = personRepository.Repository.FirstOrDefault(x => x.id == id);

            if (person != null)
            {

                PersonSectionAddEditModel model = CreatePersonSetionAddEditFromPerson(person);

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Person/_PersonEdit", model);
                }
                return View("Edit", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany pracownik nie istnieje",
                    Action = "Index",
                    Controller = "Person"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Edit(string username)
        {
            MembershipUser user = Membership.GetUser(username);
            if (user != null)
            {
                MembershipUserModel model = new MembershipUserModel(user.ProviderName,
                            user.UserName, user.ProviderUserKey, user.Email, user.PasswordQuestion, user.Comment, user.IsApproved,
                            user.IsLockedOut, user.CreationDate, user.LastLoginDate, user.LastActivityDate, user.LastPasswordChangedDate, user.LastLockoutDate, user.IsOnline);

                if (Request.IsAjaxRequest())
                {
                    return PartialView("MembershipUser/_MembershipUserEdit", model);
                }

                return View(model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany użytkownik nie istnieje",
                    Action = "Index",
                    Controller = "MembershipUser"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Delete(int id)
        {
            Person person = personRepository.Repository.FirstOrDefault(x => x.id == id);
            if (person != null)
            {
                DeleteObjectById model = new DeleteObjectById();
                model.Description = "Czy napewno chcesz usunąć pracownika: " + person.id + " " + person.name + " " + person.surname + "?";
                model.Id = id;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Person/_PersonDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany pracownik nie istnieje",
                    Action = "Index", Controller = "Person"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Edit(int id)
        {
            Device device = deviceRepository.Repository.FirstOrDefault(x => x.id == id);

            if (device != null)
            {

                DeviceExtendedModel model = CreateDeviceModelFromDevice(device);

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Device/_DeviceEdit", model);
                }
                return View("Device", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podane urządzenie nie istnieje",
                    Action = "Index",
                    Controller = "Device"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }
        public ActionResult Delete(int id)
        {
            Kind kind = kindRepository.Repository.FirstOrDefault(x => x.id == id);
            if (kind != null)
            {
                DeleteObjectById model = new DeleteObjectById();
                model.Description = "Czy napewno chcesz usunąć rodzaj: " + kind.name + "?";
                model.Id = id;

                if (Request.IsAjaxRequest())
                {
                    return PartialView("Kind/_KindDelete", model);
                }

                return View("Delete", model);
            }
            else
            {
                InfoModel model = new InfoModel()
                {
                    Description = "Podany rodzaj nie istnieje",
                    Action = "Index",
                    Controller = "Kind"
                };
                if (Request.IsAjaxRequest())
                {
                    return PartialView("_Info", model);
                }
                return View("Info", model);
            }
        }