Пример #1
0
        private async void SaveChanges()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to save changes?");

            if (confirmed)
            {
                FormatRunTimeFields();

                try
                {
                    await RunTimeParameterService.UpdateRunTimesForJob(results);

                    Toaster.Add("Run Time Changes Saved Successfully", MatToastType.Success, "Success", "✓");

                    await GetData();

                    Modal.Close(ModalResult.Ok(results));
                }
                catch (Exception ex)
                {
                    Toaster.Add("Error Saving Run Time Changes, try again.", MatToastType.Danger, "Warning", "⚠");
                    Console.WriteLine("Error saving run time changes", ex.Message);
                }
            }
        }
Пример #2
0
        protected async Task Ekle()
        {
            if (selectedOgrenciId == 0)
            {
                await JsRunTime.InvokeAsync <string>("AlertCustom", new object[] { "Hello" });

                StateHasChanged();
            }
            else
            {
                OgrenciServis.Data.Ogrenci ogrenciObject = ogrenciListByOkul.Where(x => x.Id == selectedOgrenciId).FirstOrDefault();

                VeliList.Add(new Data.Veli
                {
                    Id        = 0,
                    OgrenciId = selectedOgrenciId,
                    OkulId    = selectedOkulId,
                    OgrenciAd = ogrenciObject.AdSoyad,
                    OkulAd    = okulList.Where(o => o.Id == selectedOkulId).FirstOrDefault().OkulAd
                });

                ogrenciListByOkul.Remove(ogrenciObject);
                selectedOgrenciId = 0;
            }
        }
Пример #3
0
        public async void ValidateSql(string sqlState)
        {
            Dictionary <string, string> pairs = new Dictionary <string, string>();

            foreach (var item in results.Where(i => i.JOB_NAME == jobSelected))
            {
                sqlState = item.JOB_CLOB;
                sqlState = sqlState.Replace("\t", " ").Replace("\n", " ").Replace("\r", " ");
                pairs.Add(item.DB_SCHEMA, sqlState);
                FormUrlEncodedContent formContent = new FormUrlEncodedContent(pairs);

                try
                {
                    var IsValid = await HttpClient.PostAsync(ServiceEndpoints.VALIDATE_SQL_POST, formContent);

                    if (IsValid.IsSuccessStatusCode)
                    {
                        await JsRunTime.InvokeAsync <string>("confirm", "Valid Sql Statement");
                    }
                    else
                    {
                        await JsRunTime.InvokeAsync <string>("confirm", "Invalid Sql Statement");
                    }
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error", ex.Message);
                }
            }
        }
Пример #4
0
        private async void ClearDownTimes()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Do you want to Remove Service Monitoring for the selected jobs?");

            if (confirmed)
            {
                result.JobId = string.Empty;
                foreach (var item in results.Where(i => i.IsJobSelected == true))
                {
                    item.ScheduledDownTime = null;
                    result.JobId          += item.JobId + ",";
                }
                result.JobId = result.JobId.TrimEnd(',');
                if (result.JobId == string.Empty)
                {
                    Toaster.Add("Please check the job(s) you want to clear.", MatToastType.Warning, "Warning", "⚠");
                }

                await ServiceManagerService.DeleteJobTimes(result);
                await GetData();

                GetStatus();
                ClearSelected();
                StartDate = DateTime.Now;
                EndDate   = DateTime.Now;
            }
            else
            {
                GetStatus();
            }
            StateHasChanged();
        }
