public IActionResult HRDashboard(string attendanceStatus, int location, string date) { HttpResponseMessage response = _service.GetResponse(ApiUrl + "api/Dashboard/Admin/" + attendanceStatus + "/" + location + "/" + date); string stringData = response.Content.ReadAsStringAsync().Result; Admin_Dashboard dashboard = JsonConvert.DeserializeObject <Admin_Dashboard>(stringData); return(Json(dashboard)); }
public Admin_Dashboard GetAdminDashboard(string attendanceStatus, int location, int TenantId, string date) { DateTime date1 = Convert.ToDateTime(date); string date2 = date1.ToString("yyyy-MM-dd"); Admin_Dashboard Model = new Admin_Dashboard(); Model.sP_AdminDashboardCount = new SP_AdminDashboardCount(); Model.sP_AdminDashboards = new List <SP_AdminDashboard>(); var param = new SqlParameter("@locationId", location); var param2 = new SqlParameter("@date", date2); string usp = "LMS.usp_GetAdminDashboardDetails @locationId, @date"; Model.sP_AdminDashboards = _dbContext._sp_AdminDashboard.FromSql(usp, param, param2).ToList(); usp = "LMS.usp_GetAdminDashboardCountDetails @locationId,@date"; Model.sP_AdminDashboardCount = _dbContext._sp_AdminDashboardcount.FromSql(usp, param, param2).FirstOrDefault(); usp = "LMS.usp_GetAdminDashboardLeaveDetails @locationId"; Model.sp_AdminDashboardLeaves = _dbContext._sp_AdminDashboardLeave.FromSql(usp, param).ToList(); //foreach (var x in results) //{ // x.p.Attendance = x.Attendances.ToList(); //} //var result = results.Select(x => x.p).ToList(); if (attendanceStatus == "Present") { Model.sP_AdminDashboards = Model.sP_AdminDashboards.Where(x => x.TimeIn != null).ToList(); } else if (attendanceStatus == "Absent") { Model.sP_AdminDashboards = Model.sP_AdminDashboards.Where(x => x.TimeIn == null).ToList(); } return(Model); }
// This function allows the user to login private void Login(object sender, EventArgs e) { // The password will be hashed trough EasyEncryption, via the MD5 protocol string HashedPassword = EasyEncryption.MD5.ComputeMD5Hash(text: PasswordBoxLog.Text); // First i check that the user box is not empy... if (UserBoxLog.Text == "") { MessageBox.Show(text: "You forgot the username!"); UserBoxLog.Focus(); return; } // ... same for the password if (PasswordBoxLog.Text == "") { MessageBox.Show(text: "You forgot the password"); PasswordBoxLog.Focus(); return; } // I check that the user exists, if not, i show a message if (!WCF.UserChecker(UserBoxLog.Text)) { MessageBox.Show("Username doesn't exist!"); UserBoxLog.Clear(); PasswordBoxLog.Clear(); UserBoxLog.Focus(); } // Then i send the data to the WCF so i can check if user and password are correct else { try { bool isAdmin = WCF.Login(Utente: UserBoxLog.Text, Password: HashedPassword); UserTitle = UserBoxLog.Text; // If the user is admin i open the admin dashboard... if (isAdmin) { Admin_Dashboard admin = new Admin_Dashboard(); this.Hide(); admin.ShowDialog(); UserTitle = UserBoxLog.Text; } // ... else i open the client dashboard else { Client_Dashboard client = new Client_Dashboard(); this.Hide(); client.ShowDialog(); UserTitle = UserBoxLog.Text; } } catch (Exception loginException) { MessageBox.Show(text: "Username or password (or both) are wrong!"); UserBoxLog.Clear(); PasswordBoxLog.Clear(); UserBoxLog.Focus(); MessageBox.Show(text: loginException.ToString()); } } }
public IActionResult GetAdminDashboard(string attendanceStatus, int location, string date) { Admin_Dashboard dashboard = _repository.Dashboard.GetAdminDashboard(attendanceStatus, location, TenantId, date); return(Ok(dashboard)); }