protected void Page_Load(object sender, EventArgs e) { EmployeeLogic el = new EmployeeLogic(); Employee e2 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"])); if (e2.Designation.Equals("HR MANAGER") || e2.Designation.Equals("HR EMPLOYEE") || e2.Designation.Equals("MANAGING DIRECTOR") || e2.Designation.Equals("CHAIRMAN")) { AttendanceLogic al = new AttendanceLogic(); DataTable dt = al.Select(); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label3.Visible = true; } else { Table1.Visible = true; Label3.Visible = false; } } else { Response.Redirect("Access.aspx"); } }
public ActionResult ViewAttendance(string eventId) { _viewModel = new EventViewModel(); try { if (!string.IsNullOrEmpty(eventId)) { long myEventId = Convert.ToInt64(Utility.Decrypt(eventId)); AttendanceLogic attendanceLogic = new AttendanceLogic(); AbsentLogLogic absentLogLogic = new AbsentLogLogic(); _viewModel.AttendanceList = attendanceLogic.GetEntitiesBy(s => s.Event_Id == myEventId); _viewModel.AttendanceList.ForEach(e => { if (e.Attendance_Status_Id == (int)AttendanceStatuses.Excused) { e.ATTENDANCE_STATUS.Name = absentLogLogic.GetAbsenceRequestStatus(e); } }); _viewModel.EventId = myEventId; } } catch (Exception ex) { SetMessage("Error! " + ex.Message, Message.Category.Error); } return(View(_viewModel)); }
protected void Button2_Click(object sender, EventArgs e) { if (TextBox1.Text.Equals("")) { Label2.Visible = true; } else { AttendanceLogic al = new AttendanceLogic(); DateTime d1 = new DateTime(); if (!DateTime.TryParseExact(TextBox1.Text, "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { } DataTable dt = al.Search(d1); Repeater1.DataSource = dt; Repeater1.DataBind(); if (dt.Rows.Count == 0) { Table1.Visible = false; Label3.Visible = true; } else { Table1.Visible = true; Label3.Visible = false; } } }
public AttendanceController() { _studentLogic = new StudentLogic(); _eventLogic = new EventLogic(); _absentTypeLogic = new AbsentTypeLogic(); _attendanceLogic = new AttendanceLogic(); _absentLogLogic = new AbsentLogLogic(); _courseLogic = new CourseLogic(); }
public AttendanceController() { var config = new MapperConfiguration(cfg => { cfg.AddProfile <ModelMapper>(); }); _mapper = config.CreateMapper(); _attendanceLogic = new AttendanceLogic(); }
protected void Button2_Click(object sender, EventArgs e) { if (FileUpload1.HasFile) { Label1.Visible = false; DataSet ds = new DataSet(); String path = ""; string ticks = DateTime.Now.Ticks.ToString(); if (FileUpload1.HasFile) { FileUpload1.SaveAs(Server.MapPath("Images/" + ticks + FileUpload1.FileName)); path = Server.MapPath("Images/" + ticks + FileUpload1.FileName); OpenExcelFile(path, ref ds); } AttendanceLogic al = new AttendanceLogic(); Attendance a = new Attendance(); DateTime d1 = new DateTime(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { a.EmployeeID = Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"]); if (!DateTime.TryParseExact(ds.Tables[0].Rows[i]["ADate"].ToString(), "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { } a.Adate = d1; if (ds.Tables[0].Rows[i]["Mark"].ToString().Equals("P")) { a.Mark = true; } else if (ds.Tables[0].Rows[i]["Mark"].ToString().Equals("A")) { a.Mark = false; } al.Insert(a); } ds.Tables[0].Columns.Add(new DataColumn("EmployeeName")); EmployeeLogic el = new EmployeeLogic(); for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++) { ds.Tables[0].Rows[i]["EmployeeName"] = (el.SelectByID(Convert.ToInt32(ds.Tables[0].Rows[i]["EmployeeID"]))).Name; } Repeater1.DataSource = ds; Repeater1.DataBind(); } else { Label1.Visible = true; } }
public ActionResult LoadAttendanceInfo(Guid?userId, DateTime beginTime, DateTime endTime) { AttendanceLogic al = new AttendanceLogic(); if (userId == null) { userId = UserContext.CurrentUser.UserId; } var data = al.QueryAttendance(userId.Value, beginTime, endTime); return(Json(data)); }
protected void LinkButton1_Command(object sender, CommandEventArgs e) { repdiv.Visible = false; EmployeeLogic el = new EmployeeLogic(); Employee e1 = el.SelectByID(Convert.ToInt32(e.CommandArgument)); Label1.Text = "Attendance Report for "+e1.Name; empreport.Visible = true; AttendanceLogic al = new AttendanceLogic(); DataTable dt = al.SelectForEmp(Convert.ToInt32(e.CommandArgument)); Repeater2.DataSource = dt; Repeater2.DataBind(); }
protected void LinkButton1_Command(object sender, CommandEventArgs e) { repdiv.Visible = false; EmployeeLogic el = new EmployeeLogic(); Employee e1 = el.SelectByID(Convert.ToInt32(e.CommandArgument)); Label1.Text = "Attendance Report for " + e1.Name; empreport.Visible = true; AttendanceLogic al = new AttendanceLogic(); DataTable dt = al.SelectForEmp(Convert.ToInt32(e.CommandArgument)); Repeater2.DataSource = dt; Repeater2.DataBind(); }
private ATTENDANCE ProcessHallAttendance(HALL hall, STUDENT student) { ATTENDANCE attendance = null; try { AttendanceLogic attendanceLogic = new AttendanceLogic(); EventLogic eventLogic = new EventLogic(); int numberOfTimesPresent = attendanceLogic.GetEntitiesBy(s => s.EVENT.Hall_Id == hall.Id && s.Student_Id == student.Person_Id && s.Attendance_Status_Id == (int)AttendanceStatuses.Present).Count(); int numberOfLectures = eventLogic.GetEntitiesBy(s => s.Hall_Id == hall.Id && (s.Active == true || s.Active == null)).Count(); int numberOfAbsence = attendanceLogic.GetEntitiesBy(s => s.EVENT.Hall_Id == hall.Id && s.Student_Id == student.Person_Id && s.Attendance_Status_Id == (int)AttendanceStatuses.Excused).Count(); int numberOfLecturesHeld = numberOfLectures - numberOfAbsence; double eligibilityPercentage = (Convert.ToDouble(numberOfTimesPresent) / Convert.ToDouble(numberOfLecturesHeld)) * 100.0; attendance = new ATTENDANCE(); attendance.Percentage = eligibilityPercentage; //result.ApproximateNumberOfLectures = numberOfLecturesHeld; //result.EligibilityPercentage = eligibilityPercentage; //result.NumberOfAbsent = numberOfAbsence; //result.NumberOfPresent = numberOfTimesPresent; //result.TotalNumberOfLectures = numberOfLectures; if (eligibilityPercentage > 75) { attendance.IsEligible = true; } else { attendance.IsEligible = false; } } catch (Exception) { throw; } return(attendance); }
public JsonResult DeleteEvent(long eventId) { JsonResponseModel result = new JsonResponseModel(); try { if (eventId > 0) { AbsentLogLogic logLogic = new AbsentLogLogic(); EventLogic eventLogic = new EventLogic(); AttendanceLogic attendanceLogic = new AttendanceLogic(); ABSENT_LOG eventLog = logLogic.GetEntitiesBy(e => e.Event_Id == eventId).LastOrDefault(); ATTENDANCE eventAttendance = attendanceLogic.GetEntitiesBy(e => e.Event_Id == eventId).LastOrDefault(); if (eventLog == null && eventAttendance == null) { eventLogic.Delete(c => c.Id == eventId); result.IsError = false; result.Message = "Operation Successful!"; } else { result.IsError = true; result.Message = "Event is already attached to an attendance / absent log"; } } else { result.IsError = true; result.Message = "Invalid parameter"; } } catch (Exception ex) { result.IsError = true; result.Message = ex.Message; } return(Json(result, JsonRequestBehavior.AllowGet)); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["Date"] != null) { Label1.Text = "Attendance for " + Request.QueryString["Date"]; DateTime d1 = new DateTime(); if (!DateTime.TryParseExact(Request.QueryString["Date"], "dd/MM/yyyy", null, System.Globalization.DateTimeStyles.None, out d1)) { } AttendanceLogic al = new AttendanceLogic(); Repeater2.DataSource = al.SelectForAttendanceReport(d1); Repeater2.DataBind(); } else { Label1.Text = "Today's Attendance"; AttendanceLogic al = new AttendanceLogic(); Repeater2.DataSource = al.SelectForAttendanceReport(DateTime.Today); Repeater2.DataBind(); } }
public ActionResult DownloadAttendance(string eventId) { _viewModel = new EventViewModel(); try { if (!string.IsNullOrEmpty(eventId)) { long myEventId = Convert.ToInt64(Utility.Decrypt(eventId)); AttendanceLogic attendanceLogic = new AttendanceLogic(); AbsentLogLogic absentLogLogic = new AbsentLogLogic(); _viewModel.AttendanceList = attendanceLogic.GetEntitiesBy(s => s.Event_Id == myEventId); _viewModel.AttendanceList.ForEach(e => { if (e.Attendance_Status_Id == (int)AttendanceStatuses.Excused) { e.ATTENDANCE_STATUS.Name = absentLogLogic.GetAbsenceRequestStatus(e); } }); GridView gv = new GridView(); DataTable ds = new DataTable(); if (_viewModel.AttendanceList.Count > 0) { List <ATTENDANCE> list = _viewModel.AttendanceList.OrderBy(p => p.STUDENT.Matric_Number).ToList(); List <AttendanceModel> sort = new List <AttendanceModel>(); for (int i = 0; i < list.Count; i++) { AttendanceModel attendance = new AttendanceModel(); attendance.SN = (i + 1); attendance.Name = list[i].STUDENT.PERSON.Last_Name + " " + list[i].STUDENT.PERSON.First_Name + " " + list[i].STUDENT.PERSON.Other_Name; attendance.Registration_Number = list[i].STUDENT.Matric_Number; attendance.Event_Type = list[i].EVENT.EVENT_TYPE.Name; if (list[i].EVENT.COURSE != null) { attendance.Course_Hall = list[i].EVENT.COURSE.Name; } else if (list[i].EVENT.HALL != null) { attendance.Course_Hall = list[i].EVENT.HALL.Name; } else { attendance.Course_Hall = ""; } attendance.Location = list[i].EVENT.LOCATION.Name; attendance.Date = list[i].EVENT.Date.ToLongDateString(); attendance.Time_Taken = list[i].Time_Taken.ToLongTimeString(); attendance.Status = list[i].ATTENDANCE_STATUS.Name; sort.Add(attendance); } gv.DataSource = sort; string caption = "Attendnace Report"; if (list != null && list.Count > 0) { caption = "Attendnace Report for " + list.FirstOrDefault().EVENT.DEPARTMENT.Name + ". " + list.FirstOrDefault().EVENT.LEVEL.Name + ". Session: " + list.FirstOrDefault().EVENT.SESSION.Name; } gv.Caption = caption.ToUpper(); gv.DataBind(); string filename = caption.Replace("\\", "") + ".xls"; return(new DownloadFileActionResult(gv, filename)); } else { Response.Write("No data available for download"); Response.End(); return(new JavaScriptResult()); } } } catch (Exception ex) { SetMessage("Error! " + ex.Message, Message.Category.Error); } return(RedirectToAction("ViewAttendance", "Event", new { Area = "Admin", eventId = eventId })); }
protected void Page_Load(object sender, EventArgs e) { DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today); int present = Convert.ToInt32(dt.Rows[0][1]); int absent = Convert.ToInt32(dt.Rows[1][1]); lblPResentPerc.Text = ((float)present * 100) / ((float)present + absent) + ""; lblPResentPerc.Attributes.Add("Present", present.ToString()); lblPResentPerc.Attributes.Add("Absent", absent.ToString()); DataTable dt1 = new InvoiceLogic().SelectForBestOrder(); bestOrd.Text = dt1.Rows[0]["ProductName"].ToString(); totalAmt.Text = dt1.Rows[0]["GrandTotal"].ToString(); txtCustomer.Text = dt1.Rows[0]["CustomerName"].ToString(); string dp = dt1.Rows[0]["ProductImage"].ToString(); String[] arr = dp.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries); proimg.Src = arr[arr.Length - 1]; DataTable dt2 = new InvoiceLogic().SelectForRevenue(); txtTotIncome.Text = dt2.Rows[0]["TotalIncome"].ToString(); DataTable dt4 = new InvoiceLogic().SelectIndividualInvoiceAmount(); string s = ""; for (int i = 0; i < dt4.Rows.Count; i++) { s += dt4.Rows[i]["GrandTotal"] + ","; } s = "[" + s.TrimEnd(',') + "]"; individualInvoiceAmount.Attributes.Add("data-data", s); DataTable dt3 = new ProductLogic().SelectBestProduct(); OrderNumber.Text = dt3.Rows[0]["Total"].ToString() + " Orders"; string dp1 = dt3.Rows[0]["DesignFiles"].ToString(); String[] arr1 = dp1.Split(new String[] { "#,#" }, StringSplitOptions.RemoveEmptyEntries); topProimg.Src = arr1[arr1.Length - 1]; ProName.Text = dt3.Rows[0]["Name"].ToString(); DataTable dt5 = new InvoiceLogic().SelectTotalSale2(); Repeater2.DataSource = dt5; Repeater2.DataBind(); DataTable dt6 = new InventoryLogic().SelectRawStock(); Repeater1.DataSource = dt6; Repeater1.DataBind(); CustomerLogic CL = new CustomerLogic(); Repeater3.DataSource = CL.SelectForReport1(); Repeater3.DataBind(); TransitionLogic ol = new TransitionLogic(); Repeater9.DataSource = ol.SelectProductStatus1(DateTime.Today); Repeater9.DataBind(); TransitionLogic ol2 = new TransitionLogic(); Repeater4.DataSource = ol2.SelectOrderStatus1(DateTime.Today); Repeater4.DataBind(); }
public AttendanceController() { _attendanceLogic = new AttendanceLogic(); }
protected void Page_Load(object sender, EventArgs e) { if (Session["EmployeeID"] == null) { Response.Redirect("login.aspx"); } if (!IsPostBack) { Session["LastLink"] = Request.Url.PathAndQuery; } EmployeeLogic el = new EmployeeLogic(); Employee e1 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"])); Label1.Text = e1.Name; Image1.ImageUrl = e1.Photo; if (e1.Designation.Equals("MANAGING DIRECTOR")) { MDDiv.Visible = true; } else if (e1.Designation.Equals("MARKETING MANAGER")) { MarketingDiv.Visible = true; } else if (e1.Designation.Equals("MARKETING EMPLOYEE")) { MarketingDiv.Visible = true; } else if (e1.Designation.Equals("DESIGNER")) { DesignerDiv.Visible = true; } else if (e1.Designation.Equals("COMERCIAL MANAGER")) { ComercialDiv.Visible = true; } else if (e1.Designation.Equals("COMERCIAL EMPLOYEE")) { ComercialDiv.Visible = true; } else if (e1.Designation.Equals("STOCK MANAGER")) { StockDiv.Visible = true; } else if (e1.Designation.Equals("STOCK EMPLOYEE")) { StockDiv.Visible = true; } else if (e1.Designation.Equals("PRODUCTION MANAGER")) { ProDiv.Visible = true; } else if (e1.Designation.Equals("PRODUCTION EMPLOYEE")) { ProDiv.Visible = true; } else if (e1.Designation.Equals("HR MANAGER")) { HRDiv.Visible = true; } else if (e1.Designation.Equals("HR EMPLOYEE")) { HRDiv.Visible = true; } else if (e1.Designation.Equals("EMPLOYEE")) { EmpDiv.Visible = true; } else if (e1.Designation.Equals("CHAIRMAN")) { MDDiv.Visible = true; } else if (e1.Designation.Equals("ACCOUNTATANT")) { AccDiv.Visible = true; } DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today); float present = Convert.ToSingle(dt.Rows[0][1]); float absent = Convert.ToSingle(dt.Rows[1][1]); lblPResentPerc.Text = (present * 100) / (present + absent) + ""; attendanceperc.Attributes["aria-valuenow"] = (present * 100) / (present + absent) + ""; attendanceperc.Attributes["style"] = "width: " + ((present * 100) / (present + absent)) + "%"; }
protected void Page_Load(object sender, EventArgs e) { if (Session["EmployeeID"] == null) { Response.Redirect("login.aspx"); } if (!IsPostBack) { Session["LastLink"] = Request.Url.PathAndQuery; } EmployeeLogic el = new EmployeeLogic(); Employee e1 = el.SelectByID(Convert.ToInt32(Session["EmployeeID"])); Label1.Text = e1.Name; Image1.ImageUrl = e1.Photo; if (e1.Designation.Equals("MANAGING DIRECTOR")) { MDDiv.Visible = true; } else if (e1.Designation.Equals("MARKETING MANAGER")) { MarketingDiv.Visible = true; } else if (e1.Designation.Equals("MARKETING EMPLOYEE")) { MarketingDiv.Visible = true; } else if (e1.Designation.Equals("DESIGNER")) { DesignerDiv.Visible = true; } else if (e1.Designation.Equals("COMERCIAL MANAGER")) { ComercialDiv.Visible = true; } else if (e1.Designation.Equals("COMERCIAL EMPLOYEE")) { ComercialDiv.Visible = true; } else if (e1.Designation.Equals("STOCK MANAGER")) { StockDiv.Visible = true; } else if (e1.Designation.Equals("STOCK EMPLOYEE")) { StockDiv.Visible = true; } else if (e1.Designation.Equals("PRODUCTION MANAGER")) { ProDiv.Visible = true; } else if (e1.Designation.Equals("PRODUCTION EMPLOYEE")) { ProDiv.Visible = true; } else if (e1.Designation.Equals("HR MANAGER")) { HRDiv.Visible = true; } else if (e1.Designation.Equals("HR EMPLOYEE")) { HRDiv.Visible = true; } else if (e1.Designation.Equals("EMPLOYEE")) { EmpDiv.Visible = true; } else if (e1.Designation.Equals("CHAIRMAN")) { MDDiv.Visible = true; } else if (e1.Designation.Equals("ACCOUNTATANT")) { AccDiv.Visible = true; } DataTable dt = new AttendanceLogic().SelectForAttendanceReport(DateTime.Today); float present = Convert.ToSingle(dt.Rows[0][1]); float absent = Convert.ToSingle(dt.Rows[1][1]); lblPResentPerc.Text = (present * 100) / (present + absent)+""; attendanceperc.Attributes["aria-valuenow"] = (present * 100) / (present + absent) + ""; attendanceperc.Attributes["style"] = "width: "+((present * 100) / (present + absent)) + "%"; }
public ActionResult DownloadSemesterAttendance(string attendanceId) { EventViewModel viewModel = (EventViewModel)TempData["ViewModel"]; if (viewModel == null) { return(null); } try { if (!string.IsNullOrEmpty(attendanceId)) { long myAttendnaceId = Convert.ToInt64(Utility.Decrypt(attendanceId)); EventLogic eventLogic = new EventLogic(); StudentLevelLogic studentLevelLogic = new StudentLevelLogic(); AttendanceLogic attendanceLogic = new AttendanceLogic(); //ATTENDANCE myAttendnace = attendanceLogic.GetEntitiesBy(s => s.Event_Id == myAttendnaceId).LastOrDefault(); //if (myAttendnace == null) //{ // return null; //} List <STUDENT_LEVEL> studentLevels = new List <STUDENT_LEVEL>(); studentLevels = studentLevelLogic.GetEntitiesBy(s => s.Department_Id == viewModel.Department.Id && s.Level_Id == viewModel.Level.Id && s.Programme_Id == viewModel.Programme.Id && s.Session_Id == viewModel.Session.Id); List <ATTENDANCE> masterAttendance = new List <ATTENDANCE>(); for (int i = 0; i < studentLevels.Count; i++) { if (viewModel.EventType.Id == (int)EventTypes.Lecture && viewModel.Course != null && viewModel.Course.Id > 0) { ATTENDANCE attendance = ProcessCourseAttendance(viewModel.Course, studentLevels[i].STUDENT); if (attendance != null) { attendance.STUDENT = studentLevels[i].STUDENT; attendance.EVENT = eventLogic.GetEntitiesBy(e => e.Course_Id == viewModel.Course.Id).LastOrDefault(); masterAttendance.Add(attendance); } } else if (viewModel.EventType.Id == (int)EventTypes.HallAttendance && viewModel.Hall != null && viewModel.Hall.Id > 0) { ATTENDANCE attendance = ProcessHallAttendance(viewModel.Hall, studentLevels[i].STUDENT); if (attendance != null) { attendance.STUDENT = studentLevels[i].STUDENT; attendance.EVENT = eventLogic.GetEntitiesBy(e => e.Hall_Id == viewModel.Hall.Id).LastOrDefault(); masterAttendance.Add(attendance); } } else { ATTENDANCE attendance = ProcessOtherAttendance(viewModel.EventType, studentLevels[i].STUDENT); if (attendance != null) { attendance.STUDENT = studentLevels[i].STUDENT; attendance.EVENT = eventLogic.GetEntitiesBy(e => e.Event_Type_Id == viewModel.EventType.Id).LastOrDefault(); masterAttendance.Add(attendance); } } } GridView gv = new GridView(); DataTable ds = new DataTable(); if (masterAttendance.Count > 0) { List <ATTENDANCE> list = masterAttendance.OrderBy(p => p.STUDENT.Matric_Number).ToList(); List <SemesterAttendanceModel> sort = new List <SemesterAttendanceModel>(); for (int i = 0; i < list.Count; i++) { SemesterAttendanceModel attendance = new SemesterAttendanceModel(); attendance.SN = (i + 1); attendance.Name = list[i].STUDENT.PERSON.Last_Name + " " + list[i].STUDENT.PERSON.First_Name + " " + list[i].STUDENT.PERSON.Other_Name; attendance.Registration_Number = list[i].STUDENT.Matric_Number; attendance.Event_Type = list[i].EVENT.EVENT_TYPE.Name; if (list[i].EVENT.COURSE != null) { attendance.Course_Hall = list[i].EVENT.COURSE.Name; } else if (list[i].EVENT.HALL != null) { attendance.Course_Hall = list[i].EVENT.HALL.Name; } else { attendance.Course_Hall = ""; } attendance.Percentage = list[i].Percentage.ToString() + "%"; attendance.Status = list[i].IsEligible ? "Eligible" : "Not Eligible"; sort.Add(attendance); } gv.DataSource = sort; string caption = "Attendnace Report"; if (list != null && list.Count > 0) { caption = "Attendnace Report for " + list.FirstOrDefault().EVENT.DEPARTMENT.Name + ". " + list.FirstOrDefault().EVENT.LEVEL.Name + ". Session: " + list.FirstOrDefault().EVENT.SESSION.Name; } gv.Caption = caption.ToUpper(); gv.DataBind(); string filename = caption.Replace("\\", "") + ".xls"; return(new DownloadFileActionResult(gv, filename)); } else { Response.Write("No data available for download"); Response.End(); return(new JavaScriptResult()); } } } catch (Exception ex) { SetMessage("Error! " + ex.Message, Message.Category.Error); } return(RedirectToAction("SemesterAttendance", "Event", new { Area = "Admin" })); }