예제 #1
2
        protected void Page_Load(object sender, EventArgs e)
        {
            PerformanceTest pt = new PerformanceTest();
            pt.SetCount(10000);//设置循环次数
            Models.Student ss = new Models.Student() { id=1 };
            pt.Execute(i =>
            {
                ResolveExpress r = new ResolveExpress();
                Expression<Func<Models.InsertTest, bool>> func = x => x.id>ss.id;
                r.ResolveExpression(r,func);

            }, m => { }, "lambda");

         
            //输出测试页面
            GridView gv = new GridView();
            gv.DataSource = pt.GetChartSource();
            gv.DataBind();
            Form.Controls.Add(gv);
        }
예제 #2
2
        private void AddData(HttpContext context)
        {
            var stuModel = new Models.Student();
            stuModel.StudentId = Guid.NewGuid();
            SetModelValue(stuModel, context);
            stuModel.CreateTime = DateTime.Now;
            stuModel.LastModifyTime = DateTime.Now;
            var stuBll = new BLL.Student();
            var result = false;
            var msg = "";
            try
            {
                var sysUserMo = new Models.SysUser();
                var sysuserbll = new BLL.SysUser();
                sysUserMo.UserRole = (int) EnumUserRole.Student;
                sysUserMo.UserName = stuModel.StuName;
                sysUserMo.UserId = stuModel.StudentId;
                sysUserMo.UserPassWord = stuBll.GetPwd();
                sysUserMo.UserAccount = stuBll.GetStuAccount();

                sysuserbll.Add(sysUserMo);
                result = stuBll.Add(stuModel);

                if (!result)
                {
                    msg = "保存失败!";
                }
            }
            catch (Exception ex)
            {
                LogHelper.WriteLogofExceptioin(ex);
                result = false;
                msg = ex.Message;

            }

            //  var str = JsonConvert.SerializeObject(new { success = result, errorMsg = msg});
            context.Response.Write(msg);
        }
        //Here action name is 'Show2' and by default HTTP verb is 'GET'
        //To calls this method user will type /Student/Show2 in URL
        public ActionResult Show2()
        {
            //Create an anonymous object to pass to 'View'
            //In normal cases, this will come from 'Model'
            BasicMVCApp.Models.Student std = new Models.Student();
            std.StudentID = 1;
            std.Name = "Bilal";
            std.Address = "Lahore";
            std.Age = 200;

            /*
             * We can pass a single object to View which is called a 'Model' or 'ViewModel'
             * This object can be a single object, a complex, a List of Objects etc.
             * We'll have to set 'model' property with the 'Type' of this Object in view file at start
             */
            return View(std);
        }
예제 #4
0
        IEnumerable <Models.Student> IDbService.GetStudents()
        {
            var Db         = new s19110Context();
            var dbStudents = Db.Student.Include(st => st.IdEnrollmentNavigation).Include(st => st.IdEnrollmentNavigation.IdStudyNavigation).ToList();

            var modelStudents = new List <Models.Student>();

            foreach (var student in dbStudents)
            {
                var toAdd = new Models.Student()
                {
                    FirstName   = student.FirstName,
                    LastName    = student.LastName,
                    IndexNumber = student.IndexNumber,
                    BirthDate   = student.BirthDate
                };

                if (student.IdEnrollmentNavigation != null)
                {
                    toAdd.Studies  = student.IdEnrollmentNavigation.IdStudyNavigation.Name;
                    toAdd.Semester = student.IdEnrollmentNavigation.Semester;
                }
                modelStudents.Add(toAdd);
            }

            return(modelStudents);
        }
