private void emp_restriction_current_user_Load(object sender, EventArgs e)
        {
            Emp_Restriction er, er2 = new Emp_Restriction();
            er2.empid = Global.CURRENT_USER.empid;
            er = er2.SELECT_BY_ID();

            //LOOP THROUGH ALL RESTRICTIONS THEN ADD A CHECKBOX FOR EACH RESTRICTION

            GenereateCheckBoxes(er);
        }
Ejemplo n.º 2
0
        private void tztpassword_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode.ToString().Equals("Return"))
            {

                Employee emp, emp1 = new Employee();
                emp1.empid = txtid.Text;
                String hash;
                using (MD5 md5Hash = MD5.Create())
                {
                    hash = Global.GetMd5Hash(md5Hash, txtpassword.Text);
                }

                emp1.password = hash;
                emp = emp1.SELECT_BY_IDPASS();

                //MessageBox.Show(hash);

                if (emp != null)
                {

                    Global.CURRENT_USER.empid = emp.empid;
                    Global.CURRENT_USER = emp;
                    Global.CURRENT_USER.pic = emp.GET_IMAGE_BY_ID();
                    Global.CURRENT_USER.basic_pay = emp.GET_BASIC_PAY();
                    Global.CURRENT_USER.emp_status = emp.GET_EMPLOYMENT_STATUS();
                    Global.CURRENT_USER.position = emp.GET_CURRENT_POSITION();
                    Global.CURRENT_USER.branch = emp.GET_BRANCH_ASSIGNMENT();

                    //CREATE A RESTRICTION OBJECT
                    Emp_Restriction r = new Emp_Restriction();
                    //SET CURRENT USER RESTRICTION
                    r.empid = Global.CURRENT_USER.empid;
                    Global.CURRENT_USER.restriction = r.SELECT_BY_ID();
                    Global.CURRENT_USER.LIST_BENEFITS();

                    //GET CURRENT USER LATEST SCHEDULE
                    Emp_Sched es = new Emp_Sched();
                    es.empid = Global.CURRENT_USER.empid;
                    Global.CURRENT_USER.schedule = es.SELECT_BY_EMPID();

                    Global.CURRENT_USER.ISLOGGEDIN = true;

                    frmMain f = new frmMain();
                    f.Show();

                    this.Hide();

                }
                else {
                    MessageBox.Show("Nothing found");
                }

            }
        }
Ejemplo n.º 3
0
        protected void chk_checkchanged(object sender, EventArgs e)
        {
            Emp_Restriction er = new Emp_Restriction();
            er.empid = emp.empid;
            // identify which button was clicked and perform necessary actions
            CheckBox chk = sender as CheckBox;

            if (er.Toggle(emp.empid, chk.Name, chk.Checked))
            {
                chk.Checked = chk.Checked;
            }
            else
            {
                MessageBox.Show("There was a problem updating restriction. : \n" + db.err.Message);
                chk.Checked = chk.Checked;
            }
        }
Ejemplo n.º 4
0
        private void cboEmp_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlrestrictions.Controls.Clear();

            if (cboEmp.Text != "")
            {
                String[] c = cboEmp.Text.ToString().Split('-');
                String id = c[1];
                Employee emp1, emp2 = new Employee();
                emp2.empid = id;

                emp1 = emp2.SELECT_BY_ID();
                emp = emp1;

                //emp1.SELECT_BY_ID();
                emp1.GET_IMAGE_BY_ID();

                String pos = (emp1.GET_CURRENT_POSITION() != "") ? emp1.position.ToString() : "NO_POSITION_INDICATED";
                lblemp.Text = emp1.lname.ToUpper() + ", " + emp1.fname.ToUpper() + " " + emp1.mname.ToUpper() + " - " + pos;

                if (emp1.pic != null)
                {
                    MemoryStream ms = new MemoryStream(emp1.pic);
                    pb.Image = Image.FromStream(ms);
                    pb.SizeMode = PictureBoxSizeMode.Zoom;
                }
                else
                {
                    pb.Image = Properties.Resources.noimagefound;
                    pb.SizeMode = PictureBoxSizeMode.Zoom;
                }

                //GET THE RESTRICTIONS
                Emp_Restriction er, er2 = new Emp_Restriction();
                er2.empid = emp.empid;
                er = er2.SELECT_BY_ID();

                //LOOP THROUGH ALL RESTRICTIONS THEN ADD A CHECKBOX FOR EACH RESTRICTION

                GenereateCheckBoxes(er);

            }
        }
