public List <Company> GetAllCompanyInfoSortCode() { //Part mPart = new Part(); QueryCommands qc = new QueryCommands(); List <String> resultArr = new List <string>(); List <Company> resultArrC = new List <Company>(); try { resultArr = qc.AllCompanyInfoSortCode(WorkingUser.Username, WorkingUser.Password); for (int i = 0; i < resultArr.Count(); i = i + 14) { Company tempC = new Company(); 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); }
private void Otpremnica_Load(object sender, EventArgs e) { comboBox3.Text = Properties.Settings.Default.MainCompanyCode; comboBox4.Text = Properties.Settings.Default.MainCompanyCode; //this.printPrewBT.Enabled = false; Thread myThread = new Thread(fillComboBoxes); myThread.Start(); listView1.View = View.Details; listView1.Columns.Add("RB"); listView1.Columns.Add("Name"); listView1.Columns.Add("Code"); listView1.Columns.Add("SN"); listView1.Columns.Add("CN"); listView1.Columns.Add("Condition"); QueryCommands qc = new QueryCommands(); ConnectionHelper cn = new ConnectionHelper(); try { Company cmpList = new Company(); //List<Company> resultArrC = new List<Company>(); resultArrC = cmpList.GetAllCompanyInfoSortByName(); if (!resultArrC[0].Name.Equals("")) { for (int i = 0; i < resultArrC.Count(); i++) { this.comboBox1.Items.Add(resultArrC[i].Name); } } } catch (Exception e1) { new LogWriter(e1); } resultArr.Clear(); try { resultArr = qc.AllCompanyInfoSortCode(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 10; i < resultArr.Count(); i = i + 14) { comboBox4.Items.Add(resultArr[i]); comboBox3.Items.Add(resultArr[i]); } } resultArr.Clear(); resultArr = qc.SelectNameCodeFromSifrarnik(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 0; i < resultArr.Count(); i = i + 2) { comboBox2.Items.Add(resultArr[i]); //resultArrSearchName.Add(resultArr[i]); resultArrSearchCode.Add(resultArr[i + 1]); } } } catch (Exception e1) { new LogWriter(e1); Program.LoadStop(); this.Focus(); } Program.LoadStop(); this.Focus(); }
private void IUS_Load(object sender, EventArgs e) { comboBox3.Text = Properties.Settings.Default.MainCompanyCode; comboBox4.Text = Properties.Settings.Default.MainCompanyCode; //this.printPrewBT.Enabled = false; Thread myThread = new Thread(fillComboBoxes); myThread.Start(); listView1.View = View.Details; listView1.Columns.Add("RB"); listView1.Columns.Add("Name"); listView1.Columns.Add("Code"); listView1.Columns.Add("SN"); listView1.Columns.Add("CN"); listView1.Columns.Add("Condition"); try { Company cmpList = new Company(); resultArrC = cmpList.GetAllCompanyInfoSortByName(); if (!resultArrC[0].Name.Equals("")) { for (int i = 0; i < resultArrC.Count(); i++) { this.comboBox1.Items.Add(resultArrC[i].Name); } } resultArr.Clear(); resultArr = qc.AllCompanyInfoSortCode(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 10; i < resultArr.Count(); i = i + 14) { comboBox4.Items.Add(resultArr[i]); comboBox3.Items.Add(resultArr[i]); } } resultArr.Clear(); resultArr = qc.SelectNameCodeFromSifrarnik(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 0; i < resultArr.Count(); i = i + 2) { comboBox2.Items.Add(resultArr[i]); //resultArrSearchName.Add(resultArr[i]); resultArrSearchCode.Add(resultArr[i + 1]); } } partsArr = qc.ListPartsByRegionStateP(WorkingUser.RegionID, "ng"); partsArrCB5 = new List <Part>(partsArr); if (partsArr.Count > 0) { for (int i = 0; i < partsArr.Count; i++) { comboBox6.Items.Add(partsArr[i].CodePartFull + " # " + partsArr[i].SN + " # " + partsArr[i].CN); } } } catch (Exception e1) { Program.LoadStop(); this.Focus(); new LogWriter(e1); } Program.LoadStop(); this.Focus(); }
private void Narudzbe_Load(object sender, EventArgs e) { dateTimePicker1.Value = DateTime.Today.AddDays(+20); comboBox3.Text = Properties.Settings.Default.MainCompanyCode; comboBox4.Text = Properties.Settings.Default.MainCompanyCode; //this.printPrewBT.Enabled = false; Thread myThread = new Thread(fillComboBoxes); myThread.Start(); QueryCommands qc = new QueryCommands(); ConnectionHelper cn = new ConnectionHelper(); try { Company cmpList = new Company(); //List<Company> resultArrC = new List<Company>(); resultArrC = cmpList.GetAllCompanyInfoSortByName(); if (!resultArrC[0].Name.Equals("")) { for (int i = 0; i < resultArrC.Count(); i++) { this.cbTvrtka.Items.Add(resultArrC[i].Name); } } } catch (Exception e1) { new LogWriter(e1); } resultArr.Clear(); try { resultArr = qc.AllCompanyInfoSortCode(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 10; i < resultArr.Count(); i = i + 14) { comboBox4.Items.Add(resultArr[i]); comboBox3.Items.Add(resultArr[i]); } } resultArr.Clear(); resultArr = qc.SelectNameCodeFromSifrarnik(WorkingUser.Username, WorkingUser.Password); if (!resultArr[0].Equals("nok")) { for (int i = 0; i < resultArr.Count(); i = i + 2) { cbPart.Items.Add(resultArr[i]); //resultArrSearchName.Add(resultArr[i]); resultArrSearchCode.Add(resultArr[i + 1]); } } } catch (Exception e1) { new LogWriter(e1); Program.LoadStop(); this.Focus(); } textBox5.Text = resultArrC.ElementAt(int.Parse(comboBox4.Text) - 1).Name.Trim(); textBox6.Text = resultArrC.ElementAt(int.Parse(comboBox3.Text) - 1).Name.Trim(); Program.LoadStop(); this.Focus(); }