public void Update_PunchStation(Punch_Station_Info info) { con.Open(); SqlCommand cmd = new SqlCommand("Update_PunchStation", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p = new SqlParameter(); p = cmd.Parameters.Add("@punch_id", SqlDbType.Int); p.Value = info.Punch_Id; p = cmd.Parameters.Add("@punch_name", SqlDbType.VarChar, 50); p.Value = info.Punch_Name; p = cmd.Parameters.Add("@towards", SqlDbType.VarChar, 50); p.Value = info.Towards; p = cmd.Parameters.Add("@stage", SqlDbType.Int); p.Value = info.Stage; p = cmd.Parameters.Add("@punch_category", SqlDbType.VarChar, 50); p.Value = info.Punch_Category; p = cmd.Parameters.Add("@distance", SqlDbType.Float); p.Value = info.Distance; cmd.ExecuteNonQuery(); con.Close(); }
public Punch_Station_Info View_PunchStation(string punch_name) { con.Open(); SqlCommand cmd = new SqlCommand("ViewPunchStation", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p = new SqlParameter(); p = cmd.Parameters.Add("@punch_name", SqlDbType.VarChar); p.Value = punch_name; SqlDataReader read = cmd.ExecuteReader(); Punch_Station_Info p_info = new Punch_Station_Info(); read.Read(); if (read.HasRows) { p_info.Punch_Name = read["punch_name"].ToString(); p_info.Towards = read["towards"].ToString(); p_info.Stage = int.Parse(read["stage"].ToString()); p_info.Punch_Category = read["punch_category"].ToString(); p_info.Distance = float.Parse(read["distence"].ToString()); } read.Close(); con.Close(); return(p_info); }
public string ReturnTowrds(string pnchname) { con.Open(); string towards = ""; SqlCommand cmd = new SqlCommand("ReturnTowrds", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter p = new SqlParameter(); p = cmd.Parameters.Add("@punch_name", SqlDbType.Int); p.Value = pnchname; SqlDataReader read = cmd.ExecuteReader(); Punch_Station_Info p_info = new Punch_Station_Info(); read.Read(); if (read.HasRows) { // p_info.Punch_Name = read["punch_name"].ToString(); towards = read["towards"].ToString(); // p_info.Stage = int.Parse(read["stage"].ToString()); //p_info.Punch_Category = read["punch_category"].ToString(); } read.Close(); con.Close(); return(towards); }
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { Memb_Info info = new Memb_Info(); Memb_Sp sp = new Memb_Sp(); info.Usrname = Login1.UserName; info.Password = Login1.Password; Memb_Info inf_return = new Memb_Info(); inf_return = sp.logcheck_1(info.Usrname); //checks,is there any user as per given datas if (inf_return.Authorised == 1000) //if so retuns his authorisation status. { lbunexpcted.Text = "ACCESS DENIED"; lbunexpcted.Visible = true; } else { if (inf_return.Password == info.Password) { if (inf_return.Authorised == 2) { Session["username"] = Login1.UserName; bool flag = true; string type_of_user = ""; switch (inf_return.Type) { case 0: { Response.Redirect("owners_home.aspx"); //string UserName = (string)(Session["usrname"]); //string Password = (string)(Session["First"]); break; } case 1: { //type_of_user = "******";//redirect Response.Redirect("admin_home.aspx"); break; } case 2: { //type_of_user = "******"; Session["username"] = Login1.UserName; //Punch_Station_Sp psp = new Punch_Station_Sp(); //Punch_Station_Info pinfo= psp.View_PunchStation(Login1.UserName); //Session["towards"] = pinfo.Towards; //Punch_Distance_Sp pdp = new Punch_Distance_Sp(); //Punch_Distence_Info pdinfo = pdp.View_PunchDistance(pinfo.Punch_Id); //Session["distance"] = pdinfo.Distance; Response.Redirect("punch_bus_station.aspx"); //redirect break; } case 3: { Session["username"] = Login1.UserName; Punch_Station_Sp psp = new Punch_Station_Sp(); Punch_Station_Info pinfo = psp.View_PunchStation(Login1.UserName); Session["towards"] = pinfo.Towards; //Punch_Distance_Sp pdp = new Punch_Distance_Sp(); //Punch_Distence_Info pdinfo = pdp.View_PunchDistance(pinfo.Punch_Id); Session["distance"] = pinfo.Distance; Response.Redirect("Punching.aspx"); //redirect break; } case 4: { //type_of_user = "******"; Response.Redirect("rto_home.aspx"); //redirect break; } default: { lbunexpcted.Text = "ACCESS DENIED"; lbunexpcted.Visible = true; flag = false; break; } } } else { lbunexpcted.Text = "Hi " + inf_return.MemberName + ",u r still unauthorised ,waite untill we conform ur membership. "; lbunexpcted.Visible = true; } } else { lbunexpcted.Text = "ACCESS DENIED"; lbunexpcted.Visible = true; } } }