Exemple #1
0
        public int insertCredential(EmployeeBean emp1)
        {
            int       status      = 0;
            DataTable eventsTable = new DataTable("Events");

            using (MySqlConnection CN = new MySqlConnection(
                       ConfigurationManager.ConnectionStrings["IEMConStr"].ConnectionString))
            {
                CN.Open();
                MySqlCommand CMD = new MySqlCommand();
                CMD.Connection  = CN;
                CMD.CommandType = CommandType.StoredProcedure;
                CMD.CommandText = "insertCredential";

                CMD.Parameters.AddWithValue("p_empid", emp1.emp_id);
                CMD.Parameters.AddWithValue("p_email", emp1.email);
                CMD.Parameters.AddWithValue("p_pwd", emp1.pwd);
                CMD.Parameters.AddWithValue("p_role", emp1.role);

                status = CMD.ExecuteNonQuery();

                CN.Close();
            }
            return(status);
        }
Exemple #2
0
        public int insertEmployee(EmployeeBean emp)
        {
            int       status      = 0;
            DataTable eventsTable = new DataTable("Events");

            using (MySqlConnection CN = new MySqlConnection(
                       ConfigurationManager.ConnectionStrings["IEMConStr"].ConnectionString))
            {
                CN.Open();
                MySqlCommand CMD = new MySqlCommand();
                CMD.Connection  = CN;
                CMD.CommandType = CommandType.StoredProcedure;
                CMD.CommandText = "insertEmployee";
                CMD.Parameters.AddWithValue("p_employeeID", emp.emp_id);
                CMD.Parameters.AddWithValue("p_ename", emp.emp_name);
                CMD.Parameters.AddWithValue("p_deptID", emp.dept_id);
                CMD.Parameters.AddWithValue("p_city", emp.city);
                CMD.Parameters.AddWithValue("p_email", emp.email);
                CMD.Parameters.AddWithValue("p_phone", emp.phone);
                CMD.Parameters.AddWithValue("p_dob", emp.dob);
                CMD.Parameters.AddWithValue("p_doj", emp.doj);
                CMD.Parameters.AddWithValue("p_roleid", emp.role_id);

                status = CMD.ExecuteNonQuery();

                CN.Close();
            }
            return(status);
        }
 /// <summary>
 /// 开启线程从后台加载数据
 /// </summary>
 public void Initialization()
 {
     DispatcherHelper.CheckBeginInvokeOnUI(() => {
         List <Employee> employees = _EmployeeService.QueryByEmployee();
         if (null != employees && employees.Count() > 0)
         {
             foreach (var e in employees)
             {
                 Employees.Add(EmployeeBean.Build(e));
             }
         }
     });
 }