protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                std = (students)Session["std"];
                Session["studentids"] = std.ids;
                Image1.ImageUrl       = "Handler3.ashx?id=" + int.Parse(Session["studentids"].ToString());

                // ids = int.Parse(Request.QueryString["sid"].ToString());
                //   Session["tempis"] = ids;

                //  classes.Text = Request.QueryString["sclass"];
                fname.Text        = std.fname;
                lname.Text        = std.lname;
                gender.Text       = std.gender;
                phoneB.Text       = std.phone;
                emailaddress.Text = std.email;
                dob.Text          = std.dateofbirth;
                address.Text      = std.address;
                username.Text     = std.username;
                password.Text     = std.password;
                // classes.Text = Request.QueryString["sclass"];
                Session["studentids"] = std.ids;
                doa.Text = std.dateofAdmission;
            }
        }
Exemple #2
0
 private static void Main(string[] args)
 {
     Console.WriteLine("請輸入國文成績:");
     String A = Console.ReadLine();
     int ANumber = int.Parse(A);
     Console.WriteLine("請輸入英文成績:");
     String B = Console.ReadLine();
     int BNumber = int.Parse(B);
     Console.WriteLine("請輸入數學成績:");
     String C = Console.ReadLine();
     int CNumber = int.Parse(C);
     Console.WriteLine("請輸入社會成績:");
     String D = Console.ReadLine();
     int DNumber = int.Parse(D);
     Console.WriteLine("請輸入自然成績:");
     String E = Console.ReadLine();
     int ENumber = int.Parse(E);
     students[] Students = new students[]
         {
             new Students {ANumber},
         };
     Array.Sort(Students);
     for (int index = 0; index < Students.Length; ++index)
     {
         Console.WriteLine(Students[index]);
     }
 }
        public HttpResponseMessage studentLogin([FromBody] dynamic std)
        {
            string query = $"SELECT * FROM Student where Email='{std.Email}' and SPassword='******'";

            using (SqlConnection sqlConnection = new SqlConnection(CONNSTRING))
            {
                SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
                try
                {
                    String email    = std.Email;
                    String password = std.SPassword;
                    sqlConnection.Open();
                    SqlDataReader studentReader = sqlCommand.ExecuteReader();
                    students      stdnt         = null;
                    while (studentReader.Read())
                    {
                        stdnt = new students(
                            studentReader.GetString(studentReader.GetOrdinal("EmpName")),
                            studentReader.GetString(studentReader.GetOrdinal("Email")),
                            studentReader.GetString(studentReader.GetOrdinal("MobileNumber")),
                            studentReader.GetString(studentReader.GetOrdinal("RollNumber")),
                            studentReader.GetString(studentReader.GetOrdinal("EPassword"))
                            );
                    }
                    return(Request.CreateResponse(HttpStatusCode.OK, stdnt));
                }
                catch (Exception e)
                {
                    return(Request.CreateResponse(HttpStatusCode.InternalServerError, e));
                }
            }
        }
Exemple #4
0
 public MainWindow()
 {
     InitializeComponent();
     // set the DataContext to the code in this window
     this.DataContext = this;
     // create youe Student model
     StudentModel = new students();
 }
        public ActionResult DeleteConfirmed(int id)
        {
            students students = db.students.Find(id);

            db.students.Remove(students);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public IHttpActionResult eidtor(students stu)
 {
     try
     {
         string sid = HttpContext.Current.Session["sid"].ToString();
         if (sid == stu.id)
         {
             using (var db = new oucfreetalkEntities())
             {
                 var s = db.students.FirstOrDefault(a => a.id == stu.id);
                 if (s == null)
                 {
                     results res = new results();
                     res.result = 3;//没有此用户
                     return(Ok(res));
                 }
                 else
                 {
                     s.nikename = stu.nikename;
                     s.sex      = stu.sex;
                     s.birth    = stu.birth;
                     s.year     = stu.year;
                     s.family   = stu.family;
                     s.pic      = stu.pic;
                     s.ifname   = stu.ifname;
                     s.ifsex    = stu.ifsex;
                     s.ifbirth  = stu.ifbirth;
                     s.ifmobile = stu.ifmobile;
                     s.ifemail  = stu.ifemail;
                     if (db.SaveChanges() != 0)
                     {
                         results res = new results();
                         res.result = 1;//成功
                         return(Ok(res));
                     }
                     else
                     {
                         results res = new results();
                         res.result = 4;//保存失败
                         return(Ok(res));
                     }
                 }
             }
         }
         else
         {
             results res = new results();
             res.result = 2; //id不合法
             return(Ok(res));
         }
     }
     catch
     {
         results res = new results();
         res.result = 0; //还未登录
         return(Ok(res));
     }
 }
    public static students Select_Record(students clsstudentsPara)
    {
        students      clsstudents = new students();
        SqlConnection connection  = SchoolData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [StudentId] "
              + "    ,[ClassId] "
              + "    ,[FullName] "
              + "    ,[DateOfBirth] "
              + "    ,[HomeAddress] "
              + "    ,[Gender] "
              + "    ,[Father] "
              + "    ,[Mother] "
              + "    ,[ParentContact] "
              + "FROM "
              + "     [students] "
              + "WHERE "
              + "     [StudentId] = @StudentId "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@StudentId", clsstudentsPara.StudentId);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsstudents.StudentId     = System.Convert.ToInt32(reader["StudentId"]);
                clsstudents.ClassId       = reader["ClassId"] is DBNull ? null : (Int32?)reader["ClassId"];
                clsstudents.FullName      = reader["FullName"] is DBNull ? null : reader["FullName"].ToString();
                clsstudents.DateOfBirth   = reader["DateOfBirth"] is DBNull ? null : (DateTime?)reader["DateOfBirth"];
                clsstudents.HomeAddress   = reader["HomeAddress"] is DBNull ? null : reader["HomeAddress"].ToString();
                clsstudents.Gender        = System.Convert.ToString(reader["Gender"]);
                clsstudents.Father        = reader["Father"] is DBNull ? null : reader["Father"].ToString();
                clsstudents.Mother        = reader["Mother"] is DBNull ? null : reader["Mother"].ToString();
                clsstudents.ParentContact = reader["ParentContact"] is DBNull ? null : reader["ParentContact"].ToString();
            }
            else
            {
                clsstudents = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsstudents);
    }
        void IStudentsRepo.addStudent(students model)
        {
            using (var ctx = new katselaborEntities())
            {
                ctx.students.Add(model);
                ctx.SaveChanges();

                logger.Info("Saving to db something");
            }
        }
 public ActionResult Edit(students students)
 {
     if (ModelState.IsValid)
     {
         db.Entry(students).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(students));
 }
 public ActionResult Edit([Bind(Include = "no,name,surname,gano")] students students)
 {
     if (ModelState.IsValid)
     {
         db.Entry(students).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(students));
 }
