/* * GetPackageType Method * It is used tu get all package type price with the employee_id -> display according to the connected employee */ public static PackageType getPackageType(int employee_id, String date) { JObject jsonParse = JObject.Parse(RAO.post("packageType", "employee_id=" + employee_id + "&date=" + date)); if (employee_id.ToString().Length > 0) { return(JsonConvert.DeserializeObject <PackageType>(jsonParse.ToString())); } else { return(null); } }
/** * GetEmployeeTypeId Method * It is used to retrieve the id of a employee with his login */ public static Employee getEmployeeTypeId(String login) { JObject jsonParse = JObject.Parse(RAO.post("role", "login=" + login)); if (login.ToString().Length > 0) { return(JsonConvert.DeserializeObject <Employee>(jsonParse.ToString())); } else { return(null); } }
/** * ResearchEmployee Method * It is used to research an employee by is login -> after modify this employee */ public static Employee researchEmployee(String login) { JObject jsonParse = JObject.Parse(RAO.post("researchEmployee", "login="******"lastname"].ToString().Length > 0) { return(JsonConvert.DeserializeObject <Employee>(jsonParse.ToString())); } else { return(null); } }
/** * CreateAcountEmployee Method * It is used to create an employee with all parameters */ public static Employee createAccountEmployee(int activation, String lastname, String firstname, String pwd, String login, String address, String PC, String city, String phone, String hireDateDay, String hireDateMonth, String hireDateYear, int district, int employee_type_id) { JObject jsonParse = JObject.Parse(RAO.post("createAccountEmployee", "activation=" + activation + "&firstname=" + firstname + "&lastname=" + lastname + "&password="******"&login="******"&address=" + address + "&postalCode=" + PC + "&city=" + city + "&phone=" + phone + "&hireDate=" + hireDateYear + "/" + hireDateMonth + "/" + hireDateDay + "&district_id=" + district + "&employee_type_id=" + employee_type_id)); if (lastname.ToString().Length > 0) { return(JsonConvert.DeserializeObject <Employee>(jsonParse.ToString())); } else { return(null); } }
/** * Auth method * Allow the connection */ public static Employee auth(String login, String password) { // Transforme la chaine de caractère du RAO en objet JSON = parser JObject jsonParse = JObject.Parse(RAO.post("auth", "login="******"&password="******"token"].ToString().Length > 0) { // Retourne un objet de la classe Login à partir de la chaine de caractère de l'objet JSON parsé avec clef "content" return(JsonConvert.DeserializeObject <Employee>(jsonParse.ToString())); } else { return(null); } }