private void label7_Click(object sender, EventArgs e) { Model.edari model = new Model.edari() { kollPD = Int32.Parse(dollari.Text), kollPR = Int32.Parse(rially.Text), title = title.Text, shenasnameID = GlobalVariable.shenasnameID, }; dbcontext.edaris.Add(model); dbcontext.SaveChanges(); int index = 0; foreach (Form form in Application.OpenForms) { if (form.Name == "Form13_Hazine_edari") { break; } index += 1; } this.Hide(); Application.OpenForms[index].Close(); Form13_Hazine_edari form13 = new Form13_Hazine_edari(); form13.Show(); }
private void label7_Click(object sender, EventArgs e) { Form13_Hazine_edari form = new Form13_Hazine_edari(); form.Show(); this.Hide(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { using (var dbcontext = new Model.Context()) { Model.shenasname item = dbcontext.shenasnames.Where(x => x.ID == GlobalVariable.shenasnameID).FirstOrDefault(); if (item.final != 1) { int iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex; if (iSelectedGridIndex != 0) { return; } int rowindex = dataGridView1.CurrentCell.RowIndex; string rowID = dataGridView1.Rows[rowindex].Cells[2].Value.ToString(); Model.edari model = dbcontext.edaris.SingleOrDefault(x => x.title == rowID); dbcontext.Entry(model).State = EntityState.Deleted; dbcontext.SaveChanges(); int index = 0; foreach (Form form in Application.OpenForms) { if (form.Name == "Form13_Hazine_edari") { break; } index += 1; } this.Hide(); Application.OpenForms[index - 1].Close(); Form13_Hazine_edari form13 = new Form13_Hazine_edari(); form13.Show(); } } }