예제 #5
0
        public IActionResult GetStudents([FromServices] IDbService dbService)
        {
            var listOfStudents = new List <Models.Student>();

            using (SqlConnection client = new SqlConnection("Data Source=db-mssql16.pjwstk.edu.pl; Initial Catalog=s19048; User ID=apbds19048; Password=admin"))
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = client;
                    command.CommandText = "select IndexNumber, FirstName, LastName, BirthDate, Name, Semester, Student.Idenrollment, Studies.name " +
                                          "from Student inner join Enrollment on Enrollment.IdEnrollment = Student.IdEnrollment " +
                                          "inner join Studies on Enrollment.IdStudy = Studies.IdStudy";
                    client.Open();
                    SqlDataReader SqlDataReader = command.ExecuteReader();
                    while (SqlDataReader.Read())
                    {
                        var student = new Models.Student();
                        student.IndexNumber  = SqlDataReader["IndexNumber"].ToString();
                        student.FirstName    = SqlDataReader["FirstName"].ToString();
                        student.LastName     = SqlDataReader["LastName"].ToString();
                        student.BirthDate    = DateTime.Parse(SqlDataReader["BirthDate"].ToString());
                        student.Semester     = int.Parse(SqlDataReader["Semester"].ToString());
                        student.IdEnrollment = int.Parse(SqlDataReader["Idenrollment"].ToString());
                        student.Studies      = SqlDataReader["name"].ToString();
                        listOfStudents.Add(student);
                    }
                }
            }
            return(Ok(listOfStudents));
        }
예제 #6
0
        public IActionResult GetStudent(string IndexNumber)
        {
            int id = int.Parse(IndexNumber);

            using (SqlConnection client = new SqlConnection("Data Source=db-mssql16.pjwstk.edu.pl; Initial Catalog=s19048; User ID=apbds19048; Password=admin"))
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = client;
                    command.CommandText = " select IndexNumber, FirstName, LastName, BirthDate, IdEnrollment " +
                                          "from Student " +
                                          "where IndexNumber=@id";
                    command.Parameters.AddWithValue("id", id);

                    client.Open();
                    SqlDataReader SqlDataReader = command.ExecuteReader();
                    if (SqlDataReader.Read())
                    {
                        var student = new Models.Student();
                        student.IndexNumber  = SqlDataReader["IndexNumber"].ToString();
                        student.FirstName    = SqlDataReader["FirstName"].ToString();
                        student.LastName     = SqlDataReader["LastName"].ToString();
                        student.BirthDate    = DateTime.Parse(SqlDataReader["BirthDate"].ToString());
                        student.IdEnrollment = int.Parse(SqlDataReader["IdEnrollment"].ToString());
                        return(Ok(student));
                    }
                    return(NotFound("Nie znaleziono studenta"));
                }
        }
예제 #7
0
 public StudentDetailPage(Models.Student student)
 {
     InitializeComponent();
     _viewModel         = new ViewModels.StudentDetailViewModel();
     _viewModel.Student = student;
     BindingContext     = _viewModel;
 }
예제 #8
0
        public static List <Models.Audience> GetAudiencesFromStudent(Models.Student student)
        {
            var error = false;
            List <Models.Audience> audiences = new List <Models.Audience>();

            try
            {
                var a1 = GetSchoolAudience(student.School, false);
                if (a1 != null)
                {
                    audiences.Add(a1);
                }
                var a2 = GetSchoolGradeAudience(student.School, student.GradeLevel, false);
                if (a2 != null)
                {
                    audiences.Add(a2);
                }
                var a3 = GetSchoolTeacherAudience(student.School, student.Teacher, false);
                if (a3 != null)
                {
                    audiences.Add(a3);
                }
                var a4 = GetGradeAudience(student.GradeLevel, false);
                if (a4 != null)
                {
                    audiences.Add(a4);
                }
                error = true;
            }
            catch (Exception ex)
            {
                error = false;
            }
            return(audiences);
        }
예제 #9
0
        private bool hasStudent(string username, string password)
        {
            string            query = "SELECT * FROM Students";
            SQLiteConnection  Con   = new SQLiteConnection(connection);
            SQLiteCommand     Com   = new SQLiteCommand(query, Con);
            SQLiteDataAdapter Da    = new SQLiteDataAdapter();
            DataTable         Dt    = new DataTable();

            Com.Connection   = Con;
            Com.CommandText  = query;
            Da.SelectCommand = Com;
            Da.Fill(Dt);
            if (Dt.Rows.Count > 0)
            {
                LoginedUser = new Models.Student()
                {
                    Id       = Convert.ToInt32(Dt.Rows[0]["id"]),
                    Name     = Dt.Rows[0]["name"].ToString(),
                    Username = Dt.Rows[0]["username"].ToString(),
                    Surname  = Dt.Rows[0]["surname"].ToString(),
                    Email    = Dt.Rows[0]["email"].ToString(),
                    Password = Dt.Rows[0]["password"].ToString(),
                    Image    = Dt.Rows[0]["image"].ToString(),
                    Gender   = Dt.Rows[0]["gender"].ToString() == "1"
                };
                return(true);
            }
            return(false);
        }
        //[ValidateAntiForgeryToken]
        public ActionResult Oppdater([Bind("Navn,Telefon,Adresse")] Models.Student student)
        {
            if (ModelState.IsValid)
            {
                if (_db.Students.Any(x => x.UserId == _userId))
                {
                    //oppdater eksisterende data i databasen
                    var studentOld = _db.Students.FirstOrDefault(x => x.UserId == _userId);
                    studentOld.Navn    = student.Navn;
                    studentOld.Adresse = student.Adresse;
                    studentOld.Telefon = student.Telefon;
                    _db.Students.Update(studentOld);
                }
                else
                {
                    //Brukeren har ikke fylt inn informasjon før
                    student.UserId = _userId;
                    _db.Students.Add(student);
                }

                _db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View());
        }
 public IActionResult CreateStudent(Models.Student student)
 {
     //...add to databaase
     //... generating index number
     student.IndexNumber = $"s{new Random().Next(1, 20000)}";
     return(Ok(student));
 }