Пример #5
0
        public async void ClearDowntimes()
        {
            string sqlStatement = "";
            string taskString   = "";
            bool   confirmed    = await JsRunTime.InvokeAsync <bool>("confirm", "Do you want to Activate Service Monitoring for the selected jobs?");

            if (confirmed)
            {
                foreach (var item in results.Where(i => i.IsJobSelected == true))
                {
                    item.ScheduledDownTime = null;
                    taskString            += "'" + item.TASK_ID + "'" + ",";
                }
                taskString = taskString.TrimEnd(',');
                if (taskString == "")
                {
                    FontColor = "red";
                    Message   = "Please check the job(s) you want to clear";
                }
                sqlStatement = "update " + OracleTableNames.JobService + " set service_suspend_start = NULL, service_suspend_stop = null where task_id in (" + taskString + ")";
                var sqlString = new StringContent(sqlStatement, Encoding.UTF8, "text/plain");
                await HttpClient.PostAsync(ServiceEndpoints.EXECUTE_SQL_POST, sqlString);
                await GetData();

                GetStatus();
                ClearSelected();
                Date1 = DateTime.Now;
                Date2 = DateTime.Now;
            }
            else
            {
                GetStatus();
            }
            StateHasChanged();
        }
Пример #6
0
        protected async Task KaydetOkul()
        {
            okulList.Add(new Data.Okul {
                Id = 7, OkulAd = veliPagePopupComponent.GetChangeValueOkulAd
            });
            await JsRunTime.InvokeAsync <string>("SaveSuccess", new object[] { "Hello" });

            StateHasChanged();
        }
Пример #7
0
        public async void SaveChanges()
        {
            if (Date1 < Date2)
            {
                bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to make these changes?");

                if (confirmed)
                {
                    string tasks = "";
                    foreach (var item in results.Where(i => i.IsJobSelected == true))
                    {
                        tasks += "'" + item.TASK_ID + "'" + ",";
                        item.ScheduledDownTime = Date1.ToString() + " - " + Date2.ToString();
                    }
                    tasks = tasks.TrimEnd(',');
                    string insertSql = "update " + OracleTableNames.JobService + " set service_suspend_start = to_date('" + Date1.ToString() + "','MM/DD/YYYY HH:MI:SS AM')," +
                                       " service_suspend_stop = to_date('" + Date2.ToString() + "','MM/DD/YYYY HH:MI:SS AM')  where task_id in (" + tasks + ")";
                    var sqlString = new StringContent(insertSql, Encoding.UTF8, "text/plain");
                    await HttpClient.PostAsync(ServiceEndpoints.EXECUTE_SQL_POST, sqlString);
                    await GetData();

                    GetStatus();
                    ClearSelected();
                    Date1 = DateTime.Now;
                    Date2 = DateTime.Now;
                }
                else
                {
                    GetStatus();
                    Date1 = DateTime.Now;
                    Date2 = DateTime.Now;
                }
            }
            else
            {
                FontColor = "red";
                Message   = "Start Time must be less than End Time";
                GetStatus();
            }
            await GetData();

            GetStatus();
            StateHasChanged();
        }
