public static DialogResult ShowNotice(string message) { var nf = new NoticeForm(message); return(nf.ShowDialog()); }
private void addButton_Click(object sender, EventArgs e) { if (tbFirstName.Text != string.Empty && tbLastName.Text != string.Empty && tbSystem.SelectedItem != null && tbKategoria.SelectedItem != null && tbRodzaj.SelectedItem != null && tbTyp.SelectedItem != null && tbJiraId.Text != string.Empty) { if (!Validate_DateFormat(tbDataWystBledu.Text)) { NoticeForm.ShowNotice("Pole: Data wystąpienia błędu, zostało błędnie uzupełnione. Należy poprawić dane."); return; } cancelButton.Enabled = false; addButton.Enabled = false; issue.issueWFS = new BillingDTHIssueWFS() { NumerZgloszenia = tbNo.Text, TytulZgloszenia = tbTitle.Text, Imie = tbFirstName.Text, Nazwisko = tbLastName.Text, Email = tbEmail.Text, DataWystapieniaBledu = tbDataWystBledu.Text, DataIGodzinaUtworzeniaZgloszenia = tbDataUtworzeniaZgl.Text, DataIGodzinaOstatniegoKomentarza = tbDataOstKoment.Text, IdKontraktu = tbIdKontraktu.Text, IdZamowienia = tbIdZamowienia.Text, System = new Entities.Component() { Text = ((BillingDthLBItem)tbSystem.SelectedItem).Text, Value = ((BillingDthLBItem)tbSystem.SelectedItem).Value }, Kategoria = new Entities.Component() { Text = ((BillingDthLBItem)tbKategoria.SelectedItem).Text, Value = ((BillingDthLBItem)tbKategoria.SelectedItem).Value }, Rodzaj = new Entities.Component() { Text = ((BillingDthLBItem)tbRodzaj.SelectedItem).Text, Value = ((BillingDthLBItem)tbRodzaj.SelectedItem).Value }, Typ = new Entities.Component() { Text = ((BillingDthLBItem)tbTyp.SelectedItem).Text, Value = ((BillingDthLBItem)tbTyp.SelectedItem).Value }, TrescZgloszenia = tbTrescZgloszenia.Text, Priorytet = ((BillingDthLBItem)tbPriorytet.SelectedItem).Value.ToString(), JiraId = tbJiraId.Text, CzyOnCall = (cb_CzyOncall.Checked == true ? "True" : "False"), SrodowiskoProblemu = (tbSrodowiskoProblemu.Text != "" ? tbSrodowiskoProblemu.Text : "---") }; List <List <string> > zgloszenie = gujacz2.ExecuteStoredProcedure("[spCheckJiraId]", new string[] { issue.issueWFS.JiraId.ToString() }, DatabaseName.SupportCP); /* stara obsługa * if(issue.issueWFS.System.Text != "Problem") * zgloszenie = gujacz2.ExecuteStoredProcedure("[spCheckJiraId]", new string[] { issue.issueWFS.JiraId.ToString() }, DatabaseName.SupportCP); * else * zgloszenie = gujacz2.ExecuteStoredProcedure("[spCheckJiraId]", new string[] { issue.issueWFS.NumerZgloszenia.ToString() }, DatabaseName.SupportCP); */ if (zgloszenie.Count > 0) { NoticeForm nf = new NoticeForm(("Numer zgłoszenia " + issue.issueWFS.NumerZgloszenia + " istnieje już zapisany pod nr sprawy: " + zgloszenie[0][1].ToString()), NoticeButtons.OK, new string[] { "OK" }); nf.ShowDialog(); this.Close(); } else { if (_newIssue) { issue.issueHelios = new IssueHelios() { number = tbNo.Text, title = tbTitle.Text, firstName = tbFirstName.Text, lastName = tbLastName.Text, email = tbEmail.Text, date = tbDataOstKoment.Text, updated = tbDataWystBledu.Text, projekt = ((BillingDthLBItem)tbKategoria.SelectedItem).Text, rodzaj_zgloszenia = ((BillingDthLBItem)tbSystem.SelectedItem).Text, rodzaj_bledu = ((BillingDthLBItem)tbRodzaj.SelectedItem).Text, severity = ((BillingDthLBItem)tbPriorytet.SelectedItem).Value.ToString(), czyOnCall = (cb_CzyOncall.Checked == true ? "True" : "False"), srodowiskoProblemu = (tbSrodowiskoProblemu.Text != "" ? tbSrodowiskoProblemu.Text : "---") }; } if (mass && callback != null)//Jeśli dodawana masowo, to wyślij obiekt przez callback { callback(issue, _tr, _newIssue); this.Close(); } else { // jeśli nie dodawane masowo tylko pojedyńczo to zapisz obiekt doByWorker(new DoWorkEventHandler(doWorkSaveToWFS), issue, new RunWorkerCompletedEventHandler(doSavingCompleted)); } } } else { if (sender.ToString() != "autousupelnianie") { MessageBox.Show("Przed dodaniem zgłoszenia do WFS należy uzupełnić wszystkie wymagane pola.", "Brak danych", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
public static DialogResult ShowNotice(string message, NoticeButtons buttons, string[] buttonsLabels) { var nf = new NoticeForm(message, buttons, buttonsLabels); return(nf.ShowDialog()); }