public ApptStatus GetApptStatus(DataTable table) { if (table == null || SchedulerStatuses == null) { return(null); } ApptStatus status = null; try { foreach (ApptStatus sts in SchedulerStatuses) { table.DefaultView.RowFilter = CriteriaToWhereClauseHelper.GetDataSetWhere(CriteriaOperator.Parse(sts.StatusCriteria)); if (table.DefaultView.Count > 0 && sts.StatusCriteria != "") { status = sts; break; } if (sts.StatusCriteria == "") { status = sts; //default label } } } catch (Exception e) { } return(status); }
public override void OnSaveData() { try { ApptStatus saveObj = defaultBindingSource.Current as ApptStatus; saveObj.StatusCriteria = ctrl_FilterControl.FilterString; var store = new StoreApptStatus() { Status = saveObj.ConvertTo <ApptStatusDto>() }; var resp = ServiceClient.Post(store); //if the response was good, then notify the others. if (resp.ResponseStatus == null) { saveObj = resp.Status.ConvertTo <ApptStatus>(); Context.ServiceClient.Post(new ApptStatusesNotification() { FromUserName = Context.LoggedInUser.UserName, Selector = SelectorTypes.store, Ids = new List <int>() { resp.Status.Id } }); } base.OnSaveData(); lblInfo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } catch (Exception exS) { OnExceptionEvent(exS); } }
private void defaultBindingSource_AddingNew(object sender, System.ComponentModel.AddingNewEventArgs e) { string currlbl = (defaultBindingSource.Current as ApptStatus).ViewName; string currIntfT = (defaultBindingSource.Current as ApptStatus).UseInterfaceType; ApptStatus newStatus = new ApptStatus(); newStatus.ViewName = currlbl; newStatus.StatusName = ""; newStatus.UseInterfaceType = currIntfT; e.NewObject = newStatus; }
public override bool OnDeleteData() { if (base.OnDeleteData(true)) { ApptStatus delObj = defaultBindingSource.Current as ApptStatus; var delReq = new DeleteApptStatus { Id = delObj.Id }; ServiceClient.Delete(delReq); defaultBindingSource.RemoveCurrent(); defaultBindingSource.ResetBindings(false); } lblInfo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; return(base.OnDeleteData()); }
private ApptStatusDto StoreStatus(ApptStatusDto status, string modifyUser, IDataRepositoryCrudBase <ApptStatus> _repository) { ApptStatus sts = status.ConvertTo <ApptStatus>(); if (sts.Id == 0) { //then save the label, to get an ID, sts = _repository.CreateUpdate(sts, modifyUser); //then but also set the criteria to the correct value and save it again.. if (Type.GetType(sts.UseInterfaceType) == typeof(IEntityWithStatusLabels)) { sts.StatusCriteria = $"([{nameof(IEntityWithStatusLabels.StatusKey)}] = '{sts.Id}')"; } } return(_repository.CreateUpdate(sts, modifyUser).ConvertTo <ApptStatusDto>()); }
public void AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e, AppointmentStatusDataStorage statuses) { try { //apply the colours according to the value of the location. //e.ViewInfo.Appearance.BackColor <-- this is label colour //e.ViewInfo.Status <-- this is status strip colour (we set it on the appointment, not on the entity in "ENTITY" custom field. if (e.ViewInfo.Appointment.CustomFields != null) { if (e.ViewInfo.Appointment.CustomFields["ENTITY"] is IEntityWithProgressStatus) { Appointment appt = e.ViewInfo.Appointment; DataTable table = appt.CustomFields["ENTITY"].ConvertToDataTable();//TempDataTableCreator.CreateDataTableFromEntity(appt.CustomFields["ENTITY"]); ApptLabel label = GetApptLabel(table); ApptStatus status = GetApptStatus(table); if (label != null) { e.ViewInfo.Appearance.BackColor = Color.FromArgb(label.ColourRGB); } else { e.ViewInfo.Appearance.BackColor = Color.FromArgb(SchedulerLabels.First(l => l.SortIndex == 99).ColourRGB); } if (status != null) { e.ViewInfo.Status = statuses.Items.Find(s => s.Id.ToString() == status.Id.ToString()); } else { e.ViewInfo.Status = statuses.Items.CreateNewStatus(Guid.NewGuid(), "", "", new SolidBrush(Color.FromArgb(SchedulerStatuses.First(s => s.SortIndex == 99).ColourRGB))); } } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw ex; #endif } }
void CreateDefaultRecord(FindApptStatuses request, IGenericEntityRepositoryBase <ApptStatus, IDataContextNhJars> repository) { ApptStatus sts = new ApptStatus() { UseInterfaceType = request.InterfaceTypeName, ViewName = request.ViewType, StatusCriteria = "" }; sts = repository.CreateUpdate(sts, "SYSTEM"); Type t = Type.GetType(request.InterfaceTypeName); if (t == typeof(IEntityWithStatusLabels)) { sts.StatusCriteria = $"([StatusKey] = '{sts.Id}')"; repository.CreateUpdate(sts, "SYSTEM"); } }
public void AppointmentViewInfoCustomizing(object sender, AppointmentViewInfoCustomizingEventArgs e, AppointmentStatusDataStorage statuses) { try { if (e.ViewInfo.Appointment.CustomFields != null) { if (e.ViewInfo.Appointment.CustomFields["ENTITY"] is IEntityWithStatusLabels) { Appointment appt = e.ViewInfo.Appointment; DataTable table = appt.CustomFields["ENTITY"].ConvertToDataTable(); ApptLabel label = GetApptLabel(table); ApptStatus status = GetApptStatus(table); if (label != null) { e.ViewInfo.Appearance.BackColor = Color.FromArgb(label.ColourRGB); } else { e.ViewInfo.Appearance.BackColor = Color.FromArgb(SchedulerLabels.First(l => l.SortIndex == 99).ColourRGB); } if (status != null) { e.ViewInfo.Status = statuses.Items.Find(s => s.Id.ToString() == status.Id.ToString()); } else { e.ViewInfo.Status = statuses.Items.CreateNewStatus(Guid.NewGuid(), "", "", new SolidBrush(Color.FromArgb(SchedulerStatuses.First(s => s.SortIndex == 99).ColourRGB))); } } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw ex; #endif } }
private List <ApptStatusDto> StoreStatuses(List <ApptStatusDto> statuses, string modifyUser, IDataRepositoryCrudBase <ApptStatus> _repository) { List <ApptStatus> saveList = new List <ApptStatus>(); foreach (var status in statuses) { ApptStatus sts = status.ConvertTo <ApptStatus>(); if (sts.Id == 0) { //then save the label, to get an ID, sts = _repository.CreateUpdate(sts, modifyUser); //then but also set the criteria to the correct value and save it again.. if (Type.GetType(sts.UseInterfaceType) == typeof(IEntityWithStatusLabels)) { sts.StatusCriteria = $"([{nameof(IEntityWithStatusLabels.StatusKey)}] = '{sts.Id}')"; } } saveList.Add(sts); } return(_repository.CreateUpdateList(saveList, modifyUser).ConvertAllTo <ApptStatusDto>().ToList()); }
///<summary>Returns the message used to ask if the user would like to save the appointment/patient note as a commlog when deleting an appointment/patient note. Only returns up to the first 30 characters of the note.</summary> public static string GetDeleteApptCommlogMessage(string noteText, ApptStatus apptStatus) { //No need to check RemotingRole; no call to db. string commlogMsgText = ""; if (noteText != "") { if (apptStatus == ApptStatus.PtNote || apptStatus == ApptStatus.PtNoteCompleted) { commlogMsgText = Lans.g("Commlogs", "Save patient note in CommLog?") + "\r\n" + "\r\n"; } else { commlogMsgText = Lans.g("Commlogs", "Save appointment note in CommLog?") + "\r\n" + "\r\n"; } //Show up to 30 characters of the note because they can get rather large thus pushing the buttons off the screen. commlogMsgText += noteText.Substring(0, Math.Min(noteText.Length, 30)); commlogMsgText += (noteText.Length > 30)?"...":""; //Append ... to the end of the message so that they know there is more to the note than what is displayed. } return(commlogMsgText); }
private void gvBOSExternalEntity_CustomDrawRowIndicator(object sender, RowIndicatorCustomDrawEventArgs e) { try { if (e.RowHandle > -1) { if (ActiveViewOption != null) { //DataTable table1 = TempDataTableCreator.CreateDataTableFromEntity(gvExample.GetRow(e.RowHandle)); DataTable table = gvBOSExternalEntity.GetRow(e.RowHandle).ConvertToDataTable(); ApptStatus status = ActiveViewOption.GetApptStatus(table); e.DefaultDraw(); if (status != null) { e.Appearance.BackColor = Color.FromArgb(status.ColourRGB); e.Appearance.FillRectangle(e.Cache, new Rectangle(e.Bounds.X, e.Bounds.Y, e.Bounds.Width - 1, e.Bounds.Height - 1)); if (e.Info.IsRowIndicator) { if (!(e.Info.ImageIndex < 0)) { ImageCollection ic = e.Info.ImageCollection as ImageCollection; Image indicator = ic.Images[e.Info.ImageIndex]; e.Cache.Paint.DrawImage(e.Graphics, indicator, new Rectangle(e.Bounds.X + 4, e.Bounds.Y + 20, indicator.Width, indicator.Height)); } } e.Handled = true; } } } } catch (Exception ex) { Logger.Error(ex.Message, ex); #if DEBUG throw ex; #endif } }
public override void OnAddData() { base.OnAddData(); //Create a new label record ApptStatus newStatus = defaultBindingSource.AddNew() as ApptStatus; Type newLabelInterfaceType = Type.GetType(newStatus.UseInterfaceType); if (newLabelInterfaceType == typeof(IEntityWithStatusLabels)) { newStatus.StatusCriteria = "([StatusKey] = '0')"; lblInfo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; ctrl_FilterControl.Enabled = false; } else { lblInfo.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } defaultBindingSource.Position = defaultBindingSource.IndexOf(newStatus); defaultBindingSource.ResetCurrentItem(); }
private void FillGrid() { List <Procedure> entireList = Procedures.Refresh(AptCur.PatNum); ProcList = new List <Procedure>(); bool isPlanned = AptCur.AptStatus == ApptStatus.Planned; ApptStatus apptStatus = AptCur.AptStatus; for (int i = 0; i < entireList.Count; i++) { //We want all unattached completed procs with same date as appt. //but only if one of these types if (apptStatus == ApptStatus.Scheduled || apptStatus == ApptStatus.Complete || apptStatus == ApptStatus.Broken) { if (entireList[i].AptNum == 0 && entireList[i].ProcStatus == ProcStat.C && entireList[i].ProcDate.Date == AptCur.AptDateTime.Date) { ProcList.Add(entireList[i]); } } //otherwise, we only want TP procs that are not attached to this appointment. //As for TP procs attached to other appointments, we will show this to the user and warn them about it, //but we won't filter them out. if (entireList[i].ProcStatus != ProcStat.TP) { continue; } if (isPlanned) { if (entireList[i].PlannedAptNum == AptCur.AptNum) { continue; } } else { if (entireList[i].AptNum == AptCur.AptNum) { continue; } } ProcList.Add(entireList[i]); } gridMain.BeginUpdate(); gridMain.Columns.Clear(); ODGridColumn col; col = new ODGridColumn(Lan.g("TableProcSelect", "OtherAppt"), 70, HorizontalAlignment.Center); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Code"), 55); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Priority"), 55); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Tooth"), 50); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Description"), 250); gridMain.Columns.Add(col); col = new ODGridColumn(Lan.g("TableProcSelect", "Fee"), 60, HorizontalAlignment.Right); gridMain.Columns.Add(col); gridMain.Rows.Clear(); ODGridRow row; for (int i = 0; i < ProcList.Count; i++) { row = new ODGridRow(); if (ProcList[i].ProcStatus == ProcStat.C) //so unattached { row.Cells.Add(""); } else if (isPlanned && ProcList[i].PlannedAptNum != 0) { row.Cells.Add("X"); } else if (!isPlanned && ProcList[i].AptNum != 0) { row.Cells.Add("X"); } else { row.Cells.Add(""); } row.Cells.Add(ProcedureCodes.GetStringProcCode(ProcList[i].CodeNum)); row.Cells.Add(Defs.GetName(DefCat.TxPriorities, ProcList[i].Priority)); row.Cells.Add(Tooth.ToInternat(ProcList[i].ToothNum)); row.Cells.Add(ProcedureCodes.GetLaymanTerm(ProcList[i].CodeNum)); row.Cells.Add(ProcList[i].ProcFee.ToString("F")); gridMain.Rows.Add(row); } gridMain.EndUpdate(); }
///<summary>Returns the message used to ask if the user would like to save the appointment/patient note as a commlog when deleting an appointment/patient note. Only returns up to the first 30 characters of the note.</summary> public static string GetDeleteApptCommlogMessage(string noteText,ApptStatus apptStatus) { //No need to check RemotingRole; no call to db. string commlogMsgText=""; if(noteText!="") { if(apptStatus==ApptStatus.PtNote || apptStatus==ApptStatus.PtNoteCompleted){ commlogMsgText=Lans.g("Commlogs","Save patient note in CommLog?")+"\r\n"+"\r\n"; } else{ commlogMsgText=Lans.g("Commlogs","Save appointment note in CommLog?")+"\r\n"+"\r\n"; } //Show up to 30 characters of the note because they can get rather large thus pushing the buttons off the screen. commlogMsgText+=noteText.Substring(0,Math.Min(noteText.Length,30)); commlogMsgText+=(noteText.Length>30)?"...":"";//Append ... to the end of the message so that they know there is more to the note than what is displayed. } return commlogMsgText; }
///<summary></summary> public static Appointment CreateAppointment(long patNum, DateTime aptDateTime, long opNum, long provNum, long provHyg = 0, string pattern = "//XXXX//" , long clinicNum = 0, bool isHygiene = false, ApptStatus aptStatus = ApptStatus.Scheduled, ApptPriority priority = ApptPriority.Normal, string aptNote = "" , long appointmentTypeNum = 0) { Appointment appointment = new Appointment(); appointment.AptDateTime = aptDateTime; appointment.AptStatus = aptStatus; appointment.ClinicNum = clinicNum; appointment.IsHygiene = isHygiene; appointment.Op = opNum; appointment.PatNum = patNum; appointment.Pattern = pattern; appointment.ProvNum = provNum; appointment.ProvHyg = provHyg; appointment.Priority = priority; appointment.Note = aptNote; appointment.AppointmentTypeNum = appointmentTypeNum; Appointments.Insert(appointment); return(appointment); }
///<summary>Use to send to unscheduled list, to set broken, etc. Do not use to set complete.</summary> public static void SetAptStatus(long aptNum,ApptStatus newStatus) { if(RemotingClient.RemotingRole==RemotingRole.ClientWeb) { Meth.GetVoid(MethodBase.GetCurrentMethod(),aptNum,newStatus); return; } string command="UPDATE appointment SET AptStatus="+POut.Long((int)newStatus) +" WHERE AptNum="+POut.Long(aptNum); Db.NonQ(command); }