private void loadSelectData() { List <MedicineTimenDate> allMedicineTimenDate = new List <MedicineTimenDate>(); if (ddlExistingRecord.SelectedValue != "0") { string searchString = " and MedicineDate >= '" + DateTime.Parse(ddlExistingRecord.SelectedValue) + "' and MedicineDate <= '" + DateTime.Parse(ddlExistingRecord.SelectedValue).AddMinutes(1) + "'"; allMedicineTimenDate = MedicineTimenDateManager.GetAllMedicineTimenDatesDistinctDateByResidentIDnDate(int.Parse(Request.QueryString["ResidentID"]), searchString); } foreach (GridViewRow gvr in gvMedicaiton.Rows) { CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); TextBox txtComment = (TextBox)gvr.FindControl("txtComment"); Label lblSavedBy = (Label)gvr.FindControl("lblSavedBy"); chkSelect.Checked = false; lblSavedBy.Text = ""; txtComment.Text = ""; foreach (MedicineTimenDate item in allMedicineTimenDate) { if (chkSelect.ValidationGroup == item.MedicationTimeID.ToString()) { chkSelect.Checked = true; txtComment.Text = item.ExtraField1; lblSavedBy.Text = item.ExtraField3; } } } }
protected void btnSave_Click(object sender, EventArgs e) { if (ddlExistingRecord.SelectedValue != "0") { string DateRange = " and MedicineDate >= '" + DateTime.Parse(ddlExistingRecord.SelectedValue) + "' and MedicineDate <= '" + DateTime.Parse(ddlExistingRecord.SelectedValue).AddMinutes(1) + "'"; MedicineTimenDateManager.DeleteMedicineTimenDateByResidentID(int.Parse(Request.QueryString["ResidentID"]), DateRange); } foreach (GridViewRow gvr in gvMedicaiton.Rows) { CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); if (chkSelect.Checked) { TextBox txtComment = (TextBox)gvr.FindControl("txtComment"); MedicineTimenDate medicineTimenDate = new MedicineTimenDate(); medicineTimenDate.MedicationTimeID = Int32.Parse(chkSelect.ValidationGroup); medicineTimenDate.MedicineDate = ddlExistingRecord.SelectedValue == "0" ? DateTime.Now : DateTime.Parse(ddlExistingRecord.SelectedValue); medicineTimenDate.ExtraField1 = txtComment.Text; medicineTimenDate.ExtraField2 = getLogin().LoginID.ToString(); medicineTimenDate.ExtraField3 = getLogin().ExtraField4; MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate); } } lblMsg.Visible = true; lblNewMedicationAddedSuccessfully.Visible = false; loadMedicineTimenDateDate(); foreach (GridViewRow gvr in gvMedicaiton.Rows) { CheckBox chkSelect = (CheckBox)gvr.FindControl("chkSelect"); chkSelect.Checked = false; } }
protected void lbDelete_Click(object sender, EventArgs e) { LinkButton linkButton = new LinkButton(); linkButton = (LinkButton)sender; bool result = MedicineTimenDateManager.DeleteMedicineTimenDate(Convert.ToInt32(linkButton.CommandArgument)); showMedicineTimenDateGrid(); }
private void showMedicineTimenDateData() { MedicineTimenDate medicineTimenDate = new MedicineTimenDate(); medicineTimenDate = MedicineTimenDateManager.GetMedicineTimenDateByID(Int32.Parse(Request.QueryString["medicineTimenDateID"])); ddlMedicationTime.SelectedValue = medicineTimenDate.MedicationTimeID.ToString(); txtMedicineDate.Text = medicineTimenDate.MedicineDate; }
protected void btnAdd_Click(object sender, EventArgs e) { MedicineTimenDate medicineTimenDate = new MedicineTimenDate(); medicineTimenDate.MedicationTimeID = Int32.Parse(ddlMedicationTime.SelectedValue); medicineTimenDate.MedicineDate = txtMedicineDate.Text; int resutl = MedicineTimenDateManager.InsertMedicineTimenDate(medicineTimenDate); Response.Redirect("AdminMedicineTimenDateDisplay.aspx"); }
protected void btnUpdate_Click(object sender, EventArgs e) { MedicineTimenDate medicineTimenDate = new MedicineTimenDate(); medicineTimenDate = MedicineTimenDateManager.GetMedicineTimenDateByID(Int32.Parse(Request.QueryString["medicineTimenDateID"])); MedicineTimenDate tempMedicineTimenDate = new MedicineTimenDate(); tempMedicineTimenDate.MedicineTimenDateID = medicineTimenDate.MedicineTimenDateID; tempMedicineTimenDate.MedicationTimeID = Int32.Parse(ddlMedicationTime.SelectedValue); tempMedicineTimenDate.MedicineDate = txtMedicineDate.Text; bool result = MedicineTimenDateManager.UpdateMedicineTimenDate(tempMedicineTimenDate); Response.Redirect("AdminMedicineTimenDateDisplay.aspx"); }
private void loadMedicineTimenDateDate() { ddlExistingRecord.Items.Clear(); ListItem li = new ListItem("New Record", "0"); ddlExistingRecord.Items.Add(li); DataSet ds = MedicineTimenDateManager.GetAllMedicineTimenDatesDistinctDateByResidentID(int.Parse(Request.QueryString["ResidentID"])); foreach (DataRow assessmentnCareDate in ds.Tables[0].Rows) { ListItem item = new ListItem(DateTime.Parse(assessmentnCareDate["MedicineDate"].ToString()).ToString("yyyy-MM-dd hh:mm tt"), DateTime.Parse(assessmentnCareDate["MedicineDate"].ToString()).ToString("yyyy-MM-dd hh:mm tt")); ddlExistingRecord.Items.Add(item); } }
private void loadList() { DateTime startDate = DateTime.Parse(ddlYears.SelectedValue + "-" + ddlMonths.SelectedValue + "-1"); DateTime endDate = startDate.AddMonths(1).AddMinutes(-1); string html = ""; //Initial html += "<table border='0' class='reportTable'><tr>"; html += "<tr><td colspan='4'></td>"; int totalDayOfthisMonth = 0; for (int i = 0; startDate.AddDays(i) <= endDate; i++) { html += "<td style='text-align:center'>" + startDate.AddDays(i).ToString("dd") + "<br/>" + startDate.AddDays(i).DayOfWeek.ToString().Substring(0, 1) + "</td>"; totalDayOfthisMonth = i; } html += "</tr>"; DataSet ds = MedicationTimeManager.GetAllMedicationTimesByResident(int.Parse(Request.QueryString["ResidentID"]), ddlMedicationList.SelectedValue); //DataSet ds = MedicationTimeManager.GetAllMedicationTimesByResident(int.Parse(Request.QueryString["ResidentID"])); DataSet dsAllData = MedicineTimenDateManager.GetMedicationTimenDateByResidentIDWithDateRange(int.Parse(Request.QueryString["ResidentID"]), startDate, endDate); List <Login> allUser = LoginManager.GetAllLogins(); string CareGiverList = ""; foreach (DataRow dr in ds.Tables[0].Rows) { if (ddlShowStaus.SelectedValue != "All") { if (ddlShowStaus.SelectedValue != dr["ExtraField6"].ToString()) { continue; } } html += "<tr><td>" + dr["TakingTime"].ToString() + "</td><td>" + dr["MedicineName"].ToString() + "</td><td>" + dr["Quality"].ToString() + "</td><td>" + dr["Quantity"].ToString() + "</td>"; //html += "</tr>" + "<tr><td>" + dr["MedicineName"] + "</td><td colspan='" + (totalDayOfthisMonth + 1).ToString() + "'>Report will goes here</td>"; for (int i = 0; startDate.AddDays(i) <= endDate; i++) { bool isFount = false; foreach (DataRow drAllData in dsAllData.Tables[0].Rows) { if (dr["MedicationTimeID"].ToString() == drAllData["MedicationTimeID"].ToString() && startDate.AddDays(i).ToString("yyyy-MM-dd") == DateTime.Parse(drAllData["MedicineDate"].ToString()).ToString("yyyy-MM-dd")) { isFount = true; html += "<td style='background-color:#DDDDDD;color:Black;'>" + drAllData["ExtraField3"].ToString() + "</td>"; foreach (Login item in allUser) { if (item.ExtraField4 == drAllData["ExtraField3"].ToString() && !CareGiverList.Contains("(" + item.ExtraField4 + ")")) { CareGiverList += (CareGiverList == ""?"":", ") + item.FirstName + " " + item.LastName + "(" + item.ExtraField4 + ")"; break; } } break; } } if (!isFount) { html += "<td></td>"; } } html += "</tr>"; } lblCareGiver.Text = CareGiverList; html += "</table>"; lblMonthlyPrint.Text = html; }
private void showMedicineTimenDateGrid() { gvMedicineTimenDate.DataSource = MedicineTimenDateManager.GetAllMedicineTimenDates(); gvMedicineTimenDate.DataBind(); }