internal void UpdateEmployee(Employee ins, string admin)
        {
            base.com.CommandText = "spUpdateEmployee";
            base.com.Parameters.AddWithValue("_EmpID", ins.EmpID);
            base.com.Parameters.AddWithValue("_Username", ins.Username);
            base.com.Parameters.AddWithValue("_FirstName", ins.Firstname);
            base.com.Parameters.AddWithValue("_LastName", ins.Lastname);
            base.com.Parameters.AddWithValue("_KioskID", ins.KioskID);
            base.com.Parameters.AddWithValue("_Department", ins.Department);
            base.com.Parameters.AddWithValue("_UserLevelID", ins.UserLevelID);
            base.com.Parameters.AddWithValue("_MobileNo", ins.MobileNo);
            base.com.Parameters.AddWithValue("_Email", ins.Email);
            base.com.Parameters.AddWithValue("_CreatedBy", admin);
            base.com.ExecuteScalar();

            closeConnection();
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var ins = new Employee();

            string id = hdnEmpID.Value;

            string userlevel = ddlUserLevel.SelectedItem.Value;

            if (userlevel != "3")
            {
                ins.Username = tbEmpUsername.Text.Trim();
                ins.Password = tbEmpPassword.Text.Trim();
            }
            else
            {
                ins.Username = "";
                ins.Password = "";
            }

            ins.UserLevelID = Convert.ToInt32(ddlUserLevel.SelectedItem.Value);
            ins.Firstname = tbEmpFirstname.Text.Trim().ToUpper();
            ins.Lastname = tbEmpLastname.Text.Trim().ToUpper();
            ins.Department = tbEmpDepartment.Text.Trim().ToUpper();
            ins.KioskID = Convert.ToInt32(ddlKioskList.SelectedItem.Value);

            ins.DateHired = DateTime.ParseExact(tbEmpDateHired.Text.Trim(), "yyyy-MM-dd",System.Globalization.CultureInfo.InvariantCulture);

            ins.MobileNo = tbEmpMobile.Text.Trim().ToUpper();
            ins.Email = tbEmpEmail.Text.Trim().ToUpper();
            //
            bool isSuccess = true;
            string msg = ""; ;
            //
            if (id == "0")
            { // insert method
                ins.EmpID = tbEmpID.Text.Trim();
                ins.DateCreated = DateTime.Now;

                try
                {
                    Employee.InsertEmployee(ins, GlobalAccess.EmpID);
                    msg = "Insert Success";
                }
                catch (Exception ee)
                {
                    isSuccess = false;
                    (Master as Frame).PopUp(ee.Message);
                }
            }
            else
            { // update method
                ins.EmpID = id;
                ins.DateUpdated = DateTime.Now;

                try
                {
                    Employee.UpdateEmployee(ins, GlobalAccess.EmpID);
                    msg = "Update Success";
                }
                catch (Exception ee)
                {
                    isSuccess = false;
                    (Master as Frame).PopUp(ee.Message);
                }
            }

            if (isSuccess)
            {
                (Master as Frame).PopUp(msg);
                CallDataGrid();
                mvMain.ActiveViewIndex = 0;
            }
        }
 public static void UpdateEmployee(Employee ins, string admin)
 {
     var dal = new EmployeeDAL();
     dal.UpdateEmployee(ins, admin);
 }
        public static Employee SelectEmployeeByID(string id)
        {
            var dal = new EmployeeDAL();
            DataRow row = dal.SelectEmployeeByID(id);

            var ins = new Employee();
            ins.Bind(row);

            return ins;
        }
        public static void InsertEmployee(Employee ins, string admin)
        {
            var dal = new EmployeeDAL();

            dal.InsertEmployee(ins, admin);
        }
        public static List<Employee> GetLoggedEmployee()
        {
            var dal = new EmployeeDAL();
            var collection = new List<Employee>();

            foreach (DataRow row in dal.GetLoggedEmployee().Rows)
            {
                var ins = new Employee();
                ins.Bind2(row);

                collection.Add(ins);
            }

            return collection;
        }
        public static Employee GetEmployeeByUsername(string username)
        {
            var dal = new EmployeeDAL();

            DataRow row = dal.GetEmployeeByUsername(username);

            var instance = new Employee();
            instance.Bind(row);

            return instance;
        }