Beispiel #1
0
        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";
        }
Beispiel #2
0
        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();
        }