//public static int SUCCESS; //public Everyday(string sLog, string sPass) //{ // //Properties. // //protected int ID { get; set; } // //protected string Title { get; set; } // //protected string Description { get; set; } // //protected TimeSpan jobLength { get; set; } // Login(sLog, sPass); // //if (Login(sLog, sPass)==0) // //{ // //} //} //GetEvents IEveryday.getEvents() //{ // return getEvents; //} //LoginData IEveryday.getLoginData() //{ // return loginData; //} //ErrorStatus IEveryday.getErrorStatus() //{ // return errStatus; //} public static int Login(string sLog, string sPass) { Uri uri = new Uri(SERVER + "Login.php?"); string postData = String.Format("&Devid={0}&Platform={1}&Query={{\"login\":\"{2}\",\"pass\":\"{3}\"}}", ComputerID, OSVersion, sLog, sPass); if (MakeQueryToServer(uri, postData) == 0) { return(0); } loginData = JsonConvert.DeserializeObject <LoginData>(response); uri = new Uri(SERVER_IOS + "rGetEvents.php?"); postData = String.Format("Token={0}&Devid={1}&Platform={2}&Query={{\"date_start\":\"{3}\",\"date_end\":\"{4}\"}}", loginData.token, "bsm11", "WinXP", DateTime.Today.ToString("yyyy-MM-dd"), DateTime.Today.ToString("yyyy-MM-dd")); if (MakeQueryToServer(uri, postData, true) == 0) { return(0); } getEvents = JsonConvert.DeserializeObject <GetEvents>(response); return(1); }
//Everyday eday; public frmMain() { InitializeComponent(); pbxKlient.Image = Everyday.UserImg; events = Everyday.GetEventsByData(monthCalendar1.TodayDate.ToString("yyyy-MM-dd"), monthCalendar1.TodayDate.ToString("yyyy-MM-dd")); FillData(events); }
//================================================================================================= public static GetEvents GetEventsByData(string date_start, string date_end) //date format "2014-08-20" { Uri uri = new Uri(SERVER + "ios/rGetEvents.php?"); string postData = String.Format("Token={0}&Devid={1}&Platform={2}&Query={{\"date_start\":\"{3}\",\"date_end\":\"{4}\"}}", loginData.token, ComputerID, OSVersion, date_start, date_end); if (MakeQueryToServer(uri, postData) == 0) { return(null); } GetEvents getEvents = JsonConvert.DeserializeObject <GetEvents>(response); return(getEvents); }
private void FillData(GetEvents events) { ImageList imageListSmall = new ImageList(); ImageList imageListLarge = new ImageList(); listView1.Clear(); listView1.Columns.Add("Мероприятия", 130, HorizontalAlignment.Left); listView1.Columns.Add("Продукты", 200, HorizontalAlignment.Left); foreach (Event ev in events.events) { ListViewItem item = new ListViewItem(ev.event_name.ToString(), 0); item.Checked = ev.confirmed == 1 ? true : false; Bitmap bmp = Everyday.GetResponse(Everyday.SERVER_IMG + ev.img, true) as Bitmap; if (bmp != null) { imageListSmall.Images.Add(bmp); } ListViewItem.ListViewSubItemCollection lvi = new ListViewItem.ListViewSubItemCollection(item); if (ev.details != null && ev.details.items != null) { foreach (Item it in ev.details.items) { lvi.Add(it.caption); } } listView1.Items.AddRange(new ListViewItem[] { item }); } //Initialize the ImageList objects with bitmaps. //imageListSmall.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MySmallImage1.bmp")); //imageListSmall.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MySmallImage2.bmp")); //imageListLarge.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MyLargeImage1.bmp")); //imageListLarge.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MyLargeImage2.bmp")); //Assign the ImageList objects to the ListView. //listView1.LargeImageList = imageListLarge; //listView1.SmallImageList = imageListSmall; listView1.SmallImageList = imageListSmall; }
private void FillData(GetEvents events) { ImageList imageListSmall = new ImageList(); ImageList imageListLarge = new ImageList(); listView1.Clear(); listView1.Columns.Add("Мероприятия", 130, HorizontalAlignment.Left); listView1.Columns.Add("Продукты", 200, HorizontalAlignment.Left); foreach (Event ev in events.events) { ListViewItem item = new ListViewItem(ev.event_name.ToString(), 0); item.Checked = ev.confirmed == 1 ? true : false; Bitmap bmp = Everyday.GetResponse(Everyday.SERVER_IMG + ev.img, true) as Bitmap; if (bmp != null) imageListSmall.Images.Add(bmp); ListViewItem.ListViewSubItemCollection lvi = new ListViewItem.ListViewSubItemCollection(item); if (ev.details != null && ev.details.items != null) { foreach (Item it in ev.details.items) { lvi.Add(it.caption); } } listView1.Items.AddRange(new ListViewItem[] { item }); } //Initialize the ImageList objects with bitmaps. //imageListSmall.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MySmallImage1.bmp")); //imageListSmall.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MySmallImage2.bmp")); //imageListLarge.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MyLargeImage1.bmp")); //imageListLarge.Images.Add(pbxKlient.Image);//Bitmap.FromFile("C:\\MyLargeImage2.bmp")); //Assign the ImageList objects to the ListView. //listView1.LargeImageList = imageListLarge; //listView1.SmallImageList = imageListSmall; listView1.SmallImageList = imageListSmall; }
private void monthCalendar1_DateChanged(object sender, DateRangeEventArgs e) { events = Everyday.GetEventsByData(e.Start.ToString("yyyy-MM-dd"), e.End.ToString("yyyy-MM-dd")); FillData(events); }
//public static int SUCCESS; //public Everyday(string sLog, string sPass) //{ // //Properties. // //protected int ID { get; set; } // //protected string Title { get; set; } // //protected string Description { get; set; } // //protected TimeSpan jobLength { get; set; } // Login(sLog, sPass); // //if (Login(sLog, sPass)==0) // //{ // //} //} //GetEvents IEveryday.getEvents() //{ // return getEvents; //} //LoginData IEveryday.getLoginData() //{ // return loginData; //} //ErrorStatus IEveryday.getErrorStatus() //{ // return errStatus; //} public static int Login(string sLog, string sPass) { Uri uri = new Uri(SERVER + "Login.php?"); string postData = String.Format("&Devid={0}&Platform={1}&Query={{\"login\":\"{2}\",\"pass\":\"{3}\"}}", ComputerID, OSVersion, sLog, sPass); if (MakeQueryToServer(uri, postData) == 0) return 0; loginData = JsonConvert.DeserializeObject<LoginData>(response); uri = new Uri(SERVER_IOS + "rGetEvents.php?"); postData = String.Format("Token={0}&Devid={1}&Platform={2}&Query={{\"date_start\":\"{3}\",\"date_end\":\"{4}\"}}", loginData.token, "bsm11", "WinXP", DateTime.Today.ToString("yyyy-MM-dd"), DateTime.Today.ToString("yyyy-MM-dd")); if (MakeQueryToServer(uri, postData,true) == 0) return 0; getEvents = JsonConvert.DeserializeObject<GetEvents>(response); return 1; }