예제 #1
0
 public PAGE_GroupInformation(TRS_Domain.GROUP.Data Groupdata, TRS_Domain.USER.Data Client, FormMain main)
 {
     InitializeComponent();
     client                = Client;
     groupdata             = Groupdata;
     Main                  = main;
     Lbl_GroupName.Content = Groupdata.Name;
 }
예제 #2
0
        public bool JoinGroup(TRS_Domain.USER.Data client, Data myGroup)
        {
            bool output = false;

            //Try-Catch for safety:
            try
            {
                using (MySqlConnection Conn = _connectDb.GetConnection())
                {
                    //  Open Connection:
                    Conn.Open();

                    //  the incomplete query
                    MainQuery =
                        "INSERT INTO `group_members` (`GroupID`, `UserID`)" +
                        "VALUES(@GroupId, @ClientId)";


                    //  DEFINE the paramaters
                    MySqlParameter param1 = new MySqlParameter();
                    param1.ParameterName = "@ClientId";
                    param1.Value         = client.UserId;

                    MySqlParameter param2 = new MySqlParameter();
                    param2.ParameterName = "@GroupId";
                    param2.Value         = myGroup.GroupId;

                    //  build the command

                    MainCommand = new MySqlCommand(MainQuery, Conn);

                    //  add the parameters to the command
                    MainCommand.Parameters.Add(param1);
                    MainCommand.Parameters.Add(param2);

                    //  use the command
                    output = _connectDb.ExecuteNonQuery(MainCommand);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return(output);
        }
 public bool JoinGroup(TRS_Domain.USER.Data client, TRS_Domain.GROUP.Data myGroup)
 {
     return(groupContext.JoinGroup(client, myGroup));
 }