private void label2_Click(object sender, EventArgs e)
        {
            if (nepaliCalender1From.engdate > nepaliCalender2To.engdate)
            {
                var notification = new RetailControls.NotificationMAnager();
                notification.show("beging date can not be bigger then finising date", 2000);
                return;
            }
            if (Amountofsalary.Text.Trim() == "")
            {
                var notification = new RetailControls.NotificationMAnager();
                notification.show("please enter the amout", 2000);
                return;
            }
            if (!(Convert.ToDecimal(Amountofsalary.Text) > 0))
            {
                var notification = new RetailControls.NotificationMAnager();
                notification.show("enter the salary'amount in positive value", 2000);
                return;
            }
            try
            {
                salary sal = new salary();
                sal.employee_id = this.id;
                sal.form        = nepaliCalender1From.engdate;
                sal.toto        = nepaliCalender2To.engdate;
                sal.amount      = Convert.ToDecimal(Amountofsalary.Text);
                sal.dates       = Dashboard.Instance.nepaliCalender1.engdate;
                sal.day         = nepaliCalender1From.DATESTAMP;
                sal.today       = nepaliCalender2To.DATESTAMP;
                db.salaries.Add(sal);
                db.SaveChanges();
                var notification = new RetailControls.NotificationMAnager();
                notification.show("Salary Added for " + this.name, 2000);
                this.Dispose();
            }

            catch (Exception ex)
            {
                var notification = new RetailControls.NotificationMAnager();
                notification.show("please enter the correct value" + this.name, 2000);
            }
        }
Пример #2
0
 private void label2_Click(object sender, EventArgs e)
 {
     if (Amountoadvance.Text.Trim() == "")
     {
         var notification = new RetailControls.NotificationMAnager();
         notification.show("please enter the amout", 2000);
         return;
     }
     if (!(Convert.ToDecimal(Amountoadvance.Text) > 0))
     {
         var notification = new RetailControls.NotificationMAnager();
         notification.show("enter the salary'amount in positive value", 2000);
         return;
     }
     using (var db = new Models.HamroSuperMarketEntities())
     {
         try
         {
             db.advances.Add(
                 new Models.advance()
             {
                 employee_id = this.id,
                 amount      = Convert.ToDecimal(Amountoadvance.Text),
                 dates       = Dashboard.Instance.nepaliCalender1.engdate,
                 day         = Dashboard.Instance.nepaliCalender1.date.Day,
                 month       = Dashboard.Instance.nepaliCalender1.date.Month,
                 year        = Dashboard.Instance.nepaliCalender1.date.Day,
                 updated_at  = DateTime.Now,
                 created_at  = DateTime.Now
             });
             db.SaveChanges();
             var notification = new RetailControls.NotificationMAnager();
             notification.show("Advance added for" + this.name, 2000);
             this.Dispose();
         }
         catch (Exception ex)
         {
             var notification = new RetailControls.NotificationMAnager();
             notification.show("Advance cannot be saved", 2000);
         }
     }
 }