Ejemplo n.º 1
0
 private void SalaryButton_Click(object sender, RoutedEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(txt_gross_salary.Text) && date_month.SelectedDate != null)
     {
         Salary new_salary = new Salary();
         new_salary.Date   = new DateTime(Convert.ToDateTime(date_month.SelectedDate).Year, Convert.ToDateTime(date_month.SelectedDate).Month, 1);
         new_salary.Holder = HoldersItems.Where(r => r.IsChecked == true).Select(x => x.HolderName).First();
         new_salary.Amount = Math.Round(Convert.ToDouble(txt_gross_salary.Text), 2);
         new_salary.Delete();
         new_salary.Save();
         SetSalaryDatepicker();
         DisplayDefaultSalary();
     }
 }
        protected void gridSalary_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            int    id         = (int)gridSalary.DataKeys[e.RowIndex].Value;
            Salary repository = new Salary();

            if (repository.Delete(id))
            {
                this.ShowSuccessfulNotification("Salary deleted.");
                Load_Data_Grid();
            }
            else
            {
                this.ShowErrorNotification("Error occured.");
                e.Cancel = true;
            }
        }