コード例 #1
0
        private void btnStartDate_Click(object sender, EventArgs e)
        {
            // CrazyMethod();
            DateTime startDate = DateTime.Now;

            lblstart.Text = startDate.ToString();
            int id = dataGridViewSalaryCalc.CurrentRow.Index + 1;

            // MessageBox.Show(id.ToString());

            foreach (var item in DataBase.Workers)
            {
                if (item.WorkerId == id)
                {
                    item.WorkerStartDate = startDate;
                }
            }

            MessageBox.Show(startDate.ToString());

            ExtensionsClass.UpdateSources(dataGridViewSalaryCalc);
            //var upsource = new BindingSource();
            //upsource.DataSource = DataBase.Workers;
            //dataGridViewSalaryCalc.DataSource = upsource;
        }
コード例 #2
0
        private void btnCalc_Click(object sender, EventArgs e)
        {
            DateTime Startday;
            TimeSpan minus;
            int      id = Convert.ToInt32((dataGridViewSalaryCalc.CurrentRow.Index) + 1);

            foreach (var item in DataBase.Workers)
            {
                if (item.WorkerId == id)
                {
                    Startday = item.WorkerStartDate;
                    DateTime Exitdate = dateTimePickerExit.Value.AddMinutes(1);

                    decimal WorkerHourlymoney = item.WorkerHourlyPay;
                    decimal WorkerDailymoney  = item.WorkerDailyPay;
                    minus = Exitdate - Startday;      // datetimepicker

                    //  minus = Exitday - Startday; // DateTime.now
                    decimal minute = minus.Minutes;
                    decimal hours  = minus.Hours;


                    WorkerDailymoney    = hours * (decimal)(WorkerHourlymoney) + minute * (decimal)(WorkerHourlymoney / 60);//+(minus.Minutes*(Pul/Saat) bunu nece double edim ? :/
                    item.WorkerDailyPay = Math.Round(WorkerDailymoney, 2, MidpointRounding.ToEven);
                    MessageBox.Show(Math.Round(WorkerDailymoney, 2, MidpointRounding.ToEven).ToString());
                    MessageBox.Show(minus.Days.ToString() + " :" + minus.Hours.ToString() + " :" + minus.Minutes.ToString() + ">>>> " + item.WorkerDailyPay.ToString());
                    MessageBox.Show(item.WorkerDailyPay.ToString());

                    ExtensionsClass.UpdateSources(dataGridViewSalaryCalc);
                    //var upsource = new BindingSource();
                    //upsource.DataSource = DataBase.Workers;
                    //dataGridViewSalaryCalc.DataSource = upsource;
                }
            }
        }
コード例 #3
0
 private void btnAllWorkers_Click(object sender, EventArgs e)
 {
     ExtensionsClass.UpdateSources(dataGridViewUniversal);
     //var upsource = new BindingSource();
     //upsource.DataSource = DataBase.Workers;
     //dataGridViewUniversal.DataSource = upsource;
 }
コード例 #4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            int id = Convert.ToInt32((dataGridViewSalaryCalc.CurrentRow.Index) + 1);
            // MessageBox.Show(id.ToString());
            int money = Convert.ToInt32(comboBox1.SelectedItem);

            foreach (var item in DataBase.Workers)
            {
                if (item.WorkerId == id)
                {
                    item.WorkerHourlyPay = money;
                }
            }
            // MessageBox.Show(comboBox1.ToString());

            ExtensionsClass.UpdateSources(dataGridViewSalaryCalc);
            //var upsource = new BindingSource();
            //upsource.DataSource = DataBase.Workers;
            //dataGridViewSalaryCalc.DataSource = upsource;
        }
コード例 #5
0
        //private void CrazyMethod()
        //{
        //    DateTime startDate = DateTime.Now;
        //    DateTime exitDate = DateTime.Now;


        //    int id = Convert.ToInt32((dataGridViewSalaryCalc.CurrentRow.Index) + 1);
        //    // MessageBox.Show(id.ToString());

        //    foreach (var item in DataBase.Workers)
        //    {
        //        if (item.WorkerId == id)
        //        {
        //            item.WorkerStartDate = startDate;
        //            item.WorkerExitDate = exitDate;
        //        }
        //    }
        //}

        private void btnExitDate_Click(object sender, EventArgs e)
        {
            DateTime exitDate = dateTimePickerExit.Value;
            int      id       = Convert.ToInt32((dataGridViewSalaryCalc.CurrentRow.Index) + 1);

            // MessageBox.Show(id.ToString());

            foreach (var item in DataBase.Workers)
            {
                if (item.WorkerId == id)
                {
                    item.WorkerExitDate = exitDate;
                }
            }
            MessageBox.Show(exitDate.ToString());

            ExtensionsClass.UpdateSources(dataGridViewSalaryCalc);

            //var upsource = new BindingSource();
            //upsource.DataSource = DataBase.Workers;
            //dataGridViewSalaryCalc.DataSource = upsource;
        }
コード例 #6
0
        private void btnAddWorkerTolist_Click(object sender, EventArgs e)
        {
            var name    = tbxName.Text;
            var surname = tbxSurname.Text;
            var work    = tbxWork.Text;
            var pay     = tbxPay.Text;
            var number  = tbxNumber.Text;
            var email   = tbxEmail.Text;
            var regdate = dateTimePickerRegister.Value;
            //var regdate = dtpicker.Value;
            //var date = txtRegisterDate;
            var worker = new Worker(name, surname, work, Convert.ToInt32(pay), Convert.ToInt32(number), email, regdate);

            DataBase.Workers.Add(worker);
            //DataBase.Workers.Add(new Worker(1, Parviz, Aliyev, Coder, Convert.ToInt32(1000), Convert.ToInt32(050 - 685 - 69 - 15), parvizra@codeeduaz, DateTime.Now))
            MessageBox.Show("New worker added");

            ExtensionsClass.UpdateSources(dataGridViewAddWorker);

            //var upsource = new BindingSource();
            //upsource.DataSource = DataBase.Workers;
            //dataGridViewAddWorker.DataSource = upsource;
        }