예제 #1
0
 //private void butAll_Click(object sender,EventArgs e) {
 //    for(int i=0;i<listProv.Items.Count;i++){
 //        listProv.SetSelected(i,true);
 //    }
 //}
 private void butAddTime_Click(object sender, System.EventArgs e)
 {
     Schedule SchedCur=new Schedule();
     SchedCur.SchedDate=SchedCurDate;
     SchedCur.Status=SchedStatus.Open;
     SchedCur.StartTime=new TimeSpan(8,0,0);//8am
     SchedCur.StopTime=new TimeSpan(17,0,0);//5pm
     //schedtype, provNum, and empnum will be set down below
     FormScheduleEdit FormS=new FormScheduleEdit();
     FormS.SchedCur=SchedCur;
     FormS.ShowDialog();
     if(FormS.DialogResult!=DialogResult.OK){
         return;
     }
     Schedule schedTemp;
     for(int i=0;i<listProv.SelectedIndices.Count;i++){
         schedTemp=new Schedule();
         schedTemp=SchedCur.Copy();
         schedTemp.SchedType=ScheduleType.Provider;
         schedTemp.ProvNum=ProviderC.ListShort[listProv.SelectedIndices[i]].ProvNum;
         SchedList.Add(schedTemp);
     }
     for(int i=0;i<listEmp.SelectedIndices.Count;i++) {
         schedTemp=new Schedule();
         schedTemp=SchedCur.Copy();
         schedTemp.SchedType=ScheduleType.Employee;
         schedTemp.EmployeeNum=Employees.ListShort[listEmp.SelectedIndices[i]].EmployeeNum;
         SchedList.Add(schedTemp);
     }
     FillGrid();
 }
예제 #2
0
		private void OnBlockCut_Click() {
			if(!Security.IsAuthorized(Permissions.Blockouts)) {
				return;
			}
			//not even enabled if not right click on a blockout
			Schedule SchedCur=GetClickedBlockout();
			if(SchedCur==null) {
				MessageBox.Show("Blockout not found.");
				return;//should never happen
			}
			BlockoutClipboard=SchedCur.Copy();
			Schedules.Delete(SchedCur);
			RefreshPeriod();
		}
		///<summary></summary>
		public FormScheduleBlockEdit(Schedule schedCur){
			InitializeComponent();
			SchedCur=schedCur;
			Lan.F(this);
		}
예제 #4
0
		private void butHoliday_Click(object sender,System.EventArgs e) {
			for(int i=0;i<_listScheds.Count;i++){
				if(_listScheds[i].SchedType==ScheduleType.Practice
					&& _listScheds[i].Status==SchedStatus.Holiday)
				{
					MsgBox.Show(this,"Day is already a Holiday.");
					return;
				}
			}
		  Schedule SchedCur=new Schedule();
      SchedCur.SchedDate=_dateSched;
      SchedCur.Status=SchedStatus.Holiday;
			SchedCur.SchedType=ScheduleType.Practice;
		  FormScheduleEdit FormS=new FormScheduleEdit();
			FormS.SchedCur=SchedCur;
			FormS.ClinicNum=_clinicNum;
      FormS.ShowDialog();
			if(FormS.DialogResult!=DialogResult.OK) {
				return;
			}
			_listScheds.Add(SchedCur);
      FillGrid();
		}
예제 #5
0
		private void butNote_Click(object sender,EventArgs e) {
			Schedule SchedCur=new Schedule();
			SchedCur.SchedDate=_dateSched;
			SchedCur.Status=SchedStatus.Open;
			SchedCur.SchedType=ScheduleType.Practice;
			FormScheduleEdit FormS=new FormScheduleEdit();
			FormS.SchedCur=SchedCur;
			FormS.ClinicNum=_clinicNum;
			FormS.ShowDialog();
			if(FormS.DialogResult!=DialogResult.OK) {
				return;
			}
			_listScheds.Add(SchedCur);
			FillGrid();
		}
예제 #6
0
		private void butProvNote_Click(object sender,EventArgs e) {
			Schedule schedCur=new Schedule();
			schedCur.SchedDate=_dateSched;
			schedCur.Status=SchedStatus.Open;
			//schedtype, provNum, and empnum will be set down below
			FormScheduleEdit FormS=new FormScheduleEdit();
			FormS.SchedCur=schedCur;
			FormS.ClinicNum=_clinicNum;
			FormS.ShowDialog();
			if(FormS.DialogResult!=DialogResult.OK) {
				return;
			}
			Schedule schedTemp;
			for(int i=0;i<listProv.SelectedIndices.Count;i++) {
				schedTemp=new Schedule();
				schedTemp=schedCur.Copy();
				schedTemp.SchedType=ScheduleType.Provider;
				schedTemp.ProvNum=_listProvs[listProv.SelectedIndices[i]].ProvNum;
				_listScheds.Add(schedTemp);
			}
			for(int i=0;i<listEmp.SelectedIndices.Count;i++) {
				schedTemp=new Schedule();
				schedTemp=schedCur.Copy();
				schedTemp.SchedType=ScheduleType.Employee;
				schedTemp.EmployeeNum=_listEmps[listEmp.SelectedIndices[i]].EmployeeNum;
				_listScheds.Add(schedTemp);
			}
			FillGrid();
		}
