コード例 #1
0
    protected void GrdLetter_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        Label lblId = (Label)GrdLetter.Rows[e.RowIndex].FindControl("lblId");

        DropDownList ddlLetterType       = (DropDownList)GrdLetter.Rows[e.RowIndex].FindControl("ddlLetterType");
        DropDownList ddlSite             = (DropDownList)GrdLetter.Rows[e.RowIndex].FindControl("ddlSite");
        TextBox      txtCode             = (TextBox)GrdLetter.Rows[e.RowIndex].FindControl("txtCode");
        TextBox      txtMessage          = (TextBox)GrdLetter.Rows[e.RowIndex].FindControl("txtMessage");
        TextBox      txtDocName          = (TextBox)GrdLetter.Rows[e.RowIndex].FindControl("txtDocName");
        CheckBox     chkIsSendToMedico   = (CheckBox)GrdLetter.Rows[e.RowIndex].FindControl("chkIsSendToMedico");
        CheckBox     chkIsAllowedReclaim = (CheckBox)GrdLetter.Rows[e.RowIndex].FindControl("chkIsAllowedReclaim");

        //CheckBox     chkIsManualOverride = (CheckBox)GrdLetter.Rows[e.RowIndex].FindControl("chkIsManualOverride");
        //DropDownList ddlNumCopiesToPrint = (DropDownList)GrdLetter.Rows[e.RowIndex].FindControl("ddlNumCopiesToPrint");

        txtDocName.Text = txtDocName.Text.Trim();
        if (txtDocName.Text.Length > 0 &&
            (!txtDocName.Text.EndsWith(".docx") &&
             !txtDocName.Text.EndsWith(".doc") &&
             !txtDocName.Text.EndsWith(".dot")))
        {
            SetErrorMessage("Only .docx, .doc, and .dot files allowed");
            return;
        }


        if (txtCode.Text.Length == 0 &&
            (Convert.ToInt32(ddlLetterType.SelectedValue) == 235 ||  // dva reject letter
             Convert.ToInt32(ddlLetterType.SelectedValue) == 234 ||  // medicare reject letter
             Convert.ToInt32(ddlLetterType.SelectedValue) == 214 ||  // organisation reject letter
             Convert.ToInt32(ddlLetterType.SelectedValue) == 3))     // patient reject letter
        {
            SetErrorMessage("Reject Code can not be empty for letters of type " + ddlLetterType.SelectedItem.Text);
            return;
        }

        int       letter_id = Convert.ToInt32(lblId.Text);
        DataTable dt        = Session["letter_data"] as DataTable;

        DataRow[] foundRows = dt.Select("letter_letter_id=" + letter_id.ToString());
        Letter    letter    = LetterDB.LoadAll(foundRows[0]);

        int orgID   = letter.Organisation == null ? 0 : letter.Organisation.OrganisationID;
        int site_id = (GrdLetter.Rows[e.RowIndex].Cells[3].CssClass == "hiddencol") ? letter.Site.SiteID : Convert.ToInt32(ddlSite.SelectedValue);

        LetterDB.Update(letter_id, orgID, Convert.ToInt32(ddlLetterType.SelectedValue), site_id, txtCode.Text, txtMessage.Text, txtDocName.Text.Trim(), chkIsSendToMedico.Checked, chkIsAllowedReclaim.Checked, false, 1, letter.IsDeleted);

        GrdLetter.EditIndex = -1;
        FillGrid();
    }
コード例 #2
0
ファイル: LetterDB.cs プロジェクト: nblaurenciana-md/Websites
    public static Hashtable GetHashTable(int site_id = -1)
    {
        Hashtable hash = new Hashtable();

        DataTable tbl = GetDataTable(site_id);

        for (int i = 0; i < tbl.Rows.Count; i++)
        {
            Letter letter = LetterDB.LoadAll(tbl.Rows[i]);
            hash[letter.LetterID] = letter;
        }

        return(hash);
    }
コード例 #3
0
    protected void PopulateLettersList()
    {
        DataTable letters = LetterDB.GetDataTable_ByOrg(0, Convert.ToInt32(Session["SiteID"]));

        // remove ones that dont exists
        for (int i = letters.Rows.Count - 1; i >= 0; i--)
        {
            Letter letter = LetterDB.LoadAll(letters.Rows[i]);
            if (!letter.FileExists(Convert.ToInt32(Session["SiteID"])))
            {
                letters.Rows.RemoveAt(i);
            }
        }

        lstLetters.DataSource     = letters;
        lstLetters.DataTextField  = "letter_docname";
        lstLetters.DataValueField = "letter_letter_id";
        lstLetters.DataBind();
    }
