Esempio n. 1
0
 public ProfilePaySlipForm(employee emp)
 {
     this.emp = emp;
     InitializeComponent();
     dgvPayslipdetails.AutoGenerateColumns = false;
 }
Esempio n. 2
0
 public ManagerDashForm(employee emp, MainForm mf)
 {
     this.emp = emp;
     this.mf  = mf;
     InitializeComponent();
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtName.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Name", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(dtpJoiningDate.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Date", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (rbtnMale.Checked == false && rbtnFemale.Checked == false)
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Gender", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (chkJava.Checked == false && chkCsharp.Checked == false && chkAlgo.Checked == false)
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Skills", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtEmail.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Email", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtPhone.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Phone", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtAddress.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Address", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (rbtnIsActiveYes.Checked == false && rbtnIsActiveNo.Checked == false)
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter IsActive", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtBasic.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter Basic Salary", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtCa.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter CA", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtHa.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter HA", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (rbtnInvalid.Checked == false && rbtnValid.Checked == false)
            {
                MetroFramework.MetroMessageBox.Show(this, "Enter IsActive", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            employee employee;

            if (string.IsNullOrEmpty(txtId.Text))
            {
                employee = new employee();
                context.employees.Add(employee);
            }
            else
            {
                int n = Int32.Parse(txtId.Text);
                employee = context.employees.FirstOrDefault(emp => emp.empId == n);
            }

            employee.empName     = txtName.Text;
            employee.joiningDate = Convert.ToDateTime(dtpJoiningDate.Text);
            employee.empGender   = rbtnMale.Checked == true ? "Male" : "Female";
            string skill = "";

            if (chkAlgo.Checked)
            {
                skill += string.IsNullOrEmpty(skill) ? "Algorithm" : ",Algorithm";
            }
            if (chkCsharp.Checked)
            {
                skill += string.IsNullOrEmpty(skill) ? "C#" : ",C#";
            }
            if (chkJava.Checked)
            {
                skill += string.IsNullOrEmpty(skill) ? "Java" : ",Java";
            }
            employee.empSkill    = skill;
            employee.empEmail    = txtEmail.Text;
            employee.empPhone    = txtPhone.Text;
            employee.empAddress  = txtAddress.Text;
            employee.empIsActive = rbtnIsActiveYes.Checked == true ? "Yes" : "No";
            context.SaveChanges();
            var u = context.usertypes.FirstOrDefault(ui => ui.utypeId == 3);

            u.employees.Add(employee);
            context.SaveChanges();
            salary sal;

            if (string.IsNullOrEmpty(txtId.Text))
            {
                sal = new salary();
                context.salaries.Add(sal);
                sal.empId = employee.empId;
                double b, h, c;
                if (!double.TryParse(txtBasic.Text, out b) || !double.TryParse(txtCa.Text, out c) || !double.TryParse(txtHa.Text, out h))
                {
                    MetroFramework.MetroMessageBox.Show(this, "Enter Correct Format of Basic,CA,HA", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                sal.basic    = b;
                sal.ca       = c;
                sal.ha       = h;
                sal.isActive = rbtnValid.Checked == true ? "valid" : "invalid";
                sal.salDate  = dtpJoiningDate.Text;
                context.SaveChanges();
            }
            fullrefresh();
            dgvDetails.ClearSelection();
            for (int i = 0; i < dgvDetails.Rows.Count; i++)
            {
                int n = Int32.Parse(dgvDetails.Rows[i].Cells[0].Value.ToString());
                if (n == employee.empId)
                {
                    dgvDetails.Rows[i].Selected = true;
                    loaddetail(n);
                }
            }
            salaryHide();
            MetroFramework.MetroMessageBox.Show(this, "Oparation inserted", "Successfull", MessageBoxButtons.OK, MessageBoxIcon.Question);
        }
Esempio n. 4
0
 public mycontrol_employee(employee emp)
 {
     h1 = emp;
 }
Esempio n. 5
0
 public void employe()
 {
     employee emp = new employee();
     emp.Show();
 }
Esempio n. 6
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtusername.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please Enter UserID", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(txtpassword.Text))
            {
                MetroFramework.MetroMessageBox.Show(this, "Please Enter Password", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            var user = context.users.FirstOrDefault(u => u.userId == txtusername.Text && u.pass == txtpassword.Text);

            if (user == null)
            {
                MetroFramework.MetroMessageBox.Show(this, "Invalid UserID or Password", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (user.employee.empIsActive.ToUpper() == "No".ToUpper())
            {
                MetroFramework.MetroMessageBox.Show(this, "User is Inactive", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (user.employee.usertype.utypeName.ToString() == "admin")
            {
                employee emp = context.employees.FirstOrDefault(ep => ep.empId == user.empId);
                this.mf.userid = emp.empName;
                AdminDashForm adf = new AdminDashForm(emp, this.mf);
                adf.TopLevel        = false;
                adf.AutoScroll      = true;
                adf.FormBorderStyle = FormBorderStyle.None;
                adf.Dock            = DockStyle.Fill;
                this.mf.pnlmain.Controls.Clear();
                this.mf.pnlmain.Controls.Add(adf);

                adf.Show();
            }
            else if (user.employee.usertype.utypeName.ToString() == "manager")
            {
                employee        emp = context.employees.FirstOrDefault(ep => ep.empId == user.empId);
                ManagerDashForm mdf = new ManagerDashForm(emp, this.mf);
                mdf.TopLevel        = false;
                mdf.AutoScroll      = true;
                mdf.FormBorderStyle = FormBorderStyle.None;
                mdf.Dock            = DockStyle.Fill;
                this.mf.pnlmain.Controls.Clear();
                this.mf.pnlmain.Controls.Add(mdf);
                mdf.Show();
            }
            else
            {
                employee         emp = context.employees.FirstOrDefault(ep => ep.empId == user.empId);
                EmployeeDashForm mdf = new EmployeeDashForm(emp, this.mf);
                mdf.TopLevel        = false;
                mdf.AutoScroll      = true;
                mdf.FormBorderStyle = FormBorderStyle.None;
                mdf.Dock            = DockStyle.Fill;
                this.mf.pnlmain.Controls.Clear();
                this.mf.pnlmain.Controls.Add(mdf);
                mdf.Show();
            }
        }
Esempio n. 7
0
 public AdminDashForm(employee emp, MainForm mf)
 {
     this.mf  = mf;
     this.emp = emp;
     InitializeComponent();
 }
Esempio n. 8
0
 public ProfileForm(employee emp)
 {
     this.emp = emp;
     InitializeComponent();
 }