Exemplo n.º 1
0
        private void ToolStripButton4_Click(object sender, EventArgs e)
        {
            if (Dgv1.SelectedRows.Count != 1)
            {
                MessageBox.Show("Выделите акт, который надо скопировать!", "Внимание!");
                return;
            }
            if (MessageBox.Show("Добавить новый акт, скопировав данные текущего ?", "Внимание!", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;
            }
            my.Nbut = 111;
            my.Szap = " and id_us = " + my.Id_us;
            frmSprDGV fr = new frmSprDGV();

            fr.Withup = false;
            fr.Tag    = my.Nbut;
            fr.ShowDialog();
            if (!my.IsNumeric(my.Szap))
            {
                return;
            }
            Int16 ValData = 0;

            if (MessageBox.Show("Копировать числовые данные ?", "Внимание!", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                ValData = 1;
            }
            my.sc.CommandText = "exec F2_CopyAkt " + Dgv1.CurrentRow.Cells[0].Value.ToString() + "," + my.Id_us + "," + ValData + ",'000'," + my.Szap;
            my.cn.Open();
            my.sc.ExecuteScalar();
            my.cn.Close();
            spisok();
            MessageBox.Show("Готово!");
        }
Exemplo n.º 2
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         my.Szap = "";
         my.Nbut = 129;
         frmSprDGV fr = new frmSprDGV();
         fr.ShowDialog();
         string idcompl = idComplex.SelectedValue.ToString();
         my.FillDC(idComplex, 21, "");
         if (my.IsNumeric(my.Szap))
         {
             idComplex.SelectedValue = my.Szap; button1_Click(null, null);
         }
         else
         {
             idComplex.SelectedValue = idcompl;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
     //if (!my.isFormInMdi("frmSprDGV", my.Nbut, this))
     //{
     //    my.showSprDGV(my.Nbut, true, true);
     //}
 }
Exemplo n.º 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                my.Szap = "";
                my.Nbut = 130;
                frmSprDGV fr = new frmSprDGV();
                fr.ShowDialog();
                string idcompl = idComplex.SelectedValue.ToString();
                my.FillDC(idChapter, 22, " and (idChapter = 0 or idChapter in (select idChapter from sprav.dbo.tComplexChapter where idComplex = " + idComplex.SelectedValue.ToString() + ")) ");
                if (my.IsNumeric(my.Szap))
                {
                    my.cn.Open();
                    my.sc.CommandText = " if not exists (select 1 from sprav.dbo.tComplexChapter where idcomplex = " + idComplex.SelectedValue.ToString() + " and idchapter = " + my.Szap + "  ) insert into sprav.dbo.tComplexChapter (idcomplex,idchapter) values (" + idComplex.SelectedValue.ToString() + "," + my.Szap + ")";
                    my.sc.ExecuteScalar();
                    my.cn.Close();
                    my.FillDC(idChapter, 22, " and (idChapter = 0 or idChapter in (select idChapter from sprav.dbo.tComplexChapter where idComplex = " + idComplex.SelectedValue.ToString() + ")) ");

                    idChapter.SelectedValue = my.Szap; button1_Click(null, null);
                }
                else
                {
                    idChapter.SelectedValue = idcompl;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                if ((int)my.cn.State == 1)
                {
                    my.cn.Close();
                }
            }
        }
Exemplo n.º 4
0
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         my.Szap = " and idosr = 0";
         my.Nbut = 124;
         frmSprDGV fr = new frmSprDGV();
         fr.Withup = false;
         fr.ShowDialog();
         string idcompl = idOSR.SelectedValue.ToString();
         if (my.IsNumeric(my.Szap))
         {
             my.cn.Open();
             my.sc.CommandText = " update  sprav.dbo.tsmeti set idosr = " + idOSR.SelectedValue.ToString() + " where idsm = " + my.Szap;
             my.sc.ExecuteScalar();
             my.cn.Close();
             button1_Click(null, null);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         if ((int)my.cn.State == 1)
         {
             my.cn.Close();
         }
     }
 }
Exemplo n.º 5
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            my.Nbut = 26;
            my.Szap = "";
            frmSprDGV fr = new frmSprDGV();

            fr.Withup = false;
            fr.Tag    = my.Nbut;
            fr.Pform  = this;
            fr.ShowDialog();
            my.FillDC(idPredpr, 48, " ");
            idPredpr_SelectedValueChanged(null, null);
        }