private void button2_Click(object sender, EventArgs e) { using (TotalSalary sal = new TotalSalary()) { if (!sal.IsAddORNot(Convert.ToInt32(ID.Text), Convert.ToInt32(comboAccout.SelectedValue))) { } else { this.DialogResult = DialogResult.None; MessageBox.Show("لقد تم تسجيل هذا الموظف في هذا الشهر", "خطاء", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (!string.IsNullOrWhiteSpace(ID.Text)) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); EmpID = Convert.ToInt32(ID.Text); empName = txtname.Text; Salary = Convert.ToDouble(txtSalary.Text); InsurancePercent = Convert.ToDecimal(txtInsurancepersent.Text); InsuranceValue = Convert.ToDecimal(txtinsurancevalues.Text) * Convert.ToDecimal(0.14) * 12; idaccount = Convert.ToInt32(comboAccout.SelectedValue); AccountName = comboAccout.Text; } else { this.DialogResult = DialogResult.None; } }
private void frmBank_Load(object sender, EventArgs e) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); decimal?b = entities.Employees.Sum(a => a.Salary); txtAllSalary.Text = b.ToString(); SelectInforamtiom(entities); }
private void DepartmentSalaryChart_Load(object sender, EventArgs e) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); comboBox1.DataSource = entities.Banks.ToList(); comboBox1.DisplayMember = "Name"; comboBox1.ValueMember = "ID"; }
public void SelectInforamtiom(OurModel.CompanyEntities entities) { var select = from x in entities.Banks.ToList() select new { x.ID, x.Name, x.BankBlance, x.AddedDate }; dataGridBank.DataSource = select.ToList(); dataGridBank.Columns[0].Visible = false; dataGridBank.Columns[1].HeaderText = "اسم الحساب"; dataGridBank.Columns[2].HeaderText = "المبلغ"; dataGridBank.Columns[3].HeaderText = "التاريخ"; }
private void frmAddEmployees_SalaryInformation_Load(object sender, EventArgs e) { OurModel.CompanyEntities company = new OurModel.CompanyEntities(); comboAccout.DataSource = company.Banks.ToList(); comboAccout.DisplayMember = "Name"; comboAccout.ValueMember = "ID"; foreach (var item in company.Employees) { Search.AutoCompleteCustomSource.Add(item.Name); } }
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 frmSalaryInformation_Load(object sender, EventArgs e) { DataGridViewModel(); OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); //Add To Salary comboAddToSalary.DataSource = entities.AddSalaries.ToList(); comboAddToSalary.DisplayMember = "Justification"; comboAddToSalary.ValueMember = "ID"; //SubTrackToSalary OurModel.SubTractSalary sub = new OurModel.SubTractSalary(); comboSubTrackToSalary.DataSource = entities.SubTractSalaries.ToList(); comboSubTrackToSalary.DisplayMember = "Justification"; comboSubTrackToSalary.ValueMember = "ID"; }
private void btnSubTrackToSalary_Click(object sender, EventArgs e) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); int ID = Convert.ToInt32(comboSubTrackToSalary.SelectedValue); OurModel.SubTractSalary sub = entities.SubTractSalaries.SingleOrDefault(a => a.ID == ID); datasubtrackSalary.Rows.Add(ID, sub.Justification, sub.Amount); double subcal = 0; for (int i = 0; i < datasubtrackSalary.RowCount - 1; i++) { subcal -= Convert.ToDouble(datasubtrackSalary.Rows[i].Cells[2].Value); } txtTotalSubtract.Text = subcal.ToString(); }
/// <summary> /// تقوم بأستدعاء البيانات من قواعد البيانات /// </summary> private void SelectInformation() { try { CompanyEntities entities = new OurModel.CompanyEntities(); var x = from n in entities.AddSalaries select new { n.ID, n.Amount, n.Justification }; dataGridView1.DataSource = x.ToList(); dataGridView1.Columns[0].Visible = false; dataGridView1.Columns["Amount"].HeaderText = "الكمية"; dataGridView1.Columns["Justification"].HeaderText = "التبرير"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
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); } }
private void btnAddSalary_Click(object sender, EventArgs e) { OurModel.CompanyEntities entities = new OurModel.CompanyEntities(); int ID = Convert.ToInt32(comboAddToSalary.SelectedValue); OurModel.AddSalary salary = entities.AddSalaries.SingleOrDefault(a => a.ID == ID); dataAddSalary.Rows.Add(ID, salary.Justification, salary.Amount); double addcal = 0; for (int i = 0; i < dataAddSalary.RowCount - 1; i++) { addcal += Convert.ToDouble(dataAddSalary.Rows[i].Cells[2].Value); } txtTotalAdd.Text = addcal.ToString(); }
private void btnSearch_Click(object sender, EventArgs e) { OurModel.CompanyEntities company = new OurModel.CompanyEntities(); string seach = Search.Text; OurModel.Employee employee = company.Employees.SingleOrDefault(a => a.Name == seach); string departmentName = company.Departments.SingleOrDefault(a => a.ID == employee.DepartmentID).DepartmentName; if (employee != null) { txtname.Text = employee.Name; txtSalary.Text = employee.Salary.ToString(); txtjobname.Text = employee.JobTitle.Name; ID.Text = employee.ID.ToString(); txtDepartment.Text = departmentName; ImageConverter converter = new ImageConverter(); pictureBox1.Image = (Image)converter.ConvertFrom(employee.Picture); } }
private void btnAddEmployee_Click(object sender, EventArgs e) { using (frmAddEmployees_SalaryInformation frm = new frmAddEmployees_SalaryInformation()) { if (frm.ShowDialog() == DialogResult.OK) { txtSearch.Text = frm.empName; label5.Text = frm.EmpID.ToString(); txtSalarym.Text = frm.Salary.ToString(); txtSalary.Text = (frm.Salary * 12).ToString(); txtInsuransValue.Text = frm.InsuranceValue.ToString(); txtInsurancem.Text = (frm.InsuranceValue / 12).ToString(); txtbeforettaxt.Text = (Convert.ToDecimal(txtSalary.Text) - Convert.ToDecimal(txtInsuransValue.Text)).ToString(); #region TaxCalculations decimal de = Convert.ToDecimal(txtbeforettaxt.Text); OurModel.CompanyEntities company = new OurModel.CompanyEntities(); List <OurModel.SalaryTaxInformation> list = company.SalaryTaxInformations.ToList(); OurModel.SalaryTaxInformation info = list.SingleOrDefault(a => a.MinValue <de && a.MaxValue> de); decimal cal1 = CalValueTaxAfterMainRow(list, info.ID); decimal cal2 = de - Convert.ToDecimal(info.MinValue); cal2 = cal2 * Convert.ToDecimal(info.Taxpercent); txtTaxAfter.Text = (cal1 + cal2).ToString(); txtTaxValuem.Text = (Math.Round(Convert.ToDecimal(txtTaxAfter.Text) / 12)).ToString(); txtnumbertax.Text = info.ID.ToString(); #endregion txtaccountid.Text = frm.idaccount.ToString(); txtAccountName.Text = frm.AccountName; } } }