Пример #1
0
 /// <summary>
 /// Add all the users to the group.
 /// </summary>
 /// <param name="groupModelPublish"></param>
 /// <param name="dBPushFunctions"></param>
 private static void AddUsersToNewGroup(ref GroupModelPublish groupModelPublish, ref DBPushFunctions dBPushFunctions)
 {
     for (int i = 0; i < groupModelPublish.Users.Count(); i++)
     {
         Dictionary <string, string> valuesDict = new Dictionary <string, string>();
         valuesDict.Add("groupID", groupModelPublish.ID.ToString());
         valuesDict.Add("userID", groupModelPublish.Users[i].ToString());
         dBPushFunctions.PushStringDataToDB("userGroup", valuesDict);
     }
 }
Пример #2
0
        /// <summary>
        /// Creates a dictonary from
        /// </summary>
        /// <param name="groupModelPublish"></param>
        /// <returns></returns>
        private static Dictionary <string, string> CreateDictonaryFromModel(ref GroupModelPublish groupModelPublish)
        {
            Dictionary <string, string> valuesDict = new Dictionary <string, string>();

            valuesDict.Add("name", groupModelPublish.Name);
            valuesDict.Add("description", groupModelPublish.Description);
            valuesDict.Add("createdByUser", groupModelPublish.CreatedByID.ToString());

            return(valuesDict);
        }
Пример #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="groupModelPublish"></param>
        public static void CreateNewGroup(GroupModelPublish groupModelPublish)
        {
            MySqlConnection connection = new MySqlConnection(connectionString);

            DBPushFunctions pushFunction = new DBPushFunctions(connection);
            int             j            = pushFunction.PushStringDataToDB("allGroups", CreateDictonaryFromModel(ref groupModelPublish));

            groupModelPublish.ID = j;
            AddUsersToNewGroup(ref groupModelPublish, ref pushFunction);
        }
Пример #4
0
        public static GroupModelPublish createTestUser()
        {
            GroupModelPublish groupModelPublish = new GroupModelPublish();

            int[] stringArray = new int[4];

            stringArray[0] = 0;
            stringArray[1] = 1;
            stringArray[2] = 2;
            stringArray[3] = 3;



            return(groupModelPublish);
        }
Пример #5
0
 public void Post(GroupModelPublish value)
 {
     DBGroupCreator.CreateNewGroup(value);
 }