public ShowInfo MakeBooking(string Paymentmode) { ShowInfo ticketInfo = null; int ShowId = Context.Session.GetInt32("ShowId").Value; int CustomerId = Context.Session.GetInt32("CustomerId").Value; string seats = Context.Session.GetString("seats"); string[] Seats = JsonConvert.DeserializeObject <string[]>(seats); BookingInformation obj = new BookingInformation(); obj.CustomerId = CustomerId; obj.Seatno = Seats; obj.ShowId = ShowId; obj.Paymentmode = Paymentmode; string json = JsonConvert.SerializeObject(obj); HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); HttpResponseMessage response = client.PostAsync("Booking/BookTickets", content).Result; if (response.IsSuccessStatusCode == true) { string ticketJson = response.Content.ReadAsStringAsync().Result; ticketInfo = JsonConvert.DeserializeObject <ShowInfo>(ticketJson); } return(ticketInfo); }
public void LogInAsUser() { string login = ""; string password = ""; Dictionary <string, string> LoginPassword = new Dictionary <string, string>(); LoginPassword.Add("Alfar", "1234"); LoginPassword.Add("Maxim", "2345"); LoginPassword.Add("Ulan", "3456"); //Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Enter login: "******"Enter password: "******"wrong login or password..."); } // foreach (KeyValuePair<string, string> v in LoginPassword) // { // Console.WriteLine($"-> Users: <- \n Login:\t {login}\n Password:\t {password}"); // } }
private void Form1_Load(object sender, EventArgs e) { if (!server.Setup(8888)) { return; } if (!server.Start()) { return; } server.NewSessionConnected += Server_NewSessionConnected; server.SessionClosed += Server_SessionClosed; server.NewRequestReceived += Server_NewRequestReceived; MyShowInfoDelgete = new ShowInfo((str, add) => { if (add) { listBox1.Items.Add(str); } else { listBox1.Items.Remove(str); } }); ShowClientRecv = new ShowInfo((str, add) => { textBox_ClientRecv.Text = str; }); client = new AsyncTcpSession(); client.Connect(new IPEndPoint(IPAddress.Parse("127.0.0.1"), 8888)); client.DataReceived += Client_DataReceived; client.NoDelay = true; }
private void LboxSearchCities_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { try { Weather wtp = new Weather(); string location = LboxSearchCities.SelectedValue.ToString(); string city, country; int comaIndex = location.IndexOf(','); country = location.Substring(comaIndex + 1); city = location.Remove(comaIndex); City cityFound = Cities.CityList.FirstOrDefault<City>(c => c.name == city | c.country == country); wtp.GetWeatherById(cityFound._id); Mw.SetWeatherData(wtp); TbCitySearch.Clear(); CloseTextBoxvoxFl(); } catch (Exception ex) { ShowInfo sg = new ShowInfo("Ошибка", ex.ToString()); sg.ShowDialog(); } }
public ActionResult FollowShow(int showId) { if (ModelState.IsValid) { var userId = User.Identity.GetUserId(); //var listOfMembers = membersDb.All.ToList(); //var member = listOfMembers.First(c => c.AccountUserId.Contains(userId)); Member member = membersDb.All.First(c => c.AccountUserId == userId); var allreadyFollowsShow = showInfoDb.All.FirstOrDefault(c => c.MemberId == member.MemberId && c.ShowId == showId); if (allreadyFollowsShow == null) { ShowInfo showInfo = new ShowInfo { ShowId = showId, MemberId = member.MemberId }; showInfoDb.InsertOrUpdate(showInfo); showInfoDb.Save(); } return(RedirectToAction("Index")); } return(View("Error")); }
public List <ShowInfo> GetShowsByVenue(string venueName) { var shws = from s in db.Shows from d in s.ShowDetails where s.Venue.VenueName.Equals(venueName) select new { d.Artist.ArtistName, s.ShowName, s.ShowTime, s.ShowDate, s.ShowTicketInfo }; List <ShowInfo> shows = new List <ShowInfo>(); foreach (var sh in shws) { ShowInfo sInfo = new ShowInfo(); sInfo.ArtistName = sh.ArtistName; sInfo.ShowName = sh.ShowName; sInfo.ShowDate = sh.ShowDate.ToShortDateString(); sInfo.ShowTime = sh.ShowTime.ToString(); shows.Add(sInfo); } return(shows); }
public List <ShowInfo> GetShowsByVenue(string venueName) { List <ShowInfo> showInfos = new List <ShowInfo>(); var s_table = from s in ste.Shows join v in ste.Venues on s.VenueKey equals v.VenueKey where v.VenueName.Equals(venueName) select new { s.ShowName, s.ShowDate, s.ShowTime }; foreach (var row in s_table) { ShowInfo si = new ShowInfo(); si.ShowName = row.ShowName; si.ShowDate = row.ShowDate; si.ShowStartTime = row.ShowTime; showInfos.Add(si); } return(showInfos); }
public List<ShowInfo> GetShowsByVenue(string venueName) { var shws = from s in st.Shows from d in s.ShowDetails where s.Venue.VenueName.Equals(venueName) select new { d.Artist.ArtistName, s.ShowName, s.ShowTime, s.ShowDate, s.ShowTicketInfo }; List<ShowInfo> shows = new List<ShowInfo>(); foreach (var sh in shws) { ShowInfo sInfo = new ShowInfo(); sInfo.ArtistName = sh.ArtistName; sInfo.ShowName = sh.ShowName; sInfo.ShowDate = sh.ShowDate.ToShortDateString(); sInfo.ShowTime = sh.ShowTime.ToString(); shows.Add(sInfo); } return shows; }
void jingzhangdie() { jingzhangsiwang = false; GameStage = "转移警长"; ShowInfo.SetActive(false); GameStatus.GetComponent <Text> ().text = "警长死亡,请移交警徽"; CanClick = true; }
void lierendie() { lierensiwang = false; GameStage = "猎人"; ShowInfo.SetActive(false); GameStatus.GetComponent <Text> ().text = "猎人死亡,选择枪杀对象"; CanClick = true; }
public RatingsBreakdown(Show s, MiniNetwork n) { network = n; InitializeComponent(); ShowInfo.Elapsed += ShowInfo_Elapsed; ShowInfo.Start(); Load_Ratings(s); }
public ExStoreMgr(AWindow w, Document doc) { this.doc = doc; W = w; dsMgr = new DataStoreManager(doc); scMgr = SchemaManager.Instance; show = new ShowInfo(w); exData = ExStorData.Instance; }
/// <summary> /// ���һ���µĺ�����Ϣ���� /// </summary> /// <param name="info">Ҫ��ӵ��µĺ�����Ϣ����</param> /// <param name="infoId"></param> /// <returns>����,���ڻ����0��ɹ�,���ʧ��</returns> public int Insert(ShowInfo info,out long infoId) { if (object.Equals(null, info)) { infoId = -1; return -2; } return DAL.Insert(info,out infoId); }
public void Show_TestCaptionEvent_EqualsCaption() { ShowInfo showInfo = new ShowInfo(); string testText = ""; string testCaption = ""; object testSender = new object(); showInfo.ShowInformation += (object sender, string text, string caption) => { testText = text; testCaption = caption; testSender = sender; }; showInfo.Show("test", "caption"); Assert.AreEqual("caption", testCaption); }
public async Task SubscribeShow(ShowInfo show) { await Initialize(); if (!_shows.Any(s => s.Id == show.Id)) { _shows.Add(show); await _localStorage.SetItem(ShowSubscriptionsKey, _shows); SubscriptionsChanged?.Invoke(_shows); } }
private List <ShowInfo> searchdata(string Searchkey, int currpage, int pagesize) { List <ShowInfo> prolist = new List <ShowInfo>(); //string indexpath = HttpContext.Server.MapPath("/Indexdata"); string indexpath = "E:\\Indexdata1"; FSDirectory directory = FSDirectory.Open(new DirectoryInfo(indexpath), new NoLockFactory()); IndexReader reader = IndexReader.Open(directory, true); IndexSearcher searcher = new IndexSearcher(reader); BooleanQuery bqAllFilter = new BooleanQuery(); string keyword = Common.SplitContent.GetKeyWordsSplitBySpace(Searchkey, new PanGuTokenizer()); //TermQuery tquery = new TermQuery(new Term("title", keyword)); Query querytitle = new QueryParser("title", new PanGuAnalyzer(true)).Parse(keyword); Query querycontent = new QueryParser("keywords", new PanGuAnalyzer(true)).Parse(keyword); Query querysysattr = new QueryParser("sysattr", new PanGuAnalyzer(true)).Parse(keyword); bqAllFilter.Add(querytitle, BooleanClause.Occur.MUST); bqAllFilter.Add(querycontent, BooleanClause.Occur.SHOULD); bqAllFilter.Add(querysysattr, BooleanClause.Occur.SHOULD); SortField sorttitle = new SortField("title", SortField.SCORE, false); SortField sortkeywords = new SortField("keywords", SortField.SCORE, false); SortField sortsysattr = new SortField("sysattr", SortField.SCORE, false); Sort sort = new Sort(new SortField[] { sorttitle, sortkeywords, sortsysattr }); //Hits hits = searcher.Search(bqAllFilter); Hits hits = searcher.Search(bqAllFilter, sort); if (currpage >= 0 && pagesize > 0 && currpage * pagesize < hits.Length()) { int i = currpage * pagesize; while (i < (currpage + 1) * pagesize) { ShowInfo info = new ShowInfo(); info.Id = int.Parse(hits.Doc(i).Get("id")); info.Title = Common.SplitContent.HightLight(keyword, hits.Doc(i).Get("title")); //pro.Keywords = hits.Doc(i).Get("keywords"); info.Keywords = Common.SplitContent.HightLight(keyword, hits.Doc(i).Get("keywords")); if (string.IsNullOrEmpty(info.Keywords)) { info.Keywords = hits.Doc(i).Get("keywords"); } info.Detail = Common.SplitContent.HightLight(keyword, hits.Doc(i).Get("detail")); if (string.IsNullOrEmpty(info.Detail)) { info.Detail = hits.Doc(i).Get("detail"); } prolist.Add(info); i++; } } return(prolist); }
void Stage_taolun() { GameStage = "讨论"; ShowInfo.SetActive(false); if (day % 2 == 1) { GameStatus.GetComponent <Text> ().text = "请从警长/死者右手开始发言"; } else { GameStatus.GetComponent <Text> ().text = "请从警长/死者左手开始发言"; } }
public void InsertOrUpdate(ShowInfo showInfo) { if (showInfo.ShowInfoId == 0) { context.ShowInfos.Add(showInfo); } else { context.Entry(showInfo).State = EntityState.Modified; } //how can this method know if the student is new or existing. //if studentId == 0 //then it is new, if not it is existing object. }
//Window show ImageProperty private void OpenImgInfo() { if (ImageOne == null) { MessageBox.Show("Please open at least one image"); return; } ShowInfo _showInfo = new ShowInfo(ImageOne); _showInfo.Show(); Console.WriteLine("Open image Infro"); }
public Popups() { InitializeComponent(); this.SizeChanged += Popups_SizeChanged; this.nIcon.Click += nIcon_Click; this.nIcon.MouseClick += nIcon_MouseClick; this.FormClosing += Popups_FormClosing; this.pictureBox1.DoubleClick += pictureBox1_DoubleClick; this.pictureBox1.MouseClick += pictureBox1_MouseClick; Port.DataReceived += Port_DataReceived; sInfo = new ShowInfo(ShowText); }
// Use this for initialization void Start() { //初始化游戏界面 CanClick = true; ConfigUI.SetActive(false); PlayerUI.SetActive(false); ChoosePlayer.SetActive(false); ShowInfo.SetActive(false); ShowPlayer.SetActive(false); GameStage = "准备开始"; GameMode = "Player"; GameObject.Find("MainCanvas/NextStage").GetComponent <Button> ().interactable = false; }
public FrequencyChooseControl(List <HDDCQKInfo> hDDCQKInfo) { InitializeComponent(); infos = hDDCQKInfo; List <HDDCQKInfo> tempList = new List <HDDCQKInfo>(); foreach (var temp in infos) { if (temp.IsCheck) { tempList.Add(temp); } } var list = (from c in infos where !(from d in tempList select d.id).Contains(c.id) select c ).ToList(); LoadPage.Text = "1"; int count = list.Count() / 9; if (list.Count() % 9 != 0) { count++; } CountPage.Content = count.ToString(); this.countPage = count; if (count > 1) { int index = 8; while (index >= 0) { ShowInfo.Add(list[8 - index]); index--; } } else { countPage = 1; CountPage.Content = 1.ToString(); LoadPage.Text = 1.ToString(); foreach (var temp in list) { ShowInfo.Add(temp); } } Bind.ItemsSource = tempList; grid.ItemsSource = ShowInfo; NBInfos = list; }
protected async override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); //这个e.Parameter是获取传递过来的参数,其实大家应该再次之前判断这个参数是否为null的,我偷懒了 if (e != null) { ViewModel = (ShowInfo)e.Parameter; //this.imageSource = await ImageHelper.ConvertBytesToBitmapImage(ViewModel.imge_source); var s = Convert.ToBase64String(ViewModel.imge_source); imageSource = await ImageHelper.SaveToImageSource(ViewModel.imge_source); this.Image_Thumbnail.Source = this.imageSource; } }
public async Task UnsubscribeShow(ShowInfo show) { await Initialize(); var subscription = _shows.FirstOrDefault(s => s.Id == show.Id); if (subscription != null) { _shows.Remove(subscription); await _localStorage.SetItem(ShowSubscriptionsKey, _shows); SubscriptionsChanged?.Invoke(_shows); } }
public void AddProgramInfos(ShowInfo si) { if (string.IsNullOrWhiteSpace(si.Name)) { return; } //YYYYMMDDhhmmss +0100 for gmt+1 if (si.Name.Contains("&")) { si.Name = si.Name.Replace("&", "&"); } if (!string.IsNullOrWhiteSpace(si.ShortInfo) && si.ShortInfo.Contains("&")) { si.ShortInfo = si.ShortInfo.Replace("&", "&"); } var channelName = si.StationName.Replace(" ", "").Replace("/", "I").Replace("_", ""); channelName += ".1"; _resultBuilder.AppendLine( $"<programme start='{DateFormatter(si.Start)}' stop='{DateFormatter(si.End)}' channel='{channelName}'>"); _resultBuilder.AppendLine($"<title lang='de'>{si.Name}</title>"); if (!string.IsNullOrWhiteSpace(si.ShortInfo)) { _resultBuilder.AppendLine($"<sub-title lang='de'>{si.ShortInfo}</sub-title>"); } if (!string.IsNullOrWhiteSpace(si.Description)) { _resultBuilder.AppendLine($"<desc lang='de'>{GetUtf8String(si.Description)}</desc>"); } if (si.Year != -1) { _resultBuilder.AppendLine($"<date>{si.Year}</date>"); } if (!string.IsNullOrEmpty(si.Category)) { _resultBuilder.AppendLine($"<category lang='de'>{si.Category}</category>"); } _resultBuilder.AppendLine("</programme>"); }
/// <summary> /// ��ȡָ����ŵ�չ����Ϣ���� /// </summary> /// <param name="infoId">ָ����ŵ�չ����Ϣ����</param> /// <returns>�ñ�Ŷ�Ӧ��չ����Ϣ����</returns> public ShowInfo GetItem(Int64 infoId) { ShowInfo info = null; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@strWhere"," where id ="+infoId.ToString()), new SqlParameter("@strTableName","XYV_ShowInfo"), new SqlParameter("@strOrder","") }; using (SqlDataReader reader = XYECOM.Core.Data.SqlHelper.ExecuteReader( CommandType.StoredProcedure, "XYP_SelectByWhere", param)) { if (reader.Read()) { info = new ShowInfo(); info.Id = Core.MyConvert.GetInt32(reader["id"].ToString()); info.Infotitle = reader["infotitle"].ToString(); info.AddInfoTime = reader["addInfoTime"].ToString(); info.Contents = reader["contents"].ToString(); info.Typeid = Core.MyConvert.GetInt32(reader["typeid"].ToString()); info.HtmlPage = reader["htmlPage"].ToString(); info.IsCommend = reader["IsCommend"].ToString() == "1"; info.BeginTime = reader["BeginTime"].ToString(); info.EndTime = reader["EndTime"].ToString(); info.District = reader["District"].ToString(); info.Site = reader["Site"].ToString(); info.Sponsor = reader["Sponsor"].ToString(); info.Undertake = reader["undertake"].ToString(); info.Coorganizor = reader["coorganizor"].ToString(); info.Sustain = reader["sustain"].ToString(); info.Sycle = reader["Sycle"].ToString(); info.Type = reader["Type"].ToString(); info.URL = reader["URL"].ToString(); info.Area = reader["Area"].ToString(); info.UnitPrice = Core.MyConvert.GetInt32(reader["unitPrice"].ToString()); info.LeastRation = Core.MyConvert.GetInt32(reader["leastRation"].ToString()); info.AreaTotal = Core.MyConvert.GetInt32(reader["areaTotal"].ToString()); info.AttachInfo = new Attachment().GetItems(info.Id, "i_showinfo"); //���ø�����Ϣ //this.SetAttachmentInfo(info, reader); } } return info; }
/// <summary> /// 记录修改临时设置显示数据 /// </summary> /// <param name="showInfo"></param> /// <returns></returns> public bool InsertOrModifyShow(ShowInfo showInfo) { string sSql = $@" IF NOT EXISTS(Select * from ShowInfo where Id = '{showInfo.ID}') BEGIN Insert into ShowInfo(ConfigName,AreaName,BeginTime,EndTime,ByOrder,ScreenId) values('{showInfo.ConfigName}','{showInfo.AreaName}','{showInfo.BeginTime}','{showInfo.EndTime}','{showInfo.ByOrder}','{showInfo.ScreenId}') END ELSE BEGIN Update ShowInfo set ConfigName = '{showInfo.ConfigName}',AreaName = '{showInfo.AreaName}',BeginTime = '{showInfo.BeginTime}',EndTime = '{showInfo.EndTime}',ByOrder= '{showInfo.ByOrder}',ScreenId = '{showInfo.ScreenId}' where Id = '{showInfo.ID}' END "; return(server.ExecuteNonQuery(sSql) > 0); }
public PredictionBreakdown(Show s, MiniNetwork n) { show = s; network = n; details = new ObservableCollection <DetailsContainer>(); InitializeComponent(); ShowInfo.Elapsed += ShowInfo_Elapsed; ShowInfo.Start(); ShowDetails.ItemsSource = details; LoadBreakdown(); }
void baitianjiesuan() { GameStage = "白天结算"; ShowInfo.SetActive(true); jieguo = ""; if (toupiao == null) { jieguo = "平安日"; } else { die(toupiao, "处决"); } GameObject.Find("ShowInfo/Text").GetComponent <Text> ().text = jieguo; }
static void Main() { uint choice; var Bus1 = new Bus("Mercedes", "A100", "Blue", "Wheel", 1, 90, 10, 15); ShowInfo show = Bus1.ShowInfo; var Bus2 = new Bus("MAZ", "103", "Green", "Wheel", 8, 95, 5, 18); show += Bus2.ShowInfo; var Bus3 = new Bus("Radzimich", "92", "Yellow", "Wheel", 8, 100, 0, 9); show += Bus3.ShowInfo; var Bus4 = new Bus("Neman", "88", "White", "Wheel", 8, 95, 0, 7); show += Bus4.ShowInfo; show(); Bus1.Notify += DisplayMessage; Bus2.Notify += DisplayMessage; //Delegate + event JOB try { choice = Convert.ToUInt32(Console.ReadLine()); if (choice > 4) { throw new Exception("Choose int in range of 1-4"); } Bus1.TakeJob(choice); } catch (Exception e) { Console.WriteLine(e); } Bus1.RemoveJob(); Bus2.GetRandomJob(); //Calculate fuel compsution Calculator calc = (miles, fuel) => miles * fuel; Console.WriteLine(calc(Convert.ToInt32(Console.ReadLine()), Bus1.FuelConsumption)); //calculate Distance of travel Calculator milesCalculator = delegate(int miles, int fuel) { return(Bus1.MaxSpeed * miles * fuel); }; Console.WriteLine(milesCalculator(Convert.ToInt32(Console.ReadLine()), Bus1.FuelConsumption)); }
private void FillConstructorData(string classWholeName) { paramList.Clear(); Type tt = Type.GetType(classWholeName); var r = tt; ConstructorInfo[] constructInfoList = r.GetConstructors(BindingFlags.Instance | BindingFlags.Public); foreach (var constructorInfo in constructInfoList) { ShowInfo showInfo = new ShowInfo(); showInfo.constructorInfo = constructorInfo; paramList.Add(showInfo); } }
public ShowInfo GetShowInfo() { string sql = "select AllOrPart from ShowInfo where Flag=1"; SQLiteDataReader objReader = SQLiteHelper.GetReader(sql); ShowInfo objShowInfo = null; if (objReader.Read()) { objShowInfo = new ShowInfo() { AllOrPart = Convert.ToInt32(objReader["AllOrPart"]) }; } objReader.Close(); return(objShowInfo); }
private void CheckInternetConnection() { LbInfo.Content = "Проверка подключения к интернету"; try { IPHostEntry obj = Dns.GetHostByName("www.google.com"); progressbar.Value = 1; } catch { ShowInfo sg = new ShowInfo("Состояние сети", "Подключения к интернету нет."); sg.ShowDialog(); Mw.CloseWindow(); this.Close(); } }
private void FillMethodData(string classWholeName) { paramList.Clear(); Type tt = Type.GetType(classWholeName); var r = tt; MethodInfo[] methodInfoList = r.GetMethods(); foreach (var methodInfo in methodInfoList) { ShowInfo showInfo = new ShowInfo(); showInfo.methodInfo = methodInfo; paramList.Add(showInfo); } }
void yewanjiesuan() { GameStage = "夜晚结算"; day++; jieguo = ""; diyiye = false; if (dusha != null) { die(dusha, "毒杀"); dusha = null; } if (jisha != null) { //有杀人 if (shouhu != jisha) { //没守对 if (shiyongjieyao) { //用解药了 jieyaoyongle = true; shiyongjieyao = false; } else { //没用解药 if (jisha.GetComponent <PlayerCard> ().Role == "长老" && shaguozhanglao == false) { //杀到长老第一条命 shaguozhanglao = true; } else { die(jisha, "击杀"); } } } } GameStatus.GetComponent <Text> ().text = "天亮了,昨晚结果为"; ShowInfo.SetActive(true); if (jieguo == "") { jieguo = "平安夜"; } GameObject.Find("ShowInfo/Text").GetComponent <Text> ().text = jieguo; }
public List<ShowInfo> GetShowsForFanArtists(int fanKey) { Fan myFan = (from f in se.Fans where f.FanKey == fanKey select f).First(); List<ShowInfo> shows = new List<ShowInfo>; //this loop within a loop is very inefficient foreach (Artist a in myFan.Artists) { //get all the shows for the fan var shws = from s in se.Shows from sd in s.ShowDetails where sd.ArtistKey == a.ArtistKey select new { s.ShowName, s.ShowTime, s.ShowDate, s.ShowTicketInfo, s.Venue.VenueName, sd.Artist.ArtistName }; //loop through the shows and write them to //ShowInfo objects then add those objects //to the list foreach (var sh in shws) { ShowInfo info = new ShowInfo(); info.ShowName = sh.ShowName; info.ShowDate = sh.ShowDate; info.ShowTicketInfo = sh.ShowTicketInfo; shows.Add(info); } } return shows; }
public MainWindow() { try { StartWindow StWindow = new StartWindow(); StWindow.ShowDialog(); wr = new Weather(); InitializeComponent(); InitializeDezign(); SetWeatherData(wr); ReadSettingsDataXML(); searchflyout.SetMainWnd(this); GetWeatherXmlCity(); settingsflyout.Wetspeed.LowerSlider.Minimum = 0; settingsflyout.Wetspeed.UpperSlider.Minimum = 0; } catch (Exception ex) { ShowInfo sg = new ShowInfo("Ошибка", ex.ToString()); sg.ShowDialog(); } }
public List<ShowInfo> GetShowsByVenue(string VenueName) { List<ShowInfo> shows = new List<ShowInfo>(); var sho = from s in stdb.Shows where s.Venue.VenueName.Equals(VenueName) select new { s.ShowName, s.ShowDate, s.ShowTicketInfo }; foreach (var s in sho) { ShowInfo info = new ShowInfo(); info.ShowName = s.ShowName; info.ShowDate = s.ShowDate; info.ShowTicketInfo = s.ShowTicketInfo; shows.Add(info); } return shows; }
//public Weather(string city, string country, string temperature, string maxTemperature, string minTemperature, string pressure, string humidity, // string windSpeed, string sky, DateTime sunset, DateTime sunrise) //{ // City = city; // Country = country; // Temperature = temperature; // MaxTemperature = maxTemperature; // MinTemperature = minTemperature; // Pressure = pressure; // Humidity = humidity; // WindSpeed = windSpeed; // Sky = sky; // Sunset = sunset; // Sunrise = sunrise; //} public void GetWeatherById(int id) { try { var path = "http://api.openweathermap.org/data/2.5/weather?id=" + id.ToString() + "&APPID=4355fd6b34d30979fb0e05c52642bf31" + "&mode=xml" + "&units=metric" + "&lang=ru"; XDocument doc = XDocument.Load(path); City = doc.Element("current").Element("city").Attribute("name").Value; Country = doc.Element("current").Element("city").Element("country").Value; var sunrise = doc.Element("current").Element("city").Element("sun").Attribute("rise").Value; var sunset = doc.Element("current").Element("city").Element("sun").Attribute("set").Value; Sunrise = Convert.ToDateTime(sunrise).ToLocalTime().ToShortTimeString(); Sunset = Convert.ToDateTime(sunset).ToLocalTime().ToShortTimeString(); Temperature = doc.Element("current").Element("temperature").Attribute("value").Value; MaxTemperature = doc.Element("current").Element("temperature").Attribute("max").Value; MinTemperature = doc.Element("current").Element("temperature").Attribute("min").Value; Humidity = doc.Element("current").Element("humidity").Attribute("value").Value + doc.Element("current").Element("humidity").Attribute("unit").Value; Pressure = doc.Element("current").Element("pressure").Attribute("value").Value + doc.Element("current").Element("pressure").Attribute("unit").Value; WindSpeed = doc.Element("current").Element("wind").Element("speed").Attribute("value").Value; Sky = doc.Element("current").Element("weather").Attribute("value").Value; var time = doc.Element("current").Element("lastupdate").Attribute("value").Value; Time = Convert.ToDateTime(time).ToLocalTime().ToShortTimeString(); Date = Convert.ToDateTime(time).ToShortDateString(); int rain = Convert.ToInt32(doc.Element("current").Element("weather").Attribute("number").Value); if (rain >= 500 || rain <= 531 || rain >= 600 || rain <= 622) { Downfalls = true; } else { Downfalls = false; } } catch (Exception ex) { ShowInfo sg = new ShowInfo("Ошибка", "К сожалению, информация о данном городе на сервере не найдена."); sg.ShowDialog(); } }
private void BigButton_Click(object sender, EventArgs e) { BigButton.Enabled = false; if (BigButton.Text.Contains("START")) { new ChooseShow(this); } else { ShowInfo si = new ShowInfo(this, kCurrentPodcast); si.ShowDialog(this); } }
/// <summary> /// ����һ��ָ����չ����Ϣ���� /// </summary> /// <param name="shi">Ҫ�ĵ�չ����Ϣ����</param> /// <returns>����,���ڻ����0��ɹ�,�����ʧ��</returns> public int Update(ShowInfo shi) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@id",shi.Id), new SqlParameter("@infotitle",shi.Infotitle), new SqlParameter("@typeid",shi.Typeid), new SqlParameter("@contents",shi.Contents), new SqlParameter("@BeginTime",shi.BeginTime), new SqlParameter("@EndTime",shi.EndTime), new SqlParameter("@District",shi.District), new SqlParameter("@Site",shi.Site), new SqlParameter("@sponsor",shi.Sponsor), new SqlParameter("@undertake",shi.Undertake), new SqlParameter("@coorganizor",shi.Coorganizor), new SqlParameter("@sustain",shi.Sustain), new SqlParameter("@Sycle",shi.Sycle), new SqlParameter("@Type",shi.Type), new SqlParameter("@URL",shi.URL), new SqlParameter("@Area",shi.Area), new SqlParameter("@unitPrice",shi.UnitPrice), new SqlParameter("@leastRation",shi.LeastRation), new SqlParameter("@areaTotal",shi.AreaTotal), new SqlParameter("@IsCommend",shi.IsCommend), new SqlParameter("@htmlPage",shi.HtmlPage) }; return XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure,"XYP_UpdateShowInfo", param); }
void ShowMap(string location) { try { string city, country; int comaIndex = location.IndexOf(' '); country = location.Substring(comaIndex + 1); city = location.Remove(comaIndex); City cityFound = Cities.CityList.First<City>(c => c.name == city && c.country == country); var lat = Convert.ToInt32(cityFound.coord.lat); var lon = Convert.ToInt32(cityFound.coord.lon); string uri = "http://openweathermap.org/Maps?zoom=12&lat=" + lat.ToString() + "&lon=" + lon.ToString() + "&layers=B0FTTFF"; webbrawser.brawser.Navigate(uri); } catch (Exception ex) { ShowInfo sg = new ShowInfo("Ошибка", "Информация о данной локации на сервере отсутствует."); sg.ShowDialog(); } }
public void WriteSettingsDataXML() { try { var path = "userSettings.xml"; XDocument doc = new XDocument(); XElement settings = new XElement("settings"); doc.Add(settings); XElement location = new XElement("location"); XElement notification = new XElement("notification"); XElement notificationIsEnable = new XElement("isenabled"); //Чек бокс на отправку уведомлений if (CbNotifications.IsChecked == true) { notificationIsEnable.Value = "true"; XElement mintemperature = new XElement("mintemperature"); mintemperature.Value = slider_temperature.MinCurrent.ToString(); XElement maxtemperature = new XElement("maxtemperature"); maxtemperature.Value = slider_temperature.MaxCurrent.ToString(); XElement minwind = new XElement("minwind"); minwind.Value = Wetspeed.MinCurrent.ToString(); XElement maxwind = new XElement("maxwind"); maxwind.Value = Wetspeed.MaxCurrent.ToString(); XElement downfall = new XElement("downfall"); if (Cbdownfall.IsChecked == true) { downfall.Value = "true"; } else { downfall.Value = "false"; } XElement email = new XElement("email"); email.Value = tbox_email.Text; notification.Add(email, mintemperature, maxtemperature, minwind, maxwind, downfall); XElement city = new XElement("city"); city.Value = TboxCityNotification.Text; //XElement country = new XElement("country"); //country.Value = tbCountryToDisplay.Text; notification.Add(notificationIsEnable); location.Add(city); doc.Root.Add(location); doc.Root.Add(notification); doc.Save(path); ShowInfo sg = new ShowInfo("Пользовательские данные", "Ваши данные оповещения о изменении погоды было сохраненно"); sg.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
protected override string Show(ElaValue @this, ShowInfo info, ExecutionContext ctx) { return !String.IsNullOrEmpty(info.Format) ? Value.ToString(info.Format) : Value.ToString(); }
/// <summary> /// ����һ��ָ���ĺ�����Ϣ���� /// </summary> /// <param name="info">Ҫ�ĵĺ�����Ϣ����</param> /// <returns>����,���ڻ����0��ɹ�,�����ʧ��</returns> public int Update(ShowInfo info) { if (object.Equals(null, info)) return -2; return DAL.Update(info); }
/// <summary> /// ���һ���µ�չ����Ϣ���� /// </summary> /// <param name="info">Ҫ��ӵ��µ�չ����Ϣ����</param> /// <param name="infoId"></param> /// <returns>����,���ڻ����0��ɹ�,���ʧ��</returns> public int Insert(ShowInfo info,out long infoId) { SqlParameter[] param = new SqlParameter[] { new SqlParameter ("@id",SqlDbType.BigInt), new SqlParameter("@infotitle",info.Infotitle), new SqlParameter("@typeid",info.Typeid), new SqlParameter("@contents",info.Contents), new SqlParameter("@BeginTime",info.BeginTime), new SqlParameter("@EndTime",info.EndTime), new SqlParameter("@District",info.District), new SqlParameter("@Site",info.Site), new SqlParameter("@sponsor",info.Sponsor), new SqlParameter("@undertake",info.Undertake), new SqlParameter("@coorganizor",info.Coorganizor), new SqlParameter("@sustain",info.Sustain), new SqlParameter("@Sycle",info.Sycle), new SqlParameter("@Type",info.Type), new SqlParameter("@URL",info.URL), new SqlParameter("@Area",info.Area), new SqlParameter("@unitPrice",info.UnitPrice), new SqlParameter("@leastRation",info.LeastRation), new SqlParameter("@areaTotal",info.AreaTotal) }; param[0].Direction = ParameterDirection.Output; int rowAffected = XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure,"XYP_InsertShowInfo", param); if (rowAffected >= 0) { if (param[0].Value != null && param[0].Value.ToString() != "") infoId = (long)param[0].Value; else infoId = 0; } else { infoId = -1; } return rowAffected; }
private void StopButton_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to end your show?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { ShowInfo si = new ShowInfo(this.mf, this.kCurrentPodcast); si.ac = this; si.Show(); } }
protected override string Show(ElaValue @this, ShowInfo info, ExecutionContext ctx) { return new ElaValue(ConvertToRecord()).Show(info, ctx); }
private void LboxSearchCities_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { try { Weather wtp = new Weather(); string location = LboxSearchCities.SelectedValue.ToString(); LboxSearchCities.Items.Clear(); TboxCityNotification.Clear(); TboxCityNotification.Text = location; } catch (Exception ex) { ShowInfo sg = new ShowInfo("Ошибка", ex.ToString()); sg.ShowDialog(); } }