write your best answer on the providedpever veurbest vi When creating a procedur
ID: 3802114 • Letter: W
Question
write your best answer on the providedpever veurbest vi When creating a procedure just write something 1. Imagine you are a manager of three consultants and vouwant to keep arunning total of their value to You need a form where you can add brownie points to their running total when they have done somethin points from the n they error that has dropdown ispre loa write a web form company's three employee's names (text field) and value field. a textbox wherein you can type in a textbox for output create one variable for each employee. write the that can take the employee chosen in the dropdownlist, and give them more brow points based on the number typed to textbox 5the employee loses 5 points if you ty employee gains 5 points. you type-5 of each employee's value on separate After each transaction write the status Write the procedure that can clear the form for the next data entry. Be careful not to cear the runn hree employees (5 points). A hotel's website has two calendar controls on a form (or two textbox controls that show calendars ate and one for checkout date, a button and an output textbox. The hotel charges $35 per day. writ e textbox that reflects the cost of the hotel stay depending on how many days were selected in the ints). write any quick Select Case coding example (no error checking needed) that shows your mastery nts). Not a full procedure, rather a code segment that makes sense. Save time for the last proble magine you are using an ASP.NET webform to book optional tours at a resort in Thailand. Imagin kboxlist of optional tours and their prices. You received a request from a high-roller customer s of all the optional tours. Don't worry about the specific names and prices, the list is pre-load the procedure that can loop the items collection of the checkboxlist, and build a string varia rices of the optional tours. output this string variable to a textbox. (30 points).Explanation / Answer
As requested here is the code for question 1 written in c#. Please feel free to ask any questions.
Employee.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Employee.aspx.cs" Inherits="Employee" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 275px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table border="1">
<tr>
<td class="auto-style1">Employee Name</td>
<td>
<asp:DropDownList ID="ddlEmployees" runat="server"></asp:DropDownList></td>
</tr>
<tr>
<td class="auto-style1">Add Brownee Points</td>
<td>
<asp:TextBox ID="txtBrowneePoints" runat="server"></asp:TextBox>
<%--<asp:RegularExpressionValidator SetFocusOnError="true" ForeColor="Red" ID="RegularExpressionValidator1" ControlToValidate="txtBrowneePoints" runat="server" ErrorMessage="Only Numbers allowed" ValidationExpression="d+"></asp:RegularExpressionValidator>--%>
</td>
</tr>
<tr>
<td class="auto-style1">Total Score</td>
<td>
<asp:TextBox ID="txtTotalScore" runat="server" Enabled="false"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" class="auto-style1">
<asp:Button ID="btnSubmit" runat="server" Text="Submit Score" /></td>
</tr>
</table>
</div>
</form>
</body>
</html>
Employee.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Employee : System.Web.UI.Page
{
public class EmployeeDetails
{
public int Id
{
get;
set;
}
public int Points
{
get;
set;
}
public string Name
{
get;
set;
}
}
static List<EmployeeDetails> lstEmployeeDetails = new List<EmployeeDetails>();
EmployeeDetails employeeDetails = new EmployeeDetails();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//Variable for Employee 1
employeeDetails.Id = 1;
employeeDetails.Name = "Employee 1";
employeeDetails.Points = 0;
lstEmployeeDetails.Add(employeeDetails);
//Variable for Employee 2
employeeDetails = new EmployeeDetails();
employeeDetails.Id = 2;
employeeDetails.Name = "Employee 2";
employeeDetails.Points = 0;
lstEmployeeDetails.Add(employeeDetails);
//Variable for Employee 3
employeeDetails = new EmployeeDetails();
employeeDetails.Id = 3;
employeeDetails.Name = "Employee 3";
employeeDetails.Points = 0;
lstEmployeeDetails.Add(employeeDetails);
ddlEmployees.DataSource = lstEmployeeDetails;
ddlEmployees.DataValueField = "id";
ddlEmployees.DataTextField = "Name";
ddlEmployees.DataBind();
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
int selectedEmployee = Convert.ToInt16(ddlEmployees.SelectedValue);
for(int i=0;i<= lstEmployeeDetails.Count-1;i++)
{
if (lstEmployeeDetails[i].Id == selectedEmployee)
{
lstEmployeeDetails[i].Points = lstEmployeeDetails[i].Points + Convert.ToInt16(txtBrowneePoints.Text);
txtTotalScore.Text = Convert.ToString(lstEmployeeDetails[i].Points);
break;
}
}
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.