예제 #7
0
		private int CompareSchedule(Schedule x,Schedule y){
			if(x==y){
				return 0;
			}
			if(x==null && y==null){
				return 0;
			}
			if(y==null){
				return 1;
			}
			if(x==null){
				return -1;
			}
			if(x.SchedType!=y.SchedType){
				return x.SchedType.CompareTo(y.SchedType);
			}
			if(x.ProvNum!=y.ProvNum){
				return Providers.GetProv(x.ProvNum).ItemOrder.CompareTo(Providers.GetProv(y.ProvNum).ItemOrder);
			}
			if(x.EmployeeNum!=y.EmployeeNum) {
				return Employees.GetEmp(x.EmployeeNum).FName.CompareTo(Employees.GetEmp(y.EmployeeNum).FName);
			}
			return x.StartTime.CompareTo(y.StartTime);
		}
예제 #8
0
파일: Schedules.cs 프로젝트: nampn/ODental
 ///<summary></summary>
 private static void Validate(Schedule sched)
 {
     if(sched.StartTime > sched.StopTime) {
         throw new Exception(Lans.g("Schedule","Stop time must be later than start time."));
     }
     if(sched.StartTime+TimeSpan.FromMinutes(5) > sched.StopTime	&& sched.Status==SchedStatus.Open) {
         throw new Exception(Lans.g("Schedule","Stop time cannot be the same as the start time."));
     }
 }
예제 #9
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary>Supply a list of all Schedule for one day. Then, this filters out for one type.</summary>
		public static Schedule[] GetForType(List<Schedule> ListDay,ScheduleType schedType,long provNum){
			//No need to check RemotingRole; no call to db.
			ArrayList AL=new ArrayList();
			for(int i=0;i<ListDay.Count;i++){
				if(ListDay[i].SchedType==schedType && ListDay[i].ProvNum==provNum){
					AL.Add(ListDay[i]);
				}
			}
			Schedule[] retVal=new Schedule[AL.Count];
			AL.CopyTo(retVal);
			return retVal;
		}
예제 #10
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary></summary>
		public static void Delete(Schedule sched){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),sched);
				return;
			}
			string command= "DELETE from schedule WHERE schedulenum = '"+POut.Long(sched.ScheduleNum)+"'";
 			Db.NonQ(command);
			command="DELETE FROM scheduleop WHERE ScheduleNum="+POut.Long(sched.ScheduleNum);
			Db.NonQ(command);
			if(sched.SchedType==ScheduleType.Provider){
				DeletedObjects.SetDeleted(DeletedObjectType.ScheduleProv,sched.ScheduleNum);
			}
		}
예제 #11
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary>Goes to the db to look for overlaps.  Implemented for blockouts, but should work for other types, too.</summary>
		public static bool Overlaps(Schedule sched){
			//No need to check RemotingRole; no call to db.
			List<Schedule> SchedListDay=Schedules.GetDayList(sched.SchedDate);
			Schedule[] ListForType=Schedules.GetForType(SchedListDay,sched.SchedType,sched.ProvNum);//blockouts
			bool opsMatch;
			for(int i=0;i<ListForType.Length;i++){
				if(ListForType[i].SchedType==ScheduleType.Blockout){
					//only look in the same ops
					opsMatch=false;
					for(int s1=0;s1<sched.Ops.Count;s1++){
						if(ListForType[i].Ops.Contains(sched.Ops[s1])){
							opsMatch=true;
							break;
						}
					}
					if(!opsMatch){
						continue;
					}
				}
				if(sched.ScheduleNum!=ListForType[i].ScheduleNum
					&& sched.StopTime  > ListForType[i].StartTime //stop time after another schedule has started
					&& sched.StartTime < ListForType[i].StopTime) //start time before the other schedule has ended.
				{
					return true;
				}
			}
			return false;
		}
