예제 #1
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            if (formValidator.Validate())
            {
                int empId = 0;
                int.TryParse(txtEmployeeId.Text, out empId);
                var emp = new Employee
                {
                    Id = empId,
                    Name = txtName.Text,
                    Role = (cmbRoles.SelectedItem as Role).Id,
                    Designation = (cmbDesignations.SelectedItem as Designation).Id,
                    AllowLogin = Convert.ToSByte(chkAllowLogin.Checked),
                    IsDeleted = Convert.ToSByte(chkIsDeleted.Checked),
                    LoginId = txtLoginId.Text,
                    Password = txtPassword.Text,
                    CreatedBy = 1,
                    CreatedOn = DateTime.Now,
                    ModifiedBy = 1,
                    ModifiedOn = DateTime.Now
                };

                var empDao = new EmployeeDao();
                empDao.SaveEmployee(emp);

                ShowEmployees();
            }
        }
 private void OperatorReport_Load(object sender, EventArgs e)
 {
     var empDao = new EmployeeDao();
     cmbUsername.DataSource = empDao.GetLoginIds();
     cmbUsername.DisplayMember = "LoginId";
     cmbUsername.ValueMember = "Id";
 }
 private void PrintSeries_Load_1(object sender, EventArgs e)
 {
     var empDao = new EmployeeDao();
     cmbGivenTo.DataSource = empDao.GetLoginIds();
     cmbUsername.DataSource = empDao.GetLoginIds();
     ShowPrintSeries();
     ShowPrintSeriesBalance();
 }
예제 #4
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.");
     }
 }
예제 #5
0
 private void ShowEmployees()
 {
     var empDao = new EmployeeDao();
     dgvEmployees.AutoGenerateColumns = false;
     dgvEmployees.DataSource = empDao.GetAllEmployees();
 }
 private void VIPPrasadamForm_Load(object sender, EventArgs e)
 {
     var empDao = new EmployeeDao();
     cmbReferenceBy.DataSource = empDao.GetAllEmployees();
     cmbReferenceBy.DisplayMember = "Name";
     cmbReferenceBy.ValueMember = "Id";
     var serviceDao = new ServiceDao();
     cmbServiceID.DataSource = serviceDao.GetAllVIPPrasadam();
     ShowVIPPrasadam();
 }