예제 #12
0
        public List <Beschikbaarheid> GetPlanning(Models.Student student)
        {
            SqlCommand cmd = new SqlCommand("GetPlanning");

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@StudentEmail", student.email);
            List <DataRow>         beschikbaarheidOverview = new List <DataRow>();
            List <Beschikbaarheid> beschikbaarheden        = new List <Beschikbaarheid>();

            try
            {
                beschikbaarheidOverview.AddRange(connector.ExecuteQueryCommand(cmd));

                foreach (DataRow dr in beschikbaarheidOverview)
                {
                    Beschikbaarheid beschikbaarheid = new Beschikbaarheid(Convert.ToString(dr["BeginTijd"]),
                                                                          Convert.ToString(dr["EindTijd"]), Convert.ToDateTime(dr["Date"]));
                    beschikbaarheden.Add(beschikbaarheid);
                }
                return(beschikbaarheden);
            }
            catch (Exception ex)
            {
                string message = ex.ToString();
                return(null);
            }
        }
예제 #13
0
        public static void RegisterStudentHandler(PacketHeader packetheader, Connection connection, RegisterStudent reg)
        {
            var dev = AndroidDevice.Cache.FirstOrDefault(
                d => d.IP == ((IPEndPoint)connection.ConnectionInfo.RemoteEndPoint).Address.ToString());

            //Maybe do not ignore this on production
            if (dev == null)
            {
                return;
            }

            var stud = Models.Student.Cache.FirstOrDefault(x => x.StudentId == reg.Student.StudentId);

            stud = new Models.Student
            {
                FirstName = reg.Student.FirstName,
                LastName  = reg.Student.LastName,
                //Course = reg.Student.Course,
                StudentId = reg.Student.StudentId
            };
            stud.Save();

            new RegisterStudentResult(ResultCodes.Success)
            {
                StudentId = stud.Id
            }
            .Send(new IPEndPoint(IPAddress.Parse(dev.IP), dev.Port));
        }
        public ActionResult Edit(int?id, Models.Student student)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            if (student == null)
            {
                return(HttpNotFound());
            }
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    DBContext.UpdateStudentById(id, student);
                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again");
            }

            return(View(student));
        }
        public ActionResult Create(Models.Student student)
        {
            try
            {
                // TODO: Add insert logic here
                //student.StudentId = ++ MvcApplication.globalStudentId;
                //MvcApplication.studentsList.Add(student);
                if (ModelState.IsValid)
                {
                    if (student == null)
                    {
                        return(HttpNotFound());
                    }

                    DBContext.CreateStudent(student);

                    return(RedirectToAction("Index"));
                }
            }
            catch (DataException)
            {
                ModelState.AddModelError("", "Unable to save changes. Try again");
            }

            return(View(student));
        }
