Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     DbInteraction.CheckLinks();
     try
     {
         listener = new TcpListener(IPAddress.Parse(ip), port);
         listener.Start();
         Console.WriteLine("OK");
         while (true)
         {
             TcpClient    client       = listener.AcceptTcpClient();
             ClientObject clientObject = new ClientObject(client);
             Thread       clientThread = new Thread(new ThreadStart(clientObject.Process));
             clientThread.Start();
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
     }
     finally
     {
         if (listener != null)
         {
             listener.Stop();
         }
     }
 }
        private void fetchTeacherData()
        {
            List <TeacherInfo> Teachers = DbInteraction.GetAllResidenceList();

            _allTeacherCollection.Clear();

            foreach (TeacherInfo Teacher in Teachers)
            {
                _allTeacherCollection.Add(Teacher);
            }
        }
Ejemplo n.º 3
0
        private void fetchStudentData()
        {
            List <StudentInfo> Students = DbInteraction.GetAllStudentList();

            _allstudentCollection.Clear();

            foreach (StudentInfo student in Students)
            {
                _allstudentCollection.Add(student);
            }
        }
Ejemplo n.º 4
0
        private void fetchAdmissionData()
        {
            List <AdmissionInfo> Admissions = DbInteraction.GetAllAdmissionList();

            _allAdmissionFormCollection.Clear();

            foreach (AdmissionInfo admission in Admissions)
            {
                _allAdmissionFormCollection.Add(admission);
            }
        }
        private void fetchAttendanceData()
        {
            List <AttendanceInfo> Attendances = DbInteraction.GetAllAttendanceList();

            _allAttendanceCollection.Clear();

            foreach (AttendanceInfo Attendance in Attendances)
            {
                _allAttendanceCollection.Add(Attendance);
            }
        }
Ejemplo n.º 6
0
        public static void PopulateRecentQueryComboBox(List <OMQuery> qrylist, ComboBox comboboxRecentQueries)
        {
            DataTable recentQueriesDatatable;

            try
            {
                recentQueriesDatatable = new DataTable();
                recentQueriesDatatable.Columns.Add(RECENT_QUERY_QUERY_COLUMN, typeof(string));
                recentQueriesDatatable.Columns.Add(RECENT_QUERY_OMQUERY_COLUMN, typeof(OMQuery));

                comboboxRecentQueries.DataSource = null;
                comboboxRecentQueries.Items.Clear();

                DataRow newRow = recentQueriesDatatable.NewRow();
                newRow[0] = GetResourceString(Constants.COMBOBOX_DEFAULT_TEXT);
                newRow[1] = null;

                recentQueriesDatatable.Rows.Add(newRow);
                long TimeForRecentQueriesCreation =
                    dbInteraction.GetTimeforRecentQueriesCreation(dbInteraction.GetCurrentRecentConnection().ConnParam);
                long TimeforDbCreation = DbInteraction.dbCreationTime();
                if (TimeForRecentQueriesCreation != 0)
                {
                    if (TimeForRecentQueriesCreation > TimeforDbCreation)
                    {
                        foreach (OMQuery qry in qrylist)
                        {
                            if (qry != null)
                            {
                                newRow    = recentQueriesDatatable.NewRow();
                                newRow[0] = qry.QueryString;
                                newRow[1] = qry;

                                recentQueriesDatatable.Rows.Add(newRow);
                            }
                        }
                    }
                    else
                    {
                        dbInteraction.RemoveRecentQueries(dbInteraction.GetCurrentRecentConnection().ConnParam);
                        ListOMQueries.Clear();
                    }
                }

                comboboxRecentQueries.DisplayMember = RECENT_QUERY_QUERY_COLUMN;
                comboboxRecentQueries.ValueMember   = RECENT_QUERY_OMQUERY_COLUMN;

                comboboxRecentQueries.DataSource = recentQueriesDatatable;
            }
            catch (Exception oEx)
            {
                LoggingHelper.ShowMessage(oEx);
            }
        }
Ejemplo n.º 7
0
        public string Download(string nickname)
        {
            var links   = DbInteraction.Links(nickname);
            var builder = new StringBuilder();

            builder.Append("ListDownload\\::\\");
            foreach (var i in links)
            {
                builder.Append(i + "\n");
            }
            return(builder.ToString());
        }
Ejemplo n.º 8
0
 public string Register(string nick, string mail, string pass)
 {
     try
     {
         DbInteraction.Register(nick, mail, pass);
         return("CheckRegister\\::\\SUCCESS");
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return("CheckRegister\\::\\FAILED");
     }
 }
Ejemplo n.º 9
0
 public void LogOut(string nickname)
 {
     DbInteraction.LogOut(nickname);
 }
Ejemplo n.º 10
0
 public string Login(string nickname, string pass)
 {
     return(DbInteraction.IsValidAuthorization(nickname, pass) ?
            $"CheckLogin\\::\\SUCCESS\n{nickname}\n{pass}":
            $"CheckLogin\\::\\FAILED\n{nickname}\n{pass}");
 }