private void brnSubmit_Click(object sender, EventArgs e)
        {
            int psId = 0;
            int.TryParse(txtPrintSeriesId.Text, out psId);
            var psObj = new PrintSeries
            {
                Id = psId,
                GivenTo = (cmbGivenTo.SelectedItem as Employee).Id,
                PrintseriesStart = Convert.ToInt32(txtStartNumber.Text),
                PrintseriesEnd = Convert.ToInt32(txtEndNumber.Text),
                CreatedOn = DateTime.Now,
                CreatedBy = 1
            };

            var psDao = new PrintSeriesDao();
            psDao.SavePrintSeries(psObj);
            ShowPrintSeries();
        }
示例#2
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     if (formValidator.Validate())
     {
         var empDao = new EmployeeDao();
         var emp = empDao.ValidateLogin(txtLoginId.Text, txtPassword.Text);
         if (emp != null && !string.IsNullOrEmpty(emp.Name))
         {
             App.LoggedInEmployee = emp;
             var printseriesDao = new PrintSeriesDao();
             this.DialogResult = System.Windows.Forms.DialogResult.OK;
             //new MainForm().Show();
         }
         else
         {
             MessageBox.Show("Invalid user name or password ! Please try again.", "Unable to login !", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txtLoginId.Focus();
         }
     }
     else
     {
         MessageBox.Show("Error Occured.");
     }
 }
 private void ShowPrintSeries()
 {
     var psDao = new PrintSeriesDao();
     String dt = String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(currentDateTimePicker.Value));
     String dt1 = String.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(toDateTimePicker.Value));
     int UserId = (cmbUsername.SelectedItem as Employee).Id;
     dgvPrintSeries.AutoGenerateColumns = false;
     //dgvPrintSeries.DataSource = psDao.GetAllPrintSeries(dt);
     dgvPrintSeries.DataSource = psDao.GetAllPrintSeries(dt, dt1, UserId);
 }
 private void ShowPrintSeriesBalance()
 {
     var psDao = new PrintSeriesDao();
     dgvPrintSeriesBalance.AutoGenerateColumns = false;
     dgvPrintSeriesBalance.DataSource = psDao.GetAllPrintSeriesBalance();
 }