Beispiel #1
0
        public ChangeStatus()
        {
            InitializeComponent();
            current.Status     = false;
            current.IsApproved = false;
            baseURL            = "https://localhost:5001/api/CallAtApplicationItems/" + CurrentID.ToString();
            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var task1 = client.GetStringAsync(baseURL);
            List <CallAtApplication> applications = JsonConvert.DeserializeObject <List <CallAtApplication> >(task1.Result);

            current          = applications[0];
            NameLable.Text   = current.VisitorName;
            RoomLable.Text   = current.RoomNumber.ToString();
            TimeLable.Text   = current.CallAtTime.ToString();
            RemarkLable.Text = current.Remarks.ToString();
            if (current.Status == true)
            {
                if (current.IsApproved == true)
                {
                    CallAtApproved.Checked = true;
                }
                else
                {
                    CallAtDenied.Checked = true;
                }
            }
        }
Beispiel #2
0
        private void AddOK_Click(object sender, EventArgs e)
        {
            CallAtApplication callAt  = new CallAtApplication();
            string            baseURL = "https://localhost:5001/api/CallAtApplicationItems";
            HttpClient        client  = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            if (VisitorName.Text == null || Room.Text == null)
            {
                MessageBox.Show("信息填写不完整!");
            }
            else
            {
                callAt.CallAtApplicationID = ID + 1;
                callAt.CallAtTime          = DateTime.Parse(dateTimePicker.Text);
                callAt.VisitorName         = VisitorName.Text;
                callAt.IsApproved          = false;
                callAt.Remarks             = Remarks.Text;
                callAt.RoomNumber          = CurrentStudent.RoomNumber;
                callAt.Status    = false;
                callAt.StudentID = CurrentStudent.StudentID;

                HttpContent content = new StringContent(JsonConvert.SerializeObject(callAt), Encoding.UTF8, "application/json");
                var         task    = client.PostAsync(baseURL, content);
                task.Wait();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
        }
        public ChangeCallAtApplication_student()
        {
            InitializeComponent();
            string     baseURL = "https://localhost:5001/api/CallAtApplicationItems" + Index.ToString();
            HttpClient client  = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var task1 = client.GetStringAsync(baseURL);
            List <CallAtApplication> todos = JsonConvert.DeserializeObject <List <CallAtApplication> >(task1.Result);

            application         = todos[0];
            VisitorName.Text    = application.VisitorName;
            dateTimePicker.Text = application.CallAtTime.ToString();
            Remarks.Text        = application.Remarks;
        }
Beispiel #4
0
        public override bool Equals(object obj)
        {
            CallAtApplication application = (CallAtApplication)obj;

            return(application.CallAtApplicationID == CallAtApplicationID);
        }