예제 #1
0
        private ResultProcesses GetProcess()
        {
            string urlParameters = "";
            string URL           = "";
            string returnMessage = "";

            ResultProcesses     resultProcess = new ResultProcesses();
            HttpResponseMessage response      = new HttpResponseMessage();
            HttpClient          client        = new HttpClient();

            client.Timeout     = TimeSpan.FromMinutes(15);
            URL                = BaseURL + "Process/GetProcesses";
            urlParameters      = "";
            client.BaseAddress = new Uri(URL);
            response           = client.GetAsync(urlParameters).Result;
            using (HttpContent content = response.Content)
            {
                Task <string> resultTemp = content.ReadAsStringAsync();
                returnMessage = resultTemp.Result;
                resultProcess = JsonConvert.DeserializeObject <ResultProcesses>(returnMessage);
            }
            if (!response.IsSuccessStatusCode)
            {
                MessageBox.Show("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage,
                                "Transaction Error...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            return(resultProcess);
        }
예제 #2
0
        /// <summary>
        /// Get Process by a given Name
        /// </summary>
        /// <param name="processName"></param>
        /// <returns></returns>
        public static ResultProcesses GetProcessByName(string processName)
        {
            ResultProcesses resultProcess = new ResultProcesses();

            resultProcess.ReturnCode   = 0;
            resultProcess.Message      = "";
            resultProcess.RecordsCount = 0;

            try
            {
                lock (lockObj)
                {
                    LogManager.Configuration.Variables["JobName"] = "General";
                    string urlParameters = "";
                    string URL           = "";
                    string returnMessage = "";

                    HttpResponseMessage response = new HttpResponseMessage();
                    HttpClient          client   = new HttpClient();
                    client.Timeout = TimeSpan.FromMinutes(15);
                    URL            = VFRDuplicateRemoverService.BaseURL + "Process/GetProcessesByName?processName=" + processName;

                    urlParameters      = "";
                    client.BaseAddress = new Uri(URL);
                    response           = client.GetAsync(urlParameters).Result;
                    using (HttpContent content = response.Content)
                    {
                        Task <string> resultTemp = content.ReadAsStringAsync();
                        returnMessage = resultTemp.Result;
                        resultProcess = JsonConvert.DeserializeObject <ResultProcesses>(returnMessage);
                    }
                    if (!response.IsSuccessStatusCode)
                    {
                        nlogger.Error("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage);
                        Console.WriteLine("Error:" + "\r\n" + response.ReasonPhrase + "\r\n" + response.RequestMessage);
                    }
                }
            }
            catch (Exception ex)
            {
                lock (lockObj)
                {
                    LogManager.Configuration.Variables["JobName"] = "General";
                    nlogger.Fatal(General.ErrorMessage(ex));
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine(General.ErrorMessage(ex));
                    Console.ForegroundColor  = ConsoleColor.White;
                    resultProcess.ReturnCode = -2;
                    resultProcess.Message    = ex.Message;
                }
            }
            return(resultProcess);
        }
예제 #3
0
        // WORK ON THIS METHOD TO SUPPORT OTHER PROCESSES ...
        private void ProcessGridView_DoubleClick(object sender, EventArgs e)
        {
            Data.GlovalVariables.currentJobID   = Convert.ToInt32(ProcessGridView.CurrentRow.Cells[1].Value);
            Data.GlovalVariables.currentJobName = Convert.ToString(ProcessGridView.CurrentRow.Cells[6].Value);

            if (!string.IsNullOrEmpty(ProcessGridView.CurrentRow.Cells["StationID"].Value.ToString()))
            {
                Data.GlovalVariables.currentServiceStationID = Convert.ToInt32(ProcessGridView.CurrentRow.Cells["StationID"].Value);
            }
            else
            {
                Data.GlovalVariables.currentServiceStationID = 0;
            }
            Data.GlovalVariables.currentServiceStationName = Convert.ToString(ProcessGridView.CurrentRow.Cells["ServiceStation"].Value.ToString());

            if (!string.IsNullOrEmpty(ProcessGridView.CurrentRow.Cells["PDFStationID"].Value.ToString()))
            {
                Data.GlovalVariables.currentPDFStationID = Convert.ToInt32(ProcessGridView.CurrentRow.Cells["PDFStationID"].Value);
            }
            else
            {
                Data.GlovalVariables.currentPDFStationID = 0;
            }

            if (Convert.ToString(ProcessGridView.CurrentRow.Cells["Status"].Value).ToUpper() == "TRUE" ||
                Convert.ToString(ProcessGridView.CurrentRow.Cells["Status"].Value).ToUpper() == "FALSE")
            {
                Data.GlovalVariables.transactionType = "Update";
            }
            else
            {
                Data.GlovalVariables.transactionType = "New";
            }
            Forms.SchedulingForm _SchedulingForm = new Forms.SchedulingForm();
            _SchedulingForm.ShowDialog();

            //Refresh changes in Data Grid View
            if (Data.GlovalVariables.currentServiceStationID != 0)
            {
                ResultProcesses resultProcesses = new ResultProcesses();
                resultProcesses = GetProcessByIDs(Data.GlovalVariables.currentProcessID, Data.GlovalVariables.currentJobID,
                                                  Data.GlovalVariables.currentServiceStationID, Data.GlovalVariables.currentPDFStationID);
                if (resultProcesses.RecordsCount > 0)
                {
                    ProcessGridView.CurrentRow.Cells["Status"].Value          = Convert.ToString(resultProcesses.ReturnValue[0].EnableFlag);
                    ProcessGridView.CurrentRow.Cells["Schedule"].Value        = Convert.ToString(resultProcesses.ReturnValue[0].ScheduleCronFormat);
                    ProcessGridView.CurrentRow.Cells["CronDescription"].Value = Convert.ToString(resultProcesses.ReturnValue[0].CronDescription);
                    ProcessGridView.CurrentRow.Cells["ServiceStation"].Value  = Convert.ToString(resultProcesses.ReturnValue[0].StationName);
                }
            }
        }
예제 #4
0
        public void LoadProcessesFromFile(string path)
        {
            string       line;
            InputType    previousInput      = new InputType();
            StreamReader file               = new StreamReader(path);
            Regex        beforePattern      = new Regex(@"Before: \[(\d),\s(\d),\s(\d),\s(\d)\]");
            Regex        afterPattern       = new Regex(@"After:  \[(\d),\s(\d),\s(\d),\s(\d)\]");
            Regex        instructionPattern = new Regex(@"(\d+)\s(\d)\s(\d)\s(\d)");

            // have to initialize "process" before while bcs it's necessary to keep values between several lines
            InstructionProcess process = new InstructionProcess();
            // "test" can be initialized here but it's not necessary, bcs it has to also be initialised on other place
            InstructionTest test;

            // read each line of text file
            while ((line = file.ReadLine()) != null)
            {
                // recognizes to which pattern the line matches
                if (beforePattern.IsMatch(line))
                {
                    // BEFORE REGISTERS
                    // initialize the array here to verify if the Before was filled
                    process.Before = new int[4];
                    for (int i = 0; i < process.Before.Length; i++)
                    {
                        process.Before[i] = int.Parse(beforePattern.Match(line).Groups[i + 1].Value);
                    }

                    #region REFACTORING

                    /*process.Before[0] = int.Parse(beforePattern.Match(line).Groups[1].Value);
                    *  process.Before[1] = int.Parse(beforePattern.Match(line).Groups[2].Value);
                    *  process.Before[2] = int.Parse(beforePattern.Match(line).Groups[3].Value);
                    *  process.Before[3] = int.Parse(beforePattern.Match(line).Groups[4].Value);*/
                    #endregion

                    previousInput = InputType.Before;
                }
                else if (instructionPattern.IsMatch(line))
                {
                    // there are 2 types of intructions -- learning and testing
                    // testing instructions can be preceded by other instruction or empty line
                    if (previousInput == InputType.Instruction || previousInput == InputType.Empty)
                    {
                        // TESTING INSTRUCTION
                        test             = new InstructionTest();
                        test.Instruction = new int[4];
                        for (int i = 0; i < test.Instruction.Length; i++)
                        {
                            test.Instruction[i] = int.Parse(instructionPattern.Match(line).Groups[i + 1].Value);
                        }

                        #region REFACTORING

                        /*test.Instruction[0] = int.Parse(instructionPattern.Match(line).Groups[1].Value);
                        *  test.Instruction[1] = int.Parse(instructionPattern.Match(line).Groups[2].Value);
                        *  test.Instruction[2] = int.Parse(instructionPattern.Match(line).Groups[3].Value);
                        *  test.Instruction[3] = int.Parse(instructionPattern.Match(line).Groups[4].Value);*/
                        #endregion

                        // test instructions are one-line and can be stored immediately
                        ResultTests.Add(test);
                    }
                    else
                    {
                        // LEARNING INSTRUCTION
                        process.Instruction = new int[4];
                        for (int i = 0; i < process.Instruction.Length; i++)
                        {
                            process.Instruction[i] = int.Parse(instructionPattern.Match(line).Groups[i + 1].Value);
                        }

                        #region REFACTORING

                        /*process.Instruction[0] = int.Parse(instructionPattern.Match(line).Groups[1].Value);
                        *  process.Instruction[1] = int.Parse(instructionPattern.Match(line).Groups[2].Value);
                        *  process.Instruction[2] = int.Parse(instructionPattern.Match(line).Groups[3].Value);
                        *  process.Instruction[3] = int.Parse(instructionPattern.Match(line).Groups[4].Value);*/
                        #endregion
                    }

                    previousInput = InputType.Instruction;
                }
                else if (afterPattern.IsMatch(line))
                {
                    // AFTER REGISTERS
                    process.After = new int[4];
                    for (int i = 0; i < process.After.Length; i++)
                    {
                        process.After[i] = int.Parse(afterPattern.Match(line).Groups[i + 1].Value);
                    }

                    #region REFACTORING

                    /*process.After[0] = int.Parse(afterPattern.Match(line).Groups[1].Value);
                    *  process.After[1] = int.Parse(afterPattern.Match(line).Groups[2].Value);
                    *  process.After[2] = int.Parse(afterPattern.Match(line).Groups[3].Value);
                    *  process.After[3] = int.Parse(afterPattern.Match(line).Groups[4].Value);*/
                    #endregion

                    previousInput = InputType.After;
                }
                else if (!IsNullOrEmpty(process.Before) && !IsNullOrEmpty(process.Instruction) && !IsNullOrEmpty(process.After))
                {
                    // if line doesn't match any pattern and "Before", "Instruction" and "After" are filled, stores the process
                    ResultProcesses.Add(process);
                    // it's necessary to create a new instance of InstructionProcess
                    process       = new InstructionProcess();
                    previousInput = InputType.Empty;
                }
            }

            file.Close();

            // order processes by op code
            ResultProcesses = ResultProcesses.OrderBy(x => x.Instruction[0]).ToList();
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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;
            }
        }