예제 #1
0
        public static ArrayList SaveUserData(Users_List data)
        {
            ArrayList arr = new ArrayList();
            string    query;

            try
            {
                query = "EXEC[dbo].[Get_All_Users] '" +
                        data.Index_No + "','" +
                        data.Student_Name + "','" +
                        data.Temp_Password + "','" +
                        data.Student_Type + "','" +
                        data.Course + "','" +
                        data.Email + "','" +
                        data.Status + "'";

                ArrayList result = DBConnection.selectRecord(query);

                return(arr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #2
0
        //This is used to load all users data to the system

        public static ArrayList GetAllUserData(Users_List data)
        {
            ArrayList arr = new ArrayList();
            string    query;

            try
            {
                query = "EXEC[dbo].[Get_All_Users] '','','','','','',1";

                DataTable result = DBConnection.selectRecords(query);

                foreach (DataRow dtRow in result.Rows)
                {
                    Users_List rtn = new Users_List();
                    rtn.Index_No     = dtRow["Index_No"].ToString();
                    rtn.Student_Name = dtRow["Student_Name"].ToString();
                    rtn.Student_Type = dtRow["Student_Type"].ToString();
                    rtn.Course       = dtRow["Course"].ToString();
                    rtn.Email        = dtRow["Email"].ToString();
                    arr.Add(rtn);
                }

                return(arr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #3
0
        //END
        public static ArrayList LoginAuthorization(Users_List data)
        {
            Users_List rtn = new Users_List();
            //string rtn;
            ArrayList arr = new ArrayList();
            string    query;

            try {
                query = "exec [dbo].[Login_Data] '"
                        + data.Email + "','"
                        + data.Temp_Password + "','"
                        + data.Status + "'";

                DataTable result = DBConnection.selectRecords(query);

                foreach (DataRow dtRow in result.Rows)
                {
                    rtn.Index_No = dtRow["RESULT"].ToString();
                    //rtn.Index_No = dtRow["RESULT"].ToString();
                }
                //arr = DBConnection.selectRecord(query);
                arr.Add(rtn);
                return(arr);
            }
            catch (Exception ex) {
                throw ex;
            }
        }
예제 #4
0
 public IHttpActionResult GetAllUserData(Users_List data)
 {
     return(Ok(DA_AdminController.GetAllUserData(data)));
 }
예제 #5
0
        private void ReceiveMessages()
        {
            try
            {
                // Receive the response from the server
                srReceiver = new StreamReader(tcpServer.GetStream());
                // If the first character of the response is 1, connection was successful
                string ConResponse = srReceiver.ReadLine();
                // If the first character is a 1, connection was successful
                if (ConResponse[0] == '1')
                {
                    // Update the form to tell it we are now connected
                    //part of the protocol to see who is online already
                    whoisonline = srReceiver.ReadLine();
                    string temp = "";
                    for (int i = 0; i < whoisonline.Length; i++)
                    {
                        if (i == whoisonline.Length)
                        {
                            if (whoisonline[i] != '#')
                            {
                                temp += whoisonline[i];
                            }
                            Users_List.Invoke(new UpdateUsers(this.Updaterusers), temp);
                        }

                        if (whoisonline[i] == '#' && i != whoisonline.Length)
                        {
                            Users_List.Invoke(new UpdateUsers(this.Updaterusers), temp);
                            temp = "";
                        }
                        else
                        {
                            temp += whoisonline[i];
                        }

                        if (whoisonline[i] != '#' && i == whoisonline.Length - 1)
                        {
                            Users_List.Invoke(new UpdateUsers(this.Updaterusers), temp);
                        }
                    }
                    this.Invoke(new UpdateLogCallback(this.UpdateLog), new object[] { "Connected Successfully!" });
                }

                else // If the first character is not a 1 (probably a 0), the connection was unsuccessful
                {
                    string Reason = "";
                    // Extract the reason out of the response message. The reason starts at the 3rd character
                    Reason += ConResponse.Substring(2, ConResponse.Length - 2);
                    // Update the form with the reason why we couldn't connect
                    this.Invoke(new CloseConnectionCallback(this.CloseConnection), new object[] { Reason });
                    // Exit the method
                    return;
                }
            }
            catch
            {
                if (this.InvokeRequired)
                {
                    this.Invoke(new CloseConnectionCallback(this.CloseConnection), new object[] { "Disconnected from server" });
                }
                else
                {
                    CloseConnection("Disconnected from server");
                }
            }

            // While we are successfully connected, read incoming lines from the server
            while (Connected)
            {
                // Show the messages in the log TextBox
                try
                {
                    process_data();
                }
                catch
                {
                    if (this.InvokeRequired)
                    {
                        this.Invoke(new CloseConnectionCallback(this.CloseConnection), new object[] { "Disconnected from server" });
                    }
                    else
                    {
                        CloseConnection("Disconnected from server");
                    }
                    // MessageBox.Show(e1.Message);
                }
            }
        }
예제 #6
0
 public IHttpActionResult LoginAuthorization(Users_List data)
 {
     return(Ok(DA_AdminController.LoginAuthorization(data)));
 }