private void btnAdd_Click(object sender, EventArgs e) { try { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); entities.JobTitles.Add(new OurModel.JobTitle() { Name = txtjobname.Text, RangeMax = Convert.ToDecimal(txtmax.Text), RangeMin = Convert.ToDecimal(txtmin.Text), ISDelete = false }); entities.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void button1_Click(object sender, EventArgs e) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); int i = Convert.ToInt32(label4.Text); OurModel.JobTitle title = entities.JobTitles.SingleOrDefault(a => a.ID == i); title.Name = txtname.Text; title.RangeMax = Convert.ToDecimal(txtmax.Text); title.RangeMin = Convert.ToDecimal(txtmin.Text); title.ISDelete = false; if (entities.SaveChanges() > 0) { MessageBox.Show("تم تغير بيانات اسم الوظيفة", "معلومات", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnAdd_Click(object sender, EventArgs e) { if (double.Parse(txtAllSalary.Text) > double.Parse(txtAll.Value.ToString())) { MessageBox.Show("لا يمكن اضافة الحساب", "خطاء", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); entities.Banks.Add(new OurModel.Bank() { Name = txtname.Text, BankBlance = txtAll.Value, AddedDate = AllDate.Value }); if (entities.SaveChanges() > 0) { MessageBox.Show("لقد تم اضافة الحساب بتاريخ المراد بيعة", "رسالة", MessageBoxButtons.OK, MessageBoxIcon.Information); SelectInforamtiom(entities); } }