Ejemplo n.º 5
0
        }//end save

        public Emp_Restriction SELECT_BY_ID()
        {
            DataTable    dt  = new DataTable();
            MySqlCommand cmd = new MySqlCommand();

            db.SET_COMMAND_PARAMS(cmd, "EMP_RESTRICTION_BYEMPID");
            cmd.Parameters.AddWithValue("_empid", empid);
            MySqlDataAdapter da = new MySqlDataAdapter(cmd);

            da.Fill(dt);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    Emp_Restriction er = new Emp_Restriction();
                    DataRow         r  = dt.Rows[0];
                    er.empid                     = r["empid"].ToString();
                    er.CAN_ADD_EMP_SCHED         = (Boolean)r["CAN_ADD_EMP_SCHED"];
                    er.CAN_ADD_EMPLOYEE          = (Boolean)r["CAN_ADD_EMPLOYEE"];
                    er.CAN_ADD_LEAVE             = (Boolean)r["CAN_ADD_LEAVE"];
                    er.CAN_ADD_LOAN              = (Boolean)r["CAN_ADD_LOAN"];
                    er.CAN_ADD_PASS_SLIP         = (Boolean)r["CAN_ADD_PASS_SLIP"];
                    er.CAN_ADD_PROPERTIES        = (Boolean)r["CAN_ADD_PROPERTIES"];
                    er.CAN_ADD_SCHEDULE_TEMPLATE = (Boolean)r["CAN_ADD_SCHEDULE_TEMPLATE"];
                    er.CAN_ADD_SERVICE_REQUEST   = (Boolean)r["CAN_ADD_SERVICE_REQUEST"];
                    er.CAN_ADD_SUPPLIES          = (Boolean)r["CAN_ADD_SUPPLIES"];
                    er.CAN_ADD_SUPPLY_REQUEST    = (Boolean)r["CAN_ADD_SUPPLY_REQUEST"];


                    er.CAN_APPLY_LOAN = (Boolean)r["CAN_APPLY_LOAN"];


                    er.CAN_CHANGE_PASSWORD = (Boolean)r["CAN_CHANGE_PASSWORD"];
                    er.CAN_LOG_IN          = (Boolean)r["CAN_LOG_IN"];
                    er.CAN_RECOMMEND       = (Boolean)r["CAN_RECOMMEND"];


                    er.CAN_UPDATE_EMP_SCHED   = (Boolean)r["CAN_UPDATE_EMP_SCHED"];
                    er.CAN_UPDATE_EMPLOYEE    = (Boolean)r["CAN_UPDATE_EMPLOYEE"];
                    er.CAN_UPDATE_LEAVE       = (Boolean)r["CAN_UPDATE_LEAVE"];
                    er.CAN_UPDATE_PASS_SLIP   = (Boolean)r["CAN_UPDATE_PASS_SLIP"];
                    er.CAN_UPDATE_RESTRICTION = (Boolean)r["CAN_UPDATE_RESTRICTION"];


                    er.CAN_VIEW_ATTENDANCE      = (Boolean)r["CAN_VIEW_ATTENDANCE"];
                    er.CAN_VIEW_LOAN            = (Boolean)r["CAN_VIEW_LOAN"];
                    er.CAN_VIEW_PROPERTIES      = (Boolean)r["CAN_VIEW_PROPERTIES"];
                    er.CAN_VIEW_SERVICE_REQUEST = (Boolean)r["CAN_VIEW_SERVICE_REQUEST"];
                    er.CAN_VIEW_SUPPLIES        = (Boolean)r["CAN_VIEW_SUPPLIES"];
                    er.CAN_VIEW_SUPPLY_REQUEST  = (Boolean)r["CAN_VIEW_SUPPLY_REQUEST"];
                    er.CAN_VIEW_RESTRICTION     = (Boolean)r["CAN_VIEW_RESTRICTION"];
                    er.CAN_VIEW_EMPLOYEE        = (Boolean)r["CAN_VIEW_EMPLOYEE"];
                    er.CAN_VIEW_LEAVE           = (Boolean)r["CAN_VIEW_LEAVE"];
                    er.CAN_VIEW_PASS_SLIP       = (Boolean)r["CAN_VIEW_PASS_SLIP"];
                    er.CAN_VIEW_MEMBERS         = (Boolean)r["CAN_VIEW_MEMBERS"];
                    er.CAN_VIEW_EMP_SCHEDULE    = (Boolean)r["CAN_VIEW_EMP_SCHEDULE"];
                    er.CAN_VIEW_PROFILE         = (Boolean)r["CAN_VIEW_PROFILE"];


                    er.CAN_ADMINISTER_EMPLOYEE = (Boolean)r["CAN_ADMINISTER_EMPLOYEE"];

                    er.CAN_ADMINISTER_LOAN            = (Boolean)r["CAN_ADMINISTER_LOAN"];
                    er.CAN_ADMINISTER_LEAVE           = (Boolean)r["CAN_ADMINISTER_LEAVE"];
                    er.CAN_ADMINISTER_PASS_SLIP       = (Boolean)r["CAN_ADMINISTER_PASS_SLIP"];
                    er.CAN_ADMINISTER_RESTRICTION     = (Boolean)r["CAN_ADMINISTER_RESTRICTION"];
                    er.CAN_ADMINISTER_SCHEDULE        = (Boolean)r["CAN_ADMINISTER_SCHEDULE"];
                    er.CAN_ADMINISTER_MEMBER          = (Boolean)r["CAN_ADMINISTER_MEMBER"];
                    er.CAN_ADMINISTER_SUPPLY_REQUEST  = (Boolean)r["CAN_ADMINISTER_SUPPLY_REQUEST"];
                    er.CAN_ADMINISTER_SERVICE_REQUEST = (Boolean)r["CAN_ADMINISTER_SERVICE_REQUEST"];
                    er.CAN_ADMINISTER_ATTENDANCE      = (Boolean)r["CAN_ADMINISTER_ATTENDANCE"];
                    er.CAN_ADMINISTER_CUTOFF          = (Boolean)r["CAN_ADMINISTER_CUTOFF"];


                    return(er);
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 6
0
        public Emp_Restriction SELECT_BY_ID()
        {
            DataTable dt = new DataTable();
            MySqlCommand cmd = new MySqlCommand();
            db.SET_COMMAND_PARAMS(cmd, "EMP_RESTRICTION_BYEMPID");
            cmd.Parameters.AddWithValue("_empid", empid);
            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            da.Fill(dt);

            if (dt != null)
            {
                if (dt.Rows.Count > 0)
                {
                    Emp_Restriction er = new Emp_Restriction();
                    DataRow r = dt.Rows[0];
                    er.empid = r["empid"].ToString();
                    er.CAN_ADD_EMP_SCHED = (Boolean)r["CAN_ADD_EMP_SCHED"];
                    er.CAN_ADD_EMPLOYEE = (Boolean)r["CAN_ADD_EMPLOYEE"];
                    er.CAN_ADD_LEAVE = (Boolean)r["CAN_ADD_LEAVE"];
                    er.CAN_ADD_LOAN = (Boolean)r["CAN_ADD_LOAN"];
                    er.CAN_ADD_PASS_SLIP = (Boolean)r["CAN_ADD_PASS_SLIP"];
                    er.CAN_ADD_PROPERTIES = (Boolean)r["CAN_ADD_PROPERTIES"];
                    er.CAN_ADD_SCHEDULE_TEMPLATE = (Boolean)r["CAN_ADD_SCHEDULE_TEMPLATE"];
                    er.CAN_ADD_SERVICE_REQUEST = (Boolean)r["CAN_ADD_SERVICE_REQUEST"];
                    er.CAN_ADD_SUPPLIES = (Boolean)r["CAN_ADD_SUPPLIES"];
                    er.CAN_ADD_SUPPLY_REQUEST = (Boolean)r["CAN_ADD_SUPPLY_REQUEST"];

                    er.CAN_APPLY_LOAN = (Boolean)r["CAN_APPLY_LOAN"];

                    er.CAN_CHANGE_PASSWORD = (Boolean)r["CAN_CHANGE_PASSWORD"];
                    er.CAN_LOG_IN = (Boolean)r["CAN_LOG_IN"];
                    er.CAN_RECOMMEND = (Boolean)r["CAN_RECOMMEND"];

                    er.CAN_UPDATE_EMP_SCHED = (Boolean)r["CAN_UPDATE_EMP_SCHED"];
                    er.CAN_UPDATE_EMPLOYEE = (Boolean)r["CAN_UPDATE_EMPLOYEE"];
                    er.CAN_UPDATE_LEAVE = (Boolean)r["CAN_UPDATE_LEAVE"];
                    er.CAN_UPDATE_PASS_SLIP = (Boolean)r["CAN_UPDATE_PASS_SLIP"];
                    er.CAN_UPDATE_RESTRICTION = (Boolean)r["CAN_UPDATE_RESTRICTION"];

                    er.CAN_VIEW_ATTENDANCE = (Boolean)r["CAN_VIEW_ATTENDANCE"];
                    er.CAN_VIEW_LOAN = (Boolean)r["CAN_VIEW_LOAN"];
                    er.CAN_VIEW_PROPERTIES = (Boolean)r["CAN_VIEW_PROPERTIES"];
                    er.CAN_VIEW_SERVICE_REQUEST = (Boolean)r["CAN_VIEW_SERVICE_REQUEST"];
                    er.CAN_VIEW_SUPPLIES = (Boolean)r["CAN_VIEW_SUPPLIES"];
                    er.CAN_VIEW_SUPPLY_REQUEST = (Boolean)r["CAN_VIEW_SUPPLY_REQUEST"];
                    er.CAN_VIEW_RESTRICTION = (Boolean)r["CAN_VIEW_RESTRICTION"];
                    er.CAN_VIEW_EMPLOYEE = (Boolean)r["CAN_VIEW_EMPLOYEE"];
                    er.CAN_VIEW_LEAVE = (Boolean)r["CAN_VIEW_LEAVE"];
                    er.CAN_VIEW_PASS_SLIP = (Boolean)r["CAN_VIEW_PASS_SLIP"];
                    er.CAN_VIEW_MEMBERS = (Boolean)r["CAN_VIEW_MEMBERS"];
                    er.CAN_VIEW_EMP_SCHEDULE = (Boolean)r["CAN_VIEW_EMP_SCHEDULE"];
                    er.CAN_VIEW_PROFILE = (Boolean)r["CAN_VIEW_PROFILE"];

                    er.CAN_ADMINISTER_EMPLOYEE = (Boolean)r["CAN_ADMINISTER_EMPLOYEE"];

                    er.CAN_ADMINISTER_LOAN = (Boolean)r["CAN_ADMINISTER_LOAN"];
                    er.CAN_ADMINISTER_LEAVE = (Boolean)r["CAN_ADMINISTER_LEAVE"];
                    er.CAN_ADMINISTER_PASS_SLIP = (Boolean)r["CAN_ADMINISTER_PASS_SLIP"];
                    er.CAN_ADMINISTER_RESTRICTION = (Boolean)r["CAN_ADMINISTER_RESTRICTION"];
                    er.CAN_ADMINISTER_SCHEDULE = (Boolean)r["CAN_ADMINISTER_SCHEDULE"];
                    er.CAN_ADMINISTER_MEMBER = (Boolean)r["CAN_ADMINISTER_MEMBER"];
                    er.CAN_ADMINISTER_SUPPLY_REQUEST = (Boolean)r["CAN_ADMINISTER_SUPPLY_REQUEST"];
                    er.CAN_ADMINISTER_SERVICE_REQUEST = (Boolean)r["CAN_ADMINISTER_SERVICE_REQUEST"];
                    er.CAN_ADMINISTER_ATTENDANCE = (Boolean)r["CAN_ADMINISTER_ATTENDANCE"];
                    er.CAN_ADMINISTER_CUTOFF = (Boolean)r["CAN_ADMINISTER_CUTOFF"];

                    return er;
                }
                else { return null; }

            }
            else
            {
                return null;
            }
        }