Beispiel #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            switch (mode)
            {

                case Mode.stationeryMode:
                    {
                        stationeryEditForm ed = new stationeryEditForm();
                        ed.ShowDialog();
                        _stationeryTableAdapter.Fill(shopdbDataSet._stationery);
                        break;
                    }

                case Mode.salesMode:
                    {
                        salesEditForm ed = new salesEditForm();
                        ed.ShowDialog();
                        account_salesTableAdapter.Fill(shopdbDataSet.account_sales);
                        break;
                    }

                case Mode.autorizationMode:
                    {
                        autorizationEditForm ed = new autorizationEditForm();
                        ed.ShowDialog();
                        autorizationTableAdapter.Fill(shopdbDataSet.autorization);
                        break;
                    }
                case Mode.departmentMode:
                    {
                        departmentEditForm ed = new departmentEditForm();
                        ed.ShowDialog();
                        departmentTableAdapter.Fill(shopdbDataSet.department);
                        break;
                    }
                case Mode.providerMode:
                    {
                        providerEditForm ed = new providerEditForm();
                        ed.ShowDialog();
                        providerTableAdapter.Fill(shopdbDataSet.provider);
                        break;
                    }
                case Mode.wholesaleBuyersMode:
                    {
                        wholesaleBuyersEditForm ed = new wholesaleBuyersEditForm();
                        ed.ShowDialog();
                        wholesale_buyersTableAdapter.Fill(shopdbDataSet.wholesale_buyers);
                        break;
                    }
                case Mode.wholeSaleOrdersMode:
                    {
                        wholesaleOrdersEditForm ed = new wholesaleOrdersEditForm();
                        ed.ShowDialog();
                        wholesale_ordersTableAdapter.Fill(shopdbDataSet.wholesale_orders);
                        break;
                    }

                default: break;
            }
        }
Beispiel #2
0
        private void Uodate_Click(object sender, EventArgs e)
        {
            int value = Convert.ToInt32(dataView.SelectedRows[0].Cells[0].Value);
            switch (mode)
            {
                case Mode.autorizationMode:
                    {
                        string val = Convert.ToString(dataView.SelectedRows[0].Cells[0].Value);
                        shop.shopdbDataSet.autorizationDataTable auto = new shopdbDataSet.autorizationDataTable();
                        autorizationTableAdapter.FillBy(auto, value);
                        object[] row = auto.Rows[0].ItemArray;
                        autorizationEditForm an = new autorizationEditForm(row[1].ToString(),row[2].ToString(),row[3].ToString(),
                            row[4].ToString(),row[5].ToString());
                        an.ShowDialog();
                        autorizationTableAdapter.Fill(shopdbDataSet.autorization);
                        break;
                    }
                case Mode.departmentMode:
                    {
                        shop.shopdbDataSet.departmentDataTable dt = new shop.shopdbDataSet.departmentDataTable();
                        departmentTableAdapter.FillBy(dt, value);
                        object[] row = dt.Rows[0].ItemArray;
                        departmentEditForm dep = new departmentEditForm(Convert.ToInt32(row[0]), row[1].ToString(),row[2].ToString());
                        dep.ShowDialog();
                        departmentTableAdapter.Fill(shopdbDataSet.department);
                        break;
                    }
                case Mode.providerMode:
                    {

                        shop.shopdbDataSet.providerDataTable pr = new shop.shopdbDataSet.providerDataTable();
                        providerTableAdapter.FillBy(pr, value);
                        object[] row = pr.Rows[0].ItemArray;
                        providerEditForm sef = new providerEditForm(Convert.ToInt32(row[0]), row[1].ToString(),
                            row[2].ToString(), row[3].ToString());
                        sef.ShowDialog();
                        providerTableAdapter.Fill(shopdbDataSet.provider);
                        break;
                    }
                case Mode.stationeryMode:
                    {
                        shop.shopdbDataSet._stationeryDataTable sy = new shop.shopdbDataSet._stationeryDataTable();
                        _stationeryTableAdapter.FillBy(sy, value);
                        object[] row = sy.Rows[0].ItemArray;
                        stationeryEditForm sty = new stationeryEditForm(Convert.ToInt32(row[0]), row[5].ToString(),
                                                                         row[6].ToString(), row[7].ToString(), row[8].ToString(),
                                                                         Convert.ToInt32(row[1]), Convert.ToInt32(row[2]),
                                                                         Convert.ToInt32(row[4]), Convert.ToInt32(row[3]));
                        sty.ShowDialog();
                        _stationeryTableAdapter.Fill(shopdbDataSet._stationery);
                        break;
                    }
                case Mode.salesMode:
                    {
                        string date = dataView.SelectedRows[0].Cells[3].Value.ToString();
                        shop.shopdbDataSet.account_salesDataTable acs = new shopdbDataSet.account_salesDataTable();
                        account_salesTableAdapter.FillBy(acs,value);
                        object[] row = acs.Rows[0].ItemArray;
                        salesEditForm se = new salesEditForm(Convert.ToInt32(row[0]),row[1].ToString(),row[2].ToString(),
                            row[3].ToString());
                        se.ShowDialog();
                        account_salesTableAdapter.Fill(shopdbDataSet.account_sales);
                        break;
                    }
                case Mode.wholesaleBuyersMode:
                    {
                        shop.shopdbDataSet.wholesale_buyersDataTable bt = new shopdbDataSet.wholesale_buyersDataTable();
                        wholesale_buyersTableAdapter.FillBy(bt, value);
                        object[] row = bt.Rows[0].ItemArray;
                        wholesaleBuyersEditForm btf = new wholesaleBuyersEditForm(Convert.ToInt32(row[0]), row[1].ToString(),
                            row[2].ToString(), row[3].ToString());
                        btf.ShowDialog();
                        wholesale_buyersTableAdapter.Fill(shopdbDataSet.wholesale_buyers);
                        break;
                    }
                case Mode.wholeSaleOrdersMode:
                    {
                        int buyer_id = Convert.ToInt32(dataView.SelectedRows[0].Cells[1].Value);
                        shop.shopdbDataSet.wholesale_ordersDataTable bo = new shopdbDataSet.wholesale_ordersDataTable();
                        wholesale_ordersTableAdapter.FillBy(bo, value,buyer_id);
                        object[] row = bo.Rows[0].ItemArray;
                        wholesaleOrdersEditForm bof = new wholesaleOrdersEditForm(Convert.ToInt32(row[0]), Convert.ToInt32(row[1]),
                            row[2].ToString(),row[3].ToString());
                        bof.ShowDialog();
                        wholesale_ordersTableAdapter.Fill(shopdbDataSet.wholesale_orders);
                        break;
                    }
                default: break;
            }
        }