예제 #12
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary></summary>
		private static void Validate(Schedule sched){
			if(sched.StopTime > TimeSpan.FromDays(1)) {//if pasting to late afternoon, the stop time might be calculated as early the next morning.
				throw new Exception(Lans.g("Schedule","Stop time must be later than start time."));
			}
			if(sched.StartTime > sched.StopTime) {
				throw new Exception(Lans.g("Schedule","Stop time must be later than start time."));
			}
			if(sched.StartTime+TimeSpan.FromMinutes(5) > sched.StopTime	&& sched.Status==SchedStatus.Open) {
				throw new Exception(Lans.g("Schedule","Stop time cannot be the same as the start time."));
			}
		}
예제 #13
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary>Set validate to true to throw an exception if start and stop times need to be validated.  If validate is set to false, then the calling code is responsible for the validation.  Also inserts necessary scheduleop enteries.</summary>
		public static long Insert(Schedule sched,bool validate){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				sched.ScheduleNum=Meth.GetLong(MethodBase.GetCurrentMethod(),sched,validate);
				return sched.ScheduleNum;
			}
			if(validate) {
				Validate(sched);
			}
			Crud.ScheduleCrud.Insert(sched);
			ScheduleOp op;
			for(int i=0;i<sched.Ops.Count;i++){
				op=new ScheduleOp();
				op.ScheduleNum=sched.ScheduleNum;
				op.OperatoryNum=sched.Ops[i];
				ScheduleOps.Insert(op);
			}
			return sched.ScheduleNum;
		}
예제 #14
0
파일: Schedules.cs 프로젝트: mnisl/OD
		///<summary></summary>
		public static void Update(Schedule sched){
			if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) {
				Meth.GetVoid(MethodBase.GetCurrentMethod(),sched);
				return;
			}
			Validate(sched);
			Crud.ScheduleCrud.Update(sched);
			string command="DELETE FROM scheduleop WHERE ScheduleNum="+POut.Long (sched.ScheduleNum);
			Db.NonQ(command);
			ScheduleOp op;
			for(int i=0;i<sched.Ops.Count;i++){
				op=new ScheduleOp();
				op.ScheduleNum=sched.ScheduleNum;
				op.OperatoryNum=sched.Ops[i];
				ScheduleOps.Insert(op);
			}
		}
예제 #15
0
		private void OnBlockAdd_Click() {
			if(!Security.IsAuthorized(Permissions.Blockouts)) {
				return;
			}
			Schedule SchedCur=new Schedule();
			SchedCur.SchedDate=AppointmentL.DateSelected;
			if(ApptDrawing.IsWeeklyView) {
				SchedCur.SchedDate=WeekStartDate.AddDays(SheetClickedonDay);
			}
			SchedCur.SchedType=ScheduleType.Blockout;
			FormScheduleBlockEdit FormSB=new FormScheduleBlockEdit(SchedCur);
			FormSB.IsNew=true;
			FormSB.ShowDialog();
			SecurityLogs.MakeLogEntry(Permissions.Blockouts,0,"Blockout add.");
			RefreshPeriod();
		}
예제 #16
0
		///<summary>Setting clinicNum to 0 will show all operatories, otherwise only operatories for the clinic passed in will show.</summary>
		public FormScheduleBlockEdit(Schedule schedCur,long clinicNum) {
			InitializeComponent();
			_schedCur=schedCur;
			_clinicNum=clinicNum;
			Lan.F(this);
		}
예제 #17
0
파일: Schedules.cs 프로젝트: nampn/ODental
 ///<summary></summary>
 private static bool Overlaps(Schedule sched)
 {
     //No need to check RemotingRole; no call to db.
     List<Schedule> SchedListDay=Schedules.GetDayList(sched.SchedDate);
     Schedule[] ListForType=Schedules.GetForType(SchedListDay,sched.SchedType,sched.ProvNum);
     bool opsMatch;
     for(int i=0;i<ListForType.Length;i++){
         if(ListForType[i].SchedType==ScheduleType.Blockout){
             //skip if blockout, and ops don't interfere
             opsMatch=false;
             for(int s1=0;s1<sched.Ops.Count;s1++){
                 if(ListForType[i].Ops.Contains(sched.Ops[s1])){
                     opsMatch=true;
                     break;
                 }
             }
             if(!opsMatch){
                 continue;
             }
         }
         if(sched.ScheduleNum!=ListForType[i].ScheduleNum
             && sched.StartTime >= ListForType[i].StartTime
             && sched.StartTime < ListForType[i].StopTime)
         {
             return true;
         }
         if(sched.ScheduleNum!=ListForType[i].ScheduleNum
             && sched.StopTime > ListForType[i].StartTime
             && sched.StopTime <= ListForType[i].StopTime)
         {
             return true;
         }
         if(sched.ScheduleNum!=ListForType[i].ScheduleNum
             && sched.StartTime <= ListForType[i].StartTime
             && sched.StopTime >= ListForType[i].StopTime)
         {
             return true;
         }
     }
     return false;
 }