Example #1
0
        private void ShowWorkSystem(ADAMobileDataSet.ScheduleRow scheduleRow)
        {
            int scheduleId = scheduleRow.ScheduleId;

            _scheduleRow = scheduleRow;

            symbolListView1.Items.Clear();

            DataRow[] dataRows        = adaScheduleDataSet1.Activity.Select("ScheduleId=" + scheduleId, "Sequence ASC");
            int       count           = dataRows.Length;
            int       currentActivity = -1;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.ActivityRow  activityRow = dataRows[i] as ADAMobileDataSet.ActivityRow;
                SymbolListView.SymbolListItem item        = new SymbolListView.SymbolListItem();

                bool isExecuted = (!activityRow.IsExecutionStartNull() && !activityRow.IsExecutionEndNull());

                item.Checked = isExecuted;

                if (currentActivity < 0)
                {
                    if (!isExecuted)
                    {
                        currentActivity = i;
                    }
                }

                if (!activityRow.IsSymbolIdNull())
                {
                    if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(activityRow.SymbolRow.Image);
                    }

                    if (activityRow.SymbolRow != null && !activityRow.SymbolRow.IsSoundNull())
                    {
                        item.Sound = activityRow.SymbolRow.Sound;
                    }
                }

                item.Text = string.Format("{0}:{1}", activityRow.Sequence, activityRow.Name);

                symbolListView1.Items.Add(item);
            }

            symbolListView1.SelectedIndex = currentActivity;
            symbolListView1.Invalidate();
            menuItemCurrent.Enabled = (currentActivity >= 0);

            menuItemCurrent.Text = "Current";

            this.Text = scheduleRow.Name;

            EnablePrevNextPageMenuItems();
        }
Example #2
0
        private void menuItemStart_Click(object sender, EventArgs e)
        {
            ADAMobileDataSet.ScheduleRow scheduleRow = _activityRow.ScheduleRowByFK_Activity_Schedule;

            if (scheduleRow.Type == (int)ScheduleType.WorkSystemModel)
            {
                ADAMobileDataSet.ScheduleDataTable scheduleTable  = scheduleRow.Table as ADAMobileDataSet.ScheduleDataTable;
                ADAMobileDataSet.ScheduleRow       newScheduleRow = scheduleTable.NewScheduleRow();
                newScheduleRow.Type     = (int)ScheduleType.WorkSystemInstance;
                newScheduleRow.SymbolId = scheduleRow.SymbolId;
                newScheduleRow.Name     = scheduleRow.Name;
                newScheduleRow.IsActive = true;
                newScheduleRow.rowguid  = Guid.NewGuid();

                ADAMobileDataSet.UserDataTable userTable = scheduleTable.DataSet.Tables["User"] as ADAMobileDataSet.UserDataTable;
                if (userTable.Count > 0)
                {
                    newScheduleRow.UserId = (int)userTable.Rows[0]["UserId"];
                }

                scheduleTable.AddScheduleRow(newScheduleRow);

                ADAMobileDataSet.ActivityRow[]     rows          = scheduleRow.GetActivityRowsByFK_Activity_Schedule();
                ADAMobileDataSet.ActivityDataTable activityTable = _activityRow.Table as ADAMobileDataSet.ActivityDataTable;
                foreach (ADAMobileDataSet.ActivityRow row in rows)
                {
                    ADAMobileDataSet.ActivityRow newRow = activityTable.NewActivityRow();
                    newRow.ScheduleId = newScheduleRow.ScheduleId;
                    newRow.Sequence   = row.Sequence;
                    newRow.Name       = row.Name;
                    newRow.SymbolId   = row.SymbolId;
                    newRow.rowguid    = Guid.NewGuid();
                    activityTable.AddActivityRow(newRow);

                    if (row == _activityRow)
                    {
                        _activityRow = newRow;
                    }
                }
            }

            if (_activityRow.IsExecutionStartNull())
            {
                _activityRow.ExecutionStart = DateTime.Now;
            }
            else
            {
                _activityRow.ExecutionEnd = DateTime.Now;
            }

            DialogResult = DialogResult.OK;
        }
 private void symbolListView1_ItemActivated(object sender, EventArgs args)
 {
     if (_scheduleRow != null)
     {
         ShowDetail(symbolListView1.SelectedIndex);
     }
     else
     {
         DataRow[] dataRows = adaScheduleDataSet1.Schedule.Select("Type = " + (int)ScheduleType.WorkSystemModel, "Name ASC");
         ADAMobileDataSet.ScheduleRow row = dataRows[symbolListView1.SelectedIndex] as ADAMobileDataSet.ScheduleRow;
         ShowWorkSystem(row);
     }
 }
 private void menuItemCurrent_Click(object sender, EventArgs e)
 {
     if (_scheduleRow == null)
     {
         DataRow[] dataRows = adaScheduleDataSet1.Schedule.Select("Type = " + (int)ScheduleType.WorkSystemModel, "Name ASC");
         ADAMobileDataSet.ScheduleRow row = dataRows[symbolListView1.SelectedIndex] as ADAMobileDataSet.ScheduleRow;
         ShowWorkSystem(row);
     }
     else if (symbolListView1.SelectedIndex >= 0)
     {
         symbolListView1.SelectedIndex = GetCurrentActivity();
         ShowDetail(symbolListView1.SelectedIndex);
     }
 }
Example #5
0
        private void ShowModels()
        {
            _scheduleRow = null;
            symbolListView1.Items.Clear();

            DataRow[] dataRows = adaScheduleDataSet1.Schedule.Select("Type = " + (int)ScheduleType.WorkSystemModel, "Name ASC");
            int       count    = dataRows.Length;

            for (int i = 0; i < count; i++)
            {
                ADAMobileDataSet.ScheduleRow  row  = dataRows[i] as ADAMobileDataSet.ScheduleRow;
                SymbolListView.SymbolListItem item = new SymbolListView.SymbolListItem();

                if (!row.IsSymbolIdNull())
                {
                    if (!row.SymbolRow.IsImageNull())
                    {
                        item.Image = ImageEngine.FromArray(row.SymbolRow.Image);
                    }

                    if (!row.SymbolRow.IsSoundNull())
                    {
                        item.Sound = row.SymbolRow.Sound;
                    }
                }

                item.Text = row.Name;

                symbolListView1.Items.Add(item);
            }

            if (count > 0)
            {
                symbolListView1.SelectedIndex = 0;
            }

            menuItemCurrent.Enabled = (count > 0);
            menuItemCurrent.Text    = "View";

            this.Text = "Select Work System";
            symbolListView1.Invalidate();

            EnablePrevNextPageMenuItems();
        }
Example #6
0
        private void UpdateSchedule()
        {
            Cursor.Current = Cursors.WaitCursor;

            if (adaScheduleDataSet1.Schedule.Rows.Count > 0)
            {
                try
                {
                    ADAMobileDataSet.ScheduleRow scheduleRow = adaScheduleDataSet1.Schedule.Rows[0] as ADAMobileDataSet.ScheduleRow;
                    scheduleRow.IsActive = false;
                    ScheduleTableAdapter scheduleAdapter = new ScheduleTableAdapter();
                    int ret = scheduleAdapter.Update(adaScheduleDataSet1.Schedule);
                }
                catch (Exception ex)
                {
                    ReportError(ex);
                }

                Cursor.Current = Cursors.Default;
            }
        }