protected void delete_Click(object sender, EventArgs e) { Button button = (Button)sender; //int i = int.Parse(id.Text); AccessLayer.deleteRecord(businessCards[clickButtonID]); myModal.Attributes["style"] = "display:none"; Response.Redirect(Request.RawUrl); }
public void insert_Click(object sender, EventArgs e) { var newBC = new BusinessCard(); newBC.name = newName.Text; newBC.jobTitle = newTitle.Text; newBC.address = newAddress.Text; newBC.phoneNumber = newPhone.Text; newBC.email = newEmail.Text; newBC.companyID = companyID; AccessLayer.addRecord(newBC); insertModal.Attributes["style"] = "display:none"; Response.Redirect(Request.RawUrl); }
protected void Page_Load(object sender, EventArgs e) { String companyType = Request.QueryString["companyType"]; companyList = AccessLayer.getCompanies(companyType); /* * Company c1 = new Company(); * c1.companyName = "avc"; * Company c3 = new Company(); * c3.companyName = "avc"; * Company c4 = new Company(); * c4.companyName = "avc"; * Company c2 = new Company(); * c2.companyName = "sss"; * Company c5 = new Company(); * c5.companyName = "avc"; * * companyList.Add(c1); * companyList.Add(c2); * companyList.Add(c3); * companyList.Add(c4); * companyList.Add(c5); */ //Button[] buttons = new Button[companyList.Count]; for (int i = 0; i < companyList.Count; i++) { System.Web.UI.HtmlControls.HtmlGenericControl cardDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); cardDiv.ID = "card" + i; cardDiv.Attributes["style"] = "margin:0 10px 0 10px"; cardDiv.Attributes.Add("onclick", "window.location.href='businessCard.aspx?companyID=" + companyList[i].companyID + "'"); cardDiv.InnerHtml = "<div class='companyContain'><div class='card front'><div class='blue'></div><div class='yellow'>" + "</div><div class='pink'></div><div class='dots'></div><div class='personal-intro'>" + "<p>" + companyList[i].companyName + "</p></div></div></div>"; div1.Controls.Add(cardDiv); } }
protected void update_Click(object sender, EventArgs e) { var temp = businessCards[clickButtonID]; System.Diagnostics.Debug.WriteLine(clickButtonID); String ename = name.Text; String eaddress = address.Text; String ephone = phone.Text; String eTitle = title.Text; String eemail = email.Text; temp.email = eemail; temp.name = ename; temp.phoneNumber = ephone; temp.address = eaddress; temp.jobTitle = eTitle; AccessLayer.updateRecord(temp); myModal.Attributes["style"] = "display:none"; Response.Redirect(Request.RawUrl); }
protected void Page_Load(object sender, EventArgs e) { companyID = int.Parse(Request.QueryString["companyID"]); /*BusinessCard c1 = new BusinessCard(); * c1.employerID = 1; * c1.address = "123 duval drive"; * c1.name = "John"; * c1.email = "*****@*****.**"; * c1.phoneNumber = "1234567891"; * c1.jobTitle = "Developer"; * * BusinessCard c3 = new BusinessCard(); * c3.employerID = 1; * c3.address = "456 duval drive"; * c3.name = "Rose"; * c3.email = "*****@*****.**"; * c3.phoneNumber = "1234567891"; * c3.jobTitle = "Manager"; * BusinessCard c4 = new BusinessCard(); * c4.employerID = 1; * c4.address = "789 duval drive"; * c4.name = "John"; * c4.email = "*****@*****.**"; * c4.phoneNumber = "1234567891"; * c4.jobTitle = "Developer"; * BusinessCard c2 = new BusinessCard(); * c2.employerID = 1; * c2.address = "222 duval drive"; * c2.name = "Ion"; * c2.email = "*****@*****.**"; * c2.phoneNumber = "1234567891"; * c2.jobTitle = "Sales"; * BusinessCard c5 = new BusinessCard(); * c5.employerID = 1; * c5.address = "786 duval drive"; * c5.name = "Sam"; * c5.email = "*****@*****.**"; * c5.phoneNumber = "1234567891"; * c5.jobTitle = "CEO"; * * businessCards.Add(c1); * businessCards.Add(c2); * businessCards.Add(c3); * businessCards.Add(c4); * businessCards.Add(c5);*/ businessCards = AccessLayer.getBusinessCards(companyID); Button[] buttons = new Button[businessCards.Count]; for (int i = 0; i < businessCards.Count; i++) { System.Web.UI.HtmlControls.HtmlGenericControl cardDiv = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); cardDiv.ID = "card" + i; cardDiv.Attributes["style"] = "margin:0 10px 0 10px"; cardDiv.InnerHtml = "<div class='card back'><div class='yellow'></div><div class='top dots'>" + "</div><div class='personal-info'><p>" + businessCards[i].name + "</p><p>" + businessCards[i].jobTitle + "</p>" + "<p>" + businessCards[i].address + "</p><p>Sacramento, CA 14234</p><p>" + businessCards[i].phoneNumber + "</p>" + "<p>" + businessCards[i].email + "</p></div><div class='bottom dots'>" + "</div><div class='pink'></div></div>"; System.Web.UI.HtmlControls.HtmlGenericControl buttonContainer = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); buttonContainer.ID = "buttonContain" + i; buttonContainer.Attributes["style"] = "display:flex"; System.Web.UI.HtmlControls.HtmlGenericControl cardWrapper = new System.Web.UI.HtmlControls.HtmlGenericControl("DIV"); cardWrapper.ID = "cardWrapper" + i; buttons[i] = new Button(); buttons[i].ID = i.ToString(); buttons[i].Text = "Edit/Delete"; buttons[i].Visible = true; buttons[i].Attributes["style"] = "margin:auto"; buttons[i].Click += new EventHandler(ShowModal); buttonContainer.Controls.Add(buttons[i]); cardWrapper.Controls.Add(cardDiv); cardWrapper.Controls.Add(buttonContainer); div2.Controls.Add(cardWrapper); } }