public object SaveAttendance(AttendanceParameterscs atteobj) { SchoolMainContext db = new ConcreateContext().GetContext(atteobj.Userid, atteobj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } TBLATTENDENCEMASTER objmster = new TBLATTENDENCEMASTER(); TBLATTENDENCE objDetail = new TBLATTENDENCE(); var checkatt = db.Vw_ATTENDANCECHECK.FirstOrDefault(r => r.DIVISIONID == atteobj.DIVISIONID && r.ATTEDANCEDATE == atteobj.ATTEDANCEDATE); //Duplicate Attendance Check if (checkatt == null) { try { objmster.ATTEDANCEDATE = atteobj.ATTEDANCEDATE; objmster.DIVISIONID = atteobj.DIVISIONID; objmster.DISPLAY = 1; objmster.EDUCATIONYEAR = "2018-2019"; var std = db.vw_FETCHSTANDARDBYDIVISION.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.DISPLAY == 1 && r.ACADEMICYEAR == "2018-2019").ToList(); objmster.STANDARDID = Convert.ToInt32(std[0].STANDARDID); objmster.CREATEDON = DateTime.Now; objmster.CREATEDID = atteobj.Userid; db.TBLATTENDENCEMASTERs.Add(objmster); db.SaveChanges(); //TBLNOTIFICATION objnotification = new TBLNOTIFICATION(); //objnotification.TITLE = "Daily Attendance"; //objnotification.NOTIFICATIONDATE = DateTime.Now; //objnotification.NOTIFICATIONTIME = DateTime.Now.ToString("h:mm tt"); //objnotification.DIVISIONID = atteobj.DIVISIONID; //objnotification.ACADEMICYEAR = "2018-2019"; //objnotification.NOTIFICATIONTYPE = "Attendance"; //db.TBLNOTIFICATIONs.Add(objnotification); //db.SaveChanges(); string absentno = atteobj.Absentno; string[] sbno = absentno.Split(','); objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; for (int i = 0; i < sbno.Length; i++) { string abno = sbno[i].ToString(); int rollno = Convert.ToInt32(abno); var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.ROLL_NO == rollno).ToList(); if (getstudent.Count == 0) { return(new Results() { IsSuccess = false, Message = "No students found for this division " }); } objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; objDetail.ROLLNO = sbno[i].ToString(); objDetail.NAME = getstudent[0].STUDENTNAME; objDetail.STUDENTID = getstudent[0].STUDENTID; objDetail.STATUS = "A"; db.TBLATTENDENCEs.Add(objDetail); db.SaveChanges(); string[] splitname = getstudent[0].STUDENTNAME.Split(' '); TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); string txtMessage = "Dear Parent, Your Pupil " + splitname[1] + ", is absent on " + Convert.ToDateTime(atteobj.ATTEDANCEDATE).ToString("dd/MM/yyyy") + ", Kindly note it. See attendance details goo.gl/iTjC9V"; if (smsstatus == "1") { SMSSendTESTDLR(getstudent[0].GMOBILE, txtMessage); } TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); FCMPushNotification OBJPUSH = new FCMPushNotification(); //var getsubjectname = db.VIEWSUBJECTNAMEs.Where(r => r.SUBJECTID == obj.subject).ToList(); string studentid = Convert.ToString(getstudent[i].STUDENTID); var userid = db.VIEWGETUSERIDFROMEMPCODEs.Where(r => r.EmpCode == studentid).FirstOrDefault(); var device = db.VW_DEVICE.FirstOrDefault(r => r.UserId == userid.UserId); if (device != null) { if (!string.IsNullOrWhiteSpace(device.DeviceId)) { OBJPUSH.SendNotification("Attendance", string.Format("Dear Parent, Your pupil is absent on dated {0}, kindly note.", objmster.ATTEDANCEDATE.Value.ToString("dd-MM-yyyy")), device.DeviceId); } } } return(new Results { IsSuccess = true, Message = "Attendance Save successfully" }); } catch (Exception e) { return(new Results { IsSuccess = false, Message = e.Message }); } } return(new Results { IsSuccess = false, Message = "Attedance already taken for this Date" }); }
public object ResultShow(ResultParam tobj) { SchoolMainContext db = new ConcreateContext().GetContext(tobj.UserName, tobj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var Info = db.TBLUSERLOGINs.Where(r => r.UserName == tobj.UserName && r.Password == tobj.Password).FirstOrDefault(); if (Info == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var academicyear = db.View_GETACADEMICYEAR.FirstOrDefault(); int EmployeeID = Convert.ToInt16(Info.EmpCode); double[] Display_grade; var GetStudentInfo = db.TBLTRANSFERSTUDENTs.Where(r => r.STUDENTID == EmployeeID && r.ACADEMICYEAR == "2018-2019").FirstOrDefault(); if (GetStudentInfo == null) { return(new Results() { IsSuccess = false, Message = "Student Not Found" }); } List <Mark> lt = new List <Mark>(); var StandardId = Convert.ToInt32(GetStudentInfo.STANDARDID); var DivisionId = GetStudentInfo.DIVISIONID; var GetTerm = db.View_GetTermwise_Cycle.Where(r => r.Term_ID == tobj.TermId && r.DISPLAY == 1 && r.TESTNAME.StartsWith("Terminal")).ToList(); for (int j = 0; j < GetTerm.Count(); j++) { int UnitId = Convert.ToInt32(GetTerm[j].UNITID); var CycleTest = db.View_DisplayMark_CycleTest.Where(r => r.STANDARDID == StandardId && r.DIVISIONID == DivisionId && r.DISPLAY == "1" && r.ACADEMICYEAR == "2018-2019" && r.TERMID == tobj.TermId && r.STUDENTID == EmployeeID && r.UNITTESTID == UnitId).OrderBy(r => r.SUBJECTID).ToList(); for (int i = 0; i < CycleTest.Count(); i++) { int Subjectid = Convert.ToInt32(CycleTest[i].SUBJECTID); var Subject = db.TBLSUBJECTMASTERs.Where(r => r.SUBJECTID == Subjectid).FirstOrDefault(); var GetCount = db.TBLASSIGNCOMPETENCIES.Where(r => r.STANDARDID == StandardId && r.SUBJECTID == Subjectid && r.DISPLAY == 1).Count(); int TBLCOMPETENCIES_Count = GetCount * 10; double totalmark = Convert.ToInt32(CycleTest[i].TOTALMARKS); double totmark = totalmark / TBLCOMPETENCIES_Count * 10; var tot_grade = db.TBLGRADEMASTERs.Where(r => r.MARKSFROM <= Math.Round(totmark) && r.MARKSTO >= Math.Round(totmark) && r.DISPLAY == 1).FirstOrDefault(); lt.Add(new Mark { SubjectName = Subject.SUBJECTNAME, Grade = totmark, }); //foreach (var item in lt) //{ // List<double> Main_Mark = new List<double>(); // List<string> Subject_List = db.TBLSUBJECTMASTERs.Where(r => r.SUBJECTNAME == item.SubjectName).Select(r => r.SUBJECTNAME).ToList(); // if(item.SubjectName == Subject.SUBJECTNAME) // { // Main_Mark.Add(Convert.ToDouble(item.Grade)); // } //} } } return(new ResultList() { IsSuccess = true, ResultLists = lt.ToArray() }); }
public object ADDTABLE(TimeTableParam tobj) { try { SchoolMainContext db = new ConcreateContext().GetContext(tobj.Userid, tobj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } TBLTIMETABLESCHEDULE data = db.TBLTIMETABLESCHEDULEs.Where(r => r.DISPLAY == 1 && r.EMPLOYEEID == tobj.EMPLOYEEID).FirstOrDefault(); if (data != null) { var info = db.TBLTIMETABLESCHEDULEs.Where(r => r.DISPLAY == 1 && r.BATCHID == tobj.BATCHID).FirstOrDefault(); if (info != null) { return(new Results() { IsSuccess = false, Message = "Already Time Table Created" }); } else { TBLTIMETABLESCHEDULE obj = new TBLTIMETABLESCHEDULE(); obj.EMPLOYEEID = tobj.EMPLOYEEID; obj.STANDARDID = tobj.STANDARDID; obj.SUBJECTID = tobj.SUBJECTID; obj.BATCHID = tobj.BATCHID; obj.WORKINGDAYS = tobj.WORKINGDAYS; obj.EDUYEAR = tobj.EDUYEAR; obj.DISPLAY = 1; obj.COMPANYID = 1; obj.CREATEDID = 1; obj.UPDATEDID = 1; obj.CREATEDON = System.DateTime.Now.Date; obj.UPDATEDON = System.DateTime.Now.Date; obj.TIMETABLENAME = tobj.TIMETABLENAME; obj.CLASSROOMID = tobj.CLASSROOMID; obj.DIVISION = tobj.DIVISION; obj.ROOMTYPE = tobj.ROOMTYPE; obj.LABBATCH = tobj.LABBATCH; db.TBLTIMETABLESCHEDULEs.Add(obj); db.SaveChanges(); } } return(new Results() { IsSuccess = true, Message = "Created Timetable" }); } catch (Exception ex) { var st = new StackTrace(ex, true); return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object DisplayAttendace(GetTeacherParam tobj) { SchoolMainContext db = new ConcreateContext().GetContext(tobj.USERID, tobj.Password); BiometricContext Bdb = new BiometricContext(); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var Info = db.TBLUSERLOGINs.Where(r => r.UserId == tobj.USERID && r.Password == tobj.Password).FirstOrDefault(); if (Info == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } List <Result> lts = new List <Result>(); string lt = string.Empty; string et = string.Empty; string intime = string.Empty, outtime = string.Empty; string latecoming = "", earlygoing = ""; int TotalPresent = 0, TotalAbscent = 0, Totalhalfday = 0; //var academicyear = db.View_GETACADEMICYEAR.FirstOrDefault(); int EmployeeID = Convert.ToInt16(Info.EmpCode); int year = DateTime.Now.Year; int month = Convert.ToInt32(tobj.Month); string monthstr = month.ToString(); if (monthstr.Length == 1) { monthstr = "0" + monthstr; } //year = Convert.ToInt32(academicyear.ACADEMICYEAR); string TableName = "DeviceLogs" + "_" + month + "_" + year; var results = Bdb.Database.SqlQuery <DevicesParam>("TeacherAttendance @TableName,@Month", new SqlParameter("@TableName", TableName), new SqlParameter("@Month", month)).ToList(); var TodayRecords = Enumerable.Range(1, DateTime.DaysInMonth(year, month)) // Days: 1, 2 ... 31 etc. .Select(day => new DateTime(year, month, day)) // Map each day to a date .ToList(); // Load dates into a list List <DateTime> li = TodayRecords; var EmployeeList = db.View_GetEmployee.ToList(); var EmployeeWiseList = db.View_GetEmployeeWiseData.Where(r => r.EMPLOYEEID == EmployeeID).ToList(); for (int i = 0; i < EmployeeWiseList.Count(); i++) { lt = Convert.ToDateTime(EmployeeWiseList[i].Intime).ToString("HH:mm:ss"); et = Convert.ToDateTime(EmployeeWiseList[i].Outtime).ToString("HH:mm:ss"); for (int k = 0; k < li.Count; k++) { for (int j = 0; j < results.Count(); j++) { if (Convert.ToInt32(results[j].userid) == EmployeeID) { intime = Convert.ToDateTime(results[j].InTime).ToString("hh:mm:ss tt"); outtime = Convert.ToDateTime(results[j].OutTime).ToString("hh:mm:ss tt"); } } string s = Convert.ToDateTime(li[k]).ToString("dd/MM/yyyy").Replace("-", "/"); //Convert.ToDateTime(dtfilter.Rows[k]["logdate"]).ToString("dd/MM/yyyy"); int late = DateTime.Compare(Convert.ToDateTime(lt), Convert.ToDateTime(intime)); int early = DateTime.Compare(Convert.ToDateTime(et), Convert.ToDateTime(outtime)); bool flag = false; bool Halfday = false; if (intime == outtime && intime == "00:00:00" && intime == "00:00:00") { } if (intime == "00:00:00" && intime == "00:00:00") { var Holiday = db.TBLHOLIDAYs.Where(r => r.STARTDATE <= li[k] && r.ENDDATE >= li[k] && r.TYPE == "Holiday").ToList(); if (Holiday.Count > 0) { Result ddl = new Result(); ddl.Date = (li[k]).ToString("dd/MM/yyyy"); ddl.Status = "Present"; lts.Add(ddl); } else { Result ddl = new Result(); ddl.Date = (li[k]).ToString("dd/MM/yyyy"); ddl.Status = "Absent"; lts.Add(ddl); } } else if (intime != "00:00:00" && intime != "00:00:00" && intime == outtime) { Result ddl = new Result(); ddl.Date = (li[k]).ToString("dd/MM/yyyy"); ddl.Status = "Absent"; lts.Add(ddl); } else { if (intime != "00:00:00") { if (flag == false) { if (late == -1) { TimeSpan lt1 = TimeSpan.Parse(lt); DateTime ts1new = DateTime.Parse(intime); latecoming = (ts1new - lt1).ToString(); Result ddl = new Result(); ddl.Date = (li[k]).ToString("dd/MM/yyyy"); ddl.Status = "HalfDay"; lts.Add(ddl); Halfday = true; } } } if (outtime != "00:00:00") { if (flag == false && Halfday == false) { if (early == 1) { TimeSpan et1 = TimeSpan.Parse(et); TimeSpan ts2new = TimeSpan.Parse(outtime); earlygoing = (et1 - ts2new).ToString(); Result ddl = new Result(); ddl.Date = (li[k]).ToString("dd/MM/yyyy"); ddl.Status = "HalfDay"; lts.Add(ddl); Totalhalfday++; } } } } } } // var courseList = ctx.Database.SqlQuery<Course>("exec GetCoursesByStudentId @StudentId ", idParam).ToList<Course>(); return(new DatewiseAttendace() { IsSuccess = false, DateWiseStatus = lts }); }
//public object GetHomework(PARAMHOMEWORK obj) //{ // try // { // SchoolMainContext db = new ConcreateContext().GetContext(obj.user, obj.PASSWORD); // var homework = db.VIEWHOMEWORKs.Where(r => r.STANDARDID == obj.standardid && r.DIVISIONID == obj.divisionid && r.DISPLAY == 1 && r.ACADEMICYEAR == "2018-2019"). // FirstOrDefault(); // if (homework == null) // { // return new Error() { IsError = true, Message = "Homework not found" }; // } // else // { // return homework; // } // } // catch (Exception E) // { // return new Error() { IsError = true, Message = E.Message }; // } //} public Object GetStandard(PARAMSTD obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.USERID, obj.PASSWORD); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var GETTYPE = db.VW_GET_USER_TYPE.Where(r => r.UserId == obj.USERID).ToList(); var AcadamicYear = db.View_GETACADEMICYEAR.FirstOrDefault(); if (AcadamicYear == null) { return(new Results { IsSuccess = false, Message = "Not Found Academic Year" }); } if (GETTYPE[0].UserType != "STUDENT") { var Division = db.VIEWDIVISIONLISTs.Where(r => r.STANDARDID == obj.STANDARDID && r.UserId == obj.USERID && r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR).ToList(); if (Division.Count == 0) { return(new Results { IsSuccess = false, Message = "Division Not Found" }); } else { return(new DivisionListResult() { IsSuccess = true, DivisionListByUser = Division }); } } else { var Division = db.VIEWDIVISIONLISTBYSTUDENTs.Where(r => r.STANDARDID == obj.STANDARDID && r.UserId == obj.USERID && r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR).ToList(); if (Division.Count == 0) { return(new Results { IsSuccess = false, Message = "Division Not Found" }); } else { return(new DivisionListResult() { IsSuccess = true, DivisionListByUser = Division }); } } } catch (Exception E) { return(new Results { IsSuccess = false, Message = E.Message }); } }
public object ViewNotification(ParamNotificationView obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } else { var Notification = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID); //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID); List <Result> lt = new List <Result>(); foreach (var att in Notification) { Result ddl = new Result(); ddl.TITLE = att.TITLE; ddl.NOTIFICATIONID = att.NOTIFICATIONID; ddl.NOTIFICATIONDATE = att.NOTIFICATIONDATE.ToString(); ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME; ddl.UserId = att.UserId.ToString(); ddl.STUDENTID = att.STUDENTID.ToString(); ddl.STATUS = att.STATUS.ToString(); ddl.UserType = att.UserType; lt.Add(ddl); } //foreach (var att in NotificationAll) //{ // Result ddl = new Result(); // ddl.TITLE = att.TITLE; // ddl.NOTIFICATIONID = att.NOTIFICATIONID; // ddl.NOTIFICATIONDATE = att.NOTIFICATIONDATE.ToString(); // ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME; // ddl.UserId = att.UserId.ToString(); // ddl.STUDENTID = att.STUDENTID.ToString(); // ddl.STATUS = att.STATUS.ToString(); // ddl.UserType = att.UserType; // lt.Add(ddl); //} if (lt == null) { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "No Notifications Found" } }); } else { return(new DivisionListResult() { IsSuccess = true, Notification = lt.ToList().OrderByDescending(r => r.NOTIFICATIONID) }); } } } catch (Exception E) { return(new Results { IsSuccess = false, Message = E.Message }); } }
public object GetAttendanceByUser(ParamDateWiseAttendance obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.UserId, obj.Password); var usertype = db.VW_GET_USER_TYPE.Where(r => r.UserId == obj.UserId).ToList(); if (usertype.Count() == 0) { return(new AttendanceResult() { IsSuccess = false, UserWiseAttendanceList = "User Not Found" }); } if (usertype[0].UserType == "STUDENT") { var checkattendace = db.VIewAttendaceClasswiseChecks.Where(r => r.UserId == obj.UserId && r.ATTEDANCEDATE == obj.AttendanceDate && r.DISPLAY == 1 && r.EDUCATIONYEAR == "2018-2019" && r.ACADEMICYEAR == "2018-2019").ToList(); if (checkattendace.Count() == 0) { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : Attendance Is Not Marked By Class Teacher For This Date" }); } else { var StudentAttendance = db.VWATTENDANCEBYDATESTUDENTs.Where(r => r.UserId == obj.UserId && r.ATTEDANCEDATE == obj.AttendanceDate).ToList(); if (StudentAttendance.Count() == 0) { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : Present" }); //EMPLOYEE logic // return new Error() { IsError = true, Message = "Attendance not found" }; } else { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : Absent" }); } } } else { var EMPATTENDANCE = db.VWATTENDANCEEMPLOYEEs.Where(r => r.UserId == obj.UserId && r.ATTEDANCEDATE == obj.AttendanceDate && r.DISPLAY == 1).ToList(); if (usertype[0].UserType == "CLASS TEACHER") { if (EMPATTENDANCE.Count() == 0) { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : Attendance Not Completed" }); } else { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : Attendance Completed" }); } } else { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = "Status : User is not class Teacher" }); } } } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } }
public object SaveDevice(ParamDevice obj, string Password) { SchoolMainContext db = new ConcreateContext().GetContext(obj.UserId, Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } TBLDeviceRegistration objDR = new TBLDeviceRegistration(); var getUserId = db.VW_DEVICE.Where(r => r.UserId == obj.UserId).FirstOrDefault(); try { if (getUserId == null) { //save objDR.UserId = obj.UserId; objDR.DeviceId = obj.DeviceId; objDR.DeviceType = obj.DeviceType; objDR.InsertDate = DateTime.Now; objDR.ModifiedDate = DateTime.Now; objDR.Status = true; db.TBLDeviceRegistrations.Add(objDR); db.SaveChanges(); return(new Results() { IsSuccess = true, Message = new InvalidUser() { IsSuccess = true, Result = "Device Registration Succesfull!" } }); } else { //update TBLDeviceRegistration objdetail = db.TBLDeviceRegistrations.First(r => r.UserId == obj.UserId); objdetail.Id = getUserId.Id; objdetail.UserId = getUserId.UserId; objdetail.DeviceId = obj.DeviceId; objdetail.DeviceType = obj.DeviceType; objdetail.InsertDate = getUserId.InsertDate; objdetail.ModifiedDate = DateTime.Now; objdetail.Status = true; //db.TBLDeviceRegistrations.Add(objdetail); db.SaveChanges(); return(new Results() { IsSuccess = true, Message = new InvalidUser() { IsSuccess = true, Result = "Notification Updated successfully" } }); } } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.ToString() }); } }
public object GetExamSchedule(ParamExamSchedule OBJ) { try { SchoolMainContext db = new ConcreateContext().GetContext(OBJ.USERID, OBJ.PASSWORD); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var AcadamicYear = db.View_GETACADEMICYEAR.FirstOrDefault(); if (AcadamicYear == null) { return(new Results { IsSuccess = false, Message = "Not Found Academic Year" }); } var result = db.VW_EXAMSCHEDULE.Where(r => r.STANDARDID.Contains("" + OBJ.STANDARDID + "") && r.TESTTYPEID == OBJ.TESTID && r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR).ToList(); if (result.Count == 0) { return(new InvalidUser() { IsSuccess = false, Result = "Record Not Found" }); } List <examclass> Details = new List <examclass>(); for (int i = 0; i < result.Count; i++) { string[] std = result[i].STANDARDID.Split(','); int count = 0; for (int j = 0; j < std.Length; j++) { if (std[j] == OBJ.STANDARDID) { count = j; } } string[] sub = result[i].SUBJECTID.Split(','); int subid = int.Parse(sub[count]); var subname = db.VIEWSUBJECTNAMEs.Where(r => r.SUBJECTID == subid).SingleOrDefault(); int testid = int.Parse(result[i].TESTTYPEID.ToString()); var testname = db.VW_UNITMASTER.Where(r => r.UNITID == testid).SingleOrDefault(); Details.Add(new examclass { Subject = subname.SUBJECTNAME, Test = testname.TESTNAME, ExamDate = result[i].EXAMDATE, ExamTime = result[i].EXAMTIME }); } return(new InvalidUser() { IsSuccess = true, Result = Details.ToArray() }); } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object SaveAttendance(AttendanceParameterscs atteobj) { SchoolMainContext db = new ConcreateContext().GetContext(atteobj.Userid, atteobj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } TBLATTENDENCEMASTER objmster = new TBLATTENDENCEMASTER(); TBLATTENDENCE objDetail = new TBLATTENDENCE(); var logindetail = db.TBLUSERLOGINs. Where(r => r.UserId == atteobj.Userid && r.Password == atteobj.Password && r.STATUS == "ACTIVE") .FirstOrDefault(); var ClassTeacherCheck = db.TBLASSIGNCLASSTEACHERs.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.ACADEMICYEAR == "2018-2019" && r.DISPLAY == 1).ToList(); if (ClassTeacherCheck.Count != 0) { var checkatt = db.Vw_ATTENDANCECHECK.FirstOrDefault(r => r.DIVISIONID == atteobj.DIVISIONID && r.ATTEDANCEDATE == atteobj.ATTEDANCEDATE); //Duplicate Attendance Check if (checkatt == null) { try { objmster.ATTEDANCEDATE = atteobj.ATTEDANCEDATE; objmster.DIVISIONID = atteobj.DIVISIONID; objmster.DISPLAY = 1; objmster.EDUCATIONYEAR = "2018-2019"; var std = db.vw_FETCHSTANDARDBYDIVISION.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.DISPLAY == 1 && r.ACADEMICYEAR == "2018-2019").ToList(); objmster.STANDARDID = Convert.ToInt32(std[0].STANDARDID); objmster.CREATEDON = DateTime.Now; objmster.CREATEDID = atteobj.Userid; db.TBLATTENDENCEMASTERs.Add(objmster); db.SaveChanges(); TBLNOTIFICATION objnotification = new TBLNOTIFICATION(); objnotification.TITLE = "Daily Attendance"; objnotification.NOTIFICATIONDATE = DateTime.Now; objnotification.NOTIFICATIONTIME = DateTime.Now.ToString("h:mm tt"); objnotification.DIVISIONID = atteobj.DIVISIONID; objnotification.ACADEMICYEAR = "2018-2019"; objnotification.NOTIFICATIONTYPE = "Attendance"; db.TBLNOTIFICATIONs.Add(objnotification); db.SaveChanges(); string absentno = atteobj.Absentno; string[] sbno = absentno.Split(','); objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; for (int i = 0; i < sbno.Length; i++) { string abno = sbno[i].ToString(); int rollno = Convert.ToInt32(abno); var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.ROLL_NO == rollno).ToList(); if (getstudent.Count == 0) { return(new Results() { IsSuccess = false, Message = "No students found for this division " }); } objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; objDetail.ROLLNO = sbno[i].ToString(); objDetail.NAME = getstudent[0].STUDENTNAME; objDetail.STUDENTID = getstudent[0].STUDENTID; objDetail.STATUS = "A"; db.TBLATTENDENCEs.Add(objDetail); db.SaveChanges(); string[] splitname = getstudent[0].STUDENTNAME.Split(' '); TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); objnotidetails.NOTIFICATIONID = objnotification.NOTIFICATIONID; objnotidetails.STUDENTID = getstudent[0].STUDENTID; objnotidetails.STATUS = 0; db.TBLNOTIFICATIONDETAILs.Add(objnotidetails); db.SaveChanges(); string str = ""; if (logindetail.UserName.StartsWith("NKV")) { str = "goo.gl/NsoiKY"; } else if (logindetail.UserName.StartsWith("SXS")) { str = "goo.gl/zotf13"; } else if (logindetail.UserName.StartsWith("ASM")) { str = "goo.gl/9vNiX8"; } else if (logindetail.UserName.StartsWith("ASY")) { str = "goo.gl/SNtreT"; } else if (logindetail.UserName.StartsWith("NMS")) { str = "goo.gl/j7XjCx"; } string txtMessage = "Dear Parent, Your Pupil " + splitname[1] + ", is absent on " + Convert.ToDateTime(atteobj.ATTEDANCEDATE).ToString("dd/MM/yyyy") + ", Kindly note it. See attendance details " + str; if (smsstatus == "1") { string responseString = SMSSendTESTDLR(getstudent[0].GMOBILE, txtMessage, logindetail.UserName); if (responseString != "") { var jObject = JObject.Parse(responseString); var response = jObject["response"].ToString(); TBLMSGHISTORY smshist = new TBLMSGHISTORY(); smshist.DATE = DateTime.Now; smshist.TIME = DateTime.Now.ToShortTimeString(); smshist.MSG = txtMessage; smshist.TYPE = "ATT"; smshist.CREATEDID = atteobj.Userid; smshist.DISPLAY = 1; smshist.STUDENTID = getstudent[0].STUDENTID; smshist.FROMEMPID = Convert.ToInt64(logindetail.EmpCode); smshist.STATUS = "Out"; smshist.InStatus = "In"; smshist.OutStatus = "Out"; smshist.REQUESTID = response; smshist.EMPLOYEEID = 0; smshist.TOEMPID = "0"; smshist.ATTACHMENTS = ""; smshist.SUBJECT = ""; smshist.OtherNos = ""; smshist.ALUMNIID = 0; db.TBLMSGHISTORies.Add(smshist); db.SaveChanges(); } } FCMPushNotification OBJPUSH = new FCMPushNotification(); //var getsubjectname = db.VIEWSUBJECTNAMEs.Where(r => r.SUBJECTID == obj.subject).ToList(); string studentid = Convert.ToString(getstudent[0].STUDENTID); var userid = db.VIEWGETUSERIDFROMEMPCODEs.Where(r => r.EmpCode == studentid).FirstOrDefault(); var device = db.VW_DEVICE.FirstOrDefault(r => r.UserId == userid.UserId); if (device != null) { if (!string.IsNullOrWhiteSpace(device.DeviceId)) { OBJPUSH.SendNotification("Attendance", string.Format("Dear Parent, Your pupil is absent on dated {0}, kindly note.", objmster.ATTEDANCEDATE.Value.ToString("dd-MM-yyyy")), device.DeviceId); } } } return(new Results { IsSuccess = true, Message = "Attendance Save successfully" }); } catch (Exception e) { return(new Results { IsSuccess = false, Message = e.Message }); } } return(new Results { IsSuccess = false, Message = "Attedance already taken for this Date" }); } return(new Results { IsSuccess = false, Message = "Class teacher is not assign to this division" }); }
public object FileUpload(homeworkparameters obj) { int Userid = Convert.ToInt32(HttpContext.Current.Request["Userid"]); var Password = HttpContext.Current.Request["Password"]; SchoolMainContext db = new ConcreateContext().GetContext(Userid, Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var logindetail = db.TBLUSERLOGINs. Where(r => r.UserId == Userid && r.Password == Password && r.STATUS == "ACTIVE") .FirstOrDefault(); var getUserType = db.VW_GET_USER_TYPE.Where(r => r.UserId == Userid).FirstOrDefault(); try { ///Base Url string UploadBaseUrl = ""; var httpRequest = HttpContext.Current.Request; if (httpRequest.Files.Count > 0) { if (logindetail.UserName.StartsWith("NKV")) { UploadBaseUrl = ConfigurationManager.AppSettings["NkvsBaseUrl"]; } else if (logindetail.UserName.StartsWith("SXS")) { UploadBaseUrl = ConfigurationManager.AppSettings["StxavierBaseUrl"]; } else if (logindetail.UserName.StartsWith("ASM")) { UploadBaseUrl = ConfigurationManager.AppSettings["AsmBaseUrl"]; } else if (logindetail.UserName.StartsWith("ASY")) { UploadBaseUrl = ConfigurationManager.AppSettings["AsyBaseUrl"]; } else if (logindetail.UserName.StartsWith("NMS")) { UploadBaseUrl = ConfigurationManager.AppSettings["NmsBaseUrl"]; } string ftp = UploadBaseUrl; //Upload File Using FTP string ftpFolder = "UPLOADFILE/"; byte[] fileBytes = null; string fileName = ""; foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; fileName = postedFile.FileName; using (StreamReader fileStream = new StreamReader(httpRequest.Files[file].InputStream)) { fileBytes = Encoding.UTF8.GetBytes(fileStream.ReadToEnd()); fileStream.Close(); } try { //Create FTP Request. FtpWebRequest request = (FtpWebRequest)WebRequest.Create(ftp + ftpFolder + fileName); request.Method = WebRequestMethods.Ftp.UploadFile; //Enter FTP Server credentials. request.Credentials = new NetworkCredential("akronsystems", "Password@123"); request.ContentLength = fileBytes.Length; request.UsePassive = true; request.UseBinary = true; request.ServicePoint.ConnectionLimit = fileBytes.Length; request.EnableSsl = false; Stream requestStream = request.GetRequestStream(); requestStream.Write(fileBytes, 0, fileBytes.Length); requestStream.Close(); FtpWebResponse response = (FtpWebResponse)request.GetResponse(); response.Close(); ////Save HomeWork To the Table TBLHOMEWORK upload = new TBLHOMEWORK(); upload.STANDARDID = Convert.ToInt32(HttpContext.Current.Request["standardid"]); upload.CREATEDID = int.Parse(getUserType.EmpCode); upload.DIVISIONID = HttpContext.Current.Request["division"]; upload.SUBJECTID = Convert.ToInt32(HttpContext.Current.Request["subject"]); upload.TERMID = Convert.ToInt32(HttpContext.Current.Request["term"]); upload.HOMEWORK = HttpContext.Current.Request["homeworkdescription"]; upload.HOMEWORKDATE = Convert.ToDateTime(DateTime.Now.ToShortDateString()); upload.CREATEDON = Convert.ToDateTime(DateTime.Now.ToShortDateString()); upload.TIME = DateTime.Now.ToShortTimeString(); upload.DISPLAY = 1; upload.ACADEMICYEAR = "2018-2019"; upload.FILEPATH = fileName; db.TBLHOMEWORKs.Add(upload); db.SaveChanges(); ///Save HomeWork Notification TBLNOTIFICATION objmaster = new TBLNOTIFICATION(); TBLNOTIFICATIONDETAIL objdetail = new TBLNOTIFICATIONDETAIL(); objmaster.TITLE = HttpContext.Current.Request["homeworkdescription"]; objmaster.NOTIFICATIONDATE = DateTime.Now; objmaster.NOTIFICATIONTIME = DateTime.Now.ToShortTimeString(); objmaster.ACADEMICYEAR = "2018-2019"; objmaster.DIVISIONID = Convert.ToInt32(HttpContext.Current.Request["division"]); objmaster.NOTIFICATIONTYPE = "Homework"; db.TBLNOTIFICATIONs.Add(objmaster); db.SaveChanges(); objdetail.NOTIFICATIONID = objmaster.NOTIFICATIONID; var DivisionId = Convert.ToInt32(HttpContext.Current.Request["division"]); var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == DivisionId).ToList(); if (getstudent == null) { return(new Results { IsSuccess = false, Message = "Student Not Found" }); } // return getstudent; for (int i = 0; i < getstudent.Count; i++) { TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); objnotidetails.NOTIFICATIONID = objmaster.NOTIFICATIONID; objnotidetails.STUDENTID = getstudent[i].STUDENTID; objnotidetails.STATUS = 0; db.TBLNOTIFICATIONDETAILs.Add(objnotidetails); db.SaveChanges(); FCMPushNotification OBJPUSH = new FCMPushNotification(); //var getsubjectname = db.VIEWSUBJECTNAMEs.Where(r => r.SUBJECTID == obj.subject).ToList(); string studentid = Convert.ToString(getstudent[i].STUDENTID); var userid = db.VIEWGETUSERIDFROMEMPCODEs.Where(r => r.EmpCode == studentid).FirstOrDefault(); var device = db.VW_DEVICE.FirstOrDefault(r => r.UserId == userid.UserId); if (device != null) { if (!string.IsNullOrWhiteSpace(device.DeviceId)) { OBJPUSH.SendNotification("Homework", obj.homeworkdescription, device.DeviceId); } } //if (smsstatus == "1") //{ // SMSSendTESTDLR(getstudent[i].GMOBILE, objHomework.HOMEWORK); //} } return(new Results { IsSuccess = true, Message = "Homework assign successfully" }); } catch (WebException ex) { return(new Results { IsSuccess = false, Message = "Failed to upload File" }); } } } } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.ToString() }); } return(null); }
public object GetFee(FeePram obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var data = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault(); int StudentId = Convert.ToInt32(data.EmpCode); var getlist = db.View_DisplayFee.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); var GetStanderd = db.TBLSTUDENTADMISSIONs.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); var GetFee = db.View_FeeSetting.Where(r => r.STANDARDID == GetStanderd.STANDARDID).FirstOrDefault(); var RemaingFee = db.View_RemainingFeeDisplay.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); if (GetFee == null) { return(new Results { IsSuccess = false, Message = "Fee Not Found" }); } //else //{ // return new FeeList() { IsSuccess = true, TotalFee = GetFee.TOTALFEES }; //} else if (RemaingFee == null) { return new Results { IsSuccess = false, Message = "Fee Not Found" } } ; else { double Cocession = 0, TotalFee = 0; string dateadmission = ""; string ANNUALFEE = ""; dateadmission = Convert.ToDateTime(getlist.ADMISSIONDATE).ToShortDateString(); string[] admsndate = dateadmission.Split('/'); int ADMISSIONYEAR = 0, NEXTYEAR = 0; dateadmission = admsndate[2]; if (dateadmission != "") { int.TryParse(dateadmission, out ADMISSIONYEAR); } NEXTYEAR = ADMISSIONYEAR + 1; string STUDADMISSIONYEAR = ADMISSIONYEAR + "-" + NEXTYEAR; if (STUDADMISSIONYEAR == getlist.ACADEMICYEAR) { //newadmission TotalFee = Convert.ToDouble(GetFee.TOTALFEES); } else { var AdmissionFee = db.View_FeeSetting.Where(r => r.FEETYPEID == 1).FirstOrDefault(); TotalFee = Convert.ToDouble(GetFee.TOTALFEES) - Convert.ToDouble(AdmissionFee.AMOUNT); //oldadmission } if (getlist.CONCESSION != null) { Cocession = Convert.ToDouble(getlist.CONCESSION); } TotalFee = TotalFee - Cocession; return(new FeeList() { IsSuccess = true, TotalFee = TotalFee, RemainingFee = RemaingFee.AMOUNT }); } } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object getUserInfo(GetUserId UserId) { try { SchoolMainContext db = new ConcreateContext().GetContext(UserId.UserId, UserId.PASSWORD); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } object result = ""; var getUserType = db.VW_GET_USER_TYPE.Where(r => r.UserId == UserId.UserId).FirstOrDefault(); if (getUserType != null) { if (getUserType.UserType == "STUDENT") { STUDENTINFO_BUSINESS GetStudobj = new STUDENTINFO_BUSINESS(); result = GetStudobj.getStudInfo(int.Parse(getUserType.EmpCode), UserId.UserId, UserId.PASSWORD); var notificationUnreadCount = GetStudobj.getNotifCount(int.Parse(getUserType.EmpCode), Convert.ToInt16(UserId.UserId), UserId.PASSWORD); if (result != null && result is VW_STUDENT_INFO) { (result as VW_STUDENT_INFO).HomeworkNotificationUnreadCount = (int)notificationUnreadCount; InstituteBusiness Ibl = new InstituteBusiness(); var inresult = Ibl.GetInstituteName(UserId); if (inresult != null && inresult is ResultBirth) { var r = inresult as ResultBirth; var n = r.Result as ViewGetInstituteName; (result as VW_STUDENT_INFO).InstituteName = n.INSTITUTE_NAME; } } } else if (getUserType.UserType == "Alumini") { return(new Results { IsSuccess = true, Message = "Alumini User" }); } else { GetTeacherInfoBusiness GetTeacherobj = new GetTeacherInfoBusiness(); result = GetTeacherobj.getTeacherInfo(int.Parse(getUserType.EmpCode), UserId.UserId, UserId.PASSWORD); if (result != null && result is VW_EMPLOYEE) { InstituteBusiness Ibl = new InstituteBusiness(); var inresult = Ibl.GetInstituteName(UserId); if (inresult != null && inresult is ResultBirth) { var r = inresult as ResultBirth; var n = r.Result as ViewGetInstituteName; (result as VW_EMPLOYEE).InstituteName = n.INSTITUTE_NAME; } } } return(result); } return(new Results { IsSuccess = false, Message = "User Not Found" }); } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object GETSTUDENT(GETSTUDENTPARAM OBJ) { try { SchoolMainContext db = new ConcreateContext().GetContext(OBJ.USERID, OBJ.PASSWORD); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var AcadamicYear = db.View_GETACADEMICYEAR.FirstOrDefault(); if (AcadamicYear == null) { return(new Results { IsSuccess = false, Message = "Not Found Academic Year" }); } var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == OBJ.DIVISIONID && r.ACADEMICYEAR == AcadamicYear.ACADEMICYEAR).ToList(); if (getstudent.Count() == 0) { return new Results { IsSuccess = false, Message = "Student Not Found" } } ; else { //return getstudent.OrderBy(r => r.ROLL_NO).ToList(); return new STUDENTLISTRESULT() { IsSuccess = true, StudentResult = getstudent.OrderBy(r => r.ROLL_NO).ToList() } }; //var attendance = db.VIEWATTENDANCEs. // Where(r => r.ATTEDANCEDATE == DATE && r.DISPLAY == 1 ) // .FirstOrDefault(); //if (attendance == null) // return new Error() { IsError = true, Message = "ATTENDANCE IS NOT AVAILABLE." }; //else // return attendance; } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object Savehomework(homeworkparameters obj) { SchoolMainContext db = new ConcreateContext().GetContext(obj.Userid, obj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } TBLHOMEWORK objHomework = new TBLHOMEWORK(); var getUserType = db.VW_GET_USER_TYPE.Where(r => r.UserId == obj.Userid).FirstOrDefault(); objHomework.STANDARDID = int.Parse(obj.standardid); objHomework.CREATEDID = int.Parse(getUserType.EmpCode); objHomework.DIVISIONID = obj.division.ToString(); objHomework.SUBJECTID = obj.subject; objHomework.TERMID = obj.term; objHomework.HOMEWORK = obj.homeworkdescription; objHomework.HOMEWORKDATE = Convert.ToDateTime(DateTime.Now.ToShortDateString()); objHomework.TIME = DateTime.Now.ToShortTimeString(); objHomework.DISPLAY = 1; objHomework.ACADEMICYEAR = "2018-2019"; db.TBLHOMEWORKs.Add(objHomework); db.SaveChanges(); TBLNOTIFICATION objnotification = new TBLNOTIFICATION(); objnotification.TITLE = obj.homeworkdescription; objnotification.NOTIFICATIONDATE = DateTime.Now; objnotification.NOTIFICATIONTIME = DateTime.Now.ToString("h:mm tt"); objnotification.DIVISIONID = int.Parse(obj.division); objnotification.ACADEMICYEAR = "2018-2019"; objnotification.NOTIFICATIONTYPE = "Homework"; db.TBLNOTIFICATIONs.Add(objnotification); db.SaveChanges(); string[] divid = objHomework.DIVISIONID.ToString().Split(','); for (int d = 0; d < divid.Length; d++) { int singledivision = Convert.ToInt32(divid[d]); var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == singledivision).ToList(); if (getstudent == null) { return(new Results { IsSuccess = false, Message = "Student Not Found" }); } // return getstudent; for (int i = 0; i < getstudent.Count; i++) { TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); objnotidetails.NOTIFICATIONID = objnotification.NOTIFICATIONID; objnotidetails.STUDENTID = getstudent[i].STUDENTID; objnotidetails.STATUS = 0; db.TBLNOTIFICATIONDETAILs.Add(objnotidetails); db.SaveChanges(); FCMPushNotification OBJPUSH = new FCMPushNotification(); //var getsubjectname = db.VIEWSUBJECTNAMEs.Where(r => r.SUBJECTID == obj.subject).ToList(); string studentid = Convert.ToString(getstudent[i].STUDENTID); var userid = db.VIEWGETUSERIDFROMEMPCODEs.Where(r => r.EmpCode == studentid).FirstOrDefault(); var device = db.VW_DEVICE.FirstOrDefault(r => r.UserId == userid.UserId); if (device != null) { if (!string.IsNullOrWhiteSpace(device.DeviceId)) { OBJPUSH.SendNotification("Homework", obj.homeworkdescription, device.DeviceId); } } if (smsstatus == "1") { SMSSendTESTDLR(getstudent[i].GMOBILE, objHomework.HOMEWORK); } } } return(new Results { IsSuccess = true, Message = "Homework assign successfully and SMS sent Sucessfully" }); }
public object GetClassWiseStatus(ParamDateWiseAttendance PA) { try { SchoolMainContext db = new ConcreateContext().GetContext(PA.UserId, PA.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var usertype = db.VW_GET_USER_TYPE.Where(r => r.UserId == PA.UserId).ToList(); if (usertype.Count() == 0) { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "Incorrect Username" } }); } var EMPATTENDANCE = db.VWATTENDANCEEMPLOYEEs.Where(r => r.UserId == PA.UserId && r.ATTEDANCEDATE == PA.AttendanceDate && r.DISPLAY == 1).ToList(); if (EMPATTENDANCE.Count() == 0) { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "Attendance Is Not Marked By Class Teacher" } }); } if (usertype.Count() == 0) { return(new AttendanceResult() { IsSuccess = false, UserWiseAttendanceList = new InvalidUser() { IsSuccess = false, Result = "User Not Found" } }); } if (usertype[0].UserType != "CLASS TEACHER") { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "User Is Not Class Teacher" } }); } else { var AttendaceStatus = db.VW_DATEWISECLASSSTATUSATTENDANCE.Where(r => r.ATTEDANCEDATE == PA.AttendanceDate && r.CREATEDID == PA.UserId).ToList().OrderBy(r => r.ROLLNO); if (AttendaceStatus.Count() == 0) { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "No Records Found" } }); } else { return(new AttendanceResult() { IsSuccess = true, UserWiseAttendanceList = AttendaceStatus.ToList().OrderBy(r => r.ROLLNO) }); } } } catch (Exception e) { return(new Results { IsSuccess = false, Message = e.Message }); } }
public object FileUpload(homeworkparameters obj) { int Userid = Convert.ToInt32(HttpContext.Current.Request["Userid"]); var Password = HttpContext.Current.Request["Password"]; SchoolMainContext db = new ConcreateContext().GetContext(Userid, Password); var getUserType = db.VW_GET_USER_TYPE.Where(r => r.UserId == Userid).FirstOrDefault(); //if (!Request.Content.IsMimeMultipartContent()) //{ // throw new HttpResponseException(HttpStatusCode.UnsupportedMediaType); //} try { var httpRequest = HttpContext.Current.Request; if (httpRequest.Files.Count > 0) { string UploadBaseUrl = ConfigurationManager.AppSettings["UploadBaseURL"]; string fileName = string.Empty; var filePath = string.Empty; string savePath = string.Empty; foreach (string file in httpRequest.Files) { var postedFile = httpRequest.Files[file]; fileName = postedFile.FileName; filePath = ConfigurationManager.AppSettings["UploadDir"] + Guid.NewGuid() + fileName; savePath = HttpContext.Current.Server.MapPath(filePath); postedFile.SaveAs(savePath); // NOTE: To store in memory use postedFile.InputStream } TBLHOMEWORK upload = new TBLHOMEWORK(); //upload.file_id = Guid.NewGuid().ToString(); //upload.name = fileName; upload.STANDARDID = Convert.ToInt32(HttpContext.Current.Request["standardid"]); upload.CREATEDID = int.Parse(getUserType.EmpCode); upload.DIVISIONID = HttpContext.Current.Request["division"]; upload.SUBJECTID = Convert.ToInt32(HttpContext.Current.Request["subject"]); upload.TERMID = Convert.ToInt32(HttpContext.Current.Request["term"]); upload.HOMEWORK = HttpContext.Current.Request["homeworkdescription"]; upload.HOMEWORKDATE = Convert.ToDateTime(DateTime.Now.ToShortDateString()); upload.TIME = DateTime.Now.ToShortTimeString(); upload.DISPLAY = 1; upload.ACADEMICYEAR = "2018-2019"; upload.FILEPATH = UploadBaseUrl + filePath.Replace("~/", ""); //upload.insert_date = DateTime.Now; db.TBLHOMEWORKs.Add(upload); db.SaveChanges(); return(upload); } return(new Results { IsSuccess = false, Message = "Failed to upload File" }); } } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.ToString() }); } return(null); }
public object ViewAllNotification(ParamNotificationView obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } else { List <Result> lt = new List <Result>(); var NotificationHome = db.VIEWNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID); //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID); foreach (var att in NotificationHome) { Result ddl = new Result(); ddl.TITLE = att.TITLE; ddl.NOTIFICATIONID = att.NOTIFICATIONID; ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE); ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME; ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE; ddl.UserId = att.UserId.ToString(); ddl.STUDENTID = att.STUDENTID.ToString(); ddl.STATUS = att.STATUS.ToString(); ddl.UserType = att.UserType; lt.Add(ddl); } var Notification = db.VIEWGENERALNOTIFICATIONs.Where(r => r.UserId == obj.userid).ToList().OrderByDescending(r => r.NOTIFICATIONID); //var NotificationAll = db.VIEWALLNOTIFICATIONs.ToList().OrderByDescending(r => r.NOTIFICATIONID); if (Notification.Count() != 0) { foreach (var att in Notification) { Result ddl = new Result(); ddl.TITLE = att.TITLE; ddl.NOTIFICATIONID = att.NOTIFICATIONID; ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE); ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME; ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE; ddl.UserId = att.UserId.ToString(); ddl.STUDENTID = att.STUDENTID.ToString(); ddl.STATUS = att.STATUS.ToString(); ddl.UserType = att.UserType; lt.Add(ddl); } } var getUserType = db.VW_GET_USER_TYPE.Where(r => r.UserId == obj.userid).FirstOrDefault(); var Notificationgen = db.VIEWNOTIFICATIONGENs.Where(r => r.ACADEMICYEAR == "2018-2019").ToList().OrderByDescending(r => r.NOTIFICATIONID); if (Notificationgen.Count() != 0) { foreach (var att in Notificationgen) { Result ddl = new Result(); ddl.TITLE = att.TITLE; ddl.NOTIFICATIONID = att.NOTIFICATIONID; ddl.NOTIFICATIONDATE = Convert.ToDateTime(att.NOTIFICATIONDATE); ddl.NOTIFICATIONTIME = att.NOTIFICATIONTIME; ddl.NOTIFICATIONTYPE = att.NOTIFICATIONTYPE; ddl.UserId = obj.userid.ToString(); ddl.STUDENTID = ""; ddl.STATUS = ""; ddl.UserType = getUserType.UserType; lt.Add(ddl); } } if (lt == null) { return(new Results { IsSuccess = false, Message = "No Notifications Found" }); } else { return(new DivisionListResult() { IsSuccess = true, AllNotification = lt.OrderByDescending(r => Convert.ToDateTime(r.NOTIFICATIONDATE)).ToList() }); } } } catch (Exception E) { return(new Results { IsSuccess = false, Message = E.Message }); } }
public object SaveAttendance(AttendanceParameterscs atteobj) { SchoolMainContext db = new ConcreateContext().GetContext(atteobj.Userid, atteobj.Password); TBLATTENDENCEMASTER objmster = new TBLATTENDENCEMASTER(); TBLATTENDENCE objDetail = new TBLATTENDENCE(); var checkatt = db.Vw_ATTENDANCECHECK.FirstOrDefault(r => r.DIVISIONID == atteobj.DIVISIONID && r.ATTEDANCEDATE == atteobj.ATTEDANCEDATE); //Duplicate Attendance Check if (checkatt == null) { try { objmster.ATTEDANCEDATE = atteobj.ATTEDANCEDATE; objmster.DIVISIONID = atteobj.DIVISIONID; objmster.DISPLAY = 1; objmster.EDUCATIONYEAR = "2018-2019"; var std = db.vw_FETCHSTANDARDBYDIVISION.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.DISPLAY == 1 && r.ACADEMICYEAR == "2018-2019").ToList(); objmster.STANDARDID = Convert.ToInt32(std[0].STANDARDID); objmster.CREATEDON = DateTime.Now; objmster.CREATEDID = atteobj.Userid; db.TBLATTENDENCEMASTERs.Add(objmster); db.SaveChanges(); //TBLNOTIFICATION objnotification = new TBLNOTIFICATION(); //objnotification.TITLE = "Daily Attendance"; //objnotification.NOTIFICATIONDATE = DateTime.Now; //objnotification.NOTIFICATIONTIME = DateTime.Now.ToString("h:mm tt"); //objnotification.DIVISIONID = atteobj.DIVISIONID; //objnotification.ACADEMICYEAR = "2018-2019"; //objnotification.NOTIFICATIONTYPE = "Attendance"; //db.TBLNOTIFICATIONs.Add(objnotification); //db.SaveChanges(); string absentno = atteobj.Absentno; string[] sbno = absentno.Split(','); objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; for (int i = 0; i < sbno.Length; i++) { string abno = sbno[i].ToString(); int rollno = Convert.ToInt32(abno); var getstudent = db.VIEWGETSTUDENTATTs.Where(r => r.DIVISIONID == atteobj.DIVISIONID && r.ROLL_NO == rollno).ToList(); if (getstudent.Count == 0) { return(new Results() { IsSuccess = false, Message = "No students found for this division " }); } objDetail.ATTEDANCEMID = objmster.ATTEDANCEMID; objDetail.ROLLNO = sbno[i].ToString(); objDetail.NAME = getstudent[0].STUDENTNAME; objDetail.STUDENTID = getstudent[0].STUDENTID; objDetail.STATUS = "A"; db.TBLATTENDENCEs.Add(objDetail); db.SaveChanges(); TBLNOTIFICATIONDETAIL objnotidetails = new TBLNOTIFICATIONDETAIL(); // objnotidetails.NOTIFICATIONID = objnotification.NOTIFICATIONID; // objnotidetails.STUDENTID = getstudent[0].STUDENTID; // objnotidetails.STATUS = 0; // db.TBLNOTIFICATIONDETAILs.Add(objnotidetails); // db.SaveChanges(); } return(new Results { IsSuccess = true, Message = "Attendance Save successfully" }); } catch (Exception e) { return(new Error() { IsError = true, Message = e.Message }); } } return(new Results { IsSuccess = false, Message = "Attedance already taken for this Date " }); }
public object ViewHomeWorkByDates(ParamHomeWorkAll obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.userid, obj.password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var EmpHomework = db.VIEWHOMEWORKs.Where(r => r.UserId == obj.userid && r.HOMEWORKDATE >= obj.FromDate && r.HOMEWORKDATE <= obj.ToDate).OrderByDescending(r => r.HOMEWORKDATE).ToList(); //from c in db.VIEWHOMEWORKs.Where(r => r.UserId == obj.userid && r.HOMEWORKDATE>=obj.FromDate && r.HOMEWORKDATE<=obj.ToDate) //select new { c.UserId, c.HOMEWORKID, c.HOMEWORKDATE.tostr, c.SUBJECTNAME }; string UploadBaseUrl = ""; var logindetail = db.TBLUSERLOGINs. Where(r => r.UserId == obj.userid && r.Password == obj.password && r.STATUS == "ACTIVE") .FirstOrDefault(); if (logindetail.UserName.StartsWith("NKV")) { UploadBaseUrl = ConfigurationManager.AppSettings["NkvsBaseUrlUpload"]; } else if (logindetail.UserName.StartsWith("SXS")) { UploadBaseUrl = ConfigurationManager.AppSettings["StxavierBaseUrlUpload"]; } else if (logindetail.UserName.StartsWith("ASM")) { UploadBaseUrl = ConfigurationManager.AppSettings["AsmBaseUrlUpload"]; } else if (logindetail.UserName.StartsWith("ASY")) { UploadBaseUrl = ConfigurationManager.AppSettings["AsyBaseUrlUpload"]; } else if (logindetail.UserName.StartsWith("NMS")) { UploadBaseUrl = ConfigurationManager.AppSettings["NmsBaseUrlUpload"]; } List <ResultSet> Res = new List <ResultSet>(); if (EmpHomework.Count() == 0) { var StudentHomework = db.VIEWSTUDENTHOMEWORKs.Where(r => r.UserId == obj.userid && r.HOMEWORKDATE >= obj.FromDate && r.HOMEWORKDATE <= obj.ToDate).OrderByDescending(r => r.HOMEWORKDATE).ToList(); if (StudentHomework.Count() == 0) { return(new Results { IsSuccess = false, Message = "Homework Not Found" }); } else { for (int i = 0; i < StudentHomework.Count; i++) { string HOMEWORKDATE = Convert.ToDateTime(StudentHomework[i].HOMEWORKDATE).ToString("MM/dd/yyyy"); ResultSet rs = new ResultSet(); rs.UserId = StudentHomework[i].UserId; rs.UserType = StudentHomework[i].UserType; rs.HOMEWORKID = StudentHomework[i].HOMEWORKID; //rs.HOMEWORKDATE = Convert.ToDateTime(StudentHomework[i].HMDATE); rs.HOMEWORKDATE = Convert.ToDateTime(HOMEWORKDATE); rs.TIME = StudentHomework[i].TIME; rs.STANDARDID = Convert.ToInt32(StudentHomework[i].STANDARDID); rs.DIVISIONID = Convert.ToInt32(StudentHomework[i].DIVISIONID); rs.HOMEWORK = StudentHomework[i].HOMEWORK; rs.ACADEMICYEAR = StudentHomework[i].ACADEMICYEAR; if (StudentHomework[i].FILEPATH != "") { rs.FILEPATH = UploadBaseUrl + StudentHomework[i].FILEPATH; } else { rs.FILEPATH = ""; } rs.STANDARDNAME = StudentHomework[i].STANDARDNAME; rs.DIVISIONNAME = StudentHomework[i].DIVISIONNAME; rs.EMPLOYEENAME = StudentHomework[i].EMPLOYEENAME; rs.SUBJECTNAME = StudentHomework[i].SUBJECTNAME; rs.DISPLAY = Convert.ToInt32(StudentHomework[i].DISPLAY); Res.Add(rs); } return(new DivisionListResult() { IsSuccess = true, HomeWork = Res }); } } else { for (int i = 0; i < EmpHomework.Count; i++) { string HOMEWORKDATE = Convert.ToDateTime(EmpHomework[i].HOMEWORKDATE).ToString("MM/dd/yyyy"); ResultSet rs = new ResultSet(); rs.UserId = EmpHomework[i].UserId; rs.UserType = EmpHomework[i].UserType; rs.HOMEWORKID = EmpHomework[i].HOMEWORKID; // rs.HOMEWORKDATE = DateTime.ParseExact(EmpHomework[i].HMDATE, "dd/MM/yyyy", null);//DateTime.Parse(EmpHomework[i].HMDATE); rs.HOMEWORKDATE = Convert.ToDateTime(HOMEWORKDATE); rs.TIME = EmpHomework[i].TIME; rs.STANDARDID = Convert.ToInt32(EmpHomework[i].STANDARDID); rs.DIVISIONID = Convert.ToInt32(EmpHomework[i].DIVISIONID); rs.HOMEWORK = EmpHomework[i].HOMEWORK; rs.ACADEMICYEAR = EmpHomework[i].ACADEMICYEAR; if (EmpHomework[i].FILEPATH != "") { rs.FILEPATH = UploadBaseUrl + EmpHomework[i].FILEPATH; } else { rs.FILEPATH = ""; } rs.STANDARDNAME = EmpHomework[i].STANDARDNAME; rs.DIVISIONNAME = EmpHomework[i].DIVISIONNAME; rs.EMPLOYEENAME = EmpHomework[i].EMPLOYEENAME; rs.SUBJECTNAME = EmpHomework[i].SUBJECTNAME; rs.DISPLAY = Convert.ToInt32(EmpHomework[i].DISPLAY); Res.Add(rs); } return(new DivisionListResult() { IsSuccess = true, HomeWork = Res }); } } catch (Exception E) { return(new Results { IsSuccess = false, Message = E.Message }); } }
/// <summary> /// TO RETURN CLASS TEACHER DATA /// </summary> /// <param name="PC"></param> /// <returns></returns> //public object GetClassTeacher(ParamClassTeacher PC) //{ // try // { // var ClassTeacher = db.VIEWCLASSTEACHERs. // Where(r => r.EMPLOYEEID == PC.EMPLOYEEID && r.DISPLAY == 1 && r.ACADEMICYEAR == "2018-2019") // .FirstOrDefault(); // if (ClassTeacher == null) // return new Error() { IsError = true, Message = "No Class is Assigned To This Teacher" }; // else // return ClassTeacher; // } // catch (Exception ex) // { // return new Error() { IsError = true, Message = ex.Message }; // } //} public object GetAttendanceStatus(ParamAttendance PA) { try { int year = DateTime.Now.Year; List <DateTime> li = GetDates(year, PA.MONTH); CheckUsernamePassword objUP = new CheckUsernamePassword(); bool iStrue = objUP.ValidateUsernamePassword(PA.UserId, PA.Password); if (iStrue == false) { return(new MonthlyAttendanceResult() { IsSuccess = false, DateWiseStatus = new InvalidUser() { IsSuccess = false, Result = "Invalid User" } }); } List <Result> lt = new List <Result>(); SchoolMainContext db = new ConcreateContext().GetContext(PA.UserId, PA.Password); var USERTYPE = db.VW_GET_USER_TYPE.Where(r => r.UserId == PA.UserId).ToList(); if (USERTYPE[0].UserType == "STUDENT") { var ATTENDANCEDATA = db.VWATTENDANCEBYDATESTUDENTs.Where(r => r.ATTMONTH == PA.MONTH && r.UserId == PA.UserId).ToList(); //var HOLIDAYDATA = db.VIEWCHECKHOLIDAYs.Where(r => r.HOLIDAYDATE == PA.MONTH && r.DISPLAY == 1).ToList(); int flag = 0; foreach (var item in li) { var checkattendace = db.VIewAttendaceClasswiseChecks.Where(r => r.UserId == PA.UserId && r.ATTEDANCEDATE == item && r.DISPLAY == 1 && r.EDUCATIONYEAR == "2018-2019" && r.ACADEMICYEAR == "2018-2019").ToList(); if (checkattendace.Count == 0) { Result ddl = new Result(); ddl.Date = item.ToString("dd/MM/yyyy"); ddl.Status = "Attendance is not marked by class teacher for this date."; lt.Add(ddl); } else { flag = 0; foreach (var att in ATTENDANCEDATA) { if (att.ATTEDANCEDATE == item) { Result ddl = new Result(); ddl.Date = item.ToString("dd/MM/yyyy"); ddl.Status = "Absent"; lt.Add(ddl); flag = 1; } } if (flag == 0) { Result ddl = new Result(); ddl.Date = item.ToString("dd/MM/yyyy"); ddl.Status = "Present"; lt.Add(ddl); } } } if (lt == null) { return new ResultBirth { IsSuccess = false, Result = new InvalidUser() { IsSuccess = false, Result = "No Attendance Is Found Of This Date" } } } ; else { return new MonthlyAttendanceResult() { IsSuccess = true, DateWiseStatus = lt } }; } else { if (USERTYPE[0].UserType == "CLASS TEACHER") { var ATTENDANCEDATAEMP = db.VWATTENDANCEEMPLOYEEs.Where(r => r.ATTMONTH == PA.MONTH && r.UserId == PA.UserId && r.DISPLAY == 1).ToList(); //var HOLIDAYDATA = db.VIEWCHECKHOLIDAYs.Where(r => r.HOLIDAYDATE == PA.MONTH && r.DISPLAY == 1).ToList(); int flag = 0; foreach (var item in li) { flag = 0; foreach (var att in ATTENDANCEDATAEMP) { if (att.ATTEDANCEDATE == item) { Result ddl = new Result(); ddl.Date = item.ToString("dd/MM/yyyy"); ddl.Status = "Attendance Marked"; lt.Add(ddl); flag = 1; } } if (flag == 0) { Result ddl = new Result(); ddl.Date = item.ToString("dd/MM/yyyy"); ddl.Status = "Attendance Not Marked"; lt.Add(ddl); } } if (lt == null) { return new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "No Attendance Is Found Of This Date" } } } ; else { // return lt; return new MonthlyAttendanceResult() { IsSuccess = true, DateWiseStatus = lt } }; } else { return(new Results { IsSuccess = false, Message = new InvalidUser() { IsSuccess = false, Result = "User Is Not Class Teacher" } }); } } } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }
public object GetFee(FeePram obj) { try { SchoolMainContext db = new ConcreateContext().GetContext(obj.UserName, obj.Password); if (db == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } var data = db.TBLUSERLOGINs.Where(r => r.UserName == obj.UserName && r.Password == obj.Password).FirstOrDefault(); if (data == null) { return(new Results() { IsSuccess = false, Message = "Invalid User" }); } int StudentId = Convert.ToInt32(data.EmpCode); if (obj.UserName.StartsWith("SXS")) { var getlist = db.View_DisplayFee.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); var GetStanderd = db.TBLSTUDENTADMISSIONs.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); var GetFee = db.View_FeeSetting.Where(r => r.STANDARDID == GetStanderd.STANDARDID).FirstOrDefault(); var RemaingFee = db.View_RemainingFeeDisplay.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); if (GetFee == null) { return(new Results { IsSuccess = false, Message = "Fee Not Found" }); } //else //{ // return new FeeList() { IsSuccess = true, TotalFee = GetFee.TOTALFEES }; //} else if (RemaingFee == null) { return new Results { IsSuccess = false, Message = "Fee Not Found" } } ; else { double Cocession = 0, TotalFee = 0; string dateadmission = ""; dateadmission = Convert.ToDateTime(getlist.ADMISSIONDATE).ToShortDateString(); string[] admsndate = dateadmission.Split('-'); int ADMISSIONYEAR = 0, NEXTYEAR = 0; dateadmission = admsndate[2]; if (dateadmission != "") { int.TryParse(dateadmission, out ADMISSIONYEAR); } NEXTYEAR = ADMISSIONYEAR + 1; string STUDADMISSIONYEAR = ADMISSIONYEAR + "-" + NEXTYEAR; if (STUDADMISSIONYEAR == getlist.ACADEMICYEAR) { //newadmission TotalFee = Convert.ToDouble(GetFee.TOTALFEES); } else { var AdmissionFee = db.View_FeeSetting.Where(r => r.FEETYPEID == 1).FirstOrDefault(); TotalFee = Convert.ToDouble(GetFee.TOTALFEES) - Convert.ToDouble(AdmissionFee.AMOUNT); //oldadmission } if (getlist.CONCESSION != null) { Cocession = Convert.ToDouble(getlist.CONCESSION); } TotalFee = TotalFee - Cocession; return(new FeeList() { IsSuccess = true, TotalFee = TotalFee, PaindingFee = RemaingFee.AMOUNT }); } //return new FeeList() { IsSuccess = true, TotalFee = TotalFee, RemainingFee = RemaingFee.AMOUNT }; } else if (obj.UserName.StartsWith("NKV")) { double App_fee = 0; double PendingFee = 0; var nkTotalFee = db.View_GetTotalFees.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); if (nkTotalFee == null) { var ApplicableFee = db.View_GetFeeSettings.Where(r => r.ENROLLMENTNO == obj.UserName).ToList(); if (ApplicableFee.Count() == 0) { return(new FeeList() { IsSuccess = false, TotalFee = "Not Found Applicable Fee", Concession = "", PaindingFee = "" }); } for (int i = 0; i < ApplicableFee.Count; i++) { App_fee += Convert.ToDouble(ApplicableFee[i].AMOUNT); } var Concession = db.TBLTRANSFERSTUDENTs.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); //if(Concession.CONCESSIONPERCENTAGE== null) //{ // Concession.CONCESSIONPERCENTAGE = 0; //} if (Concession.CONCESSIONPERCENTAGE != null) { PendingFee = App_fee - Convert.ToDouble(Concession.CONCESSIONPERCENTAGE); } return(new FeeList() { IsSuccess = true, TotalFee = App_fee, Concession = Concession.CONCESSIONPERCENTAGE, PaindingFee = PendingFee }); } else { double Cocession = 0; if (nkTotalFee.CONCESSION != null) { Cocession = Convert.ToDouble(nkTotalFee.CONCESSIONPERCENTAGE); } nkTotalFee.TOTALFEES = nkTotalFee.TOTALFEES - Convert.ToDecimal(Cocession); // var nkpendingfee = db.View_GetPaidFees.Where(r => r.STUDENTID == StudentId).FirstOrDefault(); var Remaining_fee = nkTotalFee.TOTALFEES - nkTotalFee.PAID; return(new FeeList() { IsSuccess = true, TotalFee = nkTotalFee.TOTALFEES, Concession = nkTotalFee.CONCESSIONPERCENTAGE, PaindingFee = Remaining_fee }); } } return(null); } catch (Exception ex) { return(new Results { IsSuccess = false, Message = ex.Message }); } }