Пример #1
0
        private void BtRemoveBus_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count > 0)
            {
                var getFun      = new FuncionarioItemEdit();
                var funcionario = getFun.GetFuncionarioEdit();
                var getBus      = new OnibusItemCollection();
                getBus.SetList(funcionario.Onibus);
                var listonibusEdit = new List <OnibusItem>();
                var testelist      = new List <OnibusItem>();
                for (int i = 0; i < listView1.SelectedItems.Count; i++)
                {
                    ListViewItem onibusItem     = listView1.SelectedItems[i];
                    var          onibusTodelete = new OnibusItem(_buslistviewIndexHelper, onibusItem.SubItems[0].Text, onibusItem.SubItems[1].Text, Convert.ToDouble(onibusItem.SubItems[2].Text));
                    listonibusEdit.Add(onibusTodelete);
                }
                foreach (OnibusItem onibusItem in listonibusEdit)
                {
                    testelist = getBus.GetFuncionarioOnibusCollection();
                    getBus.RemoveBusbyId(0);
                    testelist = getBus.GetFuncionarioOnibusCollection();
                }

                //final list for visualization testes
                listonibusEdit = getBus.GetFuncionarioOnibusCollection();
                OnibusTableHandler(listonibusEdit);
                funcionario.Onibus = getBus.MakeListToCollection();
                getFun.SetFuncionarioEdit(funcionario);



                //OnibusItem onibus = new OnibusItem(listView1.SelectedItems[0]);
            }
        }
Пример #2
0
        public List <OnibusItem> ConvertSQlToBusCollectionItem(DataTable dt)
        {
            int row        = 0;
            var listOnibus = new List <OnibusItem>();

            foreach (DataRow item in dt.Rows)
            {
                var onibusItem = new OnibusItem(Convert.ToInt32(dt.Rows[row][0].ToString()), dt.Rows[row][1].ToString(), dt.Rows[row][2].ToString(), Convert.ToDouble(dt.Rows[row][3], new CultureInfo("en-US")));
                listOnibus.Add(onibusItem);
            }

            return(listOnibus);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btAddBus_Click(object sender, EventArgs e)
        {
            var getFun      = new FuncionarioItemEdit();
            var funcionario = getFun.GetFuncionarioEdit();
            var getBus      = new OnibusItemCollection();

            getBus.SetList(funcionario.Onibus);
            int id = getBus.COuntList() + 1;

            //----------------------working now------------------
            if (txtLinha.Text.Trim() != "" & cbCartao.Text.Trim() != "")
            {
                var onibus = new OnibusItem(id, txtLinha.Text.Trim(), cbCartao.Text.Trim(), Convert.ToDouble(txtPreco.Text.Trim()));
                getBus.AddBus(onibus);
                int id2 = getBus.COuntList() + 1;
            }
            funcionario.Onibus  = getBus.MakeListToCollection();
            ParentPanel.Visible = false;
            ParentPanel.SendToBack();
            ParentPanel.Controls.Clear();
            int[] a = new int[5];
        }