예제 #16
0
 private IList <Models.Grade> Grades;        // lista ocen ucznia z przedmiotu
 public ConcreteStudentPage(Models.Student student, Models.Subject subject)
 {
     _context = ((MainWindow)Application.Current.MainWindow).context;
     Student  = student;
     Subject  = subject;
     InitializeComponent();
 }
        public ActionResult Edit(Models.Student userprofile)
        {
            if (ModelState.IsValid)
            {
                string username = User.Identity.Name;
                // Get the userprofile
                Models.Student user = db.Students.FirstOrDefault(u => u.StudentEmail.Equals(username));

                // Update fields
                user.StudentName = userprofile.StudentName;
                user.Level       = userprofile.Level;
                user.Mobile      = userprofile.Mobile;
                user.DateOfBirth = userprofile.DateOfBirth;

                user.StudentEmail    = userprofile.StudentEmail;
                user.Password        = userprofile.Password;
                db.Entry(user).State = EntityState.Modified;

                db.SaveChanges();

                return(RedirectToAction("Index", "Home")); // or whatever
            }

            return(View(userprofile));
        }
예제 #18
0
 public IActionResult AddStudent([FromBody] Models.Student student)
 {
     //.. add to DB
     //... generating index number
     student.IndexNumber = $"s{new Random().Next(1, 20000)}";
     return(Ok(student));
 }
예제 #19
0
        //To Insert student Information
        public static int CreateStudent(Models.Student student)
        {
            int result;
            int newId = -1;

            using (SqlConnection cnn = GetSqlConnection())
            {
                String sql = $"Insert into Student(StudentName,Age) values ('{student.StudentName}',{student.Age})";

                using (SqlCommand command = new SqlCommand(sql, cnn))
                {
                    //open connection
                    cnn.Open();

                    command.CommandType = System.Data.CommandType.Text;
                    command.CommandText = sql;
                    //execute query
                    result = command.ExecuteNonQuery();

                    //select id of newly added record
                    string query2 = "Select @@Identity as newId from Student";
                    command.CommandText = query2;

                    newId = Convert.ToInt32(command.ExecuteScalar());
                }
            }
            return(newId);
        }
예제 #20
0
        //To Select student Information depends on Id given
        public static Models.Student SelectStudentById(int?stdId)
        {
            Models.Student studentInfo = new Models.Student();

            using (SqlConnection cnn = GetSqlConnection())
            {
                String sql = $"Select * From Student Where Id = {stdId}";

                using (SqlCommand command = new SqlCommand(sql, cnn))
                {
                    cnn.Open();

                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        while (dataReader.Read())
                        {
                            studentInfo.StudentId   = (int)dataReader.GetValue(0);
                            studentInfo.StudentName = (string)dataReader.GetValue(1);
                            studentInfo.Age         = (int)dataReader.GetValue(2);
                        }
                    }
                }
            }

            return(studentInfo);
        }
예제 #21
0
        public async Task <Models.Student> GetStudentByIndexAsync(string index)
        {
            using (var client = new SqlConnection("Data Source=db-mssql.pjwstk.edu.pl;Initial Catalog=2019SBD;Integrated Security=True"))
                using (var com = new SqlCommand())
                {
                    com.CommandText = "Select * from student where IndexNumber=@index ";
                    com.Parameters.AddWithValue("index", index);

                    using (var reader = await com.ExecuteReaderAsync())
                    {
                        if (await reader.ReadAsync())
                        {
                            var student = new Models.Student();

                            student.BirthDate = reader["Birthdate"].ToString();
                            student.Firstname = reader["FirstName"].ToString();
                            student.Lastname  = reader["LastName"].ToString();
                            student.IdStudent = (int)reader["IdEnrollment"];

                            return(student);
                        }
                        else
                        {
                            return(null);
                        }
                    }
                }
        }
