private void butDelete_Click(object sender,EventArgs e) { if(AppointmentTypeCur.IsNew) { DialogResult=DialogResult.Cancel; return; } else { AppointmentTypeCur=null; DialogResult=DialogResult.OK; } }
///<summary>Returns the time pattern for the specified appointment type (time pattern returned will always be in 5 min increments). ///If the Pattern variable is not set on the appointment type object then the pattern will be dynamically calculated. ///Optionally pass in provider information in order to use specific provider time patterns.</summary> public static string GetTimePatternForAppointmentType(AppointmentType appointmentType, long provNumDentist = 0, long provNumHyg = 0) { //No need to check RemotingRole; no call to db. string timePattern = ""; if (string.IsNullOrEmpty(appointmentType.Pattern)) { //Dynamically calculate the timePattern from the procedure codes associated to the appointment type passed in. List <string> listProcCodeStrings = appointmentType.CodeStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); List <ProcedureCode> listProcCodes = ProcedureCodes.GetProcCodes(listProcCodeStrings); timePattern = OpenDentBusiness.Appointments.CalculatePattern(provNumDentist, provNumHyg, listProcCodes.Select(x => x.CodeNum).ToList(), true); } else { timePattern = appointmentType.Pattern; //Already in 5 minute increment so no conversion required. } return(timePattern); }
///<summary></summary> public static void Update(AppointmentType appointmentType){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ Meth.GetVoid(MethodBase.GetCurrentMethod(),appointmentType); return; } Crud.AppointmentTypeCrud.Update(appointmentType); }
///<summary></summary> public static long Insert(AppointmentType appointmentType){ if(RemotingClient.RemotingRole==RemotingRole.ClientWeb){ appointmentType.AppointmentTypeNum=Meth.GetLong(MethodBase.GetCurrentMethod(),appointmentType); return appointmentType.AppointmentTypeNum; } return Crud.AppointmentTypeCrud.Insert(appointmentType); }
///<summary>Returns true if all members are the same.</summary> public static bool Compare(AppointmentType a1,AppointmentType a2) { if(a1.AppointmentTypeColor==a2.AppointmentTypeColor && a1.AppointmentTypeName==a2.AppointmentTypeName && a1.IsHidden==a2.IsHidden && a1.ItemOrder==a2.ItemOrder) { return true; } return false; }
public static int SortItemOrder(AppointmentType a1,AppointmentType a2) { if(a1.ItemOrder!=a2.ItemOrder){ return a1.ItemOrder.CompareTo(a2.ItemOrder); } return a1.AppointmentTypeNum.CompareTo(a2.AppointmentTypeNum); }
///<summary>Used when attempting to delete.</summary> public static string CheckInUse(AppointmentType appointmentType) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { return Meth.GetString(MethodBase.GetCurrentMethod(),appointmentType); } string command="SELECT COUNT(*) FROM appointment WHERE AppointmentTypeNum = "+POut.Long(appointmentType.AppointmentTypeNum); if(PIn.Int(Db.GetCount(command))>0) { return "Not allowed to delete appointment types that are in use on an appointment."; }; return ""; }