Exemplo n.º 1
0
        public List <StudentInfoObj> GetAllStudentInfo()
        {
            List <StudentInfoObj> studentinfolist = null;


            //Lets get the list of all employees in a datataable
            using (DataTable table = SqlDBHelper.ExecuteSelectCommand("GetStudentAll", CommandType.StoredProcedure))
            {
                //check if any record exist or not
                if (table.Rows.Count > 0)
                {
                    //Lets go ahead and create the list of employees
                    studentinfolist = new List <StudentInfoObj>();

                    //Now lets populate the employee details into the list of employees
                    foreach (DataRow row in table.Rows)
                    {
                        StudentInfoObj stuinfo = new StudentInfoObj();

                        stuinfo.Name            = row["Name"].ToString();
                        stuinfo.ID              = (row["ID"]).ToString();
                        stuinfo.Dept            = row["Dept"].ToString();
                        stuinfo.Gender          = Convert.ToChar(row["Gender"]);
                        stuinfo.Completedcredit = Convert.ToInt32(row["CompletedCredit"]);
                        stuinfo.Semester        = Convert.ToInt32(row["Semester"]);
                        stuinfo.Cgpa            = float.Parse(row["Cgpa"].ToString());
                        stuinfo.Password        = Convert.ToString(row["Password"]);

                        studentinfolist.Add(stuinfo);
                    }
                }
            }

            return(studentinfolist);
        }
Exemplo n.º 2
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            StudentInfoObj stuinfo = new StudentInfoObj();

            stuinfo.Name            = txtname.Text;
            stuinfo.ID              = txtid.Text;
            stuinfo.Dept            = Convert.ToString(DropDownList1.SelectedValue);
            stuinfo.Gender          = Convert.ToChar(DropDownList2.SelectedValue);
            stuinfo.Completedcredit = Convert.ToInt32(txtcredit.Text);
            stuinfo.Semester        = Convert.ToInt32(DropDownList3.SelectedValue);
            stuinfo.Cgpa            = float.Parse(txtcgpa.Text);


            stuinfo.Password = txtpassword.Text;

            DataHandler stuhandler = new DataHandler();

            stuhandler.Insert(stuinfo);

            txtname.Text = null;
            txtid.Text   = null;
            DropDownList1.SelectedValue = null;
            DropDownList2.SelectedValue = null;
            DropDownList3.SelectedValue = null;
            txtcredit.Text   = null;
            txtcgpa.Text     = null;
            txtpassword.Text = null;
            string val = "Account Created Successfully...";

            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + val + "');", true);
            Response.Redirect("StudentLogin.aspx");
        }
Exemplo n.º 3
0
        public bool StudentInfoInsert(StudentInfoObj StudentInformation)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@Name", StudentInformation.Name),
                new SqlParameter("@ID", StudentInformation.ID),
                new SqlParameter("@Dept", StudentInformation.Dept),
                new SqlParameter("@Gender", StudentInformation.Gender),
                new SqlParameter("@CompletedCredit", StudentInformation.Completedcredit),
                new SqlParameter("@Semester", StudentInformation.Semester),
                new SqlParameter("@Cgpa", StudentInformation.Cgpa),
                new SqlParameter("@Password", StudentInformation.Password),
            };

            return(SqlDBHelper.ExecuteNonQuery("StudentInfoInsert", CommandType.StoredProcedure, parameters));
        }