public static List <MainInfo> ParseMainPage() { /* Get main data from the main page * https://www.setlist.fm/ * * * Output: list of MainInfo objects * (see info in MainInfo.cs) */ HtmlWeb webDoc = new HtmlWeb(); HtmlDocument doc = webDoc.Load("https://www.setlist.fm/"); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//a"); List <MainInfo> MainPage = new List <MainInfo>(); foreach (var tag in nodes) { if (tag.Attributes.Contains("title") && tag.Attributes["title"].Value.StartsWith("View this", StringComparison.Ordinal)) { string[] txt = tag.InnerText.Split( new[] { "\n" }, StringSplitOptions.None ); txt = txt.Where(c => c != "").ToArray(); string observeLink = tag.Attributes["href"].Value; MainInfo obj = new MainInfo(clean(txt[0]), clean(txt[1]), txt[2], txt[3], txt[4], observeLink); MainPage.Add(obj); } } return(MainPage); }
public void UpdateMainInfo(MainInfo info) { string sql = "UPDATE MainInfo SET " + "Name='" + info.Name + "',INN='" + info.INN + "',Document='" + info.Document + "',Phone='" + info.Phone + "',City='" + info.City + "',UridAddress='" + info.UridAddress + "',OfficeAddress='" + info.OfficeAddress + "',Bank='" + info.Bank + "',Chief='" + info.Chief + "' WHERE Id=" + info.Id; using (SqlCeConnection conn = new SqlCeConnection(Storage.ConnectionString)) { try { conn.Open(); } catch { MessageBox.Show("Невозможно установить соединение с базой данных!", "Ошибка подключения", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } SqlCeCommand command = new SqlCeCommand(sql, conn); command.ExecuteScalar(); } }
public static void UpdateWithNewPointCount( this ICollection <PointViewModel> pointCollection, MainInfo mainInfo) { if (mainInfo.PointsCount == 0) { pointCollection.Clear(); } var newPointsNumbers = Enumerable.Range(1, mainInfo.PointsCount); foreach (var newPoint in newPointsNumbers) { var removePoints = pointCollection.Where(x => !newPointsNumbers.Contains(x.Number)).ToArray(); for (int i = 0; i < removePoints.Length; i++) { pointCollection.Remove(removePoints[i]); } } var pointsToAdd = newPointsNumbers.Where(x => !pointCollection.Any(y => y.Number == x)).ToArray(); foreach (var pointToAdd in pointsToAdd) { pointCollection.Add(new PointViewModel { Number = pointToAdd, Horizons = 0, }); } }
public static SetlistInfo ParseSetlistPage(MainInfo parent) { // Get all name of songs in the page List <string> songs = new List <string>(); string artistLink = ""; HtmlWeb webDoc = new HtmlWeb(); HtmlDocument doc = webDoc.Load("https://www.setlist.fm/" + parent.link); HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//a"); foreach (var tag in nodes) { if (tag.Attributes.Contains("class") && tag.Attributes["class"].Value == "songLabel" && !songs.Contains(tag.InnerText)) { var name = clean(tag.InnerText.Trim()); songs.Add(name); } if (tag.Attributes.Contains("title") && tag.Attributes["title"].Value == "View song statistics of all setlists") { artistLink = tag.Attributes["href"].Value.Replace("../", ""); } } if (songs.Count == 0) { songs.Add("Nothing"); } SetlistInfo obj = new SetlistInfo(parent.GetFields(), artistLink, songs); return(obj); }
private void ButtonDelete_Click(object sender, RoutedEventArgs e) { try { MainInfo deleteWork = (MainInfo)DataGridTablica.SelectedItem; if (MessageBox.Show(messageBoxText: "Вы действительно хотите удалить выбранную строку?", "Уведомление", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { if (deleteWork != null) { dbContext.db.MainInfo.Remove(deleteWork); dbContext.db.SaveChanges(); Page_Loaded(sender: null, e: null); MessageBox.Show("Вы удалили строку", "Оповещание", MessageBoxButton.OK, MessageBoxImage.Information); } else { throw new Exception(message: "Вы не выбрали строку которые хотите удалить!"); } } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error); } }
private void AddBut_Click(object sender, RoutedEventArgs e) { MainInfo newMainInfo = new MainInfo(); Employee newEmployee = new Employee(); Work newWork = new Work(); WorkInfo newWorkInfo = new WorkInfo(); newEmployee.NumberEmployee = Convert.ToInt32(tb1.Text); newEmployee.FullName = tb2.Text; newEmployee.Position = tb3.Text; newWork.NumberWork = Convert.ToInt32(tb4.Text); newWork.NameWork = (tb5.Text); newWorkInfo.Laboriousness = Convert.ToInt32(tb6.Text); newWorkInfo.DateOfComplite = Convert.ToDateTime(tb7.SelectedDate); newWorkInfo.PlannedDateFoComplite = Convert.ToDateTime(tb8.SelectedDate); newWorkInfo.Readiness = Convert.ToInt32(tb9.Text); dbContext.db.Employee.Add(newEmployee); dbContext.db.Work.Add(newWork); dbContext.db.WorkInfo.Add(newWorkInfo); newMainInfo.IDNameWork = newWork.ID; newMainInfo.IDFullName = newWork.ID; newMainInfo.IDReadiness = newWork.ID; dbContext.db.MainInfo.Add(newMainInfo); dbContext.db.SaveChanges(); MessageBox.Show("Вы добавили новые данные!", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information); }
public string CheckBaseInfo(string code, out int[] badmarkNo) { badmarkNo = null; MainInfo mainInfo = new MainInfo(); mainInfo.Panel = code; mainInfo.Resource = this.LineNo; mainInfo.Machine = this.MachineName; mainInfo.WorkArea = this.WorkArea; mainInfo.TestType = "TEST"; mainInfo.OperatorName = this.OperName; mainInfo.OperatorType = "Panel"; mainInfo.TrackType = "S"; mainInfo.Site = this.Site; mainInfo.Mac = this.Mac; string[] result = EquipmentInterActive.CheckBaseInfo(mainInfo); if (result.Length > 0) { if (result[0] == "0") { for (int i = 1; i < result.Length; ++i) { } } return(result[0]); } else { return("获取信息失败,请检查网络连接是否正常!!!"); } }
public MainInfo GetIndexCompareEneryNew() { //string username= HttpContext.Current.Session["userid"].ToString() ; MainInfo mainInfo = new MainInfo(); var nowMonth = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-1")); var endTime = DateTime.Now; var pAction = new ExecuteProcess(); try { mainInfo = new NTS.WEB.BLL.IndexEnery().GetIndexCompareEneryNew(nowMonth, endTime); pAction.Success = true; mainInfo.ActionInfo = pAction; return(mainInfo); } catch (Exception e) { pAction.Success = false; pAction.ExceptionMsg = e.Message; return(new MainInfo() { ActionInfo = pAction }); } }
public void Login(string player) { if (player == "null") { MainInfo.Instance.Login.LoginFaild(); return; } MainInfo.CleanInfo(); MainInfo.Instance.Player = JsonConvert.DeserializeObject <Player>(player); RequestAllRoomsToPlay(); MainInfo.Instance.MainWindow.OpenMainMenu(); }
public Tuple <bool, string> CheckBaseInfo(string code, out Dictionary <int, bool> badMarkList) { badMarkList = new Dictionary <int, bool>(); Tuple <bool, string> result = null; badMarkList.Clear(); Task <Dictionary <int, bool> > uploadTask = Task.Factory.StartNew <Dictionary <int, bool> >(() => { MainInfo mainInfo = new MainInfo(); mainInfo.Panel = code; mainInfo.Resource = this.LineNo; mainInfo.Machine = this.MachineName; mainInfo.WorkArea = this.WorkArea; mainInfo.TestType = "PSA"; mainInfo.OperatorName = this.OperName; mainInfo.OperatorType = "Pcs"; mainInfo.TrackType = "S"; mainInfo.Site = this.Site; mainInfo.Mac = this.Mac; mainInfo.ProgramName = this.ProgramName; Dictionary <int, bool> model = new Dictionary <int, bool>(); string[] serverResult = mflexSystem.CheckBaseInfo(mainInfo); bool isOK = serverResult[0] == "0"; if (isOK) { string badString = serverResult[1].Replace("[", "").Replace("]", ""); string[] badList = badString.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < badList.Length; ++i) { model[i + 1] = (badList[i].ToUpper() == "OK"); } } result = new Tuple <bool, string>(isOK, serverResult[1]); return(model); }); if (!uploadTask.Wait(500)) { result = new Tuple <bool, string>(false, "获取超时,连接超时时间为:[" + 500 + "]ms"); } else { if (uploadTask.Result != null) { badMarkList = uploadTask.Result; } } return(result); }
public ActionResult Create(MainInfo newUser) { if (ModelState.IsValid) { db.MainInfoes.Add(newUser); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(View(newUser)); } }
public EditPage(MainInfo selecteditems) { InitializeComponent(); this.selecteditems = selecteditems; tb1.Text = Convert.ToString(selecteditems.Employee.NumberEmployee); tb2.Text = selecteditems.Employee.FullName; tb3.Text = selecteditems.Employee.Position; tb4.Text = Convert.ToString(selecteditems.Work.NumberWork); tb5.Text = selecteditems.Work.NameWork; tb6.Text = Convert.ToString(selecteditems.WorkInfo.Laboriousness); tb7.SelectedDate = (DateTime)selecteditems.WorkInfo.DateOfComplite; tb8.SelectedDate = selecteditems.WorkInfo.PlannedDateFoComplite; tb9.Text = Convert.ToString(selecteditems.WorkInfo.Readiness); }
public override Mapper_Node Initialize(Mapper_Editor editor, Vector2 pos, string nodeName) { seInfo = new SceneAndEditorInfo(); connectors = new List <Mapper_NodeConnector>(); connectors.Add(ScriptableObject.CreateInstance <Mapper_NodeConnector>().Initialize(this, ConType.cParent)); this.nodeName = nodeName; this.editor = editor; InitializeDefaultRect(pos); mainInfo = new MainInfo(0, 0, 0); return(this); }
private void EditBut_Click(object sender, RoutedEventArgs e) { MainInfo Save = dbContext.db.MainInfo.FirstOrDefault(Item => Item.ID == selecteditems.ID); Save.Employee.NumberEmployee = Convert.ToInt32(tb1.Text); Save.Employee.FullName = (tb2.Text); Save.Employee.Position = (tb3.Text); Save.Work.NumberWork = Convert.ToInt32(tb4.Text); Save.Work.NameWork = tb5.Text; Save.WorkInfo.Laboriousness = Convert.ToInt32(tb6.Text); Save.WorkInfo.DateOfComplite = Convert.ToDateTime(tb7.Text); Save.WorkInfo.PlannedDateFoComplite = Convert.ToDateTime(tb8.Text); Save.WorkInfo.Readiness = Convert.ToInt32(tb9.Text); dbContext.db.SaveChanges(); MessageBox.Show("Вы изменили данные!", "Изменение", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); }
public MainPage() { this.InitializeComponent(); var info = MainInfo.GetInfo(); var infos = MainInfo.GetInfos(); //TruckID.Text = info.ID; //TruckName.Text = info.Name; //TruckStyle.Text = info.Style; var data = new InfoList() { Infos = new ObservableCollection <Info.TruckInfo>(infos.Infos) }; //DataContext = data; Data = data; }
private void ButtonGoEdit_Click(object sender, RoutedEventArgs e) { try { MainInfo EditAirport = (MainInfo)TableMain.SelectedItem; if (EditAirport != null) { NavigationService.Navigate(new EditPage(EditAirport)); } else { MessageBox.Show("Вы не выбрали строку которую хотите изменить", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } } catch { } }
private void ButtonEdit_Click(object sender, RoutedEventArgs e) { try { MainInfo EditWork = (MainInfo)DataGridTablica.SelectedItem; if (EditWork != null) { NavigationService.Navigate(new EditPage(EditWork)); } else { throw new Exception("Вы не выбрали не одного элменента!"); } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source, MessageBoxButton.OK, MessageBoxImage.Error); } }
public EditPage(MainInfo selecteditems) { InitializeComponent(); this.selecteditems = selecteditems; tb1.SelectedDate = selecteditems.AdditionalInformation.DateAndTimeOfDeparture; tb2.SelectedDate = selecteditems.AdditionalInformation.DateAndTimeOfArrival; tb3.Text = Convert.ToString(selecteditems.AdditionalInformation.NumberOfTicketsSold); tb4.Text = Convert.ToString(selecteditems.AdditionalInformation.AircraftOccupancy); tb5.Text = Convert.ToString(selecteditems.Airplane.NubmerAirplane); tb6.Text = selecteditems.Airplane.Brand; tb7.Text = Convert.ToString(selecteditems.Airplane.NumberOfPlaces); tb8.Text = Convert.ToString(selecteditems.Airplane.FlightSpeed); tb9.Text = Convert.ToString(selecteditems.Route.NumberRoute); tb10.Text = Convert.ToString(selecteditems.Route.Distance); tb11.Text = selecteditems.Route.DeparturePoint; tb12.Text = selecteditems.Route.Destination; }
//所选课程展示动态控件加载 public void mainShow() { Dictionary <int, List <string> > info = sts.showCourseInfo(this.account);//调用sservise中的函数并将结果保存在字典中 //字典中的值和顺序:教师名、学院、真实课堂号、课堂名 for (int i = 0; i < info.Count; i++) //遍历字典中的值 { ListViewItem ivi = new ListViewItem(); //新建一个listview控件 cls = info[i][2]; //将真实课堂号赋值给cls MainInfo mf = new MainInfo(cls); //动态控件的生成,参数为真实课堂号 mf.Name = "mf_" + i; //新控件命名为mf_0,mf_1等等依次增加 mf.labelClassId1.Content = info[i][2]; //将动态控件中需要展示真实课堂号的label中写入真实课堂号 mf.textBlockClassName1.Text = info[i][3]; //将动态控件中需要展示课堂名的地方展示对应的课堂名 mf.class1.Tag = cls; mf.class1.Click += new RoutedEventHandler(btnStuMainHomework_Click); //按钮的绑定 mf.textBlockDepartmentName1.Text = info[i][1]; //将动态控件中需要展示院系的地方展示对应的院系 mf.textBlockTeacherName1.Text = info[i][0]; //将动态控件中需要展示教师名的地方展示对应的教师名 ivi.Content = mf; //将动态控件作为listview中的一个content listView2.Items.Add(ivi); //将动态控件放在listview里,从而实现动态加载 } }
private void ButtonEdit_Click(object sender, RoutedEventArgs e) { MainInfo Save = dbcontext.db.MainInfo.FirstOrDefault(item => item.ID == selecteditems.ID); Save.AdditionalInformation.DateAndTimeOfDeparture = (DateTime)tb1.SelectedDate; Save.AdditionalInformation.DateAndTimeOfArrival = (DateTime)tb2.SelectedDate; Save.AdditionalInformation.NumberOfTicketsSold = Convert.ToInt32(tb3.Text); Save.AdditionalInformation.AircraftOccupancy = Convert.ToInt32(tb4.Text); Save.Airplane.NubmerAirplane = Convert.ToInt32(tb5.Text); Save.Airplane.Brand = (tb6.Text); Save.Airplane.NumberOfPlaces = Convert.ToInt32(tb7.Text); Save.Airplane.FlightSpeed = Convert.ToInt32(tb8.Text); Save.Route.NumberRoute = Convert.ToInt32(tb9.Text); Save.Route.Distance = Convert.ToInt32(tb10.Text); Save.Route.DeparturePoint = (tb11.Text); Save.Route.Destination = (tb12.Text); dbcontext.db.SaveChanges(); MessageBox.Show("Данные изменены", "Уведомление", MessageBoxButton.OK, MessageBoxImage.Information); NavigationService.GoBack(); }
private void ButtonAdd_Click(object sender, RoutedEventArgs e) { MainInfo newMaininfo = new MainInfo(); AdditionalInformation newAdditionalInformation = new AdditionalInformation(); Airplane newAirplane = new Airplane(); Route newRoute = new Route(); newAdditionalInformation.DateAndTimeOfDeparture = (DateTime)tb1.SelectedDate; newAdditionalInformation.DateAndTimeOfArrival = (DateTime)tb2.SelectedDate; newAdditionalInformation.NumberOfTicketsSold = Convert.ToInt32(tb3.Text); newAdditionalInformation.AircraftOccupancy = Convert.ToInt32(tb4.Text); newAirplane.NubmerAirplane = Convert.ToInt32(tb5.Text); newAirplane.Brand = tb6.Text; newAirplane.NumberOfPlaces = Convert.ToInt32(tb7.Text); newAirplane.FlightSpeed = Convert.ToInt32(tb8.Text); newRoute.NumberRoute = Convert.ToInt32(tb9.Text); newRoute.Distance = Convert.ToInt32(tb10.Text); newRoute.DeparturePoint = (tb11.Text); newRoute.Destination = (tb12.Text); newMaininfo.idAdditionalInformation = newAdditionalInformation.ID; newMaininfo.idAirplane = newAirplane.ID; newMaininfo.idRoute = newRoute.ID; dbcontext.db.MainInfo.Add(newMaininfo); dbcontext.db.AdditionalInformation.Add(newAdditionalInformation); dbcontext.db.Airplane.Add(newAirplane); dbcontext.db.Route.Add(newRoute); dbcontext.db.SaveChanges(); MessageBox.Show("Вы добавили данные", "Уведомление"); }
private void ButtonDelete_Click(object sender, RoutedEventArgs e) { try { MainInfo deleteAirport = (MainInfo)TableMain.SelectedItem; if (MessageBox.Show("Вы действительно хотите удалить выбранную строку?", "Уведомление", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { if (deleteAirport != null) { dbcontext.db.MainInfo.Remove(deleteAirport); dbcontext.db.SaveChanges(); Page_Loaded(sender: null, e: null); MessageBox.Show("Вы удалили строку", "Оповещание", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("Вы не выбрали строку", "Оповещание"); } } } catch { } }
public MoreInfoPage(MainInfo selecteditem) { InitializeComponent(); this.selecteditem = selecteditem; }
public CharacterInfo(BinaryReader br) { Main = new MainInfo(br); Cosmetic = new CosmeticInfo(br); Meta = new MetaInfo(br); }