Beispiel #1
0
        //EDIT REGION
        private void comboBox7_SelectedIndexChanged(object sender, EventArgs e)
        {
            textBox19.Text = RegionShort[comboBox7.SelectedIndex];
            textBox20.Text = FullRegion[comboBox7.SelectedIndex];
            textBox18.Text = RegionIDList[comboBox7.SelectedIndex];

            try
            {
                QueryCommands qc1   = new QueryCommands();
                Company       cmpRg = new Company();
                cmpRg.GetCompanyInfoByRegionID(RegionIDList[comboBox7.SelectedIndex]);

                addressTB.Text = cmpRg.Address;
                CityTB.Text    = cmpRg.City;
                PBTB.Text      = cmpRg.PB;
                OIBTB.Text     = cmpRg.OIB;
                ContactTB.Text = cmpRg.Contact;
                CountryTB.Text = cmpRg.Country;
                BICTB.Text     = cmpRg.BIC;
                EmailTB.Text   = cmpRg.Email;
            }
            catch
            {
                MessageBox.Show("I cant find cmp which match to region!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Beispiel #2
0
        private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                QueryCommands wkQ = new QueryCommands();

                while (true)
                {
                    if (wkQ.CheckConnection())
                    {
                        if (!pictureOn)
                        {
                            pictureBox9.Image = Properties.Resources.MainConnectionOn;
                            pictureOn         = true;
                        }

                        Thread.Sleep(60000);
                    }
                    else
                    {
                        if (pictureOn)
                        {
                            pictureBox9.Image = Properties.Resources.MainConnectionOff;
                            pictureOn         = false;
                        }

                        Thread.Sleep(5000);
                    }
                }
            }
            catch (Exception)
            {
                //new LogWriter(e1);
            }
        }
Beispiel #3
0
        private void Tickets_Load(object sender, EventArgs e)
        {
            QueryCommands    qc      = new QueryCommands();
            ConnectionHelper cn      = new ConnectionHelper();
            Company          cmpList = new Company();

            this.nextID.Text = (qc.GetLastTicketID(WorkingUser.Username, WorkingUser.Password) + 1).ToString();

            try
            {
                resultArrC = cmpList.GetAllCompanyInfoSortByName();

                if (!resultArrC[0].Name.Equals(""))
                {
                    for (int i = 0; i < resultArrC.Count(); i++)
                    {
                        this.companyCB.Items.Add(resultArrC[i].Name);
                    }
                }
            }
            catch (Exception e1)
            {
                Program.LoadStop();
                this.Focus();

                new LogWriter(e1);
            }

            Program.LoadStop();
            this.Focus();
        }
Beispiel #4
0
        private void NewDBUser_Load(object sender, EventArgs e)
        {
            QueryCommands qc        = new QueryCommands();
            List <String> sendArr   = new List <string>();
            List <String> resultArr = new List <string>();

            try
            {
                resultArr = qc.RegionInfo(WorkingUser.Username, WorkingUser.Password);
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
                return;
            }

            for (int i = 0; i < resultArr.Count; i = i + 3)
            {
                cboxArr.Add(resultArr[i + 1]);
                cboxArrID.Add(resultArr[i]);
                cboxArrFull.Add(resultArr[i + 2]);
            }

            for (int i = 0; i < cboxArr.Count; i++)
            {
                this.comboBox1.Items.Add(cboxArr[i]);
            }
        }
Beispiel #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.companyCB.Text.Equals("") || this.companyCB.Text.Equals("Search by company name") || this.datPrijave.Text.Equals("") || this.vriPrijave.Text.Equals("") || this.drive.Text.Equals("") ||
                this.SLAdat.Text.Equals("") || this.SLAvri.Text.Equals("") || this.label30.Text.Equals("") || this.filijala.Text.Equals("") ||
                this.ccn.Text.Equals("") || this.cid.Text.Equals("") || this.prio.Text.Equals("") || this.opis.Text.Equals("") || this.naziv.Text.Equals(""))
            {
                AppendTextBox(Environment.NewLine + "- " + DateTime.Now.ToString("dd.MM.yy. HH:mm - ") + "All fields must filed in" + Environment.NewLine + "    - Nothing done");
                return;
            }

            Branch        br = new Branch();
            QueryCommands qc = new QueryCommands();

            long TIDid = qc.GetLastTicketID(WorkingUser.Username, WorkingUser.Password) + 1;

            br.SetFilByTvrtkeCodeFilNumber(cmp.Code, this.filijala.Text.Trim());

            if (!qc.IsTIDExistByIDCCNCID(TIDid, ccn.Text, cid.Text))
            {
                Boolean storno = false;
                if (at.sendIntervention(cmp, datPrijave.Text, vriPrijave.Text, prio.Text, SLAdat.Text, SLAvri.Text, filijala.Text, ccn.Text, cid.Text, TIDid, drive.Text, InqUser.Text, naziv.Text, opis.Text, storno, br.City, br.Address, br.Phone, this))
                {
                    AppendTextBox(Environment.NewLine + "- " + DateTime.Now.ToString("dd.MM.yy. HH:mm - ") + " Added and sent");
                }
            }
            else
            {
                String msg = Environment.NewLine + "- " + DateTime.Now.ToString("dd.MM.yy. HH:mm - ") + " TID already exist";
                AppendTextBox(msg);
            }

            SystemSounds.Hand.Play();
        }
