private void btnSend_Click(object sender, RoutedEventArgs e)
        {
            int    intcentiveBf = 0, incentiveAf = 0;
            double workHrsBf = 0, workHrsAf = 0;

            Int32.TryParse(txtIncentiveBefore.Text.ToString(), out intcentiveBf);
            Int32.TryParse(txtIncentiveAfter.Text.ToString(), out incentiveAf);
            Double.TryParse(txtWorkHrsBefore.Text.ToString(), out workHrsBf);
            Double.TryParse(txtWorkHrsAfter.Text.ToString(), out workHrsAf);

            string reason = "";

            reason = txtReason.Text.Trim();
            CieControlIncentiveModel insertModel = new CieControlIncentiveModel()
            {
                WorkHrsBefore   = workHrsBf,
                WorkHrsAfter    = workHrsAf,
                LineId          = line.LineId,
                Reason          = reason,
                RequestTime     = date,
                IncentiveBefore = intcentiveBf,
                IncentiveAfter  = incentiveAf
            };

            if (CieControlIncentiveController.Insert(insertModel) == false)
            {
                MessageBox.Show("Error !!", "Infor", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            MessageBox.Show("Sent !", "Infor", MessageBoxButton.OK, MessageBoxImage.Information);
        }
Ejemplo n.º 2
0
        private void threadAccept_DoWork(object sender, DoWorkEventArgs e)
        {
            object[] arguments = e.Argument as object[];
            CieControlIncentiveModel acceptModel = arguments[0] as CieControlIncentiveModel;
            DateTime acceptedTime = DateTime.Now;

            e.Result = CieControlIncentiveController.Update(acceptModel.LineId, acceptModel.RequestTime, acceptedTime);
        }
Ejemplo n.º 3
0
 private void btnAccept_Click(object sender, RoutedEventArgs e)
 {
     if (MessageBox.Show("Confirm?", "Confirm", MessageBoxButton.OKCancel, MessageBoxImage.Question) == MessageBoxResult.OK)
     {
         acceptModel = dgvRequest.CurrentItem as CieControlIncentiveModel;
         if (acceptModel != null && threadAccept.IsBusy == false)
         {
             this.Cursor = Cursors.Wait;
             object[] arguments = { acceptModel };
             threadAccept.RunWorkerAsync(arguments);
         }
     }
 }
        public static bool Insert(CieControlIncentiveModel model)
        {
            var @WorkHrsBefore   = new SqlParameter("@WorkHrsBefore", model.WorkHrsBefore);
            var @WorkHrsAfter    = new SqlParameter("@WorkHrsAfter", model.WorkHrsAfter);
            var @IncentiveBefore = new SqlParameter("@IncentiveBefore", model.IncentiveBefore);
            var @IncentiveAfter  = new SqlParameter("@IncentiveAfter", model.IncentiveAfter);

            var @LineId      = new SqlParameter("@LineId", model.LineId);
            var @RequestTime = new SqlParameter("@RequestTime", model.RequestTime);
            var @Reason      = new SqlParameter("@Reason", model.Reason);

            SaovietCheckInEntities db = new SaovietCheckInEntities();

            if (db.ExecuteStoreCommand("EXEC spm_InsertCieControlIncentive @WorkHrsBefore, @WorkHrsAfter, @IncentiveBefore, @IncentiveAfter, @LineId, @RequestTime, @Reason", @WorkHrsBefore, @WorkHrsAfter, @IncentiveBefore, @IncentiveAfter, @LineId, @RequestTime, @Reason) >= 1)
            {
                return(true);
            }
            return(false);
        }