H{ouhbibib

This commit is contained in:
caschick221 2024-03-20 15:33:54 -04:00
parent 7ef9b9de87
commit fb27c94b95
5 changed files with 161 additions and 9 deletions

View File

@ -155,7 +155,7 @@
<virtualDirectoryDefaults allowSubDirConfig="true" /> <virtualDirectoryDefaults allowSubDirConfig="true" />
<site name="CNSA-216-Personal-v2" id="1"> <site name="CNSA-216-Personal-v2" id="1">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\CNSA-216-Personal-v2" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\CNSA-216-Personal-v2" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -163,7 +163,7 @@
</site> </site>
<site name="CH2" id="2"> <site name="CH2" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\CH2" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\CH2" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -171,7 +171,7 @@
</site> </site>
<site name="Scripting" id="3"> <site name="Scripting" id="3">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\Scripting" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\Scripting" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -179,7 +179,7 @@
</site> </site>
<site name="CH456" id="4"> <site name="CH456" id="4">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\CH456" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\CH456" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -187,7 +187,7 @@
</site> </site>
<site name="masterpage" id="5"> <site name="masterpage" id="5">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\masterpage" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\masterpage" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -195,7 +195,7 @@
</site> </site>
<site name="CH46" id="6"> <site name="CH46" id="6">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\CH46" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\CH46" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />
@ -203,7 +203,7 @@
</site> </site>
<site name="CH78" id="7"> <site name="CH78" id="7">
<application path="/" applicationPool="Clr4IntegratedAppPool"> <application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\eggman\Nextcloud2\TSCT\2nd Year\SEM 4\RiderProjects\CNSA-216-Personal-v2\CH78" /> <virtualDirectory path="/" physicalPath="C:\Users\caschick221\RiderProjects\CNSA-216-Personal-v2\CH78" />
</application> </application>
<bindings> <bindings>
<binding protocol="http" bindingInformation="*:5000:localhost" /> <binding protocol="http" bindingInformation="*:5000:localhost" />

View File

@ -1,5 +1,7 @@
using System; using System;
using System.Web.UI; using System.Web.UI;
using System.Data;
using System.Drawing;
namespace CH78 namespace CH78
{ {
@ -7,7 +9,95 @@ namespace CH78
{ {
protected void Page_Load(object sender, EventArgs e) protected void Page_Load(object sender, EventArgs e)
{ {
string studentID = "";
string gender;
if (!IsPostBack)
{
// retrieve the querystring
if (String.IsNullOrEmpty(Request.QueryString["ID"]))
{
// not the right entry point
Response.Redirect("Home.aspx");
}
else if (Request.QueryString["ID"].Trim().ToUpper() == "NEW")
{
// do nothing
}
else if (Request.QueryString["type"].Trim().ToUpper() == "VIEW") // display
{
GetStudent(Request.QueryString["ID"].Trim(), Request.QueryString["type"].Trim().ToUpper());
}
else if (Request.QueryString["type"].Trim().ToUpper() == "EDIT") // edit
{
GetStudent(Request.QueryString["ID"].Trim(), Request.QueryString["type"].Trim().ToUpper());
}
else // anything else
{
Response.Redirect("Home.aspx");
}
}
}
public void GetStudent(string studentid, string type)
{
// the right record
StudentDataTier stuDT = new StudentDataTier();
DataSet ds = new DataSet();
string gender;
ds = StudentDataTier.SearchStudents("","",studentid);
if (ds.Tables[0].Rows.Count > 0)
{
txtStuID.Text = ds.Tables[0].Rows[0]["student_id"].ToString();
txtFNAME.Text = ds.Tables[0].Rows[0]["fname"].ToString();
txtLNAME.Text = ds.Tables[0].Rows[0]["lname"].ToString();
// TODO complete other fields
gender = ds.Tables[0].Rows[0]["gender_desc"].ToString().Trim();
if (gender.ToUpper() == "F")
{
txtGender.SelectedItem.Text = "FEMALE";
}
else
{
txtGender.SelectedItem.Text = "MALE";
}
txtGender.Enabled = false;
//mysalary = Decimal.Parse(ds.Tables[0].Rows[0]["salary"])
//txtSalary.Text = mysalary.ToString("C")
//txtSalary.Enabled = False
txtState.DataSource = StudentDataTier.GetStates();
txtState.DataTextField = "FullAndAbbrev";
txtState.DataValueField = "abbreviation";
txtState.SelectedValue = "PA";
txtState.DataBind();
txtState.SelectedValue = ds.Tables[0].Rows[0]["state"].ToString();
if (type.ToUpper() == "VIEW")
{
txtStuID.Enabled = false;
txtFNAME.Enabled = false;
txtLNAME.Enabled = false;
btnGoStu.Visible = false;
btnCancelStu.Visible = false;
}
else if (type.ToUpper() == "EDIT")
{
txtStuID.Enabled = false;
btnGoStu.Visible = true;
btnCancelStu.Visible = true;
btnGoStu.Text = "UPDATE";
btnCancelStu.Text = "REFRESH";
btnGoStu.ForeColor = Color.Red;
btnCancelStu.ForeColor = Color.Blue;
}
}
} }
protected void btnCancelStu_OnClick(object sender, EventArgs e) protected void btnCancelStu_OnClick(object sender, EventArgs e)

View File

@ -195,7 +195,32 @@ namespace CH78
protected void lbtnEdit_Click(object sender, CommandEventArgs e) protected void lbtnEdit_Click(object sender, CommandEventArgs e)
{ {
string recordToBeEdited;
Int64 mEditedRecord = 0;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
try
{
Session["vStudentID"] = txtStudentID.Text.Trim();
Session["vFName"] = txtFName.Text.Trim();
Session["vLName"] = txtLName.Text.Trim();
// Get the record
recordToBeEdited = (e.CommandArgument.ToString().Trim());
// this script will open a popup
sb.Append("<script language='javascript'>");
sb.Append("window.open('Display.aspx?ID=" + recordToBeEdited.ToString() + "&typeEdit=" + "'DisplayEdit';");
sb.Append(", 'width=525, height=525, menubar=no, resizable=yes, left=50, top=50, scrollbars=yes');");
sb.Append("</script>");
// register with ClientScript
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "PopupScript", sb.ToString());
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex.InnerException);
}
} }
} }
} }

View File

@ -67,6 +67,43 @@ namespace CH78
} }
} }
public static DataSet GetStates()
{
try
{
// open connection
myConn.Open();
//clear any parameters
cmdString.Parameters.Clear();
// command
cmdString.Connection = myConn;
cmdString.CommandType = CommandType.StoredProcedure;
cmdString.CommandTimeout = 1500;
cmdString.CommandText = "GetAllStates";
// adapter and dataset
SqlDataAdapter aAdapter = new SqlDataAdapter();
aAdapter.SelectCommand = cmdString;
DataSet aDataSet = new DataSet();
// fill adapter
aAdapter.Fill(aDataSet);
// return dataSet
return aDataSet;
}
catch (Exception ex)
{
throw new ArgumentException(ex.Message);
}
finally
{
myConn.Close();
}
}
public static DataSet SearchStudents(string fname, string lname, string stuID) public static DataSet SearchStudents(string fname, string lname, string stuID)
{ {

View File

@ -15,7 +15,7 @@
<defaultDocument> <defaultDocument>
<files> <files>
<clear /> <clear />
<add value="Display.aspx" /> <add value="Home.aspx" />
</files> </files>
</defaultDocument> </defaultDocument>
</system.webServer> </system.webServer>