Exemple #1
0
        private void ISSSelectorCb_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (oneTimeISSSelectorCb)
            {
                if (obj != null)
                {
                    obj = null;
                    oneTimeISSSelectorCb = false;
                }


                ///////////////// LogMe ////////////////////////
                String    function = this.GetType().FullName + " - " + System.Reflection.MethodBase.GetCurrentMethod().Name;
                String    usedQC   = "ISS loaded";
                String    data     = "";
                String    Result   = "";
                LogWriter lw       = new LogWriter();
                ////////////////////////////////////////////////
                ///

                try
                {
                    CleanMe();
                    listView2.Clear();

                    listView2.View = View.Details;

                    listView2.Columns.Add("RB");
                    listView2.Columns.Add("Name");
                    listView2.Columns.Add("CodeO");
                    listView2.Columns.Add("SNO");
                    listView2.Columns.Add("CNO");
                    listView2.Columns.Add("CodeN");
                    listView2.Columns.Add("SNN");
                    listView2.Columns.Add("CNN");
                    listView2.Columns.Add("Date");
                    listView2.Columns.Add("Time");
                    listView2.Columns.Add("Work done");
                    listView2.Columns.Add("Comment");

                    long issID  = long.Parse(ISSSelectorCb.SelectedItem.ToString());
                    Part mainPr = new Part();
                    //List<String> allISSInfo = new List<String>();

                    getISSList(issID.ToString(), "ID");

                    ISSid = issID;

                    allISSInfo = qc.GetAllISSInfoById(issID);

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

                    totalTime = allISSInfo[6] + ":00";

                    mainPart = qc.SearchPartsInAllTablesBYPartID(long.Parse(allISSInfo[4]))[0];

                    PartTb.Text = mainPart.CodePartFull.ToString();

                    cmpCust.GetCompanyInfoByCode(Decoder.GetCustomerCode(mainPart.CodePartFull));

                    listIssParts.Clear();
                    listIssParts = qc.GetAllISSPartsByISSid(issID);

                    NameTb.Text     = Decoder.ConnectCodeName(sifrarnikArr, mainPart);
                    SNTb.Text       = mainPart.SN;
                    CNTb.Text       = mainPart.CN;
                    DateInTb.Text   = mainPart.DateIn;
                    DateSentTb.Text = mainPart.DateSend;
                    IDTb.Text       = mainPart.PartID.ToString();

                    for (int i = 0; i < listIssParts.Count; i++)
                    {
                        ListViewItem lvi1 = new ListViewItem(listIssParts[i].RB.ToString().ToString());

                        lvi1.SubItems.Add(qc.PartInfoByFullCodeSifrarnik(mainPart.PartialCode).FullName);

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

                        if (listIssParts[i].PrtO.CodePartFull == 0)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtO.CodePartFull.ToString());
                        }

                        if (listIssParts[i].PrtO.SN == null)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtO.SN.ToString());
                        }

                        if (listIssParts[i].PrtO.CN == null)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtO.CN.ToString());
                        }

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

                        if (listIssParts[i].PrtN.CodePartFull == 0)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtN.CodePartFull.ToString());
                        }

                        if (listIssParts[i].PrtN.SN == null)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtN.SN.ToString());
                        }

                        if (listIssParts[i].PrtN.CN == null)
                        {
                            lvi1.SubItems.Add("");
                        }
                        else
                        {
                            lvi1.SubItems.Add(listIssParts[i].PrtN.CN.ToString());
                        }

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

                        lvi1.SubItems.Add(allISSInfo[1]);

                        lvi1.SubItems.Add(listIssParts[i].Time.ToString());
                        lvi1.SubItems.Add(listIssParts[i].Work.ToString());
                        lvi1.SubItems.Add(listIssParts[i].Comment.ToString());

                        if (listView2.Items.Count > 1)
                        {
                            listView2.EnsureVisible(listView2.Items.Count - 1);
                        }

                        listView2.Items.Add(lvi1);
                    }

                    for (int i = 0; i < 12; i++)
                    {
                        listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent);
                        listView2.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize);
                    }

                    rb = listView2.Items.Count + 1;

                    data   = cmpCust.Name + ", " + cmpM.Name + ", " + "Sifrarnik arr cnt " + sifrarnikArr.Count + ", " + mainPart.CodePartFull + ", " + "listIssParts cnt " + listIssParts.Count + ", " + ISSid.ToString() + ", " + Properties.strings.ServiceReport + ", " + Properties.strings.customer + ", false";
                    Result = "ISS selected " + ISSid;
                    lw.LogMe(function, usedQC, data, Result);

                    SystemSounds.Hand.Play();
                }
                catch (Exception e1)
                {
                    data   = ISSid + Environment.NewLine;
                    Result = e1.Message;
                    lw.LogMe(function, usedQC, data, Result);
                    MessageBox.Show(Result, "NOT SAVED", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                oneTimeISSSelectorCb = true;
            }
        }
Exemple #2
0
        private void PartsList_Load(object sender, EventArgs e)
        {
            fillSifrarnik();

            this.Text      = "PartList";
            listView1.View = View.Details;

            listView1.Columns.Add("PardID");
            listView1.Columns.Add("Name");
            listView1.Columns.Add("CodePartFull");
            listView1.Columns.Add("PartialCode");
            listView1.Columns.Add("SN");
            listView1.Columns.Add("CN");
            listView1.Columns.Add("DateIn");
            listView1.Columns.Add("DateOut");
            listView1.Columns.Add("DateSent");
            listView1.Columns.Add("Storage");
            listView1.Columns.Add("State");
            listView1.Columns.Add("CompanyO");
            listView1.Columns.Add("CompanyC");

            try
            {
                int i = 0;

                if (!resultArr[0].Equals("nok"))
                {
                    for (i = 0; i < resultArr.Count(); i = i + 12)
                    {
                        ListViewItem lvi1 = new ListViewItem();

                        lvi1.Text = resultArr[i];
                        lvi1.SubItems.Add(resultArr[i + 1]);
                        lvi1.SubItems.Add(Decoder.ConnectCodeName(sifrarnikArr, long.Parse(resultArr[i + 1])));
                        lvi1.SubItems.Add(resultArr[i + 2]);
                        lvi1.SubItems.Add(resultArr[i + 3]);
                        lvi1.SubItems.Add(resultArr[i + 4]);
                        lvi1.SubItems.Add(resultArr[i + 5]);
                        lvi1.SubItems.Add(resultArr[i + 6]);
                        lvi1.SubItems.Add(resultArr[i + 7]);
                        lvi1.SubItems.Add(resultArr[i + 8]);
                        lvi1.SubItems.Add(resultArr[i + 9]);
                        lvi1.SubItems.Add(resultArr[i + 10]);
                        lvi1.SubItems.Add(resultArr[i + 11]);
                        listView1.Items.Add(lvi1);
                    }
                }

                this.label2.Text = (i / 12).ToString();
            }
            catch (Exception e1)
            {
                Program.LoadStop();
                this.Focus();

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

            for (int i = 0; i < 13; i++)
            {
                listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.ColumnContent);
                listView1.AutoResizeColumn(i, ColumnHeaderAutoResizeStyle.HeaderSize);
            }

            Program.LoadStop();
            this.Focus();
        }