protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sProgramCode = ProgramList.SelectedValue; try { Program program = new Program(); program = RequestDirector.FindProgram(sProgramCode); if (program.ProgramCode != null) { ProgramCodeLabel.Visible = true; DescriptionLabel.Visible = true; EnrolledStudentsLabel.Visible = true; ProgramCodeTextBox.Visible = true; DescriptionTextBox.Visible = true; studentsGridView.Visible = true; ProgramCodeTextBox.Text = program.ProgramCode; DescriptionTextBox.Text = program.Description; studentsGridView.DataSource = program.EnrolledStudents; studentsGridView.DataBind(); } else { MessageLabel.Text = "<i>Program find was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Student Enrollment was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void FindProgramButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string pProgramCode = ProgramCodeTextBox.Text; try { string program = RequestDirector.FindProgram(pProgramCode); if (!string.IsNullOrEmpty(program)) { ProgramCodeDescriptionTextBox.Visible = true; MessageLabel.Text = "<i>Program Found</i>"; ProgramCodeDescriptionTextBox.Text = program; } else { MessageLabel.Text = "<i>Program NOT Found</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Program NOT Found</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sStudentID = StudentIDTextBox.Text; try { Student student = new Student(); student = RequestDirector.FindStudent(sStudentID); if (!string.IsNullOrEmpty(student.FirstName)) { FirstNameLabel.Visible = true; LastNameLabel.Visible = true; EmailLabel.Visible = true; ProgramCodeLabel.Visible = true; FirstNameTextBox.Visible = true; LastNameTextBox.Visible = true; EmailLabelTextBox.Visible = true; ProgramCodeTextBox.Visible = true; FirstNameTextBox.Text = student.FirstName; LastNameTextBox.Text = student.LastName; EmailLabelTextBox.Text = student.Email; ProgramCodeTextBox.Text = student.PostalCode; } else { MessageLabel.Text = "<i>Student NOT Found</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Student NOT Found</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_ClickUpdate(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sItemCode = ItemCodeLabel.Text; string description = ItemDescriptionLabel.Text; decimal unitprice = Convert.ToDecimal(UnitPriceTextBox.Text); try { bool Confirmation = RequestDirector.UpdateItem(sItemCode, description, unitprice); if (Confirmation) { MessageLabel.Text = "<i>Item Updated successfully</i>"; } else { MessageLabel.Text = "<i>Item update was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Item update was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sProgramCode = ItemCodeTextBox.Text; string sDescription = DescriptionTextBox.Text; decimal sUnitPrice = Math.Round(Convert.ToDecimal(UnitPriceTextBox.Text)); try { bool Confirmation = RequestDirector.AddItem(sProgramCode, sDescription, sUnitPrice); if (Confirmation) { MessageLabel.Text = "<i>Create Item successful</i>"; ItemCodeTextBox.Text = ""; DescriptionTextBox.Text = ""; } else { MessageLabel.Text = "<i>Create Item was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Create Item was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_ClickDelete(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sItemCode = ItemCodeLabel.Text; try { int Confirmation = RequestDirector.DeleteItem(sItemCode); if (Confirmation == 0) { MessageLabel.Text = "<i>Item Deleted successful</i>"; dropdownItem(); hideItems(); } else if (Confirmation == 2) { MessageLabel.Text = "<i>Item NOT Deleted (Item Code part of ItemSold table )</i>"; } else { MessageLabel.Text = "<i>Delete Item was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Delete Item was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); Student AcceptedStudent = new Student(); AcceptedStudent.StudentID = StudentID.Text; AcceptedStudent.FirstName = studentFirstN.Text; AcceptedStudent.LastName = studentLastN.Text; AcceptedStudent.Email = StudentEmail.Text; string sProgramCode = ProgramList.SelectedValue; try { bool Confirmation = RequestDirector.EnrollStudent(AcceptedStudent, sProgramCode); if (Confirmation) { MessageLabel.Text = "<i>Student Enrollment Successfull</i>"; StudentID.Text = ""; studentFirstN.Text = ""; studentLastN.Text = ""; StudentEmail.Text = ""; ProgramList.SelectedIndex = 0; } else { MessageLabel.Text = "<i>Student Enrollment was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Student Enrollment was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sCustomerName = CustomerNameTextBox.Text; string sAddress = AddressTextBox.Text; string sCity = CityTextBox.Text; string sProvince = ProvinceTextBox.Text; string sPostalCode = PostalCodeTextBox.Text; try { bool Confirmation = RequestDirector.AddCustomer(sCustomerName, sAddress, sCity, sProvince, sPostalCode); if (Confirmation) { MessageLabel.Text = "<i>Customer Created successfully</i>"; CustomerNameTextBox.Text = ""; AddressTextBox.Text = ""; CityTextBox.Text = ""; ProvinceTextBox.Text = ""; PostalCodeTextBox.Text = ""; } else { MessageLabel.Text = "<i>Create Customer was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Create Customer was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sProgramCode = ProgramCodeTextBox.Text; string sDescription = DescriptionTextBox.Text; try { bool Confirmation = RequestDirector.CreateProgram(sProgramCode, sDescription); if (Confirmation) { MessageLabel.Text = "<i>Create program successful</i>"; ProgramCodeTextBox.Text = ""; DescriptionTextBox.Text = ""; } else { MessageLabel.Text = "<i>Create program was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Create program was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void UpdateButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); bool success = RequestDirector.ModifyStudent(StudentIDTextBox.Text, FirstNameTextBox.Text, LastNameTextBox.Text, EmailTextBox.Text, ProgramCodeLabelValue.Text); if (success) { MessageLabel.Text = "<i>Student Updated</i>"; } else { MessageLabel.Text = "<i style='color: red;'>Error Updating Student</i>"; } }
protected void RemoveButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); bool success = RequestDirector.RemoveStudent(StudentIDTextBox.Text); if (success) { MessageLabel.Text = "<i>Student Deleted</i>"; } else { MessageLabel.Text = "<i style='color: red;'>Error Deleting Student</i>"; } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sCustomerIDCode = CustomerIDList.SelectedValue; try { Customer cust = new Customer(); cust = RequestDirector.GetCustomerById(sCustomerIDCode); if (cust.CustomerID != 0) { CustomerNameLabel.Visible = true; CustomerNameTextBox.Visible = true; CustomerNameRequiredFieldValidator.Visible = true; CustomerNameRegularExpressionValidator.Visible = true; AddressLabel.Visible = true; AddressTextBox.Visible = true; CityLabel.Visible = true; CityTextBox.Visible = true; CityTextBoxRequiredFieldValidator.Visible = true; ProvinceLabel.Visible = true; ProvinceTextBox.Visible = true; ProvinceRequiredFieldValidator.Visible = true; PostalCodeLabel.Visible = true; PostalCodeTextBox.Visible = true; PostalCodeRequiredFieldValidator.Visible = true; PostalCodeExpressionValidator.Visible = true; SubmitButtonUpdate.Visible = true; custID.Text = (cust.CustomerID).ToString(); CustomerNameTextBox.Text = cust.CustomerName; AddressTextBox.Text = cust.Address; CityTextBox.Text = cust.City; ProvinceTextBox.Text = cust.Province; PostalCodeTextBox.Text = cust.PostalCode; } else { MessageLabel.Text = "<i>Customer NOT found</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Customer NOT Found</i>"; Console.WriteLine(ex.Message); } }
//public void dropdownList() //{ // const string dbConnectionString = @"Data Source=DATABAIST;Database=ksingh31;Integrated Security=true"; // SqlConnection dbConnection = new SqlConnection(); // dbConnection.ConnectionString = dbConnectionString; // dbConnection.Open(); // SqlCommand getItemCmd = new SqlCommand(); // getItemCmd.Connection = dbConnection; // getItemCmd.CommandType = CommandType.StoredProcedure; // getItemCmd.CommandText = "GetCustomers"; // SqlDataAdapter da = new SqlDataAdapter(getItemCmd); // DataSet custC = new DataSet(); // da.Fill(custC); // CustomerIDList.DataSource = custC; // CustomerIDList.DataTextField = "CustomerName"; // CustomerIDList.DataValueField = "CustomerID"; // CustomerIDList.DataBind(); // CustomerIDList.Items.Insert(0, new ListItem("-- Select Customer --", "0")); // dbConnection.Close(); //} protected void GoToSalePage_Click(object sender, EventArgs e) { int saleNumber = int.Parse(SaleNumberTextBox.Text); string sName = SalepersonTextBox.Text; double sSubTotal = Convert.ToDouble(subTotalTextBox.Text); double sgst = Convert.ToDouble(gstTextBox.Text); double sTotal = Convert.ToDouble(totalTextBox.Text); var list = new List <ItemsSold>(); TableRowCollection t = CartTable.Rows; foreach (TableRow r in t) { ItemsSold item1 = new ItemsSold(); item1.ItemCode = (r.Cells[0].Text).ToString(); item1.SaleNumber = saleNumber; item1.Quantity = int.Parse(r.Cells[1].Text); item1.ItemTotal = Convert.ToDouble(r.Cells[2].Text); list.Add(item1); } BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); try { bool Confirmation = RequestDirector.AddSale(saleNumber, sName, sSubTotal, sgst, sTotal, list); if (Confirmation) { MessageLabel.Text = "<i>Sale Created successfully</i>"; } else { MessageLabel.Text = "<i style='color: red;'>Sale was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Create Sale was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sStudentID = StudentIDTextBox.Text; try { bool Confirmation = RequestDirector.RemoveStudent(sStudentID); if (Confirmation) { MessageLabel.Text = "<i>Student Removed</i>"; } else { MessageLabel.Text = "<i>Student NOT Found</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Student NOT Found</i>"; Console.WriteLine(ex.Message); } }
protected void SubmitButton_Click(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sItemCode = ItemCodeList.SelectedValue; try { Item item = new Item(); item = RequestDirector.GetItemByCode(sItemCode); if (item.ItemCode != null) { ProgramCodeLabel.Visible = true; DescriptionLabel.Visible = true; UnitPriceLabel.Visible = true; ItemCodeLabel.Visible = true; ItemDescriptionLabel.Visible = true; UnitPriceTextBox.Visible = true; SubmitButtonUpdate.Visible = true; DescriptionRequiredFieldValidator.Visible = true; UnitPriceRequiredFieldValidator.Visible = true; UnitPriceTextBoxRangevalidator.Visible = true; ItemCodeLabel.Text = item.ItemCode; ItemDescriptionLabel.Text = item.Description; UnitPriceTextBox.Text = (item.UnitPrice).ToString(); } else { MessageLabel.Text = "<i>Program find was NOT successful</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Student Enrollment was NOT successful</i>"; Console.WriteLine(ex.Message); } }
protected void PopulateCartTable1() { Dictionary <string, string> cartDict = Session[CartKeyName] as Dictionary <string, string>; CartTable.Rows.Clear(); foreach (KeyValuePair <string, string> kvp in cartDict) { TableRow currentTableRow = new TableRow(); TableCell itemIdCell = new TableCell(); itemIdCell.Text = kvp.Key + ""; TableCell quantityCell = new TableCell(); quantityCell.Text = kvp.Value + ""; TableCell totalAmountCell = new TableCell(); BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); double item = RequestDirector.GetItemPrice(kvp.Key); double total = item * Convert.ToDouble(kvp.Value); totalAmountCell.Text = total.ToString(); currentTableRow.Cells.Add(itemIdCell); currentTableRow.Cells.Add(quantityCell); currentTableRow.Cells.Add(totalAmountCell); CartTable.Rows.Add(currentTableRow); } }
protected void SubmitButton_ClickDelete(object sender, EventArgs e) { BAIS3150CodeSampleHandler RequestDirector = new BAIS3150CodeSampleHandler(); string sCustomerID = custID.Text; try { bool Confirmation = RequestDirector.DeleteCustomer(sCustomerID); if (Confirmation) { MessageLabel.Text = "<i>Customer Deleted successfully</i>"; dropdownList(); } else { MessageLabel.Text = "<i>Customer NOT Deleted</i>"; } } catch (Exception ex) { MessageLabel.Text = "<i style='color: red;'>Delete Customer was NOT successful</i>"; Console.WriteLine(ex.Message); } }