Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        QuickPMWebsite.DatabaseSettings.UpdateDatabaseConnectionString(HttpContext.Current.Profile, this.Request);
        if (Request["Id"] != null)
        {
            long id;
            if (long.TryParse(Request["Id"], out id))
            {
                VolunteerTracker.Person person = new VolunteerTracker.Person(id);
                if (person.Delete() != 1)
                {
                    throw new Exception("Error deleting contact");
                }
            }
            else
            {
                throw new Exception("Can't delete contact");
            }

        }
        if (Request["return"] != null)
        {
            Response.Redirect(Request["return"]);
        }
    }
Esempio n. 2
0
    /// <summary>
    /// Please note that the database connection must be properly set up before calling this function
    /// </summary>
    /// <param name="contactId"></param>
    /// <param name="request"></param>
    /// <returns></returns>
    public static string DisplayContact(long contactId, System.Web.UI.Page page)
    {
        VolunteerTracker.Person person = new VolunteerTracker.Person(contactId);
        string editLink = "<a href=\"" + page.ResolveUrl("~/People/Person.aspx?id=" + person.Id) + "&return=" + System.Uri.EscapeUriString(page.Request.RawUrl) + "\">Edit</a>";
        string deleteLink = "<a href=\"" + page.ResolveUrl("~/People/DeletePerson.aspx?id=" + person.Id) + "&return=" + System.Uri.EscapeUriString(page.Request.RawUrl) + "\" onclick=\"javascript: return confirm('Delete?')\">Delete</a>";
        if(!person.ACL.CanWrite(VolunteerTracker.Database.GetUserId()))
        {
            editLink = "";
            deleteLink = "";
        }

        string html = @"<fieldset>
                <legend>
                    Key Contact " + (editLink != "" ?  "(" + editLink + ", " + deleteLink + ")" : "") +
                @"</legend>";

        if (person.ACL.NoAccess(VolunteerTracker.Database.GetUserId()))
        {
            html = @"<fieldset>
                        <legend>
                            Key Contact
                        </legend>
                        We're sorry you do not have have permission to view this contact. Please ask your account administrator for help
                        </fieldset>";
            return html;
        }

        if(person.Name != ""){
            html += "<b>Name</b> &nbsp;" + person.Name;
        }

        if (person.Title != "")
        {
            html += "<br/><b>Title</b> &nbsp;" + person.Title;
        }
        if(person.OfficePhone != ""){
        html += "<br/><b>Bus. Tele.</b> &nbsp;" + person.OfficePhone;
        }
        if(person.CellPhone != ""){
        html += "<br/><b>Cell Phone</b> &nbsp;" + person.CellPhone;
        }
        if(person.HomePhone != ""){
        html += "<br/><b>Home Phone</b> &nbsp;" + person.HomePhone;
        }
        if(person.Fax != ""){
        html += "<br/><b>Fax Tele.</b> &nbsp;" + person.Fax;
        }
        if(person.Email != ""){
        html += "<br/><b>Email</b> &nbsp;" + person.Email;
        }
        if (person.Address != "")
        {
            html += "<br/><b>Address</b> &nbsp;" + person.Address;
        }

        html += "</fieldset>";
        return html;
    }
Esempio n. 3
0
 protected void UpdateContact()
 {
     if (Request["NewContact"] != null)
     {
         contact = new VolunteerTracker.Person();
         contact.AssociatedKey = Request["AssociatedKey"];
     }
     contact.CellPhone = ((Tenant_PersonControl)KeyContact).CellPhone;
     contact.Email = ((Tenant_PersonControl)KeyContact).Email;
     contact.Fax = ((Tenant_PersonControl)KeyContact).Fax;
     contact.HomePhone = ((Tenant_PersonControl)KeyContact).HomePhone;
     contact.Name = ((Tenant_PersonControl)KeyContact).Name;
     contact.OfficePhone = ((Tenant_PersonControl)KeyContact).OfficePhone;
     contact.Title = ((Tenant_PersonControl)KeyContact).Title;
     contact.Address = ((Tenant_PersonControl)KeyContact).Address;
     contact.Save();
 }
Esempio n. 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request["NewContact"] != null)
     {
         return;
     }
     if (Request["Id"] == null)
     {
         return;
     }
     int id;
     if (!Int32.TryParse(Request["Id"], out id))
     {
         return;
     }
     contact = new VolunteerTracker.Person(id);
     if (!IsPostBack)
     {
         UpdatePersonControl();
     }
 }