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("Готово!"); }
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(); } } }
private void DgvComplexDC_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { DGVt dg = (DGVt)sender; int idopred = (int)dg.Rows[e.RowIndex].Cells["IdOpred"].Value; my.Nbut = 141; //if (!my.isFormInMdi("frmSprDgv", my.Nbut, this)) //{ frmSprDGV fr = new frmSprDGV(); fr.Tag = (int)my.Nbut; fr.Withup = false; fr.MdiParent = my.MDIForm; my.Szap = " and idopred = " + idopred.ToString(); if ((int)idOSR.SelectedValue == 0) { my.Szap = my.Szap + " and idcomplex = " + idComplex.SelectedValue.ToString(); } else { my.Szap = my.Szap + " and idOSR = " + idOSR.SelectedValue.ToString(); } fr.Show(); //} }
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); //} }
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(); } } }
private void ToolStripButton1_Click(object sender, EventArgs e) { my.Nbut = 18; my.Szap = ""; //" and PeriodKS2 = '" + my.Uper + "'"; frmSprDGV fr = new frmSprDGV(); fr.Withup = false; fr.Tag = my.Nbut; fr.Pform = this; fr.Show(); }
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); }
private void frmPerechSm_Load(object sender, EventArgs e) { tabControl1.Visible = false; //this.Visible = false; // Console.WriteLine(); //Console.Write("begin" + DateTime.Now.ToString()); Cursor.Current = Cursors.WaitCursor; //this.WindowState = FormWindowState.Maximized; string s = my.Szap; Console.WriteLine(); Console.Write("beginfrmCapSm" + DateTime.Now.ToString()); fr = new frmCapSm(); Console.Write("endfrmCapSm" + DateTime.Now.ToString()); fr.TopLevel = false; fr.FormBorderStyle = FormBorderStyle.None; ((ToolStrip)fr.Controls["ToolStrip1"]).Items["TEx"].Visible = false; my.Szap = " and 1 = 2"; my.Nbut = 67; frVip = new frmSprDGV(); frVip.Withup = false; frVip.TopLevel = false; frVip.FormBorderStyle = FormBorderStyle.None; frVip.Dock = DockStyle.Fill; fr.Visible = true; frVip.Visible = true; tabPage1.Controls.Add(fr); tabPage2.Controls.Add(frVip); //nbut1 = 69; //Console.WriteLine(); //Console.Write("beginspisok" + DateTime.Now.ToString()); spisok(s); //Console.WriteLine(); //Console.Write("endspisok" + DateTime.Now.ToString()); Cursor.Current = Cursors.Default; //Console.WriteLine(); //Console.Write("end" + DateTime.Now.ToString()); tabControl1.Visible = true; //this.PerformLayout(); //Visible = true; WindowState = FormWindowState.Maximized; }
public static void showSprDGV(int nbut, bool Withup, bool WithSize) { SMRC.Forms.frmSprDGV fr = new SMRC.Forms.frmSprDGV(); fr.MdiParent = MDIForm; if (WithSize) { fr.Dock = DockStyle.Fill; } fr.Withup = Withup; fr.Show(); fr.Tag = nbut; //if (WithSize) //{ // int h = fr.Height; // fr.Dock = DockStyle.None; // fr.Height = h; //} //fr.Left = (int)(MDIForm.Width - fr.Width) / 2; }
private void Dgv1_CellClick(object sender, DataGridViewCellEventArgs e) { try { if (Dgv1.CurrentCell.OwningColumn.Name == "but") { my.Nbut = 128; //if (!my.isFormInMdi("frmSprDgv", my.Nbut, this)) //{ frmSprDGV fr = new frmSprDGV(); fr.Tag = (int)my.Nbut; fr.Withup = false; fr.MdiParent = my.MDIForm; my.Szap = " and idsm = " + Dgv1.CurrentRow.Cells[0].Value.ToString(); fr.Show(); } if (Dgv1.CurrentRow != null) { my.cn.Open(); my.sc.CommandText = my.FilterSel(126, this, my.sconn, " and sprav.dbo.tsmeti.idsm = " + Dgv1.CurrentRow.Cells[0].Value.ToString()); SqlDataReader sd = my.sc.ExecuteReader(); while (sd.Read()) { this.label12.Text = "Освоено по смете(91г): Стр.раб. " + sd["VSr91"].ToString() + ", Монт.раб. " + sd["VMr91"].ToString() + ", Обор. " + sd["VOb91"].ToString() + ", Пр.раб. " + sd["VPr91"].ToString() + ", Итого " + sd["V91"].ToString(); } sd.Close(); my.cn.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); if ((int)my.cn.State == 1) { my.cn.Close(); } //throw; } //MessageBox.Show(Dgv1.CurrentRow.Cells[2].Value.ToString()); //} }