public JsonResult CheckMeetingTime(DateTime time, DateTime date, int empid) { if (empid != null && empid > 0) { scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <DAL.db.Appointment> list = scheduleAppointmentFactory.SearchScheduleAppointment(empid); var appointmentList = list.Where(x => x.AppointmentTime == time && x.AppointmentDate == date).Select(x => new { x.AppointmentBy, x.AppointmentID, x.AppointmentDate, x.EmployeeID, x.Employee.EmpName, x.Employee.Department.DepartmentName, x.Employee.Designation.DesignationName, x.CompanyName, x.Purpose, x.AppointmentTime, x.ReachTime, x.CardNO, x.Status, x.VisitorName, x.VisitorMobile, x.VisitorEmail, x.CreatedBy, x.CreatedDate, x.CheckedInTime, x.CheckedOutTime }).OrderBy(x => x.AppointmentTime); //appointmentList.OrderByDescending(x => x.AppointmentID); // var appointmentLists = appointmentList.OrderBy(x =>x.AppointmentTime); return(Json(appointmentList, JsonRequestBehavior.AllowGet)); } else { int employeeID = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id)); scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <DAL.db.Appointment> list = scheduleAppointmentFactory.SearchScheduleAppointment(employeeID); var appointmentList = list.Where(x => x.AppointmentTime == time && x.AppointmentDate == date).Select(x => new { x.AppointmentBy, x.AppointmentID, x.AppointmentDate, x.EmployeeID, x.Employee.EmpName, x.Employee.Department.DepartmentName, x.Employee.Designation.DesignationName, x.CompanyName, x.Purpose, x.AppointmentTime, x.ReachTime, x.CardNO, x.Status, x.VisitorName, x.VisitorMobile, x.VisitorEmail, x.CreatedBy, x.CreatedDate, x.CheckedInTime, x.CheckedOutTime }).OrderBy(x => x.AppointmentTime); //appointmentList.OrderByDescending(x => x.AppointmentID); // var appointmentLists = appointmentList.OrderBy(x =>x.AppointmentTime); return(Json(appointmentList, JsonRequestBehavior.AllowGet)); } }
public JsonResult GetEmployeeWiseFloor(int empID) { scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <Employee> list = scheduleAppointmentFactory.SearchEmployeeWiseFloor(empID); var empList = list.Select(x => new { x.EmployeeID, EmpName = x.EmpName + " => " + x.Designation.DesignationName + " (Floor-" + x.Floor + ")", x.Floor, x.DesignationID }); return(Json(empList, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadEmployee(int?empID) { scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <Employee> list = scheduleAppointmentFactory.SearchEmployee(empID); var empList = list.Select(x => new { x.EmployeeID, x.EmpName, x.DesignationID }); return(Json(empList, JsonRequestBehavior.AllowGet)); }
public JsonResult SaveScheduleAppointment(DAL.db.Appointment appointment) { scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); int employeeID = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id)); appointment.CreatedBy = employeeID; appointment.CreatedDate = toDayTime; result = scheduleAppointmentFactory.SaveAppointment(appointment); return(Json(result)); }
public JsonResult DepWiseEmployeeBehalf(int depID) { IVMS_DBEntities db = new IVMS_DBEntities(); int employeeID = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id)); var did = (from e in db.Employees where e.EmployeeID == employeeID select e.DesignationID).FirstOrDefault(); var dcode = (from d in db.Designations where d.DesignationID == did select d.Code).FirstOrDefault(); //var bid = (from e in db.Employees where e.EmployeeID == employeeID select e.OnBehalfEmployeeID).FirstOrDefault(); scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <Employee> list = scheduleAppointmentFactory.SearchDepWiseEmployeeBehalf(depID, (int)employeeID); var empList = list.Select(x => new { x.EmployeeID, EmpName = x.EmpName + " => " + x.Designation.DesignationName + " (Floor-" + x.Floor + ")", x.Floor, x.DesignationID }); return(Json(empList, JsonRequestBehavior.AllowGet)); }
public JsonResult LoadNotifyList() { IVMS_DBEntities db = new IVMS_DBEntities(); int employeeID = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id)); var did = (from e in db.Employees where e.EmployeeID == employeeID select e.DesignationID).FirstOrDefault(); var dcode = (from d in db.Designations where d.DesignationID == did select d.Code).FirstOrDefault(); if (dcode == "BEHALF") { //var onbhalfId = (from e in db.Employees where e.EmployeeID == employeeID select e.OnBehalfEmployeeID).FirstOrDefault(); var appointmentList = from x in db.Appointments join e in db.Employees on x.EmployeeID equals e.EmployeeID where e.OnBehalfEmployeeID == employeeID && (x.Status == "N" || x.Status == "P") select new { x.AppointmentBy, x.AppointmentID, x.AppointmentDate, x.EmployeeID, e.EmpName, x.CompanyName, x.Purpose, x.AppointmentTime, x.ReachTime, x.Status, x.VisitorName, x.NotifyMessage, x.ReplayMessage, x.CreatedBy, x.CreatedDate, x.VisitorMobile, x.VisitorEmail, e.OnBehalfEmployeeID }; //scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); //List<DAL.db.Appointment> list = scheduleAppointmentFactory.SearchNotifyDataPS((int)onbhalfId); //var appointmentList = list.Select(x => new { }); return(Json(appointmentList, JsonRequestBehavior.AllowGet)); } else { scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); List <DAL.db.Appointment> list = scheduleAppointmentFactory.SearchNotifyData(employeeID); var appointmentList = list.Select(x => new { x.AppointmentBy, x.AppointmentID, x.AppointmentDate, x.EmployeeID, x.Employee.EmpName, x.CompanyName, x.Purpose, x.AppointmentTime, x.ReachTime, x.Status, x.VisitorName, x.VisitorMobile, x.VisitorEmail, x.NotifyMessage, x.ReplayMessage, x.CreatedBy, x.CreatedDate, x.Employee.OnBehalfEmployeeID }); return(Json(appointmentList, JsonRequestBehavior.AllowGet)); } }
public JsonResult VisitorForward(DAL.db.Appointment appointment, int apID) { int results = 0; result = new Result(); int EmployeeID = Convert.ToInt32(dictionary[1].Id == "" ? 0 : Convert.ToInt32(dictionary[1].Id)); //var appData = db.Appointments.Where(x => (x.EmployeeID == EmployeeID) && (x.Status == "I") && (x.AppointmentID == apID)).FirstOrDefault(); var appData = db.Appointments.Where(x => x.AppointmentID == apID).FirstOrDefault(); if (appointment.EmployeeID == appData.EmployeeID) { result.isSucess = false; result.message = "Self forward is not allowed, Please select another employee!!!"; return(Json(result, JsonRequestBehavior.AllowGet)); } appData.CheckedOutTime = DateTime.Now; appData.Status = "O"; appointment.VisitorMobile = appData.VisitorMobile; db.Entry(appData).State = System.Data.Entity.EntityState.Modified; results = db.SaveChanges(); if (results == 1) { appointment.CheckedInTime = DateTime.Now; scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); result = scheduleAppointmentFactory.SaveAppointment(appointment); if (result.isSucess) { result.message = "Visitor Forward Successful."; } } return(Json(result, JsonRequestBehavior.AllowGet)); ////Card card = new Card(); //string cardID = string.Empty; //if (appointment.CardNO != string.Empty) //{ // string ip = ""; // int deviceNo = 0; // int portNO = 0; // cardFactory = new CardFactorys(); // utility = new Utility(); // // Getting device Information // var empInfo = db.Employees.Where(x => x.EmployeeID == appointment.EmployeeID).FirstOrDefault(); // var deviceInfo = db.DeviceInfoes.Where(x => x.FloorNO == empInfo.Floor).FirstOrDefault(); // //var cardInfo = db.Cards.Where(x => x.CardNO == appointment.CardNO).ToList(); // if (deviceInfo != null) // { // ip = deviceInfo.IPAddress; // deviceNo = deviceInfo.DeviceNO; // portNO = deviceInfo.PortNO; // if (appointment.Status == "AP") // { // result = utility.Connect(ip, deviceNo, portNO); // if (result.isSucess) // { // var cardInfo = cardFactory.GetFreeCard(deviceNo); // if (cardInfo != null) // { // appointment.CheckedInTime = DateTime.Now; // cardID = cardInfo.CardID.ToString(); // result = utility.AssignToDevice(deviceNo, cardID, appointment.CardNO); // //var card = new Card { CardID = Convert.ToInt16(cardID), CardNO = appointment.CardNO, DeviceNO = deviceNo }; // cardInfo.CardNO = appointment.CardNO; // result = cardFactory.SaveCard(cardInfo); // if (result.isSucess) // { // scheduleAppointmentFactory = new ScheduleAppointmentFactorys(); // result = scheduleAppointmentFactory.SaveAppointment(appointment); // if (result.isSucess) // { // result.message = "Visitor Forward Successful."; // } // } // } // else // { // result.isSucess = false; // result.message = deviceNo + " NO. Device Not Found."; // } // } // else // { // result.message = deviceNo + " Device Not Connected."; // return Json(result, JsonRequestBehavior.AllowGet); // } // } // } //} //else //{ // result.message = "Please Punch Visitor Card"; //} }