예제 #1
0
        ///<summary></summary>
        public static void Insert(ScreenGroup Cur)
        {
            if (PrefB.RandomKeys)
            {
                Cur.ScreenGroupNum = MiscData.GetKey("screengroup", "ScreenGroupNum");
            }
            string command = "INSERT INTO screengroup (";

            if (PrefB.RandomKeys)
            {
                command += "ScreenGroupNum,";
            }
            command += "Description,SGDate) VALUES(";
            if (PrefB.RandomKeys)
            {
                command += "'" + POut.PInt(Cur.ScreenGroupNum) + "', ";
            }
            command +=
                "'" + POut.PString(Cur.Description) + "', "
                + POut.PDate(Cur.SGDate) + ")";
            if (PrefB.RandomKeys)
            {
                General.NonQ(command);
            }
            else
            {
                Cur.ScreenGroupNum = General.NonQ(command, true);
            }
        }
예제 #2
0
        ///<summary>This will also delete all screen items, so may need to ask user first.</summary>
        public static void Delete(ScreenGroup Cur)
        {
            string command = "DELETE from screen WHERE ScreenGroupNum ='" + POut.PInt(Cur.ScreenGroupNum) + "'";

            General.NonQ(command);
            command = "DELETE from screengroup WHERE ScreenGroupNum ='" + POut.PInt(Cur.ScreenGroupNum) + "'";
            General.NonQ(command);
        }
예제 #3
0
        ///<summary></summary>
        public static void Update(ScreenGroup Cur)
        {
            string command = "UPDATE screengroup SET "
                             + "Description ='" + POut.PString(Cur.Description) + "'"
                             + ",SGDate =" + POut.PDate(Cur.SGDate)
                             + " WHERE ScreenGroupNum = '" + POut.PInt(Cur.ScreenGroupNum) + "'";

            General.NonQ(command);
        }
예제 #4
0
        ///<summary>Updates all screens for a group with the date,prov, and location info of the current group.</summary>
        public static void UpdateForGroup(ScreenGroup ScreenGroupCur)
        {
            string command = "UPDATE screen SET "
                             + "ScreenDate     =" + POut.PDate(ScreenGroupCur.SGDate)
                             + ",GradeSchool ='" + POut.PString(ScreenGroupCur.GradeSchool) + "'"
                             + ",County ='" + POut.PString(ScreenGroupCur.County) + "'"
                             + ",PlaceService ='" + POut.PInt((int)ScreenGroupCur.PlaceService) + "'"
                             + ",ProvNum ='" + POut.PInt(ScreenGroupCur.ProvNum) + "'"
                             + ",ProvName ='" + POut.PString(ScreenGroupCur.ProvName) + "'"
                             + " WHERE ScreenGroupNum = '" + ScreenGroupCur.ScreenGroupNum.ToString() + "'";

            General.NonQ(command);
        }
예제 #5
0
        private void butAdd_Click(object sender, System.EventArgs e)
        {
            ScreenGroup screenGroup = new ScreenGroup();

            if (_listScreenGroups.Count != 0)
            {
                screenGroup = _listScreenGroups[_listScreenGroups.Count - 1]; //'remembers' the last entry
            }
            screenGroup.SGDate = DateTime.Today;                              //except date will be today
            screenGroup.IsNew  = true;
            FormScreenGroupEdit FormSG = new FormScreenGroupEdit(screenGroup);

            FormSG.ShowDialog();
            FillGrid();
        }
예제 #6
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (gridMain.SelectedIndices.Length != 1)
     {
         MessageBox.Show("Please select one item first.");
         return;
     }
     ScreenGroupCur = ScreenGroupList[gridMain.GetSelectedIndex()];
     OpenDentBusiness.Screen[] screenList = Screens.Refresh(ScreenGroupCur.ScreenGroupNum);
     if (screenList.Length > 0)
     {
         MessageBox.Show("Not allowed to delete a screening group with items in it.");
         return;
     }
     ScreenGroups.Delete(ScreenGroupCur);
     FillGrid();
 }
예제 #7
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            if (listMain.SelectedIndices.Count != 1)
            {
                MessageBox.Show("Please select one item first.");
                return;
            }
            ScreenGroup ScreenGroupCur = ScreenGroups.List[listMain.SelectedIndices[0]];

            Screens.Refresh(ScreenGroupCur.ScreenGroupNum);
            if (Screens.List.Length > 0)
            {
                MessageBox.Show("Not allowed to delete a screening group with items in it.");
                return;
            }
            ScreenGroups.Delete(ScreenGroupCur);
            FillGrid();
        }
예제 #8
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            if (gridMain.SelectedIndices.Length != 1)
            {
                MessageBox.Show("Please select one item first.");
                return;
            }
            ScreenGroup screenGroupCur = _listScreenGroups[gridMain.GetSelectedIndex()];
            List <OpenDentBusiness.Screen> listScreens = Screens.GetScreensForGroup(screenGroupCur.ScreenGroupNum);

            if (listScreens.Count > 0)
            {
                MessageBox.Show("Not allowed to delete a screening group with items in it.");
                return;
            }
            ScreenGroups.Delete(screenGroupCur);
            FillGrid();
        }
예제 #9
0
        ///<summary></summary>
        public static void Refresh(DateTime fromDate, DateTime toDate)
        {
            string command =
                "SELECT * from screengroup "
                + "WHERE SGDate >= " + POut.PDateT(fromDate) + " "
                + "AND SGDate <= " + POut.PDateT(toDate.AddDays(1)) + " "
                //added one day since it's calculated based on midnight.
                + "ORDER BY SGDate,ScreenGroupNum";
            DataTable table = General.GetTable(command);;

            List = new ScreenGroup[table.Rows.Count];
            for (int i = 0; i < List.Length; i++)
            {
                List[i] = new ScreenGroup();
                List[i].ScreenGroupNum = PIn.PInt(table.Rows[i][0].ToString());
                List[i].Description    = PIn.PString(table.Rows[i][1].ToString());
                List[i].SGDate         = PIn.PDate(table.Rows[i][2].ToString());
            }
        }