protected void Page_Load(object sender, EventArgs e) { if (Session["userid"] == null) { Response.Redirect("../Login.aspx"); } HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate"); HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("Expires", "0"); if (!IsPostBack) { CompProfile.Text = ""; string CS = ConfigurationManager.ConnectionStrings["DB"].ConnectionString; SqlConnection con = new SqlConnection(CS); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from company_details"; cmd.Connection = con; con.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); CompanyNameList.DataTextField = ds.Tables[0].Columns["compname"].ToString(); CompanyNameList.DataValueField = ds.Tables[0].Columns["compid"].ToString(); CompanyNameList.DataSource = ds.Tables[0]; //assigning datasource to the dropdownlist CompanyNameList.DataBind(); } }
protected void Page_Load(object sender, EventArgs e) { string CS = ConfigurationManager.ConnectionStrings["DB"].ConnectionString; SqlConnection con = new SqlConnection(CS); if (!IsPostBack) { if (Session["userid"] == null) { Response.Redirect("../Login.aspx"); } //Assignining datasoursce to company name list SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from company_details"; cmd.Connection = con; con.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con.Close(); CompanyNameList.DataTextField = ds.Tables[0].Columns["compname"].ToString(); CompanyNameList.DataValueField = ds.Tables[0].Columns["compid"].ToString(); CompanyNameList.DataSource = ds.Tables[0]; CompanyNameList.DataBind(); } HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate"); HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("Expires", "0"); if (!IsPostBack) { BatchYearLabel.Visible = false; BatchYearListList.Visible = false; PlacementCompNameLabel.Visible = false; CompanyNameList.Visible = false; GenerateReportCommon.Visible = false; } //Select department of coordinator SqlCommand selectdeptcmd = new SqlCommand(); selectdeptcmd.CommandText = " select * from department_details where ( deptno = ( select deptno from coordinator where id = @coid ) )"; selectdeptcmd.Parameters.AddWithValue("@coid", Session["userid"].ToString()); selectdeptcmd.Connection = con; con.Open(); DataSet dsco = new DataSet(); SqlDataAdapter daco = new SqlDataAdapter(selectdeptcmd); daco.Fill(dsco); con.Close(); dept_na_co = dsco.Tables[0].Rows[0]["dname"].ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["userid"] == null) { Response.Redirect("../Login.aspx"); } //Assignining datasoursce to company name list string CS1 = ConfigurationManager.ConnectionStrings["DB"].ConnectionString; SqlConnection con1 = new SqlConnection(CS1); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Select * from company_details"; cmd.Connection = con1; con1.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); con1.Close(); CompanyNameList.DataTextField = ds.Tables[0].Columns["compname"].ToString(); CompanyNameList.DataValueField = ds.Tables[0].Columns["compid"].ToString(); CompanyNameList.DataSource = ds.Tables[0]; CompanyNameList.DataBind(); } HttpContext.Current.Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate"); HttpContext.Current.Response.AddHeader("Pragma", "no-cache"); HttpContext.Current.Response.AddHeader("Expires", "0"); string CS = ConfigurationManager.ConnectionStrings["DB"].ConnectionString; SqlConnection con = new SqlConnection(CS); //here we go for checking if form submitted SqlCommand checksubmitted = new SqlCommand(); checksubmitted.CommandText = "Select * from student_details where id = @uid"; checksubmitted.Parameters.AddWithValue("@uid", Session["userid"].ToString()); checksubmitted.Connection = con; con.Open(); DataSet cs = new DataSet(); SqlDataAdapter dcs = new SqlDataAdapter(checksubmitted); dcs.Fill(cs); con.Close(); if (cs.Tables[0].Rows.Count != 0) { Session["deptnumstud"] = cs.Tables[0].Rows[0]["deptno"].ToString(); } //here we go for checking if Already Placed SqlCommand placementstatus = new SqlCommand(); placementstatus.CommandText = "Select * from placements where id = @uid"; placementstatus.Parameters.AddWithValue("@uid", Session["userid"].ToString()); placementstatus.Connection = con; con.Open(); DataSet ps = new DataSet(); SqlDataAdapter dps = new SqlDataAdapter(placementstatus); dps.Fill(ps); con.Close(); //Checking Conditions if (!(cs.Tables[0].Rows.Count != 0 && cs.Tables[0].Rows[0][5].ToString().Equals("true"))) { PlacementStatusLabel.Text = "Submit the registration form access this feature "; PlacementCompNameLabel.Visible = false; CompanyNameList.Visible = false; OnOffCampusLabel.Visible = false; OnOffCampusList.Visible = false; PlacementPackageLabel.Visible = false; PlacementPackage.Visible = false; BatchYearLabel.Visible = false; BatchYearListList.Visible = false; UpdatePlacementSubmit.Visible = false; AddAnother.Visible = false; ErrorLabel.Text = "Form not submitted"; } else if (ps.Tables[0].Rows.Count != 0 && ps.Tables[0].Rows[0]["addmore"].Equals("false")) { PlacementStatusLabel.Text = "Well done! You have already been placed"; PlacementCompNameLabel.Visible = false; CompanyNameList.Visible = false; OnOffCampusLabel.Visible = false; OnOffCampusList.Visible = false; PlacementPackageLabel.Visible = false; PlacementPackage.Visible = false; BatchYearLabel.Visible = false; BatchYearListList.Visible = false; UpdatePlacementSubmit.Visible = false; AddAnother.Visible = true; SuccessLabel.Text = "You have been placed!! ;)"; } else { PlacementStatusLabel.Text = "Update your placement status here"; PlacementCompNameLabel.Visible = true; CompanyNameList.Visible = true; OnOffCampusLabel.Visible = true; OnOffCampusList.Visible = true; PlacementPackageLabel.Visible = true; PlacementPackage.Visible = true; BatchYearLabel.Visible = true; BatchYearListList.Visible = true; UpdatePlacementSubmit.Visible = true; AddAnother.Visible = false; SuccessLabel.Text = ""; ErrorLabel.Text = ""; } }