Пример #1
0
        private void gridGraph_CellClick(object sender, ODGridClickEventArgs e)
        {
            //only allow clicking on the 'Desired Graph Status' column
            if (e.Col != 3 || gridGraph.Rows[e.Row].Tag == null || !(gridGraph.Rows[e.Row].Tag is PhoneEmpDefault))
            {
                return;
            }
            PhoneEmpDefault phoneEmpDefault = (PhoneEmpDefault)gridGraph.Rows[e.Row].Tag;
            bool            uiGraphStatus   = gridGraph.Rows[e.Row].Cells[e.Col].Text.ToLower() == "x";
            bool            dbGraphStatus   = PhoneEmpDefaults.GetGraphedStatusForEmployeeDate(phoneEmpDefault.EmployeeNum, DateEdit);

            if (uiGraphStatus != dbGraphStatus)
            {
                MessageBox.Show(Lan.g(this, "Graph status has changed unexpectedly for employee: ") + phoneEmpDefault.EmpName + Lan.g(this, ". Exit and reopen this form, and try again."));
                return;
            }
            //flip the bit in the db and reload the grid
            PhoneGraph pg = new PhoneGraph();

            pg.EmployeeNum = phoneEmpDefault.EmployeeNum;
            pg.DateEntry   = DateEdit;
            pg.IsGraphed   = !uiGraphStatus;         //flip the bit
            PhoneGraphs.InsertOrUpdate(pg);          //update the db
            FillGrid();
        }
Пример #2
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateEntry.Text == "" || textDateEntry.errorProvider1.GetError(textDateEntry) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            //user brought in an existing entry and may have modified it so get rid of it and recreate it in its entirety
            //EG...
            //user brought in 9/27/13 Checked: TRUE...
            //then changed date to 9/28/13 Checked: FALSE...
            //user has expectation that the 9/27 entry will be gone and new 9/28 entry will be created
            if (!PhoneGraphCur.IsNew)
            {
                PhoneGraphs.Delete(PhoneGraphCur.PhoneGraphNum);
            }
            PhoneGraph pg = new PhoneGraph();

            pg.EmployeeNum = EmployeeNum;
            pg.DateEntry   = PIn.Date(textDateEntry.Text);
            pg.IsGraphed   = checkIsGraphed.Checked;
            PhoneGraphs.InsertOrUpdate(pg);
            DialogResult = DialogResult.OK;
        }