///<summary></summary> public static long Insert(Operatory operatory) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { operatory.OperatoryNum=Meth.GetLong(MethodBase.GetCurrentMethod(),operatory); return operatory.OperatoryNum; } return Crud.OperatoryCrud.Insert(operatory); }
///<summary>Hides all operatories that are not the master op and moves any appointments passed in into the master op. ///Throws exceptions</summary> public static void MergeOperatoriesIntoMaster(long masterOpNum, List <long> listOpNumsToMerge, List <Appointment> listApptsToMerge) { //No need to check RemotingRole; No db call. List <Operatory> listOps = Operatories.GetDeepCopy(); Operatory masterOp = listOps.FirstOrDefault(x => x.OperatoryNum == masterOpNum); if (masterOp == null) { throw new ApplicationException(Lans.g("Operatories", "Operatory to merge into no longer exists.")); } if (listApptsToMerge.Count > 0) { //All appts in listAppts are appts that we are going to move to new op. List <Appointment> listApptsNew = listApptsToMerge.Select(x => x.Copy()).ToList(); //Copy object so that we do not change original object in memory. listApptsNew.ForEach(x => x.Op = masterOpNum); //Associate to new op selection Appointments.Sync(listApptsNew, listApptsToMerge, 0); } List <Operatory> listOpsToMerge = listOps.Select(x => x.Copy()).ToList(); //Copy object so that we do not change original object in memory. listOpsToMerge.FindAll(x => x.OperatoryNum != masterOpNum && listOpNumsToMerge.Contains(x.OperatoryNum)) .ForEach(x => x.IsHidden = true); Operatories.Sync(listOpsToMerge, listOps); SecurityLogs.MakeLogEntry(Permissions.Setup, 0 , Lans.g("Operatories", "The following operatories and all of their appointments were merged into the") + " " + masterOp.Abbrev + " " + Lans.g("Operatories", "operatory;") + " " + string.Join(", ", listOpsToMerge.FindAll(x => x.OperatoryNum != masterOpNum && listOpNumsToMerge.Contains(x.OperatoryNum)).Select(x => x.Abbrev))); }
///<summary></summary> public static void Update(Operatory operatory) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),operatory); return; } Crud.OperatoryCrud.Update(operatory); }
public static string GetOpName(long operatoryNum) { //No need to check RemotingRole; no call to db. Operatory operatory = GetFirstOrDefault(x => x.OperatoryNum == operatoryNum); return(operatory == null ? "" : operatory.OpName); }
private void butAdd_Click(object sender, System.EventArgs e) { Operatory opCur=new Operatory(); if(gridMain.SelectedIndices.Length>0){//a row is selected opCur.ItemOrder=gridMain.SelectedIndices[0]; } else{ opCur.ItemOrder=OperatoryC.Listt.Count;//goes at end of list } FormOperatoryEdit FormE=new FormOperatoryEdit(opCur); FormE.IsNew=true; FormE.ShowDialog(); if(FormE.DialogResult==DialogResult.Cancel){ return; } if(gridMain.SelectedIndices.Length>0){ //fix the itemOrder of every Operatory following this one for(int i=gridMain.SelectedIndices[0];i<OperatoryC.Listt.Count;i++){ OperatoryC.Listt[i].ItemOrder++; Operatories.Update(OperatoryC.Listt[i]); } } FillGrid(); changed=true; }
///<summary></summary> public FormOperatoryEdit(Operatory opCur) { // // Required for Windows Form Designer support // OpCur=opCur; InitializeComponent(); Lan.F(this); }
///<summary>If no provider is found for spot then the operatory provider is returned.</summary> public static long GetAssignedProvNumForSpot(List <Schedule> listForPeriod, Operatory op, bool isSecondary, DateTime aptDateTime) { //No need to check RemotingRole; no call to db. //first, look for a sched assigned specifically to that spot for (int i = 0; i < listForPeriod.Count; i++) { if (listForPeriod[i].SchedType != ScheduleType.Provider) { continue; } if (aptDateTime.Date != listForPeriod[i].SchedDate) { continue; } if (!listForPeriod[i].Ops.Contains(op.OperatoryNum)) { continue; } if (isSecondary && !Providers.GetIsSec(listForPeriod[i].ProvNum)) { continue; } if (!isSecondary && Providers.GetIsSec(listForPeriod[i].ProvNum)) { continue; } //for the time, if the sched starts later than the apt starts if (listForPeriod[i].StartTime > aptDateTime.TimeOfDay) { continue; } //or if the sched ends (before or at same time) as the apt starts if (listForPeriod[i].StopTime <= aptDateTime.TimeOfDay) { continue; } //matching sched found Plugins.HookAddCode(null, "Schedules.GetAssignedProvNumForSpot_Found", isSecondary); return(listForPeriod[i].ProvNum); } //if no matching sched found, then use the operatory Plugins.HookAddCode(null, "Schedules.GetAssignedProvNumForSpot_None", isSecondary); if (isSecondary) { return(op.ProvHygienist); } else { return(op.ProvDentist); } //return 0;//none }
///<summary>This overload is for when the listForPeriod includes only one day.</summary> public static List <Schedule> GetSchedsForOp(List <Schedule> listForPeriod, Operatory op) { //No need to check RemotingRole; no call to db. List <Schedule> retVal = new List <Schedule>(); for (int i = 0; i < listForPeriod.Count; i++) { //if a schedule is not a provider type, then skip it if (listForPeriod[i].SchedType != ScheduleType.Provider) { continue; } //if the schedule has ops set, then only apply the schedule to those ops if (listForPeriod[i].Ops.Count > 0) { if (listForPeriod[i].Ops.Contains(op.OperatoryNum)) { retVal.Add(listForPeriod[i].Copy()); } } //but if the schedule does not have ops set, then look at the op settings to determine whether to use it. else { if (op.ProvDentist != 0 && !op.IsHygiene) //op uses dentist { if (listForPeriod[i].ProvNum == op.ProvDentist) { retVal.Add(listForPeriod[i].Copy()); } } else if (op.ProvHygienist != 0 && op.IsHygiene) //op uses hygienist { if (listForPeriod[i].ProvNum == op.ProvHygienist) { retVal.Add(listForPeriod[i].Copy()); } } else //op has no provider set //so use the provider that's set for unassigned ops { if (listForPeriod[i].ProvNum == PrefC.GetLong(PrefName.ScheduleProvUnassigned)) { retVal.Add(listForPeriod[i].Copy()); } } } } return(retVal); }
///<summary>Returns a copy of this Operatory.</summary> public Operatory Copy() { Operatory o = new Operatory(); o.OperatoryNum = OperatoryNum; o.OpName = OpName; o.Abbrev = Abbrev; o.ItemOrder = ItemOrder; o.IsHidden = IsHidden; o.ProvDentist = ProvDentist; o.ProvHygienist = ProvHygienist; o.IsHygiene = IsHygiene; o.ClinicNum = ClinicNum; return(o); }
///<summary>Sync method for inserting all necessary DefNums associated to the operatory passed in. ///Does nothing if operatory.ListWSNPAOperatoryDefNums is null. Will delete all deflinks if the list is empty. ///Optionally pass in the list of deflinks to consider in order to save database calls.</summary> public static void SyncWebSchedNewPatApptOpLinks(Operatory operatory, List <DefLink> listOpDefLinks = null) { //No need to check RemotingRole; no call to db. if (operatory.ListWSNPAOperatoryDefNums == null) { return; //null means that this column was never even considered. Save time by simply returning. } //Get all operatory deflinks from the database if a specific list was not passed in. listOpDefLinks = listOpDefLinks ?? GetDefLinksForWebSchedNewPatApptOperatories(); //Filter the deflinks down in order to get the current DefNums that are linked to the operatory passed in. listOpDefLinks = listOpDefLinks.Where(x => x.FKey == operatory.OperatoryNum).ToList(); //Delete all def links that are associated to DefNums that are not in listDefNums. List <DefLink> listDefLinksToDelete = listOpDefLinks.Where(x => !operatory.ListWSNPAOperatoryDefNums.Contains(x.DefNum)).ToList(); DeleteDefLinks(listDefLinksToDelete.Select(x => x.DefLinkNum).ToList()); //Insert new DefLinks for all DefNums that were passed in that are not in listOpDefLinks. List <long> listDefNumsToInsert = operatory.ListWSNPAOperatoryDefNums.Where(x => !listOpDefLinks.Select(y => y.DefNum).Contains(x)).ToList(); InsertDefLinksForDefs(listDefNumsToInsert, operatory.OperatoryNum, DefLinkType.Operatory); //There is no reason to "update" deflinks so there is nothing else to do. }
public static List <long> GetOpsForView(long apptViewNum) { //No need to check RemotingRole; no call to db. //ArrayList AL=new ArrayList(); List <long> retVal = new List <long>(); for (int i = 0; i < ApptViewItemC.List.Length; i++) { if (ApptViewItemC.List[i].ApptViewNum == apptViewNum && ApptViewItemC.List[i].OpNum != 0) { retVal.Add(ApptViewItemC.List[i].OpNum); } if (apptViewNum == 0 && ApptViewItemC.List[i].OpNum != 0) //No view selected so return all operatories that are not hidden. { Operatory op = Operatories.GetOperatory(ApptViewItemC.List[i].OpNum); if (!op.IsHidden) { retVal.Add(ApptViewItemC.List[i].OpNum); } } } //int[] retVal=new int[AL.Count](); return(retVal); //(int[])AL.ToArray(typeof(int)); }
///<summary>This overload is for when the listForPeriod includes only one day.</summary> public static List<Schedule> GetSchedsForOp(List<Schedule> listForPeriod,Operatory op){ //No need to check RemotingRole; no call to db. List<Schedule> retVal=new List<Schedule>(); for(int i=0;i<listForPeriod.Count;i++){ //if a schedule is not a provider type, then skip it if(listForPeriod[i].SchedType!=ScheduleType.Provider){ continue; } //if the schedule has ops set, then only apply the schedule to those ops if(listForPeriod[i].Ops.Count>0){ if(listForPeriod[i].Ops.Contains(op.OperatoryNum)){ retVal.Add(listForPeriod[i].Copy()); } } //but if the schedule does not have ops set, then look at the op settings to determine whether to use it. else{ if(op.ProvDentist!=0 && !op.IsHygiene) {//op uses dentist if(listForPeriod[i].ProvNum==op.ProvDentist){ retVal.Add(listForPeriod[i].Copy()); } } else if(op.ProvHygienist!=0 && op.IsHygiene) {//op uses hygienist if(listForPeriod[i].ProvNum==op.ProvHygienist){ retVal.Add(listForPeriod[i].Copy()); } } else {//op has no provider set //so use the provider that's set for unassigned ops if(listForPeriod[i].ProvNum==PrefC.GetLong(PrefName.ScheduleProvUnassigned)){ retVal.Add(listForPeriod[i].Copy()); } } } } return retVal; }
private void butAdd_Click(object sender, System.EventArgs e) { Operatory opCur=new Operatory(); if(gridMain.SelectedIndices.Length>0){//a row is selected opCur.ItemOrder=gridMain.SelectedIndices[0]; } else{ opCur.ItemOrder=_listOps.Count;//goes at end of list } FormOperatoryEdit FormE=new FormOperatoryEdit(opCur); FormE.ListOps=_listOps; FormE.IsNew=true; FormE.ShowDialog(); if(FormE.DialogResult==DialogResult.Cancel){ return; } FillGrid(); }
private static int compareOpsByOpNum(Operatory op1,Operatory op2) { return (int)op1.OperatoryNum-(int)op2.OperatoryNum; }
///<summary>Sorts list of operatories by ItemOrder.</summary> private static int CompareOps(Operatory op1,Operatory op2) { if(op1.ItemOrder<op2.ItemOrder) { return -1; } else if(op1.ItemOrder>op2.ItemOrder) { return 1; } return 0; }
///<summary>This overload is for when the listForPeriod includes multiple days.</summary> public static List <Schedule> GetSchedsForOp(List <Schedule> listForPeriod, DayOfWeek dayOfWeek, Operatory op) { //No need to check RemotingRole; no call to db. List <Schedule> listForDay = new List <Schedule>(); for (int i = 0; i < listForPeriod.Count; i++) { //if day of week doesn't match, then skip if (listForPeriod[i].SchedDate.DayOfWeek != dayOfWeek) { continue; } listForDay.Add(listForPeriod[i].Copy()); } return(GetSchedsForOp(listForDay, op)); }
///<summary>If no provider is found for spot then the operatory provider is returned.</summary> public static long GetAssignedProvNumForSpot(List<Schedule> listForPeriod,Operatory op,bool isSecondary,DateTime aptDateTime) { //No need to check RemotingRole; no call to db. //first, look for a sched assigned specifically to that spot for(int i=0;i<listForPeriod.Count;i++){ if(listForPeriod[i].SchedType!=ScheduleType.Provider){ continue; } if(aptDateTime.Date!=listForPeriod[i].SchedDate){ continue; } if(!listForPeriod[i].Ops.Contains(op.OperatoryNum)){ continue; } if(isSecondary && !Providers.GetIsSec(listForPeriod[i].ProvNum)){ continue; } if(!isSecondary && Providers.GetIsSec(listForPeriod[i].ProvNum)){ continue; } //for the time, if the sched starts later than the apt starts if(listForPeriod[i].StartTime > aptDateTime.TimeOfDay){ continue; } //or if the sched ends (before or at same time) as the apt starts if(listForPeriod[i].StopTime <= aptDateTime.TimeOfDay){ continue; } //matching sched found Plugins.HookAddCode(null,"Schedules.GetAssignedProvNumForSpot_Found",isSecondary); return listForPeriod[i].ProvNum; } //if no matching sched found, then use the operatory Plugins.HookAddCode(null,"Schedules.GetAssignedProvNumForSpot_None",isSecondary); if(isSecondary){ return op.ProvHygienist; } else{ return op.ProvDentist; } //return 0;//none }
///<summary>This overload is for when the listForPeriod includes multiple days.</summary> public static List<Schedule> GetSchedsForOp(List<Schedule> listForPeriod,DayOfWeek dayOfWeek,Operatory op){ //No need to check RemotingRole; no call to db. List<Schedule> listForDay=new List<Schedule>(); for(int i=0;i<listForPeriod.Count;i++){ //if day of week doesn't match, then skip if(listForPeriod[i].SchedDate.DayOfWeek!=dayOfWeek){ continue; } listForDay.Add(listForPeriod[i].Copy()); } return GetSchedsForOp(listForDay,op); }