protected void btCreateNewN_Click(object sender, EventArgs e) { NoteBO NoteBO = new NoteBO(); DataLayer.Note note = new DataLayer.Note(); string nNote = txtNNote.Text.Trim(); if (!string.IsNullOrEmpty(nNote)) { note.HealthCareProviderId = long.Parse(ddHealthCareProviderId.SelectedValue); note.PatientId = long.Parse(ddPatientId.SelectedValue); note.Note1 = nNote; note.NoteTypeId = long.Parse(ddNoteTypeId.SelectedValue); note.Active = cbNActive.Checked; note.DateEntered = DateTime.Now; note.UserIdEntered = 0; NoteBO.Add(note); NoteBO.Save(); txtNNote.Text = ""; cbNActive.Checked = false; string msg = string.Format("Note {0} created.", nNote); Response.Redirect("~/Note/NoteList.aspx?msg=" + msg); } }
protected void Button1_Click(object sender, EventArgs e) { NoteBO notebo = new NoteBO(); long l = Convert.ToInt64((TextBox1.Text.Trim())); GridView1.VirtualItemCount = notebo.Count(x => x.NoteId.Equals(l)); GridView1.DataSource = notebo.Find(x => x.NoteId.Equals(l), 0, GridView1.PageSize) .ToList(); GridView1.DataBind(); Button1.Enabled = true; }
protected void btUpdateN_Click(object sender, EventArgs e) { if (Page.IsPostBack) { NoteBO NoteBO = new NoteBO(); DataLayer.Note editNote = new DataLayer.Note(); int NoteId = Convert.ToInt32(Session["PrimaryKeyNote"]); editNote = NoteBO.Get(NoteId); if (editNote == null) { string str = string.Format("Note Type with Id {0} not found for Update.", NoteId); lblMsg.Text = str; return; } string ntNote = txtNNote.Text.Trim(); if (!string.IsNullOrEmpty(ntNote)) { editNote.Note1 = ntNote; editNote.Active = cbNActive.Checked; editNote.DateEntered = DateTime.Now; editNote.UserIdEntered = 0; NoteBO.Edit(editNote); NoteBO.Save(); txtNNote.Text = ""; cbNActive.Checked = false; string msg = string.Format("Note {0} Updated.", ntNote); Response.Redirect("~/Note/NoteList.aspx?msg=" + msg); } else { string msg = string.Format("Description field Can't be empty."); lblMsg.Text = msg; return; // Response.Redirect("~/Note/NoteList.aspx"); } } }