public List <T_BranchBuilding> GetBuildingCode()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_BranchBuildings.ToList());
     }
 }
 public List <T_DeviceSettingRFID> GetRFIDDevice()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_DeviceSettingRFIDs.ToList());
     }
 }
 public List <T_Remainder> GetRemainders()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Remainders.ToList());
     }
 }
 public bool Compare(T_SystemUser value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_SystemUsers.Where(x => x.UserID == value.UserID && x.Username == value.Username && x.Password == value.Password && x.EncryptedPassword == value.EncryptedPassword && x.FirstName == value.FirstName && x.LastName == value.LastName && x.ContactNo == value.ContactNo && x.RFIDNo == value.RFIDNo && x.RFIDStatus == value.RFIDStatus && x.Active == value.Active && x.PositionID == value.PositionID).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_AccessRight value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_AccessRights.Where(x => x.YearClass == value.YearClass && x.Semester == value.Semester && x.RoomType == value.RoomType && x.Building == value.Building && x.PositionID.ToLower() == value.PositionID.ToLower() && x.JobTitle.ToLower() == value.JobTitle.ToLower() && x.Description.ToLower() == value.Description.ToLower() && x.Active == value.Active && x.Student == value.Student && x.Instructor == value.Instructor && x.Position == value.Position && x.Users == value.Users && x.Application == value.Application && x.YearLevel == value.YearLevel && x.CivilStatus == value.CivilStatus && x.Course == value.Course && x.Subject == value.Subject && x.Room == value.Room && x.Time == value.Time && x.Display == value.Display && x.Report == value.Report && x.DeviceConfiguration == value.DeviceConfiguration).FirstOrDefault() == null ? true : false);
     }
 }
 //Year Level Like First Year or Second Year
 public List <T_YearLevel> GetYearLevel()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_YearLevels.ToList());
     }
 }
        public void Save(T_YearLevel value, ref string msg)
        {
            T_YearLevel valueupdate = new T_YearLevel();

            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                //check data is already exist
                if (Compare(value))
                {
                    //is Save New
                    if (value.ID == 0)
                    {
                        dc.T_YearLevels.InsertOnSubmit(value);
                        msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}", SystemProperties.MessageNotification.Saved, value.YearLevel, value.Active);
                    }
                    // Is Update
                    else
                    {
                        valueupdate           = dc.T_YearLevels.Where(x => x.ID == value.ID).FirstOrDefault();
                        valueupdate.YearLevel = value.YearLevel;
                        valueupdate.Active    = value.Active;
                        valueupdate.Count     = value.Count;
                        msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}", SystemProperties.MessageNotification.Updated, valueupdate.YearLevel, valueupdate.Active);
                    }
                    dc.SubmitChanges();
                }
                else
                {
                    msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}", SystemProperties.MessageNotification.Exist, value.YearLevel, value.Active);
                }
            }
        }
 public bool Compare(T_Time value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Times.Where(x => x.TimeCode.ToLower() == value.TimeCode.ToLower() && x.Active == value.Active && x.TimeStart == value.TimeStart && x.TimeEnd == value.TimeEnd).FirstOrDefault() == null ? true : false);
     }
 }
 //subject registration
 public List <T_Subject> GetSubject()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Subjects.ToList());
     }
 }
 public bool Compare(T_RoomTime value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_RoomTimes.Where(x => x.RoomCode == value.RoomCode && x.TimeCode == value.TimeCode).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_Room value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Rooms.Where(x => x.Active == value.Active && x.RoomCode.ToLower() == value.RoomCode.ToLower() && x.RoomType == value.RoomType && x.Description == value.Description && x.BuildingCode == value.BuildingCode && x.Capacity == value.Capacity).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_BranchBuilding value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_BranchBuildings.Where(x => x.Active == value.Active && x.Branch.ToLower() == value.Branch.ToLower() && x.BuildingCode.ToLower() == value.BuildingCode.ToLower() && x.BuildingName.ToLower() == value.BuildingName.ToLower()).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_CourseAndSubject value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_CourseAndSubjects.Where(x => x.CourseCode == value.CourseCode && x.CourseDescription == value.CourseDescription && x.Description == value.Description && x.SubjectCode == value.SubjectCode && x.Unit == value.Unit).FirstOrDefault() == null ? true : false);
     }
 }
        public void Save(T_BranchBuilding value, ref string msg)
        {
            T_BranchBuilding valueupdate = new T_BranchBuilding();

            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                if (Compare(value))
                {
                    if (value.ID == 0)
                    {
                        dc.T_BranchBuildings.InsertOnSubmit(value);
                        msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Branch: {1}" + Environment.NewLine + "Code: {2}" + Environment.NewLine + "Name: {3}", SystemProperties.MessageNotification.Saved, value.Branch, value.BuildingCode, value.BuildingName);
                    }
                    else
                    {
                        valueupdate = dc.T_BranchBuildings.Where(x => x.ID == value.ID).FirstOrDefault();
                        valueupdate.BuildingCode = value.BuildingCode;
                        valueupdate.Branch       = value.Branch;
                        valueupdate.BuildingName = value.BuildingName;
                        valueupdate.Active       = value.Active;
                        msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Branch: {1}" + Environment.NewLine + "Code: {2}" + Environment.NewLine + "Name: {3}", SystemProperties.MessageNotification.Updated, valueupdate.Branch, valueupdate.BuildingCode, valueupdate.BuildingName);
                    }
                }
                else
                {
                    msg = SystemProperties.MessageNotification.Exist;
                }

                dc.SubmitChanges();
            }
        }
 //Course Like Bachelor of Science in Informatation Technology
 public List <T_Course> GetCourse()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Courses.ToList());
     }
 }
 public List <T_ActiveSemester> GetActiveSemester()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_ActiveSemesters.ToList());
     }
 }
 public bool Compare(T_Course value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Courses.Where(x => x.Active == value.Active && x.Course.ToLower() == value.Course.ToLower() && x.CourseCode.ToLower() == value.CourseCode.ToLower() && x.YearMinimum == value.YearMinimum && x.YearMaximum == value.YearMaximum && x.YearLevelFromTo == value.YearLevelFromTo).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_Subject value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Subjects.Where(x => x.Code.ToLower() == value.Code.ToLower() && x.Description.ToLower() == value.Description.ToLower() && x.Unit == value.Unit && x.Active == value.Active).FirstOrDefault() == null ? true : false);
     }
 }
 public bool Compare(T_YearLevel value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_YearLevels.Where(x => x.Count == value.Count && x.Active == value.Active && x.YearLevel.ToLower() == value.YearLevel.ToLower()).FirstOrDefault() == null ? true : false);
     }
 }
        public void Save(T_Subject value, ref string msg)
        {
            T_Subject valueupdate = new T_Subject();

            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                if (Compare(value))
                {
                    if (value.ID == 0)
                    {
                        dc.T_Subjects.InsertOnSubmit(value);
                        msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}" + Environment.NewLine + " {3}", SystemProperties.MessageNotification.Saved, value.Unit, value.Code, value.Description);
                    }
                    else
                    {
                        valueupdate             = dc.T_Subjects.Where(x => x.ID == value.ID).FirstOrDefault();
                        valueupdate.Code        = value.Code;
                        valueupdate.Unit        = value.Unit;
                        valueupdate.Description = value.Description;

                        valueupdate.Active = value.Active;
                        msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}" + Environment.NewLine + " {3}", SystemProperties.MessageNotification.Updated, valueupdate.Unit, valueupdate.Code, valueupdate.Description);
                    }

                    dc.SubmitChanges();
                }
                else
                {
                    msg = string.Format("{0} " + Environment.NewLine + Environment.NewLine + "{1}" + Environment.NewLine + " {2}" + Environment.NewLine + " {3}", SystemProperties.MessageNotification.Exist, value.Unit, value.Code, value.Description);
                }
            }
        }
 public bool Compare(T_ActiveSemester value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_ActiveSemesters.Where(x => x.Active == value.Active && x.DateEnd == value.DateEnd && x.DateStart == value.DateStart && x.Semester == value.Semester && x.YearSemester == value.YearSemester).FirstOrDefault() == null ? true : false);
     }
 }
 //Application Like New Enrollment or Transferee
 public List <T_Application> GetApplication()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Applications.ToList());
     }
 }
 //Access for the system Like Admin1 or Admin2
 public List <T_AccessRight> GetAccessRight()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_AccessRights.ToList());
     }
 }
        public void Save(T_ActiveSemester value, ref string msg)
        {
            T_ActiveSemester valueupdate = new T_ActiveSemester();

            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                if (Compare(value))
                {
                    dc.T_ActiveSemesters.InsertOnSubmit(value);
                    msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Semester:  {1}" + Environment.NewLine + "Year class:  {2}", SystemProperties.MessageNotification.Saved, value.Semester, value.YearSemester);
                }
                else
                {
                    valueupdate              = dc.T_ActiveSemesters.Where(x => x.ID == value.ID).FirstOrDefault();
                    valueupdate.DateEnd      = value.DateEnd;
                    valueupdate.DateStart    = value.DateStart;
                    valueupdate.Semester     = value.Semester;
                    valueupdate.YearSemester = value.YearSemester;
                    msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Semester:  {1}" + Environment.NewLine + "Year class:  {2}", SystemProperties.MessageNotification.Saved, valueupdate.Semester, valueupdate.YearSemester);
                }


                dc.SubmitChanges();
            }
        }
        public bool Save(T_RoomDevie value, ref string msg)
        {
            bool ret = false;

            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                if (!string.IsNullOrWhiteSpace(value.DeviceCode))
                {
                    if (Compare(value))
                    {
                        dc.T_RoomDevies.InsertOnSubmit(value);
                        dc.SubmitChanges();
                        //return false;
                    }
                    else
                    {
                        msg = SystemProperties.MessageNotification.Exist;
                        ret = true;
                        //return true;
                    }
                }
                //dc.SubmitChanges();
                //return false;
                return(ret);
            }
        }
 //Civil Status Like Single Married
 public List <T_CivilStatus> GetCivilStatus()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_CivilStatus.ToList());
     }
 }
        public void Save(T_DeviceSettingRFID value, ref string msg)
        {
            //T_DeviceSettingRFID valueupdate = new T_DeviceSettingRFID();
            using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
            {
                if (Compare(value))
                {
                    if (value.ID == 0)
                    {
                        dc.T_DeviceSettingRFIDs.InsertOnSubmit(value);
                        msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Device Name: {1}" + Environment.NewLine + "Port: {2}" + Environment.NewLine + "Baund Rate: {3}" + Environment.NewLine + "Data Bit: {4}" + Environment.NewLine + "Parity: {5}" + Environment.NewLine + "Stop Bit: {6}", SystemProperties.MessageNotification.Saved, value.DeviceName, value.Port, value.BaundRate, value.DataBit, value.Parity, value.StopBit);
                    }
                    else
                    {
                        //valueupdate = dc.T_DeviceSettingRFIDs.Where(x => x.ID == value.ID).FirstOrDefault();
                        var valueupdate = dc.T_DeviceSettingRFIDs.FirstOrDefault(x => x.ID == value.ID);
                        valueupdate.DeviceName = value.DeviceName;
                        valueupdate.BaundRate  = value.BaundRate;
                        valueupdate.DataBit    = value.DataBit;
                        valueupdate.Parity     = value.Parity;;
                        valueupdate.Port       = value.Port;
                        valueupdate.StopBit    = value.StopBit;
                        valueupdate.Active     = value.Active;
                        msg = string.Format("{0}" + Environment.NewLine + Environment.NewLine + "Device Name: {1}" + Environment.NewLine + "Port: {2}" + Environment.NewLine + "Baund Rate: {3}" + Environment.NewLine + "Data Bit: {4}" + Environment.NewLine + "Parity: {5}" + Environment.NewLine + "Stop Bit: {6}", SystemProperties.MessageNotification.Updated, value.DeviceName, value.Port, value.BaundRate, value.DataBit, value.Parity, value.StopBit);
                    }
                }
                else
                {
                    msg = SystemProperties.MessageNotification.Exist;
                }

                dc.SubmitChanges();
            }
        }
 public bool Compare(T_CivilStatus value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_CivilStatus.Where(x => x.Active == value.Active && x.Status.ToLower() == value.Status.ToLower()).FirstOrDefault() == null ? true : false);
     }
 }
 public List <T_RoomDevie> GetDeviceAvailable()
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_RoomDevies.ToList());
     }
 }
 public bool Compare(T_Semester value)
 {
     using (AttMonSysRFIDDataContext dc = new AttMonSysRFIDDataContext(SystemConnection.ConnectionString))
     {
         return(dc.T_Semesters.Where(x => x.Semester.ToLower() == value.Semester.ToLower()).FirstOrDefault() == null ? true : false);
     }
 }