Exemple #1
0
        private void btn_Book_Click(object sender, EventArgs e)
        {
            var button = (Button)sender;

            if (button == null)
            {
                return;
            }
            if (string.IsNullOrEmpty(txt_CarNumber.Text))
            {
                MessageBox.Show("Vui lòng nhập số xe !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (_scheduleMainForm.TimeSlot == null)
            {
                MessageBox.Show("Vui lòng chọn giờ !", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var schedule = new CarWashingSchedule
            {
                CarNumber     = txt_CarNumber.Text.Trim(),
                GuestStatus   = rdo_waiting.Checked ? GuestStatus.Waiting : GuestStatus.Gone,
                WashingStatus = WashingStatus.New,
                WashingType   = (WashingType)group_WashingType.Controls.OfType <RadioButton>().FirstOrDefault(x => x.Checked).Tag,
                WashManId     = _scheduleMainForm.WashManForm.SelectedWashMan.Id,

                BookedTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, int.Parse(_scheduleMainForm.TimeSlot[0]), int.Parse(_scheduleMainForm.TimeSlot[1]), 0)
            };

            _scheduleMainForm.CreateSchedule(schedule);
            this.Close();
        }
Exemple #2
0
 private async void UpdateSchedule(CarWashingSchedule schedule)
 {
     using (var client = new HttpClient())
     {
         var serializedProduct = JsonConvert.SerializeObject(schedule);
         var content           = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
         var result            = await client.PutAsync(String.Format("{0}/{1}?id={2}", Common.CARWASHING_URI, "PutCarWashing", schedule.Id), content);
     }
     GetAllSchedule();
 }
Exemple #3
0
 public IEnumerable <CarWashingSchedule> PutCarWashing(int id, CarWashingSchedule carWashing)
 {
     carWashing.Id = id;
     if (id == 0 || carWashing == null)
     {
         return(null);
     }
     if (repository.Update(carWashing))
     {
         return(repository.FindAll());
     }
     else
     {
         return(null);
     }
 }
Exemple #4
0
        public async void CreateSchedule(CarWashingSchedule schedule)
        {
            using (var client = new HttpClient())
            {
                var serializedProduct = JsonConvert.SerializeObject(schedule);
                var content           = new StringContent(serializedProduct, Encoding.UTF8, "application/json");
                var result            = await client.PostAsync(string.Format("{0}/{1}", Common.CARWASHING_URI, "PostCarWashing"), content);

                if (result.IsSuccessStatusCode)
                {
                    MessageBox.Show("Lập lịch thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    GetAllSchedule();
                }
                else
                {
                    Console.WriteLine("Creat Schedule fail :" + result.StatusCode.ToString());
                }
            }
        }
Exemple #5
0
 public CarWashingSchedule PostCarWashing(CarWashingSchedule item)
 {
     return(repository.Add(item));
 }