Ejemplo n.º 1
0
        private void Btn_addacc_Click(object sender, RoutedEventArgs e)
        {
            if (wnd_w_newAccaunt == null)
            {
                wnd_w_newAccaunt = new w_newAccaunt();
            }
            // wnd_w_newAccaunt.OwnerId = (int)((DataRowView)(dtg_Clients.SelectedItem))["id"];
            wnd_w_newAccaunt.AccType  = mSSqlRep.DtAccauntTypes;
            wnd_w_newAccaunt.RateType = mSSqlRep.DtRateTypes;

            //if (((int)((DataRowView)cbbx_ClientType.SelectedItem)["id"]) == 0)
            //{
            //    wnd_w_newAccaunt.Clients =  mSSqlRep.dt_clients;
            //}
            //else
            //    wnd_w_newAccaunt.Clients =  mSSqlRep.dt_Organisations;

            DataRow row = mSSqlRep.dt_Accaunts.NewRow();
            var     id  = dtg_Clients.SelectedIndex;

            if (dtg_Clients.SelectedItem != null)
            {
                row["OwnerId"]             = (int)((DataRowView)(dtg_Clients.SelectedItem))["id"];
                wnd_w_newAccaunt.NewACCrow = row;

                wnd_w_newAccaunt.ShowDialog();
                if (wnd_w_newAccaunt.DialogResult == true)
                {
                    mSSqlRep.AddAccaunt(row, (int)((DataRowView)cbbx_ClientType.SelectedItem)["id"]);
                    dtg_Clients.SelectedIndex = id;
                }
            }
            wnd_w_newAccaunt = null;
        }
Ejemplo n.º 2
0
        private void Btn_addacc_Click(object sender, RoutedEventArgs e)
        {
            if (wnd_w_newAccaunt == null)
            {
                wnd_w_newAccaunt = new w_newAccaunt();
            }
            // wnd_w_newAccaunt.OwnerId = (int)((DataRowView)(dtg_Clients.SelectedItem))["id"];
            wnd_w_newAccaunt.AccType  = mSSqlRep.DtAccauntTypes;
            wnd_w_newAccaunt.RateType = mSSqlRep.DtRateTypes;
            DataRow row = mSSqlRep.dt_Accaunts.NewRow();
            var     id  = dtg_Clients.SelectedIndex;

            row["OwnerId"]             = (int)((DataRowView)(dtg_Clients.SelectedItem))["id"];
            wnd_w_newAccaunt.NewACCrow = row;

            wnd_w_newAccaunt.ShowDialog();
            if (wnd_w_newAccaunt.DialogResult == true)
            {
                mSSqlRep.AddAccaunt(row);
                dtg_Clients.SelectedIndex = id;
            }
        }