Example #1
0
        private void btnUpdateEquip_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                if (dataGridViewX1.SelectedRows.Count > 0)
                {
                    string placeID    = treeView1.SelectedNode.Name;
                    string placeName  = treeView1.SelectedNode.Text;
                    string equipID    = "" + dataGridViewX1.SelectedRows[0].Tag;
                    string equipname  = "" + dataGridViewX1.SelectedRows[0].Cells[1].Value;
                    string propertyNo = "" + dataGridViewX1.SelectedRows[0].Cells[2].Value;

                    frmEquip form = new frmEquip(FormMode.Update, placeID, placeName, equipID, equipname, propertyNo);
                    form.Text        = string.Format("{0}設施", EnumDescription.Get(typeof(FormMode), FormMode.Update.ToString()));
                    form.FormClosed += delegate
                    {
                        if (form.DialogResult == DialogResult.Yes)
                        {
                            ReloadDataGridView1(placeID);
                        }
                    };
                    form.ShowDialog();
                }
            }
        }
Example #2
0
        private void btnAddPlace_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null)
            {
                string parentID = treeView1.SelectedNode.Name;
                int    level    = treeView1.SelectedNode.Level;

                if (treeView1.SelectedNode.Level == 3)
                {
                    MsgBox.Show("階層已達上限,無法再往下新增所屬位置!");
                }
                else
                {
                    frmPlace form = new frmPlace(FormMode.Add, null, parentID, null, level);
                    form.Text        = string.Format("{0}位置", EnumDescription.Get(typeof(FormMode), FormMode.Add.ToString()));
                    form.FormClosed += delegate
                    {
                        if (form.DialogResult == DialogResult.Yes)
                        {
                            ReloadTreeView();
                        }
                    };
                    form.ShowDialog();
                }
            }
        }
        private void frmCaseManager_Load(object sender, EventArgs e)
        {
            #region Init dateTime
            {
                dtStart.Value = DateTime.Now.AddDays(-7);
                dtEnd.Value   = DateTime.Now;
            }
            #endregion

            #region Init cbxStatus
            {
                Status ob1 = new Status();
                ob1.Mode    = CaseStatus.IsClose;
                ob1.Name    = EnumDescription.Get(typeof(CaseStatus), CaseStatus.IsClose.ToString());
                ob1.IsClose = true;
                cbxStatus.Items.Add(ob1);

                Status ob2 = new Status();
                ob2.Mode    = CaseStatus.UnClose;
                ob2.Name    = EnumDescription.Get(typeof(CaseStatus), CaseStatus.UnClose.ToString());
                ob2.IsClose = false;
                cbxStatus.Items.Add(ob2);

                cbxStatus.SelectedIndex = 1;
                cbxStatus.DisplayMember = "Name";
                cbxStatus.ValueMember   = "IsClose";
            }
            #endregion

            #region Init cbxProgress
            {
                cbxProgress.Items.Add("--全部--");
                cbxProgress.Items.Add("未處理");
                cbxProgress.Items.Add("已維修");
                cbxProgress.Items.Add("待料中");
                cbxProgress.Items.Add("待廠商維修中");
                cbxProgress.Items.Add("校內自行處理");


                cbxProgress.SelectedIndex = 0;
            }
            #endregion

            ReloadDataGridView();

            if (!DAO.Actor.Instance.IsAdmin())
            {
                btnSetCase.Enabled = false;
                btnMerge.Enabled   = false;
                btnDoCase.Enabled  = false;
            }
        }
Example #4
0
 private void btnAddReason_Click(object sender, EventArgs e)
 {
     if (dataGridViewX1.SelectedRows.Count > 0 && dataGridViewX1.SelectedRows[0].Index > -1)
     {
         string          equipID   = "" + dataGridViewX1.SelectedRows[0].Tag;
         string          equipName = "" + dataGridViewX1.SelectedRows[0].Cells[1].Value;
         frmBrokenReason form      = new frmBrokenReason(FormMode.Add, equipID, equipName, null, null);
         form.Text        = string.Format("{0}損壞原因", EnumDescription.Get(typeof(FormMode), FormMode.Add.ToString()));
         form.FormClosed += delegate
         {
             if (form.DialogResult == DialogResult.Yes)
             {
                 ReloadDataGridView2();
             }
         };
         form.ShowDialog();
     }
 }
Example #5
0
        private void btnAddEquip_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null && !string.IsNullOrEmpty(treeView1.SelectedNode.Name))
            {
                string placeID   = treeView1.SelectedNode.Name;
                string placeName = treeView1.SelectedNode.Text;

                frmEquip form = new frmEquip(FormMode.Add, placeID, placeName, null, null, null);
                form.Text        = string.Format("{0}設施", EnumDescription.Get(typeof(FormMode), FormMode.Add.ToString()));
                form.FormClosed += delegate
                {
                    if (form.DialogResult == DialogResult.Yes)
                    {
                        ReloadDataGridView1(placeID);
                    }
                };
                form.ShowDialog();
            }
        }
Example #6
0
        private void btnUpdatePlace_Click(object sender, EventArgs e)
        {
            if (treeView1.SelectedNode != null && treeView1.SelectedNode.Name != "")
            {
                string placeID   = treeView1.SelectedNode.Name;
                string parentID  = "" + treeView1.SelectedNode.Parent.Name;
                int    level     = treeView1.SelectedNode.Level;
                string placeName = treeView1.SelectedNode.Text;

                frmPlace form = new frmPlace(FormMode.Update, placeName, parentID, placeID, level);
                form.Text        = string.Format("{0}位置", EnumDescription.Get(typeof(FormMode), FormMode.Update.ToString()));
                form.FormClosed += delegate
                {
                    if (form.DialogResult == DialogResult.Yes)
                    {
                        ReloadTreeView();
                    }
                };
                form.ShowDialog();
            }
        }