예제 #22
0
        //To Select all the student
        public static IEnumerable <Models.Student> SelectAllStudents()
        {
            IEnumerable <Models.Student> studentList = new List <Models.Student>();

            using (SqlConnection cnn = GetSqlConnection())
            {
                String sql = $"Select * From Student";

                using (SqlCommand command = new SqlCommand(sql, cnn))
                {
                    cnn.Open();

                    using (SqlDataReader dataReader = command.ExecuteReader())
                    {
                        Models.Student student;
                        while (dataReader.Read())
                        {
                            student             = new Models.Student();
                            student.StudentId   = (int)dataReader.GetValue(0);
                            student.StudentName = (string)dataReader.GetValue(1);
                            student.Age         = (int)dataReader.GetValue(2);

                            ((List <Models.Student>)studentList).Add(student);
                            //studentList.ToList<Models.Student>().Add(student);
                        }
                    }
                }
            }

            return(studentList);
        }
        public ActionResult InsertMany(string id, FormCollection collection)
        {
            try
            {
                List <Models.Student> students = new List <Models.Student>();
                int contador = 0;
                for (int i = 0; i < 2500; i++)
                {
                    Models.Student student = new Models.Student();
                    student._id          = GenerateRandomId(24);
                    student.firstName    = "Student|" + contador.ToString() + "|";
                    student.lastName     = "Student|" + contador.ToString() + "|";
                    student.emailAddress = "Student|" + contador.ToString() + "|@gmail.com";
                    students.Add(student);
                    contador++;
                }

                Models.MongoHelper.ConnectionToMongoService();
                Models.MongoHelper.students_collection =
                    Models.MongoHelper.database.GetCollection <Models.Student>("students");

                var result = Models.MongoHelper.students_collection.InsertManyAsync(students);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #24
0
        public IActionResult getStudent(string IndexNumber)
        {
            int id = int.Parse(IndexNumber);

            Debug.WriteLine("My debug string here");
            using (SqlConnection client = new SqlConnection("Data Source=10.1.1.36; Initial Catalog=s8346;Integrated Security=True"))
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = client;
                    command.CommandText = " select IndexNumber, FirstName, LastName, BirthDate, IdEnrollment from Student where IndexNumber=@id";
                    command.Parameters.AddWithValue("id", id);

                    client.Open();
                    SqlDataReader SqlDataReader = command.ExecuteReader();
                    if (SqlDataReader.Read())
                    {
                        var student = new Models.Student();
                        student.IndexNumber  = SqlDataReader["IndexNumber"].ToString();
                        student.FirstName    = SqlDataReader["FirstName"].ToString();
                        student.LastName     = SqlDataReader["LastName"].ToString();
                        student.BirthDate    = DateTime.Parse(SqlDataReader["BirthDate"].ToString());
                        student.IdEnrollment = int.Parse(SqlDataReader["IdEnrollment"].ToString());
                        return(Ok(student));
                    }
                    return(NotFound("Nie znaleziono studenta"));
                }
        }
예제 #25
0
        public ActionResult Index()
        {
            //Repositories.Repository <Models.Student> repo = new Repositories.Repository<Models.Student>();
            Repositories.BaseService<Models.Student> repo = new Repositories.BaseService<Models.Student>(new DAL.DatabaseContext());
            Models.Student stu = new Models.Student() { FirstMidName = "Lalo", LastName = "Landa", BirthDate = DateTime.Now };
            stu = repo.Find(x => x.ID.Equals(1));

            return View();
        }
예제 #26
0
파일: HomeController.cs 프로젝트: ud223/jx
        private Models.Student getUserInfo(string open_id)
        {
            string url = "https://api.weixin.qq.com/sns/userinfo?access_token=" + this.access_token +"&openid="+ open_id + "&lang=zh_CN";

            string weixin = this.file_get_contents(url);

            System.Web.Script.Serialization.JavaScriptSerializer j = new System.Web.Script.Serialization.JavaScriptSerializer();

            Models.Student stu = new Models.Student();

            stu = j.Deserialize<Models.Student>(weixin);

            return stu;
        }
예제 #27
0
파일: Student.cs 프로젝트: unie/TestGitF
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Models.Student GetModel(Guid StudentId)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select top 1 StudentId,IdentityNo,StuName,Gender,School,JobTitle,TelNo,CreateTime,LastModifyTime,Picture,Birthday, Nation, FirstRecord, FirstSchool, LastRecord,LastSchool,PoliticsStatus, Rank, RankTime, Post, PostTime, Mobile, TeachNo, Status, Description from Student ");
            strSql.Append(" where StudentId=@StudentId and Status = 1");
            SqlParameter[] parameters = {
                    new SqlParameter("@StudentId", SqlDbType.UniqueIdentifier,16)			};
            parameters[0].Value = StudentId;

            Models.Student model = new Models.Student();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }
