protected void insertCEData(object sender, EventArgs e) { //--------CONSISTENCY----------------- if (this.memberID.Text.Equals("") || this.datepicker.Text.Equals("") || this.numberOfSeats.Text.Equals("") || this.selectYear.SelectedIndex == 0) { this.errorDiv.Visible = true; this.response.Visible = false; this.errorMsg.Text = "Please fill all required fields."; } //------------------------------------ else { string user = Page.User.Identity.Name; CEDAO ceDAO = new CEDAO(); CE ce = new CE(); ce.memberID = this.memberID.Text; ce.numberOfSeats = this.numberOfSeats.Text; ce.year = this.selectYear.Text + "-01-01"; ce.eventDate = this.datepicker.Text; this.response.Visible = true; this.errorDiv.Visible = false; this.DBMsg.Text = ceDAO.insertCE(ce, user); } }
protected void goToEditionDiv(object sender, EventArgs e) { if (this.selectYear.Text.Equals("...") || this.memberName.Text.Equals("")) { this.response1.Text = "Please select one Member and the Rebate Year in order to proceed."; } else { this.response1.Text = ""; ceDAO = new CEDAO(); List<CE> ceList = ceDAO.getListOfCE(this.memberID.Text, this.selectYear.Text + "-01-01"); if (ceList != null) { System.Data.DataTable tbl = new DataTable(); DataColumn col = new DataColumn("Event Date"); tbl.Columns.Add(col); col = new DataColumn("Rebate Year"); tbl.Columns.Add(col); col = new DataColumn("Number of Seats"); tbl.Columns.Add(col); col = new DataColumn("Member ID"); tbl.Columns.Add(col); col = new DataColumn("CE ID"); tbl.Columns.Add(col); foreach (CE ce in ceList) { DataRow dr = tbl.NewRow(); dr["Event Date"] = ce.eventDate.Substring(0, 10); dr["Rebate Year"] = ce.year.Substring(0, 4); dr["Number of Seats"] = ce.numberOfSeats; dr["Member ID"] = ce.memberID; dr["CE ID"] = ce.id; tbl.Rows.Add(dr); } CEResults.DataSource = tbl; CEResults.DataBind(); ViewState.Add("TBL", tbl); this.selectedMemberName.Text = this.searchMembers.SelectedRow.Cells[2].Text; this.chooseDiv.Visible = false; this.editionDiv.Visible = true; } else { this.response1.Text = "There is no results for the given parameters."; } } }
protected void insertEditedCE(object sender, EventArgs e) { if (this.datepicker.Text.Equals("") || this.numberOfSeats.Text.Equals("") || this.selectYear2.Text.Equals("") || this.selectYear2.Text.Equals("...")) { this.errorMsg.Text = "Please fill all the 3 required fields."; } else { ceDAO = new CEDAO(); ce = new CE(); ce.id = this.CEResults.SelectedRow.Cells[5].Text; ce.memberID = this.CEResults.SelectedRow.Cells[4].Text; ce.year = this.selectYear2.Text; ce.numberOfSeats = this.numberOfSeats.Text; ce.eventDate = this.datepicker.Text; string user = this.Page.User.Identity.Name.ToString(); string result = ceDAO.editCE(ce, user); if (result.Equals("Success")){ this.DB_Response.Text = "The CE data was successfully updated on the Database."; this.errorMsg.Text = ""; }else { this.errorMsg.Text = "Nothing was commited. Some error has occurred."; this.DB_Response.Text = ""; } } }