Пример #1
0
 private void checkIsGraphed_Click(object sender, EventArgs e)
 {
     if (Security.IsAuthorized(Permissions.Schedules))
     {
         PhoneGraph phoneGraph = PhoneGraphs.GetForEmployeeNumAndDate(PedCur.EmployeeNum, DateTime.Today); //check for override
         if (phoneGraph == null)                                                                           //no existing entry so exit
         {
             return;
         }
         if (checkIsGraphed.Checked == phoneGraph.IsGraphed)               //default matches existing entry so exit
         {
             return;
         }
         //we have an existing entry so ask if they want to get rid of it
         if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Phone Graph override exists to the contrary of new setting for this employee. Do you want to delete the override and use the default?"))
         {
             return;
         }
         //get rid of the existing
         PhoneGraphs.Delete(phoneGraph.PhoneGraphNum);
         FillGrid();
         return;
     }
     //Put the checkbox back the way it was before user clicked on it.
     if (checkIsGraphed.Checked)
     {
         checkIsGraphed.Checked = false;
     }
     else
     {
         checkIsGraphed.Checked = true;
     }
 }
Пример #2
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (PhoneGraphCur.IsNew)
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
     PhoneGraphs.Delete(PhoneGraphCur.PhoneGraphNum);
     DialogResult = DialogResult.OK;
 }
Пример #3
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;
        }