Ejemplo n.º 1
0
    protected void ButtonCreateNotice_Click(object sender, EventArgs e)
    {
        Dictionary<string, string> vars = new Dictionary<string, string>();

        int days = Convert.ToInt32(DropDownListDays.SelectedValue);
        int rentTypeIndex = Convert.ToInt32(DropDownListRentTypes.SelectedValue);
        vars["intDays"] = days.ToString();
        vars["strDays"] = NumberToEnglish.EnglishFromNumber(days);
        /*if (days == 3)
        {
            vars["strDays"] = "Three";
        }
        else if (days == 5)
        {
            vars["strDays"] = "Five";
        }
        else
        {
            vars["strDays"] = days.ToString();
        }*/
        QuickPM.Tenant tenant = new QuickPM.Tenant(QuickPM.Util.FormatTenantId(DropDownListTenants.SelectedValue));
        vars["tenantName"] = tenant.Name;
        vars["tenantAddress"] = tenant.Address + ", " + tenant.City + ", " + tenant.State + " " + tenant.Zip;
        //vars["amountDue"] = "Not finished yet";
        vars["owner"] = TextBoxCreditorName.Text.Trim();
        vars["deliveryLocation"] = TextBoxDeliveryLocation.Text.Trim();
        vars["date"] = DateTime.Today.ToShortDateString();
        vars["agentTelephone"] = TextBoxAgentTelephone.Text.Trim();
        Notice notice = new Notice(Request.PhysicalApplicationPath + "/App_Data/NoticeTemplates/Pay" + Request["Notice"] + "NoticeTemplate.rtf", tenant.TenantId, rentTypeIndex, vars);
        string noticeText = notice.GenerateNotice();
        //Session["NoticeText"] = noticeText;
        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + "Notice.rtf");
        //Response.AddHeader("Content-Length", );
        Response.ContentType = "application/rtf";
        Response.Write(noticeText);
        Response.End();
    }