protected void LetterReceivedClick(object sender, EventArgs e) { if (PatientId != 0) { // create ActionItem = 'DataReceived' UserController userCt = new UserController(); int currentUserId = userCt.GetUserId(); UserDa currentUserDa = new UserDa(); DataSet currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId()); bool actionAlreadyExists = false; ActionDa actionDa = new ActionDa(); DataSet actionDs = actionDa.ValidateActionItem(PatientId, "DataReceived"); if (actionDs.Tables.Count > 0) { DataView actionDv = new DataView(actionDs.Tables[0]); actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' "; if (actionDv.Count > 0) { actionAlreadyExists = true; } } // if action item does not already exist for today if (!actionAlreadyExists) { BOL.Action actionObj = new Caisis.BOL.Action(); actionObj[BOL.Action.PatientId] = PatientId; actionObj[BOL.Action.ActionDateText] = LetterReceivedDateText.Text; actionObj[BOL.Action.ActionDate] = DateTime.Parse(LetterReceivedDate.Value).ToString(); actionObj[BOL.Action.ActionItem] = "DataReceived"; actionObj[BOL.Action.ActionNotes] = "Letter received"; actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; actionObj[BOL.Action.EnteredTime] = DateTime.Today; actionObj.Save(); } // set patient status to 'NeedDataEntry' Patient ptObj = new Patient(); ptObj.Get(PatientId); if (!ptObj.IsEmpty) { ptObj[Patient.PtContactStatus] = "NeedDataEntry"; ptObj[Patient.UpdatedBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; ptObj[Patient.UpdatedTime] = DateTime.Today; ptObj.Save(); } } Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_reloadMainPage", "reloadMainPage(); ", true); }
protected void Repeater1_ItemCommand(object o, RepeaterCommandEventArgs e) { try { string currentPatientId = Convert.ToString(e.CommandArgument); string actionItemCommand = Convert.ToString(e.CommandName); HtmlImage DataReceivedImg = (HtmlImage)e.Item.FindControl("DataReceivedImg"); ImageButton DataReceivedBtn = (ImageButton)e.Item.FindControl("DataReceivedBtn"); Label DataReceivedLBL = (Label)e.Item.FindControl("DataReceivedLBL"); HtmlImage NeedMD_ContactImg = (HtmlImage)e.Item.FindControl("NeedMD_ContactImg"); ImageButton NeedMD_ContactBtn = (ImageButton)e.Item.FindControl("NeedMD_ContactBtn"); Label NeedMD_ContactLBL = (Label)e.Item.FindControl("NeedMD_ContactLBL"); UserController userCt = new UserController(); int currentUserId = userCt.GetUserId(); UserDa currentUserDa = new UserDa(); DataSet currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId()); if (actionItemCommand == "DataReceived") { if (DataReceivedBtn != null && DataReceivedImg != null) { DataReceivedBtn.Style["display"] = "none"; } if (!String.IsNullOrEmpty(currentPatientId)) { bool actionAlreadyExists = false; ActionDa actionDa = new ActionDa(); DataSet actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), actionItemCommand); if (actionDs.Tables.Count > 0) { DataView actionDv = new DataView(actionDs.Tables[0]); actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = '" + actionItemCommand + "' "; if (actionDv.Count > 0) { actionAlreadyExists = true; } } // if action item does not already exist for today if (!actionAlreadyExists) { // create ActionItem = 'DataReceived' for patients to check BOL.Action actionObj = new Caisis.BOL.Action(); actionObj[BOL.Action.PatientId] = int.Parse(currentPatientId); actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString(); actionObj[BOL.Action.ActionDate] = DateTime.Today; actionObj[BOL.Action.ActionItem] = actionItemCommand; actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; actionObj[BOL.Action.EnteredTime] = DateTime.Today; actionObj.Save(); } // set patient status to 'NeedDataEntry' Patient ptObj = new Patient(); ptObj.Get(Int32.Parse(currentPatientId)); if (!ptObj.IsEmpty) { ptObj[Patient.PtContactStatus] = "NeedDataEntry"; ptObj[Patient.UpdatedTime] = DateTime.Today; ptObj[Patient.UpdatedBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; ptObj.Save(); } if (DataReceivedLBL != null && DataReceivedImg != null) { DataReceivedImg.Style["display"] = ""; DataReceivedLBL.Text = actionItemCommand; } // show "NeedMD_Contact" btn if (NeedMD_ContactBtn != null) { NeedMD_ContactBtn.Style["display"] = ""; } if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null) { NeedMD_ContactImg.Style["display"] = "none"; NeedMD_ContactLBL.Text = String.Empty; } } } else if (actionItemCommand == "NeedMD_Contact") { if (NeedMD_ContactBtn != null && NeedMD_ContactImg != null) { NeedMD_ContactBtn.Style["display"] = "none"; } if (!String.IsNullOrEmpty(currentPatientId)) { // if any action item was created for "DataReceived", delete ActionDa actionDa = new ActionDa(); DataSet actionDs = actionDa.ValidateActionItem(Int32.Parse(currentPatientId), "DataReceived"); if (actionDs.Tables.Count > 0) { DataView actionDv = new DataView(actionDs.Tables[0]); actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' "; if (actionDv.Count > 0) { BOL.Action actionObj = new Caisis.BOL.Action(); actionObj.Get(Int32.Parse(actionDv[0][BOL.Action.ActionId].ToString())); actionObj.Delete(); } } // set patient status to 'NeedMD_Contact' Patient ptObj = new Patient(); ptObj.Get(Int32.Parse(currentPatientId)); if (!ptObj.IsEmpty) { ptObj[Patient.PtContactStatus] = "NeedMD_Contact"; ptObj[Patient.UpdatedTime] = DateTime.Today; ptObj[Patient.UpdatedBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; ptObj.Save(); } if (NeedMD_ContactLBL != null && NeedMD_ContactImg != null) { NeedMD_ContactImg.Style["display"] = ""; NeedMD_ContactLBL.Text = actionItemCommand; } // show "Data Received" btn if (DataReceivedBtn != null) { DataReceivedBtn.Style["display"] = ""; } if (DataReceivedLBL != null && DataReceivedImg != null) { DataReceivedImg.Style["display"] = "none"; DataReceivedLBL.Text = String.Empty; } } } } catch (Exception ex) { // publish raw error ExceptionHandler.Publish(ex); } }
protected void NeedMDContactClick(object sender, EventArgs e) { if (PatientId != 0) { // create ActionItem = 'DataReceived' UserController userCt = new UserController(); int currentUserId = userCt.GetUserId(); UserDa currentUserDa = new UserDa(); DataSet currentUserDs = currentUserDa.GetByUserId(userCt.GetUserId()); bool actionAlreadyExists = false; ActionDa actionDa = new ActionDa(); DataSet actionDs = actionDa.ValidateActionItem(PatientId, "DataReceived"); if (actionDs.Tables.Count > 0) { DataView actionDv = new DataView(actionDs.Tables[0]); actionDv.RowFilter = BOL.Action.ActionDateText + " = '" + DateTime.Today.ToShortDateString() + "' AND " + BOL.Action.ActionItem + " = 'DataReceived' "; if (actionDv.Count > 0) { actionAlreadyExists = true; } } // if action item does not already exist for today if (!actionAlreadyExists) { BOL.Action actionObj = new Caisis.BOL.Action(); actionObj[BOL.Action.PatientId] = PatientId; actionObj[BOL.Action.ActionDateText] = DateTime.Today.ToShortDateString(); actionObj[BOL.Action.ActionDate] = DateTime.Today; actionObj[BOL.Action.ActionItem] = "DataReceived"; actionObj[BOL.Action.EnteredBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; actionObj[BOL.Action.EnteredTime] = DateTime.Today; actionObj.Save(); } // set patient status to 'NeedMD_ToCallPt' Patient ptObj = new Patient(); ptObj.Get(PatientId); if (!ptObj.IsEmpty) { ptObj[Patient.PtContactStatus] = "NeedMD_ToCallPt"; ptObj[Patient.UpdatedBy] = (currentUserDs.Tables.Count > 0 && currentUserDs.Tables[0].Rows.Count > 0) ? currentUserDs.Tables[0].Rows[0][BOL.User.UserName].ToString() : "not specified"; ptObj[Patient.UpdatedTime] = DateTime.Now; ptObj.Save(); if (AddressUpdatedLBL != null && AddressUpdatedImg != null) { AddressUpdatedImg.Style["display"] = "none"; AddressUpdatedLBL.Text = String.Empty; } if (NeedMDContactLBL != null && NeedMDContactImg != null) { NeedMDContactImg.Style["display"] = ""; NeedMDContactLBL.Text = "Pt Status: " + ptObj[Patient.PtContactStatus].ToString(); } } } //Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "_reloadMainPage", "reloadMainPage(); ", true); }