Beispiel #6
0
        private void fillTickets()
        {
            try
            {
                QueryCommands qc = new QueryCommands();

                allTickets = qc.getAllTickets();

                foreach (TIDs tid in allTickets)
                {
                    if (tid.UserIDUnio == 0)
                    {
                        openedTickets.Add(tid);
                    }
                    else if (tid.UserIDUnio != 0)
                    {
                        closedTickets.Add(tid);
                    }

                    if (tid.UserIDUnio == 2)
                    {
                        stornoTickets.Add(tid);
                    }

                    if (tid.UserIDPreuzeo != 0 && tid.UserIDZavrsio == 0 && tid.UserIDUnio != 2 && tid.userIDPoceo != 0)
                    {
                        workingTickets.Add(tid);
                    }
                }
            }
            catch { }
        }
Beispiel #7
0
        public void GetFilByID(long mFillID)
        {
            QueryCommands qc        = new QueryCommands();
            List <String> resultArr = new List <string>();

            FilID = 0;

            try
            {
                resultArr = qc.GetFillByID(mFillID);
                if (!resultArr[0].Equals("nok"))
                {
                    FilID      = long.Parse(resultArr[0]);
                    TvrtkeCode = resultArr[1].Trim();
                    FilNumber  = resultArr[2].Trim();
                    RegionID   = long.Parse(resultArr[3].Trim());
                    Address    = resultArr[4].Trim();
                    City       = resultArr[5].Trim();
                    Pb         = resultArr[6].Trim();
                    Phone      = resultArr[7].Trim();
                    Country    = resultArr[8];
                }
            }
            catch (Exception ex)
            {
                new LogWriter(ex);
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #8
0
        private void showList(object sender, EventArgs e)
        {
            QueryCommands        qc        = new QueryCommands();
            List <String>        resultArr = new List <string>();
            List <PartSifrarnik> partArr   = new List <PartSifrarnik>();

            ConnectionHelper cn = new ConnectionHelper();

            Control regionIdcontrol = this.Controls["lblAdd_" + ((TextBox)sender).Name.Split('_')[1]];

            try
            {
                if (((TextBox)sender).Name.Contains("txtBoxAddSNG") || ((TextBox)sender).Name.Contains("txtBoxAddSG"))
                {
                    resultArr = qc.ListPartsByCodeRegionStateS(long.Parse(label18.Text), long.Parse(regionIdcontrol.Text.Split('-')[1].Trim().ToString()), ((TextBox)sender).Name.Contains("txtBoxAddSNG") ? "sng" : "sg");
                }
                else
                {
                    resultArr = qc.ListPartsByCodeRegionStateS(long.Parse(label18.Text), long.Parse(regionIdcontrol.Text.Split('-')[1].Trim().ToString()), ((TextBox)sender).Name.Contains("txtBoxAddNG") ? "ng" : "g");
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
            }

            PartsList pl = new PartsList(resultArr);

            pl.Show();
            textBox1.Focus();
            pl.Focus();
        }
Beispiel #9
0
        private void fillSifrarnik()
        {
            QueryCommands    qc2        = new QueryCommands();
            ConnectionHelper cn         = new ConnectionHelper();
            List <String>    tresultArr = new List <string>();
            int stop = 0;

            try
            {
                while (tresultArr.Count == 0 || tresultArr[0].Equals("nok"))
                {
                    stop++;
                    sifrarnikArr.Clear();
                    tresultArr.Clear();
                    tresultArr = qc.SelectNameCodeFromSifrarnik(WorkingUser.Username, WorkingUser.Password);

                    if (stop == 100)
                    {
                        //MessageBox.Show("Cant load 'sifrarnik'.");
                        String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                        String    usedQC   = "Loading sifrarnik";
                        String    data     = "Break limit reached, arr cnt = " + tresultArr.Count;
                        String    Result   = "";
                        LogWriter lw       = new LogWriter();

                        Result = "Cant load 'sifrarnik'.";
                        lw.LogMe(function, usedQC, data, Result);

                        pictureBox1.Image = Properties.Resources.LoadDataOff;
                        this.label7.ResetText();
                        pictureOn = false;

                        this.Refresh();

                        break;
                    }
                }

                sifrarnikArr = tresultArr;

                if (sifrarnikArr.Count > 0 && stop < 100)
                {
                    pictureBox1.Image = Properties.Resources.LoadDataOn;
                    this.label7.ResetText();
                    pictureOn = true;
                }
                else
                {
                    pictureBox1.Image = Properties.Resources.LoadDataOff;
                    this.label7.ResetText();
                    pictureOn = false;
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                sifrarnikArr = tresultArr;
            }
        }
Beispiel #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "Main cmp select";
            String    data     = "";
            String    Result   = "";
            LogWriter lw       = new LogWriter();
            ////////////////////////////////////////////////
            ///

            int           index = comboBox1.SelectedIndex;
            QueryCommands qc    = new QueryCommands();

            try
            {
                if (qc.MainCmpChangeSelected(resultList[index].Name))
                {
                    Properties.Settings.Default.CmpName    = resultList[index].Name;
                    Properties.Settings.Default.CmpAddress = resultList[index].Address;
                    Properties.Settings.Default.CmpVAT     = resultList[index].OIB;
                    if (Properties.Settings.Default.CmpWWW == "")
                    {
                        Properties.Settings.Default.CmpWWW = "www";
                    }
                    if (Properties.Settings.Default.CmpPhone == "")
                    {
                        Properties.Settings.Default.CmpPhone = "Phone";
                    }
                    Properties.Settings.Default.CmpEmail = resultList[index].Email;

                    Properties.Settings.Default.MainCompanyCode = resultList[index].Code;
                    Properties.Settings.Default.CmpName         = resultList[index].Name;
                    Properties.Settings.Default.CmpID           = resultList[index].ID;
                    Properties.Settings.Default.Remember        = true;
                    Properties.Settings.Default.Save();

                    data   = comboBox1.Text;
                    Result = "Main cmp selected, please relog to see changes.";
                }
                else
                {
                    Result = "Main cmp not selected.";
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                Result = "Main cmp not selected. Error:" + Environment.NewLine + e1.Message;
            }

            lw.LogMe(function, usedQC, data, Result);
            MessageBox.Show(Result);

            Close();
        }
Beispiel #11
0
        private void button2_Click(object sender, EventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "qc.NewDBUser";
            String    data     = "";
            String    Result   = "";
            LogWriter lw       = new LogWriter();
            ////////////////////////////////////////////////

            QueryCommands qc      = new QueryCommands();
            List <String> sendArr = new List <string>();

            sendArr.Add(this.textBox1.Text.Trim());
            sendArr.Add(this.textBox2.Text.Trim());
            sendArr.Add(this.textBox3.Text.Trim());
            sendArr.Add(this.textBox4.Text.Trim());
            sendArr.Add(this.textBox5.Text.Trim());
            sendArr.Add(this.textBox6.Text.Trim());
            sendArr.Add(this.textBox8.Text.Trim());

            if (this.checkBox1.Checked && this.checkBox2.Checked)
            {
                sendArr.Add("12");
            }
            else if (this.checkBox1.Checked)
            {
                sendArr.Add("1");
            }
            else if (this.checkBox2.Checked)
            {
                sendArr.Add("2");
            }
            else
            {
                sendArr.Add("0");
            }

            data = sendArr[0] + ", " + sendArr[1] + ", " + sendArr[2] + ", " + sendArr[3] + ", " + sendArr[4] + ", " + sendArr[5] + ", " + sendArr[6] + ", " + sendArr[7];

            try
            {
                qc.NewDBUser(WorkingUser.Username, WorkingUser.Password, sendArr);
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                Result = "User NOT added." + "\n\n" + e1.Message;
                MessageBox.Show(Result);
                return;
            }

            Result = "User added.";
            lw.LogMe(function, usedQC, data, Result);
            MessageBox.Show(Result);
        }
Beispiel #12
0
        public List <Part> GetListOfPartsOTPParts(long mOTPID)
        {
            List <long>   backArr   = new List <long>();
            List <String> resultArr = new List <string>();
            List <Part>   pr        = new List <Part>();
            QueryCommands qc        = new QueryCommands();

            try
            {
                //for (int i = 0; i < mNumberOfParts; i++)
                int ii = 0;
                do
                {
                    resultArr = qc.GetPartsIDSbyOpenedOTP(WorkingUser.Username, WorkingUser.Password, mOTPID);
                    if (resultArr[0] != "nok")
                    {
                        backArr.Add(long.Parse(resultArr[ii].ToString()));
                    }
                    ii++;
                } while (ii < resultArr.Count);

                for (int k = 0; k < backArr.Count; k++)
                {
                    resultArr.Clear();
                    resultArr = qc.GetPartsByOTPID(WorkingUser.Username, WorkingUser.Password, backArr[k]);

                    if (resultArr[0] != "nok")
                    {
                        for (int i = 0; i < resultArr.Count; i = i + 12)
                        {
                            Part onlyPart = new Part();
                            onlyPart.PartID       = long.Parse(resultArr[0].ToString());
                            onlyPart.CodePartFull = long.Parse(resultArr[1].ToString());
                            onlyPart.PartialCode  = long.Parse(resultArr[2].ToString());
                            onlyPart.SN           = resultArr[3].ToString();
                            onlyPart.CN           = resultArr[4].ToString();
                            onlyPart.DateIn       = resultArr[5].ToString();
                            onlyPart.DateOut      = resultArr[6].ToString();
                            onlyPart.DateSend     = resultArr[7].ToString();
                            onlyPart.StorageID    = long.Parse(resultArr[8].ToString());
                            onlyPart.State        = resultArr[9].ToString();
                            onlyPart.CompanyO     = resultArr[10].ToString();
                            onlyPart.CompanyC     = resultArr[11].ToString();
                            pr.Add(onlyPart);
                        }
                    }
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                throw;
            }
            return(pr);
        }
Beispiel #13
0
        public List <Part> GetListOfPartsFromPartsPartsPoslanoPartsZamijenjenoByID(List <long> mPartsID)
        {
            List <Part>   pr        = new List <Part>();
            List <String> resultArr = new List <string>();
            QueryCommands qc        = new QueryCommands();

            try
            {
                for (int k = 0; k < mPartsID.Count; k++)
                {
                    resultArr = qc.GetListPartsByPartIDFromPartsPoslano(mPartsID[k]);
                    if (resultArr[0].Equals("nok"))
                    {
                        resultArr = qc.GetListPartsByPartIDFromParts(mPartsID[k]);
                    }
                    else if (resultArr[0].Equals("nok"))
                    {
                        resultArr = qc.GetListPartsByPartIDFromPartsZamijenjeno(mPartsID[k]);
                    }
                    else if (resultArr[0].Equals("nok"))
                    {
                        pr.Clear();
                        return(pr);
                    }

                    for (int i = 0; i < resultArr.Count; i = i + 12)
                    {
                        Part onlyPart = new Part();

                        onlyPart.PartID       = long.Parse(resultArr[i + 0].ToString());
                        onlyPart.CodePartFull = long.Parse(resultArr[i + 1].ToString());
                        onlyPart.PartialCode  = long.Parse(resultArr[i + 2].ToString());
                        onlyPart.SN           = resultArr[i + 3].ToString();
                        onlyPart.CN           = resultArr[i + 4].ToString();
                        onlyPart.DateIn       = resultArr[i + 5].ToString();
                        onlyPart.DateOut      = resultArr[i + 6].ToString();
                        onlyPart.DateSend     = resultArr[i + 7].ToString();
                        onlyPart.StorageID    = long.Parse(resultArr[i + 8].ToString());
                        onlyPart.State        = resultArr[i + 9].ToString();
                        onlyPart.CompanyO     = resultArr[i + 10].ToString();
                        onlyPart.CompanyC     = resultArr[i + 11].ToString();

                        pr.Add(onlyPart);
                    }
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                throw;
            }
            return(pr);
        }
Beispiel #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "qc.DeleteDBUser";
            String    data     = this.comboBox1.Text + ", " + this.label9.Text;
            String    Result   = "";
            LogWriter lw       = new LogWriter();
            ////////////////////////////////////////////////
            ///
            QueryCommands qc = new QueryCommands();

            if (!this.label9.Text.Equals("UserID"))
            {
                try
                {
                    if (qc.DeleteDBUser(WorkingUser.Username, WorkingUser.Password, this.comboBox1.Text, this.label9.Text))
                    {
                        Result = "User deleted.";
                        lw.LogMe(function, usedQC, data, Result);
                        MessageBox.Show(Result);

                        this.label6.Text = "";
                        this.label7.Text = "";
                        this.label8.Text = "";
                        this.label9.Text = "";

                        cboxArr.Clear();
                        cboxArrName.Clear();
                        cboxArrSurename.Clear();
                        cboxArrRegion.Clear();
                        cboxArrID.Clear();

                        DeleteDBUser_Load(sender, e);
                    }
                }
                catch (Exception e1)
                {
                    new LogWriter(e1);
                    Result = "User NOT deleted." + "\n\n" + e1.Message;
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                    return;
                }
            }
            else
            {
                Result = "Please select user to delete.";
                lw.LogMe(function, usedQC, data, Result);
                MessageBox.Show(Result);
            }
        }
Beispiel #15
0
        private void button3_Click(object sender, EventArgs e)
        {
            ///////////////// LogMe ////////////////////////
            String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String    usedQC   = "qc.AddFilToDB";
            String    data     = tvrtCode + ", " + Filijala + ", " + RegionID + ", " + Address + ", " + City + ", " + Zip + ", " + Phone + ", " + Country;
            String    Result   = "";
            LogWriter lw       = new LogWriter();
            ////////////////////////////////////////////////
            ///

            int index;

            index = comboBox5.FindStringExact(comboBox5.Text);

            if (index < 0)
            {
                return;
            }

            try
            {
                if (comboBox4.Text.Equals("") || comboBox5.Text.Equals("") || comboBox6.Text.Equals("") ||
                    textBox12.Text.Equals("") || textBox15.Text.Equals("") || textBox16.Text.Equals("") || textBox17.Text.Equals("") || textBox10.Text.Equals(""))
                {
                    Result = "All fields fileds must be filled in.";
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                    return;
                }
                zamjeniZabranjeneZnakove(textBox12.Text, textBox16.Text, textBox17.Text, textBox15.Text, textBox10.Text, comboBox6.Text, comboBox5.Text);

                QueryCommands qc = new QueryCommands();
                if (qc.AddFilToDB(tvrtCode, Filijala, RegionID, Address, City, Zip, Phone, Country))
                {
                    Result = "Branch added.";
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                }
                else
                {
                    Result = "Branch NOT added.";
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                }
            }
            catch (Exception e1)
            {
                MessageBox.Show(e1.Message);
                new LogWriter(e1);
            }
        }
Beispiel #16
0
        private void State_Load(object sender, EventArgs e)
        {
            QueryCommands    qc         = new QueryCommands();
            List <String>    sendArr    = new List <string>();
            List <String>    resultArr  = new List <string>();
            List <Company>   resultArrC = new List <Company>();
            ConnectionHelper cn         = new ConnectionHelper();

            comboBox2.Text = Properties.Settings.Default.MainCompanyCode;
            comboBox3.Text = Properties.Settings.Default.MainCompanyCode;

            try
            {
                Company cmpList = new Company();
                resultArrC = cmpList.GetAllCompanyInfoSortCode();

                if (!resultArrC[0].Name.Equals(""))
                {
                    for (int i = 0; i < resultArrC.Count(); i++)
                    {
                        this.comboBox2.Items.Add(resultArrC[i].Code);
                        this.comboBox3.Items.Add(resultArrC[i].Code);
                    }
                }

                resultArr = qc.SelectNameCodeFromSifrarnik(WorkingUser.Username, WorkingUser.Password);
                sendArr.Clear();

                if (!resultArr[0].Equals("nok"))
                {
                    for (int i = 0; i < resultArr.Count(); i = i + 2)
                    {
                        this.comboBox1.Items.Add(resultArr[i]);
                        //resultArrSearchName.Add(resultArr[i]);
                        resultArrSearchCode.Add(resultArr[i + 1]);
                    }
                }
            }
            catch (Exception e1)
            {
                Program.LoadStop();
                this.Focus();

                new LogWriter(e1);
                MessageBox.Show(e1.Message);
                clearME();
                return;
            }

            Program.LoadStop();
            this.Focus();
        }
Beispiel #17
0
        public List <MainCmp> GetAllMainCmpInfoSortCode()
        {
            //Part mPart = new Part();

            QueryCommands  qc         = new QueryCommands();
            List <String>  resultArr  = new List <string>();
            List <MainCmp> resultArrC = new List <MainCmp>();

            try
            {
                resultArr = qc.AllMainCmpInfoSortCode();

                if (!resultArr[0].Equals("nok"))
                {
                    for (int i = 0; i < resultArr.Count(); i = i + 19)
                    {
                        MainCmp tempC = new MainCmp();

                        tempC.ID           = long.Parse(resultArr[i + 0]);
                        tempC.Name         = resultArr[i + 1].Trim();
                        tempC.Address      = resultArr[i + 2].Trim();
                        tempC.City         = resultArr[i + 3].Trim();
                        tempC.PB           = resultArr[i + 4].Trim();
                        tempC.OIB          = resultArr[i + 5].Trim();
                        tempC.Contact      = resultArr[i + 6].Trim();
                        tempC.BIC          = resultArr[i + 7].Trim();
                        tempC.KN           = decimal.Parse(resultArr[i + 8]);
                        tempC.EUR          = decimal.Parse(resultArr[i + 9]);
                        tempC.Code         = resultArr[i + 10].Trim();
                        tempC.Country      = resultArr[i + 11].Trim();
                        tempC.RegionID     = long.Parse(resultArr[i + 12].Trim());
                        tempC.Email        = resultArr[i + 13].Trim();
                        tempC.Phone        = resultArr[i + 14].Trim();
                        tempC.WWW          = resultArr[i + 15].Trim();
                        tempC.MB           = resultArr[i + 16].Trim();
                        tempC.IBAN         = resultArr[i + 17].Trim();
                        tempC.SupportEmail = resultArr[i + 18].Trim();

                        resultArrC.Add(tempC);
                        count++;
                    }
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
            }

            return(resultArrC);
        }
Beispiel #18
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            try
            {
                Program.LoadStart();

                int   pHgth = pictureBox1.Height; //(90,90);
                Point pPos  = pictureBox1.Location;

                pictureBox1.Image    = Properties.Resources.warehousG;
                pictureBox1.Height   = pHgth + 8;
                pictureBox1.Width    = pHgth + 8;
                pictureBox1.Location = new Point(pPos.X - 4, pPos.Y - 4);
                pictureBox1.Refresh();

                System.Threading.Thread.Sleep(150);

                pictureBox1.Image    = Properties.Resources.warehousB;
                pictureBox1.Location = new Point(pPos.X, pPos.Y);
                pictureBox1.Height   = pHgth;
                pictureBox1.Width    = pHgth;
                pictureBox1.Refresh();

                QueryCommands        qc        = new QueryCommands();
                List <String>        resultArr = new List <string>();
                List <PartSifrarnik> partArr   = new List <PartSifrarnik>();

                ConnectionHelper cn = new ConnectionHelper();

                resultArr = qc.ListPartsByCodeRegionStateS(0, 0, "");

                PartsList pl = new PartsList(resultArr);

                pl.Show();
                textBox1.Focus();
                pl.Focus();
            }
            catch (Exception e1)
            {
                Program.LoadStop();
                this.Focus();

                new LogWriter(e1);
                MessageBox.Show(e1.Message);
            }
            finally
            {
                Program.LoadStop();
                this.Focus();
            }
        }
Beispiel #19
0
        public Part GetPartFromPartsPartsPoslanoPartsZamijenjenoByID(long mPartID)
        {
            Part onlyPart = new Part();

            if (mPartID != 0)
            {
                List <String> resultArr = new List <string>();
                QueryCommands qc        = new QueryCommands();
                try
                {
                    resultArr = qc.GetListPartsByPartIDFromPartsPoslano(mPartID);

                    if (resultArr[0].Equals("nok"))
                    {
                        resultArr.Clear();
                        resultArr = qc.GetListPartsByPartIDFromParts(mPartID);
                    }

                    if (resultArr[0].Equals("nok"))
                    {
                        resultArr.Clear();
                        resultArr = qc.GetListPartsByPartIDFromPartsZamijenjeno(mPartID);
                    }

                    if (resultArr[0].Equals("nok"))
                    {
                        return(onlyPart);
                    }

                    onlyPart.PartID       = long.Parse(resultArr[0].ToString());
                    onlyPart.CodePartFull = long.Parse(resultArr[1].ToString());
                    onlyPart.PartialCode  = long.Parse(resultArr[2].ToString());
                    onlyPart.SN           = resultArr[3].ToString();
                    onlyPart.CN           = resultArr[4].ToString();
                    onlyPart.DateIn       = resultArr[5].ToString();
                    onlyPart.DateOut      = resultArr[6].ToString();
                    onlyPart.DateSend     = resultArr[7].ToString();
                    onlyPart.StorageID    = long.Parse(resultArr[8].ToString());
                    onlyPart.State        = resultArr[9].ToString();
                    onlyPart.CompanyO     = resultArr[10].ToString();
                    onlyPart.CompanyC     = resultArr[11].ToString();
                }
                catch (Exception e1)
                {
                    new LogWriter(e1);
                    throw;
                }
            }
            return(onlyPart);
        }
Beispiel #20
0
 public List <PartSifrarnik> GetPartsAllSifrarnikSortByFullName()
 {
     try
     {
         QueryCommands        qc  = new QueryCommands();
         List <PartSifrarnik> prs = qc.GetPartsAllSifrarnikSortByFullName();
         return(prs);
     }
     catch (Exception e1)
     {
         new LogWriter(e1);
         throw;
     }
 }
Beispiel #21
0
        private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            QueryCommands qc  = new QueryCommands();
            List <String> arr = qc.GetAllRegions();

            for (int i = 0; i < arr.Count; i = i + 3)
            {
                if (arr[i].Equals(comboBox3.Text))
                {
                    textBox1.Text = arr[i + 2];
                    break;
                }
            }
        }
Beispiel #22
0
        public void GetTIDByID(double mID)
        {
            QueryCommands qc = new QueryCommands();

            try
            {
                TIDs tmp = qc.getTicketByID(mID);

                /*
                 * TicketID = tmp.TicketID;
                 * TvrtkeID = tmp.TvrtkeID;
                 * Prio = tmp.Prio;
                 * Filijala = tmp.Filijala;
                 * CCN = tmp.CCN;
                 * CID = tmp.CID;
                 * DatPrijave = tmp.DatPrijave;
                 * VriPrijave = tmp.VriPrijave;
                 * DatSLA = tmp.DatSLA;
                 * VriSLA = tmp.VriSLA;
                 * Drive = tmp.Drive;
                 * NazivUredaja = tmp.NazivUredaja;
                 * OpisKvara = tmp.OpisKvara;
                 * Prijavio = tmp.Prijavio;
                 * UserIDPreuzeo = tmp.UserIDPreuzeo;
                 * DatPreuzeto = tmp.DatPreuzeto;
                 * VriPreuzeto = tmp.VriPreuzeto;
                 * UserIDDrive = tmp.UserIDDrive;
                 * DatDrive = tmp.DatDrive;
                 * VriDrive = tmp.VriDrive;
                 * UserIDPoceo = tmp.UserIDPoceo;
                 * DatPoceo = tmp.DatPoceo;
                 * VriPoceo = tmp.VriPoceo;
                 * UserIDZavrsio = tmp.UserIDZavrsio;
                 * DatZavrsio = tmp.DatZavrsio;
                 * VriZavrsio = tmp.VriZavrsio;
                 * UserIDUnio = tmp.UserIDUnio;
                 * DatReport = tmp.DatReport;
                 * VriReport = tmp.VriReport;
                 * RNID = tmp.RNID;
                 * UserIDSastavio = tmp.UserIDSastavio;
                 *
                 * Rn = new RadniNalog(TicketID);
                 */

                tmp.CopyTo(this);
            }
            catch { }
        }
Beispiel #23
0
        public List <Part> GetListOfParts(long mCodePartFull, String mSN, String mCN, String mState, long mStorageID)
        {
            List <Part>   pr = new List <Part>();
            QueryCommands qc = new QueryCommands();

            try
            {
                pr = qc.ListPartsByCodeRegionStateP(WorkingUser.Username, WorkingUser.Password, mCodePartFull, mSN, mCN, mState, mStorageID);
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                throw;
            }
            return(pr);
        }
Beispiel #24
0
        public List <Company> GetAllCompanyInfoSortByName()
        {
            //Part mPart = new Part();

            QueryCommands  qc         = new QueryCommands();
            List <String>  resultArr  = new List <string>();
            List <Company> resultArrC = new List <Company>();

            //AllCompanyInfoSortCode bilo prije
            try
            {
                resultArr = qc.AllCompanyInfoSortByName(WorkingUser.Username, WorkingUser.Password);

                for (int i = 0; i < resultArr.Count(); i = i + 14)
                {
                    Company tempC = new Company();
                    if (i == 140)
                    {
                        i = 140;
                    }
                    tempC.ID       = long.Parse(resultArr[i + 0]);
                    tempC.Name     = resultArr[i + 1].Trim();
                    tempC.Address  = resultArr[i + 2].Trim();
                    tempC.City     = resultArr[i + 3].Trim();
                    tempC.PB       = resultArr[i + 4].Trim();
                    tempC.OIB      = resultArr[i + 5].Trim();
                    tempC.Contact  = resultArr[i + 6].Trim();
                    tempC.BIC      = resultArr[i + 7].Trim();
                    tempC.KN       = decimal.Parse(resultArr[i + 8]);
                    tempC.EUR      = decimal.Parse(resultArr[i + 9]);
                    tempC.Code     = resultArr[i + 10].Trim();
                    tempC.Country  = resultArr[i + 11].Trim();
                    tempC.RegionID = long.Parse(resultArr[i + 12]);
                    tempC.Email    = resultArr[i + 13].Trim();

                    resultArrC.Add(tempC);
                    count++;
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
            }

            return(resultArrC);
        }
Beispiel #25
0
        private void MainCmpSelector_Load(object sender, EventArgs e)
        {
            QueryCommands qc = new QueryCommands();

            resultList = cmp.GetAllMainCmpInfoSortByName();

            if (resultList.Count != 0)
            {
                for (int i = 0; i < resultList.Count; i++)
                {
                    comboBox1.Items.Add(resultList[i].Name);
                }
            }
            Program.LoadStop();
            this.BringToFront();
            this.Focus();
        }
Beispiel #26
0
        private void button6_Click(object sender, EventArgs e)
        {
            QueryCommands qc     = new QueryCommands();
            Boolean       result = false;

            ///////////////// LogMe ////////////////////////
            String function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
            String usedQC   = "qc.DeleteRegion";
            String data     = comboBox7.Text + ", " + textBox18.Text + ", " + textBox19.Text + ", " + textBox20.Text + ", " + addressTB.Text + ", " + CityTB.Text + ", " + PBTB.Text + ", " + OIBTB.Text + ", " +
                              ContactTB.Text + ", " + CountryTB.Text + ", " + BICTB.Text + ", " + EmailTB.Text + ", " + Properties.Settings.Default.MainCompanyCode;
            String    Result = "";
            LogWriter lw     = new LogWriter();

            ////////////////////////////////////////////////

            if (textBox18.Text.Equals("1") || textBox18.Text.Equals("2") || textBox18.Text.Equals("3") || textBox18.Text.Equals("4"))
            {
                Result = "Not deleted, regions 01, 02, 03 and 04 cant be deleted.";
                lw.LogMe(function, usedQC, data, Result);
                MessageBox.Show(Result);
                return;
            }

            try
            {
                result = qc.DeleteRegion(WorkingUser.Username, WorkingUser.Password, int.Parse(textBox18.Text.Trim()));
                if (result)
                {
                    Result = "Deleted.";
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                }
                else
                {
                    Result = "NOT Deleted.";
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result);
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show("Please check that RegionID is correct NUMBER." + "\n\n" + e1.Message);
            }
        }
Beispiel #27
0
        public Boolean GetCompanyInfoByCode(String mCode)
        {
            //Part mPart = new Part();

            QueryCommands qc        = new QueryCommands();
            List <String> resultArr = new List <string>();
            Boolean       isTrue    = false;

            try
            {
                resultArr = qc.CompanyInfoByCode(WorkingUser.Username, WorkingUser.Password, mCode);

                if (!resultArr[0].Equals("nok"))
                {
                    ID       = long.Parse(resultArr[0]);
                    Name     = resultArr[1].Trim();
                    Address  = resultArr[2].Trim();
                    City     = resultArr[3].Trim();
                    PB       = resultArr[4].Trim();
                    OIB      = resultArr[5].Trim();
                    Contact  = resultArr[6].Trim();
                    BIC      = resultArr[7].Trim();
                    KN       = decimal.Parse(resultArr[8]);
                    EUR      = decimal.Parse(resultArr[9]);
                    Code     = resultArr[10].Trim();
                    Country  = resultArr[11].Trim();
                    RegionID = long.Parse(resultArr[12]);
                    Email    = resultArr[13].Trim();

                    count++;

                    isTrue = true;
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
                return(isTrue);
            }

            return(isTrue);
        }
Beispiel #28
0
        public Boolean GetMainCmpInfoByCode(String mCode)
        {
            //Part mPart = new Part();

            QueryCommands qc        = new QueryCommands();
            List <String> resultArr = new List <string>();

            try
            {
                resultArr = qc.MainCmpInfoByCode(mCode);

                ID           = long.Parse(resultArr[0]);
                Name         = resultArr[1].Trim();
                Address      = resultArr[2].Trim();
                City         = resultArr[3].Trim();
                PB           = resultArr[4].Trim();
                OIB          = resultArr[5].Trim();
                Contact      = resultArr[6].Trim();
                BIC          = resultArr[7].Trim();
                KN           = decimal.Parse(resultArr[8].Trim());
                EUR          = decimal.Parse(resultArr[9].Trim());
                Code         = resultArr[10].Trim();
                Country      = resultArr[11].Trim();
                regionID     = long.Parse(resultArr[12].Trim());
                Email        = resultArr[13].Trim();
                Phone        = resultArr[14].Trim();
                WWW          = resultArr[15].Trim();
                MB           = resultArr[16].Trim();
                IBAN         = resultArr[17];
                SupportEmail = resultArr[18].Trim();

                count++;
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                MessageBox.Show(e1.Message);
                return(false);
            }

            return(true);
        }
Beispiel #29
0
        public void CopyTo(TIDs tmp)
        {
            QueryCommands qc = new QueryCommands();

            try
            {
                tmp.TicketID       = TicketID;
                tmp.TvrtkeID       = TvrtkeID;
                tmp.Prio           = Prio;
                tmp.Filijala       = Filijala;
                tmp.CCN            = CCN;
                tmp.CID            = CID;
                tmp.DatPrijave     = DatPrijave;
                tmp.VriPrijave     = VriPrijave;
                tmp.DatSLA         = DatSLA;
                tmp.VriSLA         = VriSLA;
                tmp.Drive          = Drive;
                tmp.NazivUredaja   = NazivUredaja;
                tmp.OpisKvara      = OpisKvara;
                tmp.Prijavio       = Prijavio;
                tmp.UserIDPreuzeo  = UserIDPreuzeo;
                tmp.DatPreuzeto    = DatPreuzeto;
                tmp.VriPreuzeto    = VriPreuzeto;
                tmp.UserIDDrive    = UserIDDrive;
                tmp.DatDrive       = DatDrive;
                tmp.VriDrive       = VriDrive;
                tmp.UserIDPoceo    = UserIDPoceo;
                tmp.DatPoceo       = DatPoceo;
                tmp.VriPoceo       = VriPoceo;
                tmp.UserIDZavrsio  = UserIDZavrsio;
                tmp.DatZavrsio     = DatZavrsio;
                tmp.VriZavrsio     = VriZavrsio;
                tmp.UserIDUnio     = UserIDUnio;
                tmp.DatReport      = DatReport;
                tmp.VriReport      = VriReport;
                tmp.RNID           = RNID;
                tmp.UserIDSastavio = UserIDSastavio;

                tmp.Rn = Rn;
            }
            catch { }
        }
Beispiel #30
0
        public List <Part> GetListOfParts(long mCodePartFull, long mStorageID, String mState)
        {
            List <Part>   pr        = new List <Part>();
            List <String> resultArr = new List <string>();
            QueryCommands qc        = new QueryCommands();

            try
            {
                resultArr = qc.ListPartsByCodeRegionStateS(mCodePartFull, mStorageID, mState);

                if (resultArr[0] != "nok")
                {
                    for (int i = 0; i < resultArr.Count; i = i + 12)
                    {
                        Part onlyPart = new Part();

                        onlyPart.PartID       = long.Parse(resultArr[i + 0].ToString());
                        onlyPart.CodePartFull = long.Parse(resultArr[i + 1].ToString());
                        onlyPart.PartialCode  = long.Parse(resultArr[i + 2].ToString());
                        onlyPart.SN           = resultArr[i + 3].ToString();
                        onlyPart.CN           = resultArr[i + 4].ToString();
                        onlyPart.DateIn       = resultArr[i + 5].ToString();
                        onlyPart.DateOut      = resultArr[i + 6].ToString();
                        onlyPart.DateSend     = resultArr[i + 7].ToString();
                        onlyPart.StorageID    = long.Parse(resultArr[i + 8].ToString());
                        onlyPart.State        = resultArr[i + 9].ToString();
                        onlyPart.CompanyO     = resultArr[i + 10].ToString();
                        onlyPart.CompanyC     = resultArr[i + 11].ToString();

                        pr.Add(onlyPart);
                    }
                }
            }
            catch (Exception e1)
            {
                new LogWriter(e1);
                throw;
            }
            return(pr);
        }