コード例 #4
0
    protected void PopulateLettersList()
    {
        UserView userView = UserView.GetInstance();

        int orgID = (txtUpdateOrganisationID.Text.Length == 0) ? 0 : Convert.ToInt32(txtUpdateOrganisationID.Text);

        if (orgID == 0 && !userView.IsAdminView)
        {
            orgID = Convert.ToInt32(Session["OrgID"]);
        }
        bool      usingDeafultLetters = orgID == 0 || chkUseDefaultDocs.Checked; // || !LetterDB.OrgHasdocs(orgID);
        DataTable letters             = LetterDB.GetDataTable_ByOrg(usingDeafultLetters ? 0 : orgID, usingDeafultLetters ? Convert.ToInt32(Session["SiteID"]) : -1);

        lblSpaceBeforeUseDefaultDocsCheckbox.Visible = orgID != 0;
        chkUseDefaultDocs.Visible                    = orgID != 0;
        chkUseDefaultDocs.ForeColor                  = System.Drawing.Color.DarkOrchid;
        lblDefaultOrOrgSpecificDocs.Visible          = orgID == 0;
        lblSpaceBeforeUseDefaultDocsCheckbox.Visible = orgID == 0;
        if (usingDeafultLetters)
        {
            SetLabel(lblDefaultOrOrgSpecificDocs, "**Using Default Docs", System.Drawing.Color.Blue, false);
        }
        else
        {
            SetLabel(lblDefaultOrOrgSpecificDocs, "**Using Organisation Specific Docs", System.Drawing.Color.DarkOrchid, false);
        }

        // remove ones that dont exists
        for (int i = letters.Rows.Count - 1; i >= 0; i--)
        {
            Letter letter = LetterDB.LoadAll(letters.Rows[i]);
            if (!letter.FileExists(Convert.ToInt32(Session["SiteID"])))
            {
                letters.Rows.RemoveAt(i);
            }
        }

        lstLetters.DataSource     = letters;
        lstLetters.DataTextField  = "letter_docname";
        lstLetters.DataValueField = "letter_letter_id";
        lstLetters.DataBind();
    }
コード例 #5
0
    protected void GrdLetter_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        DataTable letterTypes = DBBase.GetGenericDataTable_WithWhereOrderClause(null, "LetterType", "", "descr", "letter_type_id", "descr");
        DataTable sites       = SiteDB.GetDataTable();


        DataTable dt = Session["letter_data"] as DataTable;

        bool tblEmpty = (dt.Rows.Count == 1 && dt.Rows[0][0] == DBNull.Value);

        if (!tblEmpty && e.Row.RowType == DataControlRowType.DataRow)
        {
            bool      hasData   = dt.Rows[0][0].ToString() != string.Empty;
            Label     lblId     = (Label)e.Row.FindControl("lblId");
            DataRow[] foundRows = dt.Select("letter_letter_id=" + lblId.Text);
            DataRow   thisRow   = foundRows[0];
            Letter    letter    = LetterDB.LoadAll(thisRow);

            DropDownList ddlLetterType = (DropDownList)e.Row.FindControl("ddlLetterType");
            if (ddlLetterType != null)
            {
                ddlLetterType.DataSource     = letterTypes;
                ddlLetterType.DataTextField  = "descr";
                ddlLetterType.DataValueField = "letter_type_id";
                ddlLetterType.DataBind();
                ddlLetterType.SelectedValue = thisRow["letter_letter_type_id"].ToString();
            }

            DropDownList ddlSite = (DropDownList)e.Row.FindControl("ddlSite");
            if (ddlSite != null)
            {
                ddlSite.DataSource     = sites;
                ddlSite.DataTextField  = "name";
                ddlSite.DataValueField = "site_id";
                ddlSite.DataBind();
                ddlSite.SelectedValue = thisRow["letter_site_id"].ToString();
            }


            Label lblFileExists = (Label)e.Row.FindControl("lblFileExists");
            if (lblFileExists != null)
            {
                lblFileExists.Style.Remove("border-bottom");
                lblFileExists.Font.Bold = false;

                if (letter.FileExists(Convert.ToInt32(Session["SiteID"])))
                {
                    lblFileExists.Text = "Yes";
                }
                else
                {
                    if (letter.LetterType.ID == 234 || letter.LetterType.ID == 235) // medicare/dva rejection codes
                    {
                        if (letter.Docname.Length == 0)
                        {
                            lblFileExists.Text = string.Empty;
                        }
                        if (letter.Docname.Length > 0)
                        {
                            lblFileExists.Text      = "<span style=\"border-bottom:thin dotted black;\" title=\"This won't be in the list of available reject codes.\r\nTo have it in the available list of reject codes, either change the docname to be blank or change the docname to one that exists in the below list.\">No</span>";
                            lblFileExists.Font.Bold = true;
                        }
                    }
                    else
                    {
                        lblFileExists.Text = "No";
                        if (letter.Docname.Length > 0)
                        {
                            lblFileExists.Text      = "<span style=\"border-bottom:thin dotted black;\" title=\"This won't be in the list of available letters.\r\nTo have it in the available list of letters, change the docname to one that exists in the below list.\">No</span>";
                            lblFileExists.Font.Bold = true;
                        }
                    }
                }
            }


            Utilities.AddConfirmationBox(e);
            if ((e.Row.RowState & DataControlRowState.Edit) > 0)
            {
                Utilities.SetEditRowBackColour(e, System.Drawing.Color.LightGoldenrodYellow);
            }
        }
        if (e.Row.RowType == DataControlRowType.Footer)
        {
            DropDownList ddlLetterType = (DropDownList)e.Row.FindControl("ddlNewLetterType");
            ddlLetterType.DataSource     = letterTypes;
            ddlLetterType.DataTextField  = "descr";
            ddlLetterType.DataValueField = "letter_type_id";
            ddlLetterType.DataBind();

            DropDownList ddlSite = (DropDownList)e.Row.FindControl("ddlNewSite");
            ddlSite.DataSource     = sites;
            ddlSite.DataTextField  = "name";
            ddlSite.DataValueField = "site_id";
            ddlSite.DataBind();
        }
    }