Exemple #11
0
 /// <summary>
 /// 更改学生登录密码
 /// </summary>
 /// <param name="n">学生信息实体类</param>
 public void UpdatePwd(students n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@pwd", n.Pwd),
         new SqlParameter("@modifier", n.Modifier),
         new SqlParameter("@studentId", n.StudentId),
     };
     sqlhelper.ExecuteQuery("UPDATE students SET pwd = @pwd,modifier = @modifier,lastmodify = getdate() where studentId=@studentId", paras, CommandType.Text);
 }
Exemple #12
0
 public ActionResult Edit([Bind(Include = "Xueshengxuehao,Xueshengxingming,Xueshengxingbie")] students students)
 {
     if (ModelState.IsValid)
     {
         db.Entry(students).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(students));
 }
        public ActionResult Create(students students)
        {
            if (ModelState.IsValid)
            {
                db.students.Add(students);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(students));
        }
Exemple #14
0
        public ActionResult Create([Bind(Include = "Xueshengxuehao,Xueshengxingming,Xueshengxingbie")] students students)
        {
            if (ModelState.IsValid)
            {
                db.Students.Add(students);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(students));
        }
 public ActionResult Edit([Bind(Include = "ids,sname,courseid")] students students)
 {
     if (ModelState.IsValid)
     {
         db.Entry(students).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.courseid = new SelectList(db.courses1, "id", "coursename", students.courseid);
     return(View(students));
 }
        public ActionResult Create([Bind(Include = "ids,sname,courseid")] students students)
        {
            if (ModelState.IsValid)
            {
                db.students1.Add(students);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.courseid = new SelectList(db.courses1, "id", "coursename", students.courseid);
            return(View(students));
        }
Exemple #17
0
    public int getAbsentCount(string username)
    {
        //get the student specified by username
        students currStudent = getCurrentStudent(username);

        //if no student return null
        if (currStudent == null)
        {
            return(-1);
        }
        //mark student as tardy
        return(currStudent.getAbsentCount());
    }
Exemple #18
0
    private void GetPlantsPerRowByStudent(string rowOfPlantCups)
    {
        var studentEnumList     = Enum.GetValues(typeof(students));
        int currentStudentIndex = 0;

        for (int i = 0; i < rowOfPlantCups.Length; i += StudentsCupsPerRow)
        {
            var      student        = GetOwnerOfNextTwoPlants(i);
            bool     outOfBounds    = i + StudentsCupsPerRow > rowOfPlantCups.Length - 1;
            students currentStudent = (students)studentEnumList.GetValue(currentStudentIndex++);
            GetStudentPlantsInRow(rowOfPlantCups, i, currentStudent);
        }
    }
Exemple #19
0
        // GET: students/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            students students = db.Students.Find(id);

            if (students == null)
            {
                return(HttpNotFound());
            }
            return(View(students));
        }
Exemple #20
0
    //mark the student specified by username absent (increase absent count)
    //if student is not foung return false otherwise true
    public bool markAbsent(string username)
    {
        //get the student specified by username
        students currStudent = getCurrentStudent(username);

        //if no student return null
        if (currStudent == null)
        {
            return(false);
        }
        //mark student as tardy
        currStudent.markAbsent();
        return(true);
    }
        // GET: students/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            students students = db.students.Find(id);

            if (students == null)
            {
                return(HttpNotFound());
            }
            return(View(students));
        }
