Beispiel #1
0
        /// <summary>
        /// this is a function to make a Group List from database
        /// </summary>
        /// <returns>list of DescriptionDetail</returns>
        public List <GroupDetail> makeGroupList()
        {
            groupList.Clear();
            List <GroupDetail> tempGroupList = new List <GroupDetail>();
            int     retVal = 0;
            DataSet ds     = Sqlite.ExecuteSQLStatement(Query.getGroupList(), ref retVal);

            for (int i = 0; i < retVal; i++)
            {
                GroupDetail gpTemp = new GroupDetail();
                //Group ID
                if (int.TryParse(ds.Tables[0].Rows[i].ItemArray[4].ToString(), out int id))
                {
                    gpTemp.groupID = id;
                }
                //Group name
                gpTemp.groupName = ds.Tables[0].Rows[i].ItemArray[0].ToString();

                //start date
                // gpTemp.groupStartDate.Equals(ds.Tables[0].Rows[i].ItemArray[2]);
                gpTemp.groupSStartDate = ds.Tables[0].Rows[i].ItemArray[1].ToString();

                //start time
                gpTemp.groupStartTime = ds.Tables[0].Rows[i].ItemArray[2].ToString();
                //description
                gpTemp.groupDesc = ds.Tables[0].Rows[i].ItemArray[3].ToString();

                //add to list
                groupList.Add(gpTemp);
            }

            return(groupList);
        }
Beispiel #2
0
        /// <summary>
        /// on click "save" button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            GroupList                = new GroupDetail();
            GroupList.groupName      = txtGroupName.Text;
            GroupList.groupStartDate = dteDate.SelectedDate.Value;

            if (GroupList.groupStartDate.Month < 10)
            {
                GroupList.groupSStartDate = GroupList.groupStartDate.Year.ToString() + "-0" + GroupList.groupStartDate.Month.ToString();
            }
            else
            {
                GroupList.groupSStartDate = GroupList.groupStartDate.Year.ToString() + "-" + GroupList.groupStartDate.Month.ToString();
            }
            if (GroupList.groupStartDate.Day < 10)
            {
                GroupList.groupSStartDate += "-0" + GroupList.groupStartDate.Day.ToString();
            }
            else
            {
                GroupList.groupSStartDate += "-" + GroupList.groupStartDate.Day.ToString();
            }


            GroupList.groupDesc      = txtSubject.Text;
            GroupList.groupStartTime = scheduleHours + ":" + scheduleMins;
            Sqlite.ExecuteNonQuery(Query.insertGroup(GroupList));

            Close();
        }
Beispiel #3
0
 public void addGroupList(GroupDetail gp)
 {
     groupList.Add(gp);
 }
Beispiel #4
0
 public string UpdateGroup(GroupDetail group)
 {
     return("UPDATE ClassGroup SET Name = '" + group.groupName + "', StartDate ='" + group.groupSStartDate + "'," +
            "ScheduledTimeStart ='" + group.groupStartTime + "', Description = '" + group.groupDesc + "' WHERE (_id = " + group.groupID + ");");
 }
Beispiel #5
0
 public string insertGroup(GroupDetail group)
 {
     return("INSERT INTO ClassGroup (Name,StartDate,ScheduledTimeStart,Description)" +
            "VALUES ('" + group.groupName + "', '" + group.groupSStartDate + "','" + group.groupStartTime + "', '" + group.groupDesc + "');");
 }