Пример #1
0
        private void ImportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string formactive = ActiveForm.Text;

            if (formactive.IndexOf("Расходная накладная") >= 0)
            {
                //Создаем новый экземпляр
                List <ImportExport> CSV_Struct = new List <ImportExport>();
                CSV_Struct = ImportExport.ImportToCsv();

                string message   = "Загружено: " + CSV_Struct.Count + " позиций";
                int    countmess = 5;
                if (CSV_Struct.Count <= 5)
                {
                    countmess = CSV_Struct.Count;
                }
                for (int i = 0; i <= countmess - 1; i++)
                {
                    message += Environment.NewLine + CSV_Struct[i].kod + " -- " + CSV_Struct[i].qty;
                }

                DialogResult result = MessageBox.Show(message, "Загрузить данные?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.Yes)
                {
                    //Заполняем listView из нашей структуры
                    for (int i = 0; i <= CSV_Struct.Count - 1; i++)
                    {
                        CallBackMy.callbackEventHandlerRform(CSV_Struct[i].kod);
                        CallBackMy.callbackEventHandlerRformImport(CSV_Struct[i].kod, Convert.ToDouble(CSV_Struct[i].qty));
                    }
                }
            }
        }
Пример #2
0
        private void dgvvibor_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 32)
            {
                int i = dgvvibor.CurrentRow.Index;
                switch (Sform.ownerFormName)
                {
                case "Pform":
                    CallBackMy.callbackEventHandlerPform(dgvvibor.Rows[i].Cells["Kod"].Value.ToString());
                    break;

                case "Tform":
                    CallBackMy.callbackEventHandlerTform(dgvvibor.Rows[i].Cells["Kod"].Value.ToString());
                    break;

                case "Pereocenkaform":
                    CallBackMy.callbackEventHandlerPereocenkaform(dgvvibor.Rows[i].Cells["Kod"].Value.ToString());
                    break;

                case "Rform":
                    CallBackMy.callbackEventHandlerRform(dgvvibor.Rows[i].Cells["Kod"].Value.ToString());
                    break;

                default:
                    break;
                }


                this.Close();
            }
        }
Пример #3
0
        private void dgvFindT_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (dgvFindT.RowCount > 0)
            {
                if (e.KeyChar == 32)
                {
                    int irow = dgvFindT.CurrentRow.Index;

                    switch (Sform.ownerFormName)
                    {
                    case "Pform":
                        CallBackMy.callbackEventHandlerPform(dgvFindT.Rows[irow].Cells[0].Value.ToString());
                        exitfrm = "func";
                        this.Close();
                        break;

                    case "Tform":
                        CallBackMy.callbackEventHandlerTform(dgvFindT.Rows[irow].Cells[0].Value.ToString());
                        this.Close();
                        break;

                    case "Pereocenkaform":
                        CallBackMy.callbackEventHandlerPereocenkaform(dgvFindT.Rows[irow].Cells[0].Value.ToString());
                        exitfrm = "func";
                        this.Close();
                        break;

                    case "Rform":
                        CallBackMy.callbackEventHandlerRform(dgvFindT.Rows[irow].Cells[0].Value.ToString());
                        this.Close();
                        break;

                    case "ReportMoveGoodsform":
                        CallBackMy.callbackEventHandlerReportMoveGoodsform(dgvFindT.Rows[irow].Cells[0].Value.ToString(), dgvFindT.Rows[irow].Cells[1].Value.ToString());
                        break;

                    default:
                        break;
                    }
                }
            }
        }