private void ClearForm()
        {
            StationNameTextBox.Text       = "";
            EnablePDFCheckBox.Checked     = false;
            PDFGroupBox.Enabled           = false;
            MaxNumBatchesUpDown.Text      = "";
            EnableWeekendCheckBox.Checked = false;
            WeekendStartDateTimePicker.ResetText();
            WeekendStartDateTimePicker.Enabled = false;
            WeekendEndDateTimePicker.ResetText();
            WeekendEndDateTimePicker.Enabled = false;
            EnableWorkdayCheckBox.Checked    = false;
            WorkdayStartDateTimePicker.ResetText();
            WorkdayStartDateTimePicker.Enabled = false;
            WorkdayEndDateTimePicker.ResetText();
            WorkdayEndDateTimePicker.Enabled = false;

            WatchFolderComboBox.Text  = "";
            TargetFolderComboBox.Text = "";

            WeekendStartDateTimePicker.Format       = DateTimePickerFormat.Custom;
            WeekendStartDateTimePicker.CustomFormat = "HH:mm";
            WeekendEndDateTimePicker.Format         = DateTimePickerFormat.Custom;
            WeekendEndDateTimePicker.CustomFormat   = "HH:mm";

            WorkdayStartDateTimePicker.Format       = DateTimePickerFormat.Custom;
            WorkdayStartDateTimePicker.CustomFormat = "HH:mm";
            WorkdayEndDateTimePicker.Format         = DateTimePickerFormat.Custom;
            WorkdayEndDateTimePicker.CustomFormat   = "HH:mm";
        }
        private void LoadData()
        {
            //StationsListView.Items.Clear();
            string returnMessage = "";

            Cursor.Current = Cursors.WaitCursor;
            HttpClient client = new HttpClient();

            client.Timeout = TimeSpan.FromMinutes(15);
            string urlParameters         = "";
            string URL                   = "";
            HttpResponseMessage response = new HttpResponseMessage();


            // Get Working Folders
            ResultWorkingFolders resultWorkingFolders = new ResultWorkingFolders();

            URL                = BaseURL + "GeneralSettings/GetWorkingFolders";
            urlParameters      = "";
            client.BaseAddress = new Uri(URL);
            response           = client.GetAsync(urlParameters).Result;
            using (HttpContent content = response.Content)
            {
                Task <string> resultTemp = content.ReadAsStringAsync();
                returnMessage        = resultTemp.Result;
                resultWorkingFolders = JsonConvert.DeserializeObject <ResultWorkingFolders>(returnMessage);
            }
            // Add Watch and target folders in Combo Boxes
            if (resultWorkingFolders.RecordsCount != 0)
            {
                foreach (var item in resultWorkingFolders.ReturnValue)
                {
                    WatchFolderComboBox.Items.Add(new ComboBoxItem(Convert.ToString(item.FolderID), item.Path));
                    TargetFolderComboBox.Items.Add(new ComboBoxItem(Convert.ToString(item.FolderID), item.Path));
                }
            }

            if (Data.GlovalVariables.transactionType == "New")
            {
                StationNameTextBox.Enabled = true;
            }
            else
            {
                StationNameTextBox.Enabled = false;
                // Get Current Service Information
                client             = new HttpClient();
                client.Timeout     = TimeSpan.FromMinutes(15);
                URL                = Data.GlovalVariables.BaseURL + "GeneralSettings/GetServiceStationByID";
                urlParameters      = "?stationID=" + Data.GlovalVariables.currentServiceStationID;
                client.BaseAddress = new Uri(URL);
                response           = client.GetAsync(urlParameters).Result;

                if (response.IsSuccessStatusCode)
                {
                    using (HttpContent content = response.Content)
                    {
                        Task <string> resultTemp = content.ReadAsStringAsync();
                        returnMessage = resultTemp.Result;

                        ResultServiceStations resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage);
                        if (resultServiceStations.ReturnCode == 0)
                        {
                            ServiceStation station = new ServiceStation();
                            station = resultServiceStations.ReturnValue.First();
                            originalServiceStation  = station;
                            StationNameTextBox.Text = station.StationName;
                            if (station.PDFStationFlag)
                            {
                                PDFGroupBox.Enabled       = true;
                                EnablePDFCheckBox.Checked = true;
                            }
                            else
                            {
                                PDFGroupBox.Enabled       = false;
                                EnablePDFCheckBox.Checked = false;
                            }
                            MaxNumBatchesUpDown.Text = Convert.ToString(station.MaxNumberBatches);
                            if (station.WeekendFlag)
                            {
                                EnableWeekendCheckBox.Checked    = true;
                                WeekendStartDateTimePicker.Value = Convert.ToDateTime(station.WeekendStartTime);
                                WeekendEndDateTimePicker.Value   = Convert.ToDateTime(station.WeenkendEndTime);
                            }
                            else
                            {
                                EnableWeekendCheckBox.Checked = false;
                                WeekendStartDateTimePicker.ResetText();
                                WeekendStartDateTimePicker.Enabled = false;
                                WeekendEndDateTimePicker.ResetText();
                                WeekendEndDateTimePicker.Enabled = false;
                            }
                            if (station.WorkdayFlag)
                            {
                                EnableWorkdayCheckBox.Checked    = true;
                                WorkdayStartDateTimePicker.Value = Convert.ToDateTime(station.WorkdayStartTime);
                                WorkdayEndDateTimePicker.Value   = Convert.ToDateTime(station.WorkdayEndTime);
                            }
                            else
                            {
                                EnableWorkdayCheckBox.Checked = false;
                                WorkdayStartDateTimePicker.ResetText();
                                WorkdayStartDateTimePicker.Enabled = false;
                                WorkdayEndDateTimePicker.ResetText();
                                WorkdayEndDateTimePicker.Enabled = false;
                            }

                            foreach (ComboBoxItem item in WatchFolderComboBox.Items)
                            {
                                if (item.Tag == Convert.ToString(station.WatchFolderID))
                                {
                                    WatchFolderComboBox.Text = item.Text;
                                    break;
                                }
                            }

                            foreach (ComboBoxItem item in TargetFolderComboBox.Items)
                            {
                                if (item.Tag == Convert.ToString(station.TargetFolderID))
                                {
                                    TargetFolderComboBox.Text = item.Text;
                                    break;
                                }
                            }
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage,
                                    "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        private void ResetButton_Click(object sender, EventArgs e)
        {
            if (Data.GlovalVariables.transactionType == "New")
            {
                ClearForm();
            }
            else
            {
                StationNameTextBox.Text = originalServiceStation.StationName;
                if (originalServiceStation.PDFStationFlag)
                {
                    PDFGroupBox.Enabled       = true;
                    EnablePDFCheckBox.Checked = true;
                }
                else
                {
                    PDFGroupBox.Enabled       = false;
                    EnablePDFCheckBox.Checked = false;
                }
                MaxNumBatchesUpDown.Text = Convert.ToString(originalServiceStation.MaxNumberBatches);
                if (originalServiceStation.WeekendFlag)
                {
                    EnableWeekendCheckBox.Checked    = true;
                    WeekendStartDateTimePicker.Value = Convert.ToDateTime(originalServiceStation.WeekendStartTime);
                    WeekendEndDateTimePicker.Value   = Convert.ToDateTime(originalServiceStation.WeenkendEndTime);
                }
                else
                {
                    EnableWeekendCheckBox.Checked = false;
                    WeekendStartDateTimePicker.ResetText();
                    WeekendStartDateTimePicker.Enabled = false;
                    WeekendEndDateTimePicker.ResetText();
                    WeekendEndDateTimePicker.Enabled = false;
                }
                if (originalServiceStation.WorkdayFlag)
                {
                    EnableWorkdayCheckBox.Checked    = true;
                    WorkdayStartDateTimePicker.Value = Convert.ToDateTime(originalServiceStation.WorkdayStartTime);
                    WorkdayEndDateTimePicker.Value   = Convert.ToDateTime(originalServiceStation.WorkdayEndTime);
                }
                else
                {
                    EnableWorkdayCheckBox.Checked = false;
                    WorkdayStartDateTimePicker.ResetText();
                    WorkdayStartDateTimePicker.Enabled = false;
                    WorkdayEndDateTimePicker.ResetText();
                    WorkdayEndDateTimePicker.Enabled = false;
                }

                foreach (ComboBoxItem item in WatchFolderComboBox.Items)
                {
                    if (item.Tag == Convert.ToString(originalServiceStation.WatchFolderID))
                    {
                        WatchFolderComboBox.Text = item.Text;
                        break;
                    }
                }

                foreach (ComboBoxItem item in TargetFolderComboBox.Items)
                {
                    if (item.Tag == Convert.ToString(originalServiceStation.TargetFolderID))
                    {
                        TargetFolderComboBox.Text = item.Text;
                        break;
                    }
                }
            }
        }