using framework_business;
using framework_library;
using System;
using System.Collections;
using System.Drawing;
using System.Reflection;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class controls_module_medicalComplaints : UserControl, ISurfaceControlBase
{
private string controlMode = "";
#region methods
///
/// Reload Control
///
///
public void ReloadControl(oSurfaceFieldData controlFieldData, bool alternateView = false, bool readOnly = false)
{
try
{
SurfaceItemId = controlFieldData.surfaceItemId;
//oUser usr = new oUser();
//if (utils.verifySession("user"))
// usr = (oUser)Session["user"];
//if (usr.userType == pNums.UserType.WebsiteUser.GetHashCode())
//{
// SetupControlPatient();
//}
bool isWizardCompleted = true;
if (SurfaceItemId > 0)
{
foreach (oSurfaceItem surfaceItem in xData.GetTypedByCriteriaSpecific("recId", typeof(oSurfaceItem), "recId", SurfaceItemId.ToString()))
{
isWizardCompleted = surfaceItem.isWizardCompleted;
}
if (!isWizardCompleted)
{
SetupControlPatient();
}
else
{
if (alternateView)
SetupControlAlt();
else
SetupControl();
}
}
else
{
SetupControlPatient();
}
}
catch (Exception ex)
{
exception.HandleException("complaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
private void SetupControlPatient()
{
try
{
modComplaint.Attributes.Add("class", "modComplaint modComplaintPatient modal fade");
controlMode = "Patient";
pnlFull.Visible = false;
pnlAlt.Visible = false;
pnlPatient.Visible = true;
pnlPatientComplaints.Visible = false;
rblVisitReason.SelectedIndex = 0;
BindPatientComplaintsGridPatient();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
private void BindPatientComplaintsGridPatient()
{
try
{
ArrayList patientComplaintsList = xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalPatientComplaints), "surfaceItemId", SurfaceItemId.ToString(), "recId");
rptComplaintsPatient.DataSource = patientComplaintsList;
rptComplaintsPatient.DataBind();
if (rptComplaintsPatient.Items.Count > 0)
{
rblVisitReason.SelectedIndex = 1;
pnlPatientComplaints.Visible = true;
oMedicalPatientComplaints medpc = (oMedicalPatientComplaints)patientComplaintsList[0];
if (rblVisitReason.Items.FindByValue(medpc.visitReason) != null)
rblVisitReason.Items.FindByValue(medpc.visitReason).Selected = true;
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
private void SetupControlAlt()
{
try
{
modComplaint.Attributes.Add("class", "modComplaint modComplaintAlt modal fade");
controlMode = "Alt";
pnlFull.Visible = false;
pnlAlt.Visible = true;
pnlPatient.Visible = false;
BindPatientComplaintsGridAlt();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
private void BindPatientComplaintsGridAlt()
{
try
{
ArrayList patientComplaintsList = xData.GetTypedByCriteriaSpecificTop("recId", typeof(oMedicalPatientComplaints), "surfaceItemId", SurfaceItemId.ToString(), "recId", 4);
rptComplaintsAlt.DataSource = patientComplaintsList;
rptComplaintsAlt.DataBind();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Save Control Data
///
///
public void SaveControlData(ref oSurfaceFieldData _surfaceFieldData)
{
try
{
if (MedicalPatientComplaint != null)
{
SurfaceItemId = _surfaceFieldData.surfaceItemId;
if (SurfaceItemId > 0 && txtComplaint.Text != String.Empty)
{
SaveComplaint();
if (MedicalPatientComplaint.recId > 0)
xData.UpdateTyped("recId", MedicalPatientComplaint.recId.ToString(), typeof(oMedicalPatientComplaints), MedicalPatientComplaint);
else
MedicalPatientComplaint.recId = xData.SaveTyped("recId", typeof(oMedicalPatientComplaints), MedicalPatientComplaint);
_surfaceFieldData.surfaceFieldLookupID = MedicalPatientComplaint.recId;
}
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Setup Control
///
///
private void SetupControl()
{
try
{
modComplaint.Attributes.Add("class", "modComplaint modComplaintFull modal fade");
controlMode = "Full";
pnlFull.Visible = true;
pnlAlt.Visible = false;
pnlPatient.Visible = false;
BindPatientComplaintsGrid();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Bind Complaint Grid
///
///
private void BindPatientComplaintsGrid()
{
try
{
ArrayList patientComplaintsList = xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalPatientComplaints), "surfaceItemId", SurfaceItemId.ToString(), "recId");
rptComplaintsFull.DataSource = patientComplaintsList;
rptComplaintsFull.DataBind();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// set form values
///
///
private void SetFormValues(bool isView = false, bool isNew = false)
{
try
{
ClearFormValues();
txtComplaint.Text = MedicalPatientComplaint.complaint;
if (rblComplaintAge.Items.FindByValue(MedicalPatientComplaint.complaintAge) != null)
rblComplaintAge.Items.FindByValue(MedicalPatientComplaint.complaintAge).Selected = true;
if (rblWorstTime.Items.FindByValue(MedicalPatientComplaint.worstTime) != null)
rblWorstTime.Items.FindByValue(MedicalPatientComplaint.worstTime).Selected = true;
if (rblPainLevel.Items.FindByValue(MedicalPatientComplaint.painLevel.ToString()) != null)
rblPainLevel.Items.FindByValue(MedicalPatientComplaint.painLevel.ToString()).Selected = true;
foreach (string item in MedicalPatientComplaint.discomfortTypes.Split(','))
{
ListItem listItem = cblDiscomfortTypes.Items.FindByText(item);
if (listItem != null) listItem.Selected = true;
}
if (rblDiscomfortFrequency.Items.FindByValue(MedicalPatientComplaint.discomfortFrequency.ToString()) != null)
rblDiscomfortFrequency.Items.FindByValue(MedicalPatientComplaint.discomfortFrequency.ToString()).Selected = true;
foreach (string item in MedicalPatientComplaint.discomfortIncrease.Split(','))
{
ListItem listItem = cblDiscomfortIncrease.Items.FindByText(item);
if (listItem != null) listItem.Selected = true;
}
foreach (string item in MedicalPatientComplaint.discomfortDecrease.Split(','))
{
ListItem listItem = cblDiscomfortDecrease.Items.FindByText(item);
if (listItem != null) listItem.Selected = true;
}
chkIsInjuryRelated.Checked = MedicalPatientComplaint.isInjuryRelated;
txtInjuryDetails.Text = MedicalPatientComplaint.injuryDetails;
chkIsAccidentRelated.Checked = MedicalPatientComplaint.isAccidentRelated;
txtSpinalInjuryDetails.Text = MedicalPatientComplaint.spinalInjuryDetails;
chkOtherDrVisited.Checked = MedicalPatientComplaint.otherDrVisited;
txtOtherDrDetails.Text = MedicalPatientComplaint.otherDrDetails;
chkIsPastProblem.Checked = MedicalPatientComplaint.isPastProblem;
txtPastProblemDetails.Text = MedicalPatientComplaint.pastProblemDetails;
chkPastProblemTreated.Checked = MedicalPatientComplaint.pastProblemTreated;
txtPastProblemTreatment.Text = MedicalPatientComplaint.pastProblemTreatment;
txtPastProblemTreatmentAge.Text = MedicalPatientComplaint.pastProblemTreatmentAge;
txtPastProblemTreatmentProvider.Text = MedicalPatientComplaint.pastProblemTreatmentProvider;
txtPastProblemTreatmentResults.Text = MedicalPatientComplaint.pastProblemTreatmentResults;
txtComplaintNotes.Text = MedicalPatientComplaint.complaintNotes;
//if (isNew)
// rblComplaintStatus.SelectedIndex = 1;
//else
rblComplaintStatus.Items.FindByValue(MedicalPatientComplaint.isActive ? "1" : "0").Selected = true;
string bodyPartList = MedicalPatientComplaint.bodyMap;
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SetupBodyParts", "SetupBodyParts('" + bodyPartList + "','1');", true);
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Save Complaint
///
private void SaveComplaint()
{
try
{
ArrayList itemsToUpdate = new ArrayList();
if (utils.verifySession("PatientComplaintItemsNotLinked"))
itemsToUpdate = (ArrayList)Session["PatientComplaintItemsNotLinked"];
if (MedicalPatientComplaint == null)
{
MedicalPatientComplaint = new oMedicalPatientComplaints();
}
MedicalPatientComplaint.complaint = txtComplaint.Text;
MedicalPatientComplaint.complaintAge = rblComplaintAge.SelectedValue;
MedicalPatientComplaint.worstTime = rblWorstTime.SelectedValue;
if (rblPainLevel.SelectedValue != "")
MedicalPatientComplaint.painLevel = Convert.ToInt32(rblPainLevel.SelectedValue);
string discomfortTypes = string.Empty;
foreach (ListItem item in cblDiscomfortTypes.Items)
{
if (item.Selected) discomfortTypes += item.Value + ",";
}
MedicalPatientComplaint.discomfortTypes = discomfortTypes;
MedicalPatientComplaint.discomfortFrequency = rblDiscomfortFrequency.SelectedValue;
string discomfortIncreases = string.Empty;
foreach (ListItem item in cblDiscomfortIncrease.Items)
{
if (item.Selected) discomfortIncreases += item.Value + ",";
}
MedicalPatientComplaint.discomfortIncrease = discomfortIncreases;
string discomfortDecreases = string.Empty;
foreach (ListItem item in cblDiscomfortDecrease.Items)
{
if (item.Selected) discomfortDecreases += item.Value + ",";
}
MedicalPatientComplaint.discomfortDecrease = discomfortDecreases;
MedicalPatientComplaint.isInjuryRelated = chkIsInjuryRelated.Checked;
MedicalPatientComplaint.injuryDetails = txtInjuryDetails.Text;
MedicalPatientComplaint.isAccidentRelated = chkIsAccidentRelated.Checked;
MedicalPatientComplaint.spinalInjuryDetails = txtSpinalInjuryDetails.Text;
MedicalPatientComplaint.otherDrVisited = chkOtherDrVisited.Checked;
MedicalPatientComplaint.otherDrDetails = txtOtherDrDetails.Text;
MedicalPatientComplaint.isPastProblem = chkIsPastProblem.Checked;
MedicalPatientComplaint.pastProblemDetails = txtPastProblemDetails.Text;
MedicalPatientComplaint.pastProblemTreated = chkPastProblemTreated.Checked;
MedicalPatientComplaint.pastProblemTreatment = txtPastProblemTreatment.Text;
MedicalPatientComplaint.pastProblemTreatmentAge = txtPastProblemTreatmentAge.Text;
MedicalPatientComplaint.pastProblemTreatmentProvider = txtPastProblemTreatmentProvider.Text;
MedicalPatientComplaint.pastProblemTreatmentResults = txtPastProblemTreatmentResults.Text;
MedicalPatientComplaint.complaintNotes = txtComplaintNotes.Text;
MedicalPatientComplaint.isActive = (rblComplaintStatus.SelectedValue == "1");
MedicalPatientComplaint.surfaceItemId = SurfaceItemId > 0 ? SurfaceItemId : -1;
if (MedicalPatientComplaint.recId > 0)
{
MedicalPatientComplaint.dateUpdated = DateTime.Now;
if (utils.verifySession("user"))
MedicalPatientComplaint.updatedBy = ((oUser)Session["user"]).recId;
xData.UpdateTyped("recId", MedicalPatientComplaint.recId.ToString(), typeof(oMedicalPatientComplaints), MedicalPatientComplaint);
}
else
{
MedicalPatientComplaint.dateCreated = DateTime.Now;
MedicalPatientComplaint.dateUpdated = DateTime.Now;
if (utils.verifySession("user"))
{
MedicalPatientComplaint.createdBy = ((oUser)Session["user"]).recId;
MedicalPatientComplaint.updatedBy = ((oUser)Session["user"]).recId;
}
MedicalPatientComplaint.recId = xData.SaveTyped("recId", typeof(oMedicalPatientComplaints), MedicalPatientComplaint);
}
if (MedicalPatientComplaint.surfaceItemId == -1)
{
itemsToUpdate.Add(MedicalPatientComplaint);
Session["PatientComplaintItemsNotLinked"] = itemsToUpdate;
}
pnlResult.Visible = true;
lblResult.Text = "the complaint was saved successfully.";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "complaintBodySave", "complaintBodySave(" + MedicalPatientComplaint.recId.ToString() + ");", true);
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
private void ClearFormValues()
{
pnlResult.Visible = false;
txtComplaint.Text = "";
rblComplaintAge.ClearSelection();
rblWorstTime.ClearSelection();
rblPainLevel.ClearSelection();
cblDiscomfortTypes.ClearSelection();
rblDiscomfortFrequency.ClearSelection();
cblDiscomfortIncrease.ClearSelection();
cblDiscomfortDecrease.ClearSelection();
chkIsInjuryRelated.Checked = false; ;
txtInjuryDetails.Text = "";
chkIsAccidentRelated.Checked = false;
txtSpinalInjuryDetails.Text = "";
chkOtherDrVisited.Checked = false;
txtOtherDrDetails.Text = "";
chkIsPastProblem.Checked = false;
txtPastProblemDetails.Text = "";
chkPastProblemTreated.Checked = false;
txtPastProblemTreatment.Text = "";
txtPastProblemTreatmentAge.Text = "";
txtPastProblemTreatmentProvider.Text = "";
txtPastProblemTreatmentResults.Text = "";
txtComplaintNotes.Text = "";
rblComplaintStatus.ClearSelection();
}
#endregion
#region events
///
/// Page Init
///
///
///
protected void Page_Init(object sender, EventArgs e)
{
}
///
/// Page Load
///
///
///
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
//SetupControl();
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// view complaint
///
///
///
protected void lnkView_Click(object sender, EventArgs e)
{
try
{
LinkButton lnkView = (LinkButton)sender;
int recId = int.Parse(((LinkButton)sender).CommandArgument);
if (recId > 0)
{
foreach (oMedicalPatientComplaints complaint in xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalPatientComplaints), "recId", recId.ToString()))
{
MedicalPatientComplaint = complaint;
}
SetFormValues(true);
btnSave.Visible = false;
if (lnkView.ID.Contains("Alt"))
controlMode = "Alt";
else if (lnkView.ID.Contains("Patient"))
{
controlMode = "Patient";
pnlNonPatient.Visible = false;
}
else
controlMode = "Full";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
upComplaintForm.Update();
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// edit complaint
///
///
///
protected void lnkEdit_Click(object sender, EventArgs e)
{
try
{
LinkButton lnkEdit = (LinkButton)sender;
int recId = int.Parse(((LinkButton)sender).CommandArgument);
if (recId > 0)
{
foreach (oMedicalPatientComplaints complaint in xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalPatientComplaints), "recId", recId.ToString()))
{
MedicalPatientComplaint = complaint;
}
SetFormValues();
btnSave.Visible = true;
if (lnkEdit.ID.Contains("Alt"))
controlMode = "Alt";
else if (lnkEdit.ID.Contains("Patient"))
{
controlMode = "Patient";
pnlNonPatient.Visible = false;
}
else
controlMode = "Full";
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
upComplaintForm.Update();
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Remove Click
///
///
///
protected void lnkRemove_Click(object sender, EventArgs e)
{
try
{
int recId = int.Parse(((LinkButton)sender).CommandArgument);
if (recId > 0)
{
foreach (oMedicalPatientComplaints complaint in xData.GetTypedByCriteriaSpecific("recId", typeof(oMedicalPatientComplaints), "recId", recId.ToString()))
{
complaint.isActive = false;
xData.UpdateTyped("recId", complaint.recId.ToString(), typeof(oMedicalPatientComplaints), complaint);
}
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// new click
///
///
///
protected void btnNew_Click(object sender, EventArgs e)
{
try
{
MedicalPatientComplaint = new oMedicalPatientComplaints();
MedicalPatientComplaint.isActive = true;
SetFormValues(false, true);
btnSave.Visible = true;
controlMode = "Full";
string bodyPartList = MedicalPatientComplaint.bodyMap;
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SetupBodyParts", "SetupBodyParts('" + bodyPartList + "','1');", true);
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
upComplaintForm.Update();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// save click
///
///
///
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
Control btnSave = (Control)sender;
if (btnSave == null)
return;
SaveComplaint();
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "jQuery.each($('.modComplaint'), function (i,val){if(($(val).data('bs.modal') || {}).isShown){$(val).modal('toggle');}});$('body').removeClass('modal-open'); $('.modal-backdrop').remove();", true);
BindPatientComplaintsGrid();
BindPatientComplaintsGridPatient();
BindPatientComplaintsGridAlt();
upComplaint.Update();
//if (btnSave.ID == "btnSaveBack")
//{
//}
//else if (btnSave.ID == "btnSaveAndNew")
//{
// btnNew_Click(null, null);
// ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SetupBodyParts", "SetupBodyParts('','1');", true);
// ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint').animate({ scrollTop: 0 }, 'slow'); ", true);
// /*
// $('.modComplaint').on('shown.bs.modal', function () {$('#modal').animate({ scrollTop: 0 }, 'slow');});
// */
//}
//else
//{
// ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
//}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// cancel
///
///
///
protected void btnCancel_Click(object sender, EventArgs e)
{
try
{
ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
BindPatientComplaintsGrid();
BindPatientComplaintsGridPatient();
BindPatientComplaintsGridAlt();
upComplaint.Update();
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Visit Reason Selected Index Changed
///
///
///
protected void rblVisitReason_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
if (rblVisitReason.SelectedValue == "Pain Relief")
{
pnlPatientComplaints.Visible = true;
}
else
{
pnlPatientComplaints.Visible = false;
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Add new Patient Complaint
///
///
///
protected void btnPatientComplaintAdd_Click(object sender, EventArgs e)
{
try
{
if (txtPatientComplaint.Text != "")
{
ArrayList itemsToUpdate = new ArrayList();
if (utils.verifySession("PatientComplaintItemsNotLinked"))
itemsToUpdate = (ArrayList)Session["PatientComplaintItemsNotLinked"];
MedicalPatientComplaint = new oMedicalPatientComplaints();
MedicalPatientComplaint.surfaceItemId = SurfaceItemId > 0 ? SurfaceItemId : -1;
MedicalPatientComplaint.complaint = txtPatientComplaint.Text;
MedicalPatientComplaint.isActive = true;
//SetFormValues(false, true);
//btnSave.Visible = true;
//controlMode = "Patient";
//string bodyPartList = MedicalPatientComplaint.bodyMap;
//ScriptManager.RegisterStartupScript(Page, Page.GetType(), "SetupBodyParts", "SetupBodyParts('" + bodyPartList + "','1');", true);
//ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "showComplaintForm", "$('.modComplaint" + controlMode + "').modal();", true);
//pnlNonPatient.Visible = false;
//upComplaintForm.Update();
MedicalPatientComplaint.visitReason = rblVisitReason.SelectedValue;
MedicalPatientComplaint.recId = xData.SaveTyped("recId", typeof(oMedicalPatientComplaints), MedicalPatientComplaint);
if (MedicalPatientComplaint.surfaceItemId == -1)
{
itemsToUpdate.Add(MedicalPatientComplaint);
Session["PatientComplaintItemsNotLinked"] = itemsToUpdate;
}
BindPatientComplaintsGridPatient();
txtPatientComplaint.Text = "";
upComplaint.Update();
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
///
/// Item Data Bound event
///
///
///
protected void rptComplaintsPatient_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
HiddenField hfStatus = e.Item.FindControl("hfStatus") as HiddenField;
if (hfStatus != null)
{
Label lblComplaint = e.Item.FindControl("lblComplaint") as Label;
Label lblResolved = e.Item.FindControl("lblResolved") as Label;
switch (hfStatus.Value)
{
case "False"://resolved
lblComplaint.ForeColor = Color.Gray;
lblResolved.ForeColor = Color.Gray;
lblResolved.Text = "Resolved";
Label lblDateUpdated = e.Item.FindControl("lblDateUpdated") as Label;
Label lblUpdatedBy = e.Item.FindControl("lblUpdatedBy") as Label;
if (lblDateUpdated != null)
lblDateUpdated.ForeColor = Color.Gray;
if (lblUpdatedBy != null)
lblUpdatedBy.ForeColor = Color.Gray;
break;
case "True"://active
lblResolved.Text = "Active";
break;
}
}
}
catch (Exception ex)
{
exception.HandleException("medicalComplaints:", MethodBase.GetCurrentMethod().Name, ex, Session["user"]);
Response.Redirect("/error", false);
}
}
#endregion
#region properties
///
/// MPH getter and setter
///
public oMedicalPatientComplaints MedicalPatientComplaint
{
get
{
//if (ViewState["medicalPatientComplaint"] == null)
// return null;
//else
// return (oMedicalPatientComplaints)ViewState["medicalPatientComplaint"];
if (utils.verifySession("medicalPatientComplaint") && Session["medicalPatientComplaint"] != null)
{
return (oMedicalPatientComplaints)Session["medicalPatientComplaint"];
}
else
{
return null;
}
}
set
{
//ViewState["medicalPatientComplaint"] = value;
Session["medicalPatientComplaint"] = value;
}
}
public int SurfaceItemId
{
get
{
if (utils.verifySession("complaintSurfaceItemId") && Session["complaintSurfaceItemId"] != null)
return (int)Session["complaintSurfaceItemId"];
else
return 0;
}
set
{
Session["complaintSurfaceItemId"] = value;
}
}
#endregion
}