Пример #1
0
        ///<summary>All fields for all reqs will have already been set.  All except for reqstudent.ReqStudentNum if new.  Now, they just have to be persisted to the database.</summary>
        public static void SynchApt(List <ReqStudent> reqsAttached, long aptNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), reqsAttached, aptNum);
                return;
            }
            //first, detach all from this appt
            string command = "UPDATE reqstudent SET AptNum=0 WHERE AptNum=" + POut.Long(aptNum);

            Db.NonQ(command);
            if (reqsAttached.Count == 0)
            {
                return;
            }
            for (int i = 0; i < reqsAttached.Count; i++)
            {
                if (reqsAttached[i].ReqStudentNum == 0)
                {
                    ReqStudents.Insert(reqsAttached[i]);
                }
                else
                {
                    ReqStudents.Update(reqsAttached[i]);
                }
            }
        }
Пример #2
0
        ///<summary>Gets the data necesary to load FormApptEdit.</summary>
        public static LoadData GetLoadData(Appointment AptCur, bool IsNew)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                return(Meth.GetObject <LoadData>(MethodBase.GetCurrentMethod(), AptCur, IsNew));
            }
            LoadData data = new LoadData();

            data.ListProcsForAppt = Procedures.GetProcsForApptEdit(AptCur);
            data.ListAppointments = Appointments.GetAppointmentsForProcs(data.ListProcsForAppt);
            data.Family           = Patients.GetFamily(AptCur.PatNum);
            data.ListPatPlans     = PatPlans.Refresh(AptCur.PatNum);
            data.ListInsSubs      = InsSubs.RefreshForFam(data.Family);
            data.ListBenefits     = Benefits.Refresh(data.ListPatPlans, data.ListInsSubs);
            data.ListInsPlans     = InsPlans.RefreshForSubList(data.ListInsSubs);
            data.TableApptFields  = Appointments.GetApptFields(AptCur.AptNum);
            data.TableComms       = Appointments.GetCommTable(AptCur.PatNum.ToString(), AptCur.AptNum);
            data.Lab          = (IsNew ? null : LabCases.GetForApt(AptCur));
            data.PatientTable = Appointments.GetPatTable(AptCur.PatNum.ToString());
            if (!PrefC.GetBool(PrefName.EasyHideDentalSchools))
            {
                data.ListStudents = ReqStudents.GetForAppt(AptCur.AptNum);
            }
            return(data);
        }
Пример #3
0
        ///<summary>All fields for all reqs will have already been set.  All except for reqstudent.ReqStudentNum if new.  Now, they just have to be persisted to the database.</summary>
        public static void SynchApt(List <ReqStudent> listReqsAttached, List <ReqStudent> listReqsRemoved, long aptNum)
        {
            if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
            {
                Meth.GetVoid(MethodBase.GetCurrentMethod(), listReqsAttached, listReqsRemoved, aptNum);
                return;
            }
            string command;

            //first, delete all that were removed from this appt
            if (listReqsRemoved.Count(x => x.ReqStudentNum != 0) > 0)
            {
                command = "DELETE FROM reqstudent WHERE ReqStudentNum IN(" + string.Join(",", listReqsRemoved.Where(x => x.ReqStudentNum != 0)
                                                                                         .Select(x => x.ReqStudentNum)) + ")";
                Db.NonQ(command);
            }
            //second, detach all from this appt
            command = "UPDATE reqstudent SET AptNum=0 WHERE AptNum=" + POut.Long(aptNum);
            Db.NonQ(command);
            if (listReqsAttached.Count == 0)
            {
                return;
            }
            for (int i = 0; i < listReqsAttached.Count; i++)
            {
                if (listReqsAttached[i].ReqStudentNum == 0)
                {
                    ReqStudents.Insert(listReqsAttached[i]);
                }
                else
                {
                    ReqStudents.Update(listReqsAttached[i]);
                }
            }
        }