Пример #8
0
        public async void SaveChanges()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to save changes?");

            if (confirmed)
            {
                foreach (var item in results.Where(i => i.JOB_NAME == jobSelected))
                {
                    try
                    {
                        string insertSql = "update " + OracleTableNames.JobService +
                                           " set run_day = '" + item.RUN_DAY + "'," +
                                           "run_hour = '" + item.RUN_HOUR + "'," +
                                           "job_name = '" + item.JOB_NAME.Replace("'", "''") + "'," +
                                           "db_schema = '" + item.DB_SCHEMA + "'," +
                                           "job_clob  = '" + item.JOB_CLOB.Replace("'", "''") + "'," +
                                           "job_header = '" + item.JOB_HEADER.Replace("'", "''") + "'," +
                                           "run_min = '" + item.RUN_MIN + "'," +
                                           "job_active = '" + item.JOB_ACTIVE + "'," +
                                           "run_mth = '" + item.RUN_MTH + "'," +
                                           "email_subject = '" + item.EMAIL_SUBJECT.Replace("'", "''") + "'," +
                                           "slack_channel = '" + item.SLACK_CHANNEL + "'," +
                                           "slack_url = '" + SlackUrlString + "'," +
                                           "mailfrom = '" + FromMailString + "'," +
                                           "mailto = '" + item.MAILTO.Replace("'", "''") + "'," +
                                           "slack_user = '******'," +
                                           "sendmail = '" + item.SENDMAIL + "'," +
                                           "sendslack = '" + item.SENDSLACK.Replace("'", "''") + "'," +
                                           "last_updated = '" + DateTime.Now + "'" +
                                           "where task_id = '" + item.TASK_ID + "'";
                        await EditCurrentJob(insertSql);

                        NavigationManager.NavigateTo("/");
                    }
                    catch (Exception ex)
                    {
                        await JsRunTime.InvokeAsync <string>("confirm", "Could not save changes, make sure all fields are complete.");

                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Пример #9
0
        private async void SaveChanges()
        {
            if (StartDate <= EndDate)
            {
                bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to make these changes?");

                if (confirmed)
                {
                    result.JobId = "";
                    foreach (var item in results.Where(i => i.IsJobSelected == true))
                    {
                        result.JobId          += item.JobId + ",";
                        item.ScheduledDownTime = StartDate.ToString() + " - " + EndDate.ToString();
                    }
                    result.JobId        = result.JobId.TrimEnd(',');
                    result.ServiceStart = StartDate.ToString();
                    result.ServiceStop  = EndDate.ToString();
                    await ServiceManagerService.UpdateJobStatuses(result);
                    await GetData();

                    StartDate = DateTime.Now;
                    EndDate   = DateTime.Now;
                }
                else
                {
                    GetStatus();
                    StartDate = DateTime.Now;
                    EndDate   = DateTime.Now;
                }
            }
            else
            {
                Toaster.Add("Start time must be less than end time.", MatToastType.Danger, "Warning", "⚠");
                GetStatus();
            }
            await GetData();

            GetStatus();
            StateHasChanged();
        }
Пример #10
0
        private async void SaveChanges()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to save these changes?");

            if (confirmed)
            {
                result.MailFrom   = MailAddresses.FromMail;
                result.MSTeamsUrl = MSTeamsEndpoints.HSNAlerts;
                result.SlackUser  = Slack.SlackUserString;
                result.JobId      = JobId;

                if (result.MailTo == null)
                {
                    result.MailTo = string.Empty;
                }
                if (result.EmailSubject == null)
                {
                    result.EmailSubject = string.Empty;
                }
                if (result.SqlString == null)
                {
                    result.SqlString = string.Empty;
                }

                try
                {
                    await JobService.UpdateJob(result);

                    Toaster.Add("Job updated successfully", MatToastType.Success, "Success", "✓");

                    NavigationManager.NavigateTo("/");
                }
                catch (Exception ex)
                {
                    Toaster.Add("Job not updated successfully", MatToastType.Danger, "Error", "⚠");
                    Console.WriteLine("Job not updated successfully", ex.Message);
                }
            }
        }
Пример #11
0
        public async void DeleteJob()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to delete this job?");

            if (confirmed)
            {
                foreach (var item in results.Where(i => i.JOB_NAME == jobSelected))
                {
                    try
                    {
                        string insertSql = "delete " + OracleTableNames.JobService + " where task_id = '" + item.TASK_ID + "'";
                        await ExecuteDeleteJob(insertSql);
                        await GetData();

                        StateHasChanged();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }
Пример #12
0
        private async void DeleteJob()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to delete the selected job?");

            if (confirmed)
            {
                try
                {
                    await JobService.DeleteJob(result.JobId);

                    Toaster.Add("Job Deleted Successfully", MatToastType.Success, "Success", "✓");
                    await GetJobs();
                    await GetFormData();

                    StateHasChanged();
                }
                catch (Exception ex)
                {
                    Toaster.Add("Error deleting job, contact support.", MatToastType.Danger, "Warning", "⚠");
                    Console.WriteLine("Error deleting job.", ex.Message);
                }
            }
        }
Пример #13
0
        private async void AddNewJob()
        {
            bool confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Add this new job now?");

            if (confirmed)
            {
                FormatRunTimeFields();

                if (newJob.MailFrom == null)
                {
                    newJob.MailFrom = string.Empty;
                }
                if (newJob.MailTo == null)
                {
                    newJob.MailTo = string.Empty;
                }
                if (newJob.SqlString == null)
                {
                    newJob.SqlString = string.Empty;
                }

                try
                {
                    await JobService.CreateNewJob(newJob);

                    await JobService.CreateTaskId(newJob);

                    Toaster.Add("Job Created Successfully", MatToastType.Success, "Success", "✓");
                    NavigationManager.NavigateTo("/");
                }
                catch (Exception ex)
                {
                    Toaster.Add("Job Not Created Successfully", MatToastType.Danger, "Warning", "⚠");
                    Console.WriteLine("Error creating new job, ensure all fields are complete.", ex.Message);
                }
            }
        }
Пример #14
0
        public async void SaveChanges()
        {
            string monthSql  = "";
            string daySql    = "";
            string hourSql   = "";
            string minuteSql = "";
            bool   confirmed = await JsRunTime.InvokeAsync <bool>("confirm", "Are you sure you want to save changes?");

            if (confirmed)
            {
                foreach (var item in results.Where(i => i.JOB_NAME == jobSelected))
                {
                    foreach (var month in InitializeData.Months.Where(m => m.IsMonthChecked == true && m.MonthId != 0))
                    {
                        monthSql += month.MonthId.ToString() + ",";
                    }
                    monthSql = monthSql.TrimEnd(',');
                    foreach (var day in InitializeData.Days.Where(d => d.IsDayChecked == true && d.DayId != 0))
                    {
                        daySql += ConvertDays(day.DayName) + ",";
                    }
                    daySql = daySql.TrimEnd(',');
                    foreach (var hour in InitializeData.Hours.Where(h => h.IsHourChecked == true && h.HourId < 24))
                    {
                        hourSql += hour.HourName + ",";
                    }
                    hourSql = hourSql.TrimEnd(',');
                    foreach (var minute in InitializeData.Minutes.Where(m => m.IsMinuteChecked == true && m.MinuteId < 60))
                    {
                        minuteSql += minute.MinuteName + ",";
                    }
                    minuteSql = minuteSql.TrimEnd(',');

                    try
                    {
                        string insertSql = "update " + OracleTableNames.JobService +
                                           " set run_day = '" + daySql + "'," +
                                           "run_hour = '" + hourSql + "'," +
                                           "job_name = '" + item.JOB_NAME.Replace("'", "''") + "'," +
                                           "db_schema = '" + item.DB_SCHEMA + "'," +
                                           "job_clob  = '" + item.JOB_CLOB.Replace("'", "''") + "'," +
                                           "job_header = '" + item.JOB_HEADER.Replace("'", "''") + "'," +
                                           "run_min = '" + minuteSql + "'," +
                                           "job_active = '" + item.JOB_ACTIVE + "'," +
                                           "run_mth = '" + monthSql + "'," +
                                           "email_subject = '" + item.EMAIL_SUBJECT.Replace("'", "''") + "'," +
                                           "slack_channel = '" + item.SLACK_CHANNEL + "'," +
                                           "slack_url = '" + item.SLACK_URL + "'," +
                                           "mailfrom = '" + item.MAILFROM + "'," +
                                           "mailto = '" + item.MAILTO.Replace("'", "''") + "'," +
                                           "slack_user = '******'," +
                                           "sendmail = '" + item.SENDMAIL + "'," +
                                           "sendslack = '" + item.SENDSLACK.Replace("'", "''") + "'," +
                                           "last_updated = '" + DateTime.Now + "'" +
                                           "where task_id = '" + item.TASK_ID + "'";
                        await EditCurrentJob(insertSql);
                        await GetData();

                        //StateHasChanged();
                        Modal.Close(ModalResult.Ok <Results[]>(results));
                    }
                    catch (Exception ex)
                    {
                        await JsRunTime.InvokeAsync <string>("confirm", "Error saving changes. Make sure all parameters are complete (Month, Day, Hour, Minute)");

                        Console.WriteLine(ex.Message);
                    }
                }
            }
        }