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 ProcessForm_Load(object sender, EventArgs e) { try { this.Text = (currentProcessName + " Service Configuration").ToUpper(); ResultJobsExtended resultJobs = new ResultJobsExtended(); ResultProcesses resultProcess = new ResultProcesses(); List <JobExtended> jobs = new List <JobExtended>(); List <ServiceStation> serviceStations = new List <ServiceStation>(); List <ServiceStation> pdfServiceStations = new List <ServiceStation>(); // Load Process List View string returnMessage = ""; Cursor.Current = Cursors.WaitCursor; string urlParameters = ""; string URL = ""; HttpResponseMessage response = new HttpResponseMessage(); // Get Jobs HttpClient client1 = new HttpClient(); client1.Timeout = TimeSpan.FromMinutes(15); URL = BaseURL + "Jobs/GetJobs"; urlParameters = ""; client1.BaseAddress = new Uri(URL); response = client1.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultJobs = JsonConvert.DeserializeObject <ResultJobsExtended>(returnMessage); } if (response.IsSuccessStatusCode) { jobs = resultJobs.ReturnValue; // Add especial Job tothe Jobs List JobExtended job = new JobExtended(); job.JobName = "ALL"; job.JobID = 0; jobs.Add(job); JobsComboBox.Items.Add(""); foreach (var item in jobs) { JobsComboBox.Items.Add(item.JobName.Trim()); } } else { MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage, "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!string.IsNullOrEmpty(Data.GlovalVariables.currentJobName)) { // This is the case where this template is called from a Job configuration JobsComboBox.Enabled = false; JobsComboBox.Text = Data.GlovalVariables.currentJobName.Trim(); } // Get Service Stations HttpClient client2 = new HttpClient(); client2.Timeout = TimeSpan.FromMinutes(15); ResultServiceStations resultResultStations = new ResultServiceStations(); URL = BaseURL + "GeneralSettings/GetServiceStations"; urlParameters = ""; client2.BaseAddress = new Uri(URL); response = client2.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultResultStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response.IsSuccessStatusCode) { ServiceStationsComboBox.Items.Add(""); PDFServiceStationsComboBox.Items.Add(""); serviceStations = resultResultStations.ReturnValue; foreach (ServiceStation serviceStation in serviceStations) { ServiceStationsComboBox.Items.Add(serviceStation.StationName.Trim()); // Identify if Station is use for PDF Conversion if (serviceStation.PDFStationFlag) { pdfServiceStations.Add(serviceStation); PDFServiceStationsComboBox.Items.Add(serviceStation.StationName.Trim()); } } } else { MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage, "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } resultProcess = GetProcess(); string enableFlag = ""; string cronDescription = ""; string cronJob = ""; // Table Definition - We will use this definition for Any Process in the System DataTable dt = new DataTable("Processes"); dt.Columns.Add("ProcessID", typeof(string)); dt.Columns.Add("JobID", typeof(string)); dt.Columns.Add("StationID", typeof(string)); dt.Columns.Add("PDFStationID", typeof(string)); dt.Columns.Add("Status", typeof(string)); dt.Columns.Add("CustomerName", typeof(string)); dt.Columns.Add("JobName", typeof(string)); dt.Columns.Add("ServiceStation", typeof(string)); dt.Columns.Add("PDFServiceStation", typeof(string)); dt.Columns.Add("Schedule", typeof(string)); dt.Columns.Add("CronDescription", typeof(string)); // Load Table Information // this condition is to support load balancing associated to FIle Conversion Stations if (Data.GlovalVariables.currentProcessName == "Load Balancer???") { ServiceStationsComboBox.Enabled = true; PDFServiceStationsComboBox.Enabled = true; foreach (JobExtended job in jobs) { foreach (ServiceStation serviceStation in serviceStations) { foreach (ServiceStation pdfserviceStation in pdfServiceStations) { enableFlag = "No Configured"; cronDescription = ""; cronJob = ""; foreach (var process in resultProcess.ReturnValue) { if (process.ProcessID.ToString() == Data.GlovalVariables.currentProcessID.ToString() && process.JobID.ToString() == job.JobID.ToString() && process.StationID.ToString() == serviceStation.StationID.ToString() && process.PDFStationID.ToString() == pdfserviceStation.StationID.ToString()) { enableFlag = Convert.ToString(process.EnableFlag); cronDescription = process.CronDescription; cronJob = process.ScheduleCronFormat; break; } } if (Data.GlovalVariables.currentJobName == job.JobName || string.IsNullOrEmpty(Data.GlovalVariables.currentJobName)) { DataRow dr = dt.NewRow(); dr["ProcessID"] = Data.GlovalVariables.currentProcessID.ToString(); dr["JobID"] = job.JobID.ToString(); dr["StationID"] = serviceStation.StationID.ToString(); dr["PDFStationID"] = pdfserviceStation.StationID.ToString(); dr["Status"] = enableFlag; if (job.JobName.Trim() == "ALL") { dr["CustomerName"] = ""; } else { dr["CustomerName"] = job.CustomerName.Trim(); } dr["JobName"] = job.JobName.Trim(); dr["ServiceStation"] = serviceStation.StationName.Trim(); dr["PDFServiceStation"] = pdfserviceStation.StationName.Trim(); dr["Schedule"] = cronJob; dr["CronDescription"] = cronDescription; dt.Rows.Add(dr); } } } } } else { ServiceStationsComboBox.Enabled = true; PDFServiceStationsComboBox.Enabled = false; string serviceStation = ""; string serviceStationID = ""; foreach (JobExtended job in jobs) { enableFlag = "No Configured"; serviceStation = ""; cronDescription = ""; cronJob = ""; foreach (var process in resultProcess.ReturnValue) { if (process.ProcessID.ToString() == Data.GlovalVariables.currentProcessID.ToString() && process.JobID.ToString() == job.JobID.ToString()) { enableFlag = Convert.ToString(process.EnableFlag); serviceStationID = process.StationID.ToString(); serviceStation = process.StationName; cronDescription = process.CronDescription; cronJob = process.ScheduleCronFormat; break; } } DataRow dr = dt.NewRow(); dr["ProcessID"] = Data.GlovalVariables.currentProcessID.ToString(); dr["JobID"] = job.JobID.ToString(); dr["StationID"] = serviceStationID; //dr["PDFStationID"] = pdfserviceStation.StationID.ToString(); dr["Status"] = enableFlag; if (job.JobName.Trim() == "ALL") { dr["CustomerName"] = ""; } else { dr["CustomerName"] = job.CustomerName.Trim(); } dr["JobName"] = job.JobName.Trim(); dr["ServiceStation"] = serviceStation.Trim(); //dr["PDFServiceStation"] = pdfserviceStation.StationName.Trim(); dr["Schedule"] = cronJob; dr["CronDescription"] = cronDescription; dt.Rows.Add(dr); } } bs.DataSource = dt; // Define DataGrid // Filter Header based on Process Type { Synchronizer, Indexer, Load Balancer, Batch Delivery, etc } ProcessGridView.DataSource = dt; ProcessGridView.Columns["ProcessID"].Visible = false; ProcessGridView.Columns["JobID"].Visible = false; ProcessGridView.Columns["StationID"].Visible = false; ProcessGridView.Columns["PDFStationID"].Visible = false; ProcessGridView.Columns["CustomerName"].Visible = false; ProcessGridView.Columns["CustomerName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["CustomerName"].HeaderText = "Customer Name"; ProcessGridView.Columns["Status"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["Status"].ReadOnly = true; ProcessGridView.Columns["JobName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["JobName"].ReadOnly = true; ProcessGridView.Columns["JobName"].HeaderText = "Job Name"; ProcessGridView.Columns["ServiceStation"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["ServiceStation"].ReadOnly = true; ProcessGridView.Columns["ServiceStation"].HeaderText = "Service Station"; // The following condition is to be considered for future implementation if (Data.GlovalVariables.currentProcessName == "Load Balancer ???") { ProcessGridView.Columns["PDFServiceStation"].Visible = true; } else { ProcessGridView.Columns["PDFServiceStation"].Visible = false; } ProcessGridView.Columns["PDFServiceStation"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["PDFServiceStation"].ReadOnly = true; ProcessGridView.Columns["PDFServiceStation"].HeaderText = "PDF Service Station"; ProcessGridView.Columns["Schedule"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["Schedule"].ReadOnly = true; ProcessGridView.Columns["CronDescription"].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; ProcessGridView.Columns["CronDescription"].ReadOnly = true; ProcessGridView.Columns["CronDescription"].HeaderText = "Cron Description"; ProcessGridView.AllowUserToAddRows = false; ProcessGridView.RowHeadersVisible = true; ProcessGridView.AllowUserToAddRows = false; ProcessGridView.AllowUserToResizeRows = false; } catch (Exception ex) { //MainForm.ErrorMessage(ex); nlogger.Fatal(General.ErrorMessage(ex)); MessageBox.Show(General.ErrorMessage(ex), "Error ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Save(string action) { try { ServiceStation serviceStation = new ServiceStation(); ResultServiceStations resultServiceStations = new ResultServiceStations(); string bodyString = ""; string serviceStationJS = ""; string returnMessage = ""; Cursor.Current = Cursors.WaitCursor; HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMinutes(15); string urlParameters = ""; string URL = ""; HttpResponseMessage response = new HttpResponseMessage(); // Validations Rules .... if (EnablePDFCheckBox.Checked) { if (string.IsNullOrEmpty(WatchFolderComboBox.Text) || string.IsNullOrEmpty(TargetFolderComboBox.Text)) { //continueOperation = false; toolTip1.ToolTipTitle = "Warning ..."; if (string.IsNullOrEmpty(WatchFolderComboBox.Text)) { toolTip1.Show("You need to set a value for the Watch Folder.", WatchFolderComboBox, 5000); } else { toolTip1.Show("You need to set a value for the Watch Folder.", TargetFolderComboBox, 5000); } return; } if (WatchFolderComboBox.Text == TargetFolderComboBox.Text) { // Do nothing // For PDF Conversion, Watch Folder and Target Folder could be the same } if (EnableWeekendCheckBox.Checked) { if (WeekendStartDateTimePicker.Value >= WeekendEndDateTimePicker.Value) { toolTip1.ToolTipTitle = "Invalid Range."; WeekendStartDateTimePicker.Focus(); toolTip1.Show("Invalid Range Values. Begin Time must be less than End Time value.", WeekendStartDateTimePicker, 5000); WeekendStartDateTimePicker.Focus(); WeekendStartDateTimePicker.Select(); return; } } if (EnableWorkdayCheckBox.Checked) { if (WorkdayStartDateTimePicker.Value >= WorkdayEndDateTimePicker.Value) { toolTip1.ToolTipTitle = "Invalid Range."; WorkdayStartDateTimePicker.Focus(); toolTip1.Show("Invalid Range Values. Begin Time must be less than End Time value.", WorkdayStartDateTimePicker, 5000); WorkdayStartDateTimePicker.Focus(); WorkdayStartDateTimePicker.Select(); return; } } if (string.IsNullOrEmpty(MaxNumBatchesUpDown.Text)) { toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("You need to set a value for the Max Number of Batches to be processed for this PDF Station.", MaxNumBatchesUpDown, 5000); return; } else { if (Convert.ToInt32(MaxNumBatchesUpDown.Text) == 0) { toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("Max Number of Batches cannot be 0.", MaxNumBatchesUpDown, 5000); return; } } // Set PDF fields for Update/New transaction serviceStation.PDFStationFlag = true; serviceStation.MaxNumberBatches = Convert.ToInt32(MaxNumBatchesUpDown.Text); serviceStation.WeekendFlag = EnableWeekendCheckBox.Checked; serviceStation.WeekendStartTime = Convert.ToString(WeekendStartDateTimePicker.Value); serviceStation.WeenkendEndTime = Convert.ToString(WeekendEndDateTimePicker.Value); serviceStation.WorkdayFlag = EnableWorkdayCheckBox.Checked; serviceStation.WorkdayStartTime = Convert.ToString(WorkdayStartDateTimePicker.Value); serviceStation.WorkdayEndTime = Convert.ToString(WorkdayEndDateTimePicker.Value); ComboBoxItem comboItem = (ComboBoxItem)WatchFolderComboBox.SelectedItem; serviceStation.WatchFolderID = Convert.ToInt32(comboItem.Tag); comboItem = (ComboBoxItem)TargetFolderComboBox.SelectedItem; serviceStation.TargetFolderID = Convert.ToInt32(comboItem.Tag); } else { // reset PDF fields for Update/New transaction serviceStation.PDFStationFlag = false; serviceStation.MaxNumberBatches = 0; serviceStation.WeekendFlag = false; serviceStation.WeekendStartTime = ""; serviceStation.WeenkendEndTime = ""; serviceStation.WorkdayFlag = false; serviceStation.WorkdayStartTime = ""; serviceStation.WorkdayEndTime = ""; serviceStation.WatchFolderID = 0; serviceStation.TargetFolderID = 0; serviceStation.BackupFolderID = 0; } serviceStation.StationName = StationNameTextBox.Text; // Check if Service Station Name if and only if the Transactioon type is "New Service Sttaion" if (Data.GlovalVariables.transactionType == "New") { // Get Service Stations URL = BaseURL + "GeneralSettings/GetServiceStations"; urlParameters = ""; client.BaseAddress = new Uri(URL); response = client.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response.IsSuccessStatusCode) { if (resultServiceStations.RecordsCount != 0) { foreach (var item in resultServiceStations.ReturnValue) { if (StationNameTextBox.Text == item.StationName.Trim()) { // Station Name Found toolTip1.ToolTipTitle = "Warning ..."; toolTip1.Show("The Service Station Name entered already exist in the Database.", StationNameTextBox, 5000); return; } } } else { // The Station Name enter does not exist in the Database // so continue } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n") + resultServiceStations.Message, "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Add service station to the Database serviceStationJS = JsonConvert.SerializeObject(serviceStation, Newtonsoft.Json.Formatting.Indented); URL = BaseURL + "GeneralSettings/NewServiceStation"; bodyString = "'" + serviceStationJS + "'"; HttpContent body_for_new = new StringContent(bodyString); body_for_new.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response_for_new = client.PostAsync(URL, body_for_new).Result; using (HttpContent content = response_for_new.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response_for_new.IsSuccessStatusCode) { // Set the value of the new Field to a gloval variable if (resultServiceStations.ReturnCode == -1) { MessageBox.Show("Warning:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n"), "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { Data.GlovalVariables.newServiceStaionList.Add(serviceStation.StationName); if (action == "SaveAndExit") { this.Close(); } else { ClearForm(); } } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n") + resultServiceStations.Exception, "New Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { // Transaction Type = Update // Update Service station information serviceStation.StationID = Data.GlovalVariables.currentServiceStationID; serviceStationJS = JsonConvert.SerializeObject(serviceStation, Newtonsoft.Json.Formatting.Indented); URL = BaseURL + "GeneralSettings/UpdateServiceStation"; bodyString = "'" + serviceStationJS + "'"; HttpContent body_for_new = new StringContent(bodyString); body_for_new.Headers.ContentType = new MediaTypeHeaderValue("application/json"); HttpResponseMessage response_for_update = client.PostAsync(URL, body_for_new).Result; using (HttpContent content = response_for_update.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultServiceStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response_for_update.IsSuccessStatusCode) { if (action == "SaveAndExit") { this.Close(); } else { // Do nothing } } else { MessageBox.Show("Error:" + "\r\n" + resultServiceStations.Message.Replace(". ", "\r\n"), "Update Service Station Transaction ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { //MainForm.ErrorMessage(ex); nlogger.Fatal(General.ErrorMessage(ex)); MessageBox.Show(General.ErrorMessage(ex), "Error ...", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void SchedulingForm_Load(object sender, EventArgs e) { this.ControlBox = false; //this.Text = "BATCH SELIVERY SETTING FOR STATION " + currentServiceStationName; List <ServiceStation> serviceStations = new List <ServiceStation>(); ProcessNameLabel.Text = Data.GlovalVariables.currentProcessName; JobNameLabel.Text = Data.GlovalVariables.currentJobName; Cursor.Current = Cursors.WaitCursor; string returnMessage = ""; string urlParameters = ""; string URL = ""; HttpResponseMessage response = new HttpResponseMessage(); // Get Service Stations HttpClient client = new HttpClient(); client.Timeout = TimeSpan.FromMinutes(15); ResultServiceStations resultResultStations = new ResultServiceStations(); URL = BaseURL + "GeneralSettings/GetServiceStations"; urlParameters = ""; client.BaseAddress = new Uri(URL); response = client.GetAsync(urlParameters).Result; using (HttpContent content = response.Content) { Task <string> resultTemp = content.ReadAsStringAsync(); returnMessage = resultTemp.Result; resultResultStations = JsonConvert.DeserializeObject <ResultServiceStations>(returnMessage); } if (response.IsSuccessStatusCode) { ServiceStationsComboBox.Items.Add(""); serviceStations = resultResultStations.ReturnValue; foreach (ServiceStation serviceStation in serviceStations) { ComboboxItem item = new ComboboxItem(); item.Text = serviceStation.StationName.Trim(); item.ID = serviceStation.StationID; ServiceStationsComboBox.Items.Add(item); } } else { MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage, "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } serviceStationNameOriginal = Data.GlovalVariables.currentServiceStationName.Trim(); ServiceStationsComboBox.Text = Data.GlovalVariables.currentServiceStationName.Trim(); //if (Data.GlovalVariables.currentProcessName == "Batch Delivery") //{ // stationIDOriginal = Data.GlovalVariables.currentServiceStationID; // ServiceStationsComboBox.Enabled = false; //} //else //{ stationIDOriginal = 0; ServiceStationsComboBox.Enabled = true; //} // Windows control initialization WeeklyGroupBox.Enabled = false; DailyGroupBox.Enabled = false; WeeklyGroupBox.Enabled = true; RepeatTaskEveryUpDown.Enabled = true; RepeatEveryGroupBox.Enabled = false; BeginDateTimePicker.Enabled = false; EndDateTimePicker.Enabled = false; RangeCheckBox.Enabled = false; StartRadioButton.Enabled = true; StartDateTimePicker.Enabled = false; RepeatTaskEveryUpDown.Enabled = false; WeeklyGroupBox.Enabled = false; BeginDateTimePicker.Format = DateTimePickerFormat.Custom; BeginDateTimePicker.CustomFormat = "HH tt"; EndDateTimePicker.Format = DateTimePickerFormat.Custom; EndDateTimePicker.CustomFormat = "HH tt"; StartDateTimePicker.Format = DateTimePickerFormat.Custom; StartDateTimePicker.CustomFormat = "HH:mm tt"; DailyRadioButton.Checked = false; WeeklyRadioButton.Checked = false; RepeatTaskEveryRadioButton.Checked = false; StartRadioButton.Checked = false; switch (Data.GlovalVariables.transactionType) { case "New": // Set default entries for new Job-Process DailyGroupBox.Enabled = false; WeeklyGroupBox.Enabled = false; RepeatTaskEveryUpDown.Enabled = false; RepeatEveryGroupBox.Enabled = false; RangeCheckBox.Enabled = false; BeginDateTimePicker.Enabled = false; EndDateTimePicker.Enabled = false; StartDateTimePicker.Enabled = false; enableFlagOriginal = false; scheduleOriginal.dailyFlag = DailyRadioButton.Checked; scheduleOriginal.recurEveryDays = RecurDaysTextBoxUpDown.Text; scheduleOriginal.dayOfTheWeekFlag = WeeklyRadioButton.Checked; scheduleOriginal.sunday = SundayCheckBox.Checked; scheduleOriginal.monday = MondayCheckBox.Checked; scheduleOriginal.tuesday = TuesdayCheckBox.Checked; scheduleOriginal.wednesday = WednesdayCheckBox.Checked; scheduleOriginal.thursday = ThursdayCheckBox.Checked; scheduleOriginal.friday = FridayCheckBox.Checked; scheduleOriginal.saturday = SaturdayCheckBox.Checked; scheduleOriginal.repeatTaskFlag = RepeatTaskEveryRadioButton.Checked; scheduleOriginal.repeatTaskTimes = RepeatTaskEveryUpDown.Text; scheduleOriginal.repeatEveryHoursFlag = RepeatHoursRadioButton.Checked; scheduleOriginal.repeatEveryMinutesFlag = RepeatMinutesRadioButton.Checked; scheduleOriginal.repeatTaskRange = RangeCheckBox.Checked; scheduleOriginal.taskBeginHour = "0"; scheduleOriginal.taskEndHour = "0"; scheduleOriginal.startTaskAtFlag = StartRadioButton.Checked; scheduleOriginal.startTaskHour = "0"; scheduleOriginal.startTaskMinute = "0"; break; case "Update": ResultProcesses resultProcesses = new ResultProcesses(); resultProcesses = GetProcessByIDs(Data.GlovalVariables.currentProcessID, Data.GlovalVariables.currentJobID, Data.GlovalVariables.currentServiceStationID, Data.GlovalVariables.currentPDFStationID); if (resultProcesses.RecordsCount > 0) { EnablecheckBox.Checked = resultProcesses.ReturnValue[0].EnableFlag; enableFlagOriginal = resultProcesses.ReturnValue[0].EnableFlag; ScheduleTime schedule = new ScheduleTime(); schedule = resultProcesses.ReturnValue[0].Schedule; scheduleOriginal = schedule; DailyRadioButton.Checked = schedule.dailyFlag; RecurDaysTextBoxUpDown.Text = schedule.recurEveryDays; WeeklyRadioButton.Checked = schedule.dayOfTheWeekFlag; SundayCheckBox.Checked = schedule.sunday; MondayCheckBox.Checked = schedule.monday; TuesdayCheckBox.Checked = schedule.tuesday; WednesdayCheckBox.Checked = schedule.wednesday; ThursdayCheckBox.Checked = schedule.thursday; FridayCheckBox.Checked = schedule.friday; SaturdayCheckBox.Checked = schedule.saturday; RepeatTaskEveryRadioButton.Checked = schedule.repeatTaskFlag; RepeatTaskEveryUpDown.Text = schedule.repeatTaskTimes; RepeatHoursRadioButton.Checked = schedule.repeatEveryHoursFlag; RepeatMinutesRadioButton.Checked = schedule.repeatEveryMinutesFlag; RangeCheckBox.Checked = schedule.repeatTaskRange; BeginDateTimePicker.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(schedule.taskBeginHour), 0, 0); EndDateTimePicker.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(schedule.taskEndHour), 0, 0); StartRadioButton.Checked = schedule.startTaskAtFlag; StartDateTimePicker.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(schedule.startTaskHour), Convert.ToInt32(schedule.startTaskMinute), 0); } break; } }