예제 #28
0
파일: Student.cs 프로젝트: unie/TestGitF
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Models.Student DataRowToModel(DataRow row)
        {
            Models.Student model = new Models.Student();
            if (row != null)
            {
                if(row["StudentId"]!=null && row["StudentId"].ToString()!="")
                {
                    model.StudentId= new Guid(row["StudentId"].ToString());
                }
                if(row["IdentityNo"]!=null)
                {
                    model.IdentityNo=row["IdentityNo"].ToString();
                }
                if(row["StuName"]!=null)
                {
                    model.StuName=row["StuName"].ToString();
                }
                if(row["Gender"]!=null && row["Gender"].ToString()!="")
                {
                    model.Gender=int.Parse(row["Gender"].ToString());
                }
                if(row["School"]!=null)
                {
                    model.School=row["School"].ToString();
                }
                if (row["JobTitle"] != null)
                {
                    model.JobTitle = row["JobTitle"].ToString();
                }
                if(row["TelNo"]!=null)
                {
                    model.TelNo=row["TelNo"].ToString();
                }
                if(row["CreateTime"]!=null && row["CreateTime"].ToString()!="")
                {
                    model.CreateTime=DateTime.Parse(row["CreateTime"].ToString());
                }
                if(row["LastModifyTime"]!=null && row["LastModifyTime"].ToString()!="")
                {
                    model.LastModifyTime=DateTime.Parse(row["LastModifyTime"].ToString());
                }
                /*Picture,Birthday, Nation, FirstRecord, FirstSchool, LastRecord,LastSchool,PoliticsStatus, Rank, RankTime, Post, PostTime, Mobile, TeachNo, Status, Description from Student */
                if (row["Picture"] != null && row["Picture"].ToString() != "")
                {
                    model.Picture = row["Picture"].ToString();
                }
                if (row["Birthday"] != null && row["Birthday"].ToString() != "")
                {
                    model.Birthday = DateTime.Parse(row["Birthday"].ToString());
                }

                if (row["Nation"] != null && row["Nation"].ToString() != "")
                {
                    model.Nation = int.Parse(row["Nation"].ToString());
                }
                if (row["FirstRecord"] != null && row["FirstRecord"].ToString() != "")
                {
                    model.FirstRecord =row["FirstRecord"].ToString();
                }
                if (row["FirstSchool"] != null && row["FirstSchool"].ToString() != "")
                {
                    model.FirstSchool = row["FirstSchool"].ToString();
                }
                if (row["LastRecord"] != null && row["LastRecord"].ToString() != "")
                {
                    model.LastRecord = row["LastRecord"].ToString();
                }
                if (row["LastSchool"] != null && row["LastSchool"].ToString() != "")
                {
                    model.LastSchool = row["LastSchool"].ToString();
                }
                if (row["PoliticsStatus"] != null && row["PoliticsStatus"].ToString() != "")
                {
                    model.PolicticsStatus = int.Parse(row["PoliticsStatus"].ToString());
                }
                if (row["Rank"] != null && row["Rank"].ToString() != "")
                {
                    model.Rank = row["Rank"].ToString();
                }
                if (row["RankTime"] != null && row["RankTime"].ToString() != "")
                {
                    model.RankTime = DateTime.Parse(row["RankTime"].ToString());
                }
                /*Post, PostTime, Mobile, TeachNo, Status, Description*/
                if (row["Post"] != null && row["Post"].ToString() != "")
                {
                    model.Post = row["Post"].ToString();
                }
                if (row["PostTime"] != null && row["PostTime"].ToString() != "")
                {
                    model.PostTime = DateTime.Parse(row["PostTime"].ToString());
                }

                if (row["Mobile"] != null && row["Mobile"].ToString() != "")
                {
                    model.Mobile = row["Mobile"].ToString();
                }
                if (row["TeachNo"] != null && row["TeachNo"].ToString() != "")
                {
                    model.TeachNo = int.Parse(row["TeachNo"].ToString());
                }

                if (row["Status"] != null && row["Status"].ToString() != "")
                {
                    model.Status = int.Parse(row["Status"].ToString());
                }
                if (row["Description"] != null && row["Description"].ToString() != "")
                {
                    model.Description = row["Description"].ToString();
                }
            }
            return model;
        }
예제 #29
0
        private void GetStudentsButton_Click(object sender,RoutedEventArgs e)
        {
            //var p = new Root<List<Models.Student>>()
            //{
            //};

            var ss = new Models.Student[10];

            for (int i = 0; i < ss.Length; i++)
            {
                ss[i] = new Models.Student()
                {
                    ID = i
                };
            }

            GetStudentsButton.SendCommand<ViewModels.StudentViewModel[]>("StudentService/EvaluateStudents",ss,r =>
            {
                //StudentsDataGrid.ItemsSource = r.Result;
                ViewModel.Students.UnionWith(r.Result);
            });
        }