예제 #1
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public static bool Add(TaskType taskType)
        {
            lock (BusinessEntity.m_sDS)
            {
                bool success   = false;
                var  attribute = taskType.Attribute();

                if (attribute != null)
                {
                    var dataRow = BusinessEntity.m_sDS.Tasks.AddTasksRow(attribute.Description);

                    try
                    {
                        success = m_sTA.Update(dataRow) == 1;
                    }
                    catch { }

                    if (!success)
                    {
                        BusinessEntity.m_sDS.Tasks.RemoveTasksRow(dataRow);
                    }
                    else
                    {
                        m_sTasks.Add(new Task(dataRow));
                    }
                }

                return(success);
            }
        }
예제 #2
0
        public void Merge()  //DataGridView _dgTasks
        {
            bool nonexhaust;
            int  i, j, cmp;

            nonexhaust = false;
            nonexhaust = readStud.Read();
            nonexhaust = Scoop();
            nonexhaust = readBook.Read();
            //_dgTasks.RowCount = 200;
            j = 0;
            while (nonexhaust)
            {
                cmp = KeyComp(readBook.GetInt32(0), readBook.GetString(2), readBook.GetInt32(4));
                if (cmp < 0)
                {
                    nonexhaust = Scoop();
                }
                else
                if (cmp == 0)
                {
                    for (i = 0; i < Bucket.Studs.Count; i++)
                    {
                        Task.Stud            = Bucket.Studs[i].ToString();
                        Task.Grade           = Bucket.Grade;
                        Task.Theme           = Bucket.Theme;
                        Task.ComplexityLevel = Bucket.ComplexityLevel;
                        Task.NumProb         = readBook.GetString(3);

                        /* _dgTasks.Rows[j].Cells[0].Value = Task.Stud;
                         * _dgTasks.Rows[j].Cells[1].Value = Task.Grade.ToString();
                         * _dgTasks.Rows[j].Cells[2].Value = Task.Theme;
                         * _dgTasks.Rows[j].Cells[3].Value = Task.ComplexityLevel.ToString();
                         * _dgTasks.Rows[j].Cells[4].Value = Task.NumProb;*/
                        rTask         = wPB.Tasks.NewTasksRow();
                        rTask.Student = Task.Stud;
                        rTask.Grade   = (short)Task.Grade;
                        rTask.Theme   = Task.Theme;
                        rTask.Level   = (byte)Task.ComplexityLevel;
                        rTask.Number  = Task.NumProb;
                        wPB.Tasks.Rows.Add(rTask);
                        j = j + 1;
                    }
                    nonexhaust = readBook.Read();
                }
                else
                {
                    nonexhaust = readBook.Read();
                }
            }
            taTastks.Update(wPB.Tasks);
            readBook.Close();
            readStud.Close();
            conProbBook.Close();
        }
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            TasksTableAdapter tasksTableAdapter =
                new TasksTableAdapter();

            tasksTableAdapter.Adapter.RowUpdated +=
                new OleDbRowUpdatedEventHandler(OnRowUpdated);
            int rows = tasksTableAdapter.Update(tasks);

            System.Windows.MessageBox.Show(
                rows + " Appointent(s) have been saved successfully!");
        }
예제 #4
0
        private void saveButton_Click(object sender, RoutedEventArgs e)
        {
            TasksTableAdapter tasksTableAdapter =
                new TasksTableAdapter();

            tasksTableAdapter.Adapter.RowUpdated +=
                new OleDbRowUpdatedEventHandler(OnRowUpdated);
            int rows = tasksTableAdapter.Update(tasks);

            System.Windows.MessageBox.Show(
                "Changes saved back to the database, " +
                rows + " row(s) updated.");
        }