Ejemplo n.º 1
0
        private void LoadComponents()
        {
            Dictionary <int, string> kat = gujacz2.getBillingComponents(0);

            dodatkoweDane[0] = kat.Where(x => x.Value == "CRM").FirstOrDefault().Key;

            Dictionary <int, string> rodz = new Dictionary <int, string>();

            rodz             = gujacz2.getBillingComponents(kat.Where(x => x.Value == "CRM").FirstOrDefault().Key); //Dictionary<int, string>
            dodatkoweDane[1] = rodz.Where(x => x.Value == "błąd procesu").FirstOrDefault().Key;

            Dictionary <int, string> typy = new Dictionary <int, string>();

            typy = gujacz2.getBillingComponents(rodz.Where(x => x.Value == "błąd procesu").FirstOrDefault().Key);

            foreach (var k in typy)
            {
                cbTypProcesu.Items.Add(new Entities.BillingDthLBItem()
                {
                    Text = k.Value, Value = k.Key
                });
            }
            //cbTypProcesu.Items.AddRange(typy.Values.ToArray());

            List <List <string> > solutionsData = gujacz2.ExecuteStoredProcedure("GetSolutions", new string[] { }, DatabaseName.SupportCP);

            foreach (var a in solutionsData)
            {
                Entities.ProcessSolution solution = new ProcessSolution();
                solution.id            = int.Parse(a[0]);
                solution.nameCP        = a[1];
                solution.nameBuissness = a[2];
                solutions.Add(solution);
            }

            cbRozwiazanie.Items.Clear();
            foreach (Entities.ProcessSolution so in solutions)
            {
                cbRozwiazanie.Items.Add(so.nameCP);
            }

            dodatkoweInfo();
        }
Ejemplo n.º 2
0
        private void GetLoggingTime()
        {
            if (gujacz == null)
            {
                return;
            }

            if (issue == null)
            {
                return;
            }

            if (issue.issueWFS.WFSIssueId != 0)
            {
                List <List <string> > result = gujacz.ExecuteStoredProcedure("CP_WLGetLoggedTimeForIssue", new string[] { issue.issueWFS.WFSIssueId.ToString() }, DatabaseName.SupportCP);

                int seconds = 0;

                if (result.Count > 0)
                {
                    string akcja = result[0][1];
                    switch (akcja)
                    {
                    case "Start": this.status = WorkloadStatus.Start; break;

                    case "Pauza": this.status = WorkloadStatus.Pause; break;

                    case "Stop": this.status = WorkloadStatus.Stop; break;
                    }


                    if (akcja.Equals("start", StringComparison.CurrentCultureIgnoreCase) && string.IsNullOrEmpty(result[0][2]))
                    {
                        this.status     = WorkloadStatus.OtherUser;
                        this.lastTime   = TimeSpan.FromSeconds(0);
                        this.loggedTime = TimeSpan.FromSeconds(0);
                        this.totalTime  = TimeSpan.FromSeconds(0);
                        return;
                    }

                    if (!akcja.Equals("stop", StringComparison.CurrentCultureIgnoreCase))
                    {
                        seconds = Convert.ToInt32(result[0][2]);
                    }


                    lastTime = TimeSpan.FromSeconds(Convert.ToInt32(result[0][2]));
                }
                else
                {
                    this.status = WorkloadStatus.Stop;
                }

                loggedTime = TimeSpan.FromSeconds(seconds);

                List <List <string> > total = gujacz.ExecuteStoredProcedure("CP_WLGetTotalTimeForIssue", new string[] { issue.issueWFS.WFSIssueId.ToString() }, DatabaseName.SupportCP);

                seconds = 0;

                if (total.Count > 0)
                {
                    seconds = Convert.ToInt32(total[0][1]);
                }

                totalTime = TimeSpan.FromSeconds(seconds);
            }
            else
            {
                loggedTime = TimeSpan.FromSeconds(0);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Konstuktor wykorzystywany przy masowym dodawaniu spraw do WFSa Ten właściwy
        /// </summary>
        /// <param name="zgloszenie"></param>
        public WFSform(BillingIssueDto zgloszenie, bool trans = false, bool newIssue = false, bool auto = false)//: base()
        {
            this._newIssue = newIssue;
            this.issue     = (BillingIssueDtoHelios)zgloszenie;
            mass           = true;

            InitializeComponent();

            //Login formLogin = new Login(gujaczWFS, ref helLIU, ref jiraUser);
            uzupelnijFormularz((BillingIssueDtoHelios)zgloszenie, trans);
            gujacz2 = Utility.ServiceLocator.Instance.Retrieve <IParserEngineWFS>();

            if (onCallZaznacz())
            {
                cb_CzyOncall.BackColor = Color.Tomato;
                cb_CzyOncall.Checked   = true;
            }

            //if (String.IsNullOrWhiteSpace(((BillingIssueDtoHelios)zgloszenie).issueHelios.assigned_to))
            //    MessageBox.Show("Pamiętaj o przydzieleniu zgłoszenia w JIRA!");

            // PIERWOTNIE: "CRM", "CP", "INFOLINIA", "NDTH", "SR", "SOS", "ZCC"
            // "NDTH", "SR", "CP", "CRM", "INFOLINIA", "ZCC", "SOS"
            //stere: string[] kate = new string[16] { "NDTH", "SR", "CP", "CRM", "INFOLINIA", "WIND", "ZCC", "SOS", "SBL", "PLK", "BILL", "KDTH", "NDTHW", "KKK", "ZU", "PRIO" };
            //string[] kate = new string[8] { "CRM", "INFOLINIA", "WIND", "ZCC", "BILL", "KKK", "PRIO", "ZU" };


            Dictionary <int, string> kat = gujacz2.getBillingComponents(0);

            Dictionary <int, string> sys = new Dictionary <int, string>();

            sys = gujacz2.getBillingComponents(kat.Keys.ToArray()[0]); //Dictionary<int, string>

            Dictionary <int, string> rodz = new Dictionary <int, string>();

            rodz = gujacz2.getBillingComponents(sys.Keys.ToArray()[0]); //Dictionary<int, string>

            Dictionary <int, string> typy = new Dictionary <int, string>();

            typy = gujacz2.getBillingComponents(rodz.Keys.ToArray()[0]);

            foreach (KeyValuePair <int, string> s in sys)
            {
                tbSystem.Items.Add(new Entities.BillingDthLBItem()
                {
                    Text = s.Value, Value = s.Key
                });
            }
            foreach (KeyValuePair <int, string> s in kat)
            {
                tbKategoria.Items.Add(new Entities.BillingDthLBItem()
                {
                    Text = s.Value, Value = s.Key
                });
            }
            foreach (KeyValuePair <int, string> s in rodz)
            {
                tbRodzaj.Items.Add(new Entities.BillingDthLBItem()
                {
                    Text = s.Value, Value = s.Key
                });
            }
            foreach (KeyValuePair <int, string> s in typy)
            {
                tbTyp.Items.Add(new Entities.BillingDthLBItem()
                {
                    Text = s.Value, Value = s.Key
                });
            }


            if (!_newIssue)
            {
                /*
                 *  Mapowanie
                 *  Kategoryzacji
                 */
                List <List <string> > MapObszar = gujacz2.ExecuteStoredProcedure("spMapujWartosc", new string[] { issue.issueHelios.projekt, "Obsługa kodu projektu jako nazwy" }, DatabaseName.SupportCP);


                for (int index = 0; index < tbKategoria.Items.Count; index++)
                {
                    if (tbKategoria.Items[index].ToString() == issue.issueHelios.projekt)
                    {
                        tbKategoria.SelectedIndex = index;
                        break;
                    }
                }

                if (tbKategoria.SelectedIndex == -1 && MapObszar.Count > 0)
                {
                    for (int index = 0; index < tbKategoria.Items.Count; index++)
                    {
                        if (tbKategoria.Items[index].ToString() == MapObszar[0][0])
                        {
                            tbKategoria.SelectedIndex = index;
                            break;
                        }
                    }
                }

                //if (tbKategoria.SelectedIndex == -1)
                //{
                //    for (int index = 0; index < tbSystem.Items.Count; index++)
                //    {
                //        if (tbKategoria.Items[index].ToString() == issue.issueHelios.rodzaj_zgloszenia)
                //        {
                //            tbKategoria.SelectedIndex = index;
                //            break;
                //        }

                //    }
                //}

                if (tbKategoria.SelectedIndex == -1)
                {
                    tbKategoria.SelectedIndex = 0;
                }

                string rodzaj, typ;
                rodzaj = typ = string.Empty;


                /**/

                for (int index = 0; index < tbKategoria.Items.Count; index++)
                {
                    if (tbSystem.Items[index].ToString() == issue.issueHelios.rodzaj_zgloszenia)
                    {
                        tbSystem.SelectedIndex = index;
                        break;
                    }
                }


                if (tbKategoria.SelectedIndex == -1)
                {
                    tbKategoria.SelectedIndex = 0;
                }
                /**/
                if (issue.issueHelios.rodzaj_bledu != null)
                {
                    rodzaj = issue.issueHelios.rodzaj_bledu.TrimEnd();

                    for (int i = 0; i < tbRodzaj.Items.Count; i++)
                    {
                        try
                        {
                            //if (issue.issueHelios.projekt == "ZCC")
                            //{
                            //    string[] rodzajTyp = issue.issueHelios.rodzaj_bledu.Split('-');
                            //    rodzaj = rodzajTyp[0].TrimEnd();
                            //    if (rodzajTyp.Length > 1)
                            //        typ = rodzajTyp[1].TrimStart();
                            //}
                            //else


                            if (((BillingDthLBItem)tbRodzaj.Items[i]).Text.Equals(rodzaj, StringComparison.CurrentCultureIgnoreCase))
                            {
                                tbRodzaj.SelectedIndex = i;
                                break;
                            }
                        }
                        catch (Exception e) { }
                    }
                }

                if (tbRodzaj.SelectedIndex == 0 && issue.issueHelios.rodzaj_bledu == null)
                {
                    for (int i = 0; i < tbRodzaj.Items.Count; i++)
                    {
                        if (tbRodzaj.Items[i].ToString().Equals("inne", StringComparison.CurrentCultureIgnoreCase))
                        {
                            tbRodzaj.SelectedIndex = i;
                        }
                    }
                    if (tbRodzaj.SelectedIndex == 0)
                    {
                        for (int i = 0; i < tbRodzaj.Items.Count; i++)
                        {
                            if (tbRodzaj.Items[i].ToString().Equals("brak", StringComparison.CurrentCultureIgnoreCase))
                            {
                                tbRodzaj.SelectedIndex = i;
                            }
                        }
                    }
                }

                typy = gujacz2.getBillingComponents(rodz.Keys.ToArray()[0]);
                if (typ != string.Empty)
                {
                    for (int i = 0; i < tbTyp.Items.Count; i++)
                    {
                        try
                        {
                            if (((BillingDthLBItem)tbTyp.Items[i]).Text.Equals(typ, StringComparison.CurrentCultureIgnoreCase))
                            {
                                tbTyp.SelectedIndex = i;
                                break;
                            }
                        }
                        catch (Exception ex) { }
                    }
                }
            }

            List <List <string> > priorytet = gujacz2.ExecuteStoredProcedure("Billing_GetListOfPriorities", new string[] { }, DatabaseName.SupportADDONS);

            for (int i = 0; i < priorytet.Count; i++)
            {
                tbPriorytet.Items.Add(new BillingDthLBItem()
                {
                    Text = priorytet[i][1], Value = Convert.ToInt32(priorytet[i][0])
                });
            }

            if (!_newIssue)
            {
                for (int i = 0; i < priorytet.Count; i++)
                {
                    string s = priorytet[i][1];
                    if (priorytet[i][0].Equals(issue.issueHelios.severity, StringComparison.InvariantCultureIgnoreCase) ||
                        priorytet[i][1].Equals(issue.issueHelios.severity, StringComparison.InvariantCultureIgnoreCase))
                    {
                        tbPriorytet.SelectedIndex = i;
                        break;
                    }
                }
            }

            if (newIssue)
            {
                User u = gujacz2.getUser();
                tbFirstName.Text         = u.name;
                tbLastName.Text          = u.surname;
                tbEmail.Text             = u.login + "@billennium.pl";
                tbDataOstKoment.Text     = DateTime.Now.ToString();
                tbDataUtworzeniaZgl.Text = tbDataWystBledu.Text = DateTime.Now.ToString();
                tbIdKontraktu.Text       = "-1";
                tbIdZamowienia.Text      = "-1";
                tbNo.Enabled             = false;
                for (int i = 0; i < tbSystem.Items.Count; i++)
                {
                    if (tbSystem.Items[i].ToString().Equals("wewnętrzne", StringComparison.CurrentCultureIgnoreCase))
                    {
                        tbSystem.SelectedIndex = i;
                    }
                }
                for (int i = 0; i < tbKategoria.Items.Count; i++)
                {
                    if (tbKategoria.Items[i].ToString().Equals("zgłoszenie wewnętrzne", StringComparison.CurrentCultureIgnoreCase))
                    {
                        tbKategoria.SelectedIndex = i;
                    }
                }
                for (int i = 0; i < tbPriorytet.Items.Count; i++)
                {
                    if (tbPriorytet.Items[i].ToString().Equals("sredni", StringComparison.CurrentCultureIgnoreCase))
                    {
                        tbPriorytet.SelectedIndex = i;
                    }
                }
            }
            if (auto && !cb_CzyOncall.Checked)
            {
                Logging.Logger.Instance.LogInformation(string.Format("Zgłoszenie {0} dodano automatycznie o godzinie {1}!\n", zgloszenie.Idnumber, DateTime.Now));
                addButton_Click(this, null);
            }
        }
Ejemplo n.º 4
0
        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);
                }
            }
        }