Exemple #22
0
 public IHttpActionResult Post([FromBody] StudentModel studentModel)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     else
     {
         students student = Mapper.Map <StudentModel, students>(studentModel);
         _unitOfWork.studentRepository.Create(student);
         _unitOfWork.SaveChanges();
         return(Ok());
     }
 }
Exemple #23
0
        public IHttpActionResult Get([FromUri] int id)
        {
            students studentInDB = _unitOfWork.studentRepository.FindSingleBy(s => s.id == id);

            if (studentInDB == null)
            {
                return(NotFound());
            }
            else
            {
                StudentModel studentDTO = Mapper.Map <students, StudentModel>(studentInDB);
                return(Ok(studentDTO));
            }
        }
        public IHttpActionResult register(registerdata rgd)
        {
            results res = new results();

            if (IfExist(rgd.id))
            {
                res.result = 2;
                return(Ok(res));
            }

            try
            {
                using (var db = new oucfreetalkEntities())
                {
                    students std = new students();
                    std.id           = rgd.id;
                    std.nikename     = rgd.nikename;
                    std.sex          = rgd.sex;
                    std.introduction = rgd.introduce;
                    std.name         = " ";
                    std.birth        = DateTime.Today;
                    std.year         = DateTime.Today.Year.ToString();
                    std.ifsex        = false;
                    std.exp          = 0;
                    std.ifemail      = false;
                    std.ifmobile     = false;
                    std.ifname       = false;
                    std.ifbirth      = false;
                    std.password     = PasswordHash.PasswordHash.CreateHash(rgd.password);
                    db.students.Add(std);
                    if (db.SaveChanges() == 0)
                    {
                        res.result = 0;
                        return(Ok(res));
                    }
                    else
                    {
                        res.result = 1;
                        return(Ok(res));
                    }
                }
            }
            catch
            {
                //return NotFound();\
                res.result = 0;
                return(Ok(res));
            }
        }
Exemple #25
0
 /// <summary>
 /// 更新学生信息
 /// </summary>
 /// <param name="n">学生信息实体类</param>
 public void Update(students n)
 {
     SqlParameter[] paras = new SqlParameter[]
     {
         new SqlParameter("@name", n.Name),
         new SqlParameter("@sex", n.Sex),
         new SqlParameter("@subject", n.Subject),
         new SqlParameter("@college", n.College),
         new SqlParameter("@cellphone", n.Cellphone),
         new SqlParameter("@email", n.Email),
         new SqlParameter("@modifier", n.Modifier),
         new SqlParameter("@studentId", n.StudentId),
     };
     sqlhelper.ExecuteQuery("UPDATE students SET name = @name,sex = @sex,subject=@subject,college=@college,cellphone = @cellphone,email = @email,modifier = @modifier,lastmodify = getdate() where studentId=@studentId", paras, CommandType.Text);
 }
Exemple #26
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            students = await _context.students.FirstOrDefaultAsync(m => m.ID == id);

            if (students == null)
            {
                return(NotFound());
            }
            return(Page());
        }
        // GET: students1/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            students students = db.students1.Find(id);

            if (students == null)
            {
                return(HttpNotFound());
            }
            ViewBag.courseid = new SelectList(db.courses1, "id", "coursename", students.courseid);
            return(View(students));
        }
    protected void btn3_Click(object sender, EventArgs e)
    {
        students n = new students();

        n.Name      = lbl2.Text;
        n.Subject   = Label2.Text;
        n.College   = Label1.Text;
        n.Cellphone = txt2.Text;
        n.Email     = txt3.Text;
        n.Modifier  = Session["studentId"].ToString();
        n.StudentId = Session["studentId"].ToString();
        n.Sex       = tm.SelectByValue(Session["studentId"].ToString()).Rows[0]["sex"].ToString();
        tm.Update(n);
        studentbind();
    }
        public ActionResult Create([Bind(Include = "no,name,surname")] students students)
        {
            if (ModelState.IsValid)
            {
                var student = new students();
                student.no      = students.no;
                student.name    = students.name;
                student.surname = students.surname;
                student.gano    = 2.00;
                db.students.Add(student);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(students));
        }
    protected void btn5_Click(object sender, EventArgs e)
    {
        DataTable dt     = tm.SelectByValue(Session["studentId"].ToString());
        string    oldPwd = dt.Rows[0]["pwd"].ToString();
        int       tmp    = PwdLevel(txt5.Text);

        if (txt4.Text == oldPwd && tmp >= 2)
        {
            students n = new  students();
            n.StudentId = Session["studentId"].ToString();
            n.Modifier  = Session["studentId"].ToString();
            n.Pwd       = txt6.Text.Trim();
            tm.UpdatePwd(n);
            ScriptManager.RegisterStartupScript(this, this.GetType(), "updateScript", "alert(\"修改成功\");", true);
        }
    }
    public int CompareTo(object other)
    {
        students obj = (students)other;

        if (this.id > obj.id)
        {
            return(1);
        }
        else if (this.id < obj.id)
        {
            return(-1);
        }
        else
        {
            return(0);
        }
    }