예제 #1
0
    public static void SetNotDeleted(int note_id, int un_deleted_by)
    {
        Note note = NoteDB.GetByID(note_id);

        NoteHistoryDB.Insert(note.NoteID, note.NoteType.ID, note.BodyPart.ID, note.Text, note.DateAdded, note.DateModified, note.DateDeleted, note.AddedBy == null ? -1 : note.AddedBy.StaffID, note.ModifiedBy == null ? -1 : note.ModifiedBy.StaffID, note.DeletedBy == null ? -1 : note.DeletedBy.StaffID, note.Site == null ? -1 : note.Site.SiteID);

        string sql = "UPDATE Note SET date_deleted = NULL, deleted_by = NULL, date_modified = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',modified_by = " + un_deleted_by + " WHERE note_id = " + note_id.ToString();

        DBBase.ExecuteNonResult(sql);
    }
예제 #2
0
    public static void Update(int note_id, DateTime date_added, int modified_by, int note_type_id, int body_part_id, int medical_service_type_id, string text, int site_id)
    {
        Note note = NoteDB.GetByID(note_id);

        NoteHistoryDB.Insert(note.NoteID, note.NoteType.ID, note.BodyPart.ID, note.Text, note.DateAdded, note.DateModified, note.DateDeleted, note.AddedBy == null ? -1 : note.AddedBy.StaffID, note.ModifiedBy == null ? -1 : note.ModifiedBy.StaffID, note.DeletedBy == null ? -1 : note.DeletedBy.StaffID, note.Site == null ? -1 : note.Site.SiteID);

        text = text.Replace("'", "''");
        string sql = "UPDATE Note SET note_type_id = " + note_type_id + ",body_part_id = " + (body_part_id == -1 ? "NULL" : body_part_id.ToString()) + ",medical_service_type_id = " + (medical_service_type_id == -1 ? "NULL" : medical_service_type_id.ToString()) + ",date_added = '" + date_added.ToString("yyyy-MM-dd HH:mm:ss") + "'" + ",text = '" + text + "',date_modified = '" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',modified_by = " + modified_by + ",site_id = " + (site_id == -1 ? "NULL" : site_id.ToString()) + " WHERE note_id = " + note_id.ToString();

        DBBase.ExecuteNonResult(sql);
    }
    protected void FillGrid()
    {
        Note note = GetFormNote();

        if (note == null)
        {
            SetErrorMessage("Invalid note id");
            return;
        }


        DataTable dt = NoteHistoryDB.GetDataTable(note.NoteID);

        Session["noteedithistory_data"] = dt;

        if (dt.Rows.Count > 0)
        {
            if (IsPostBack && Session["noteedithistory_sortexpression"] != null && Session["noteedithistory_sortexpression"].ToString().Length > 0)
            {
                DataView dataView = new DataView(dt);
                dataView.Sort      = Session["noteedithistory_sortexpression"].ToString();
                GrdNote.DataSource = dataView;
            }
            else
            {
                GrdNote.DataSource = dt;
            }


            try
            {
                GrdNote.DataBind();
                GrdNote.PagerSettings.FirstPageText = "1";
                GrdNote.PagerSettings.LastPageText  = GrdNote.PageCount.ToString();
                GrdNote.DataBind();
            }
            catch (Exception ex)
            {
                SetErrorMessage(ex.ToString());
            }
        }
        else
        {
            dt.Rows.Add(dt.NewRow());
            GrdNote.DataSource = dt;
            GrdNote.DataBind();

            int TotalColumns = GrdNote.Rows[0].Cells.Count;
            GrdNote.Rows[0].Cells.Clear();
            GrdNote.Rows[0].Cells.Add(new TableCell());
            GrdNote.Rows[0].Cells[0].ColumnSpan = TotalColumns;
            GrdNote.Rows[0].Cells[0].Text       = "No Record Found";
        }
    }