public async Task <ActionResult> Register(TeacherRegisterViewModel model) { if (ModelState.IsValid) { var user = new BL.ApplicationUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false); TeacherData teacher = new TeacherData(model.FirstName, model.LastName, model.Email, model.PhoneNumber, model.Password); BL.RoadScholarContext rsContext = new BL.RoadScholarContext(); rsContext.addTeacher(teacher); // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>"); return(RedirectToAction("Index", "Home")); } AddErrors(result); } // If we got this far, something failed, redisplay form return(View(model)); }
// GET: Activities/HistoryByStudent public ActionResult HistoryByStudent() { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); TempData["RoomID"] = teacherData.RoomId; return(View(Adapting.getStudentListFromData(rsContext.getStudentsByTeacher(teacherData.RoomId)))); }
public JsonResult ParentStatusChange(List <ParentStatus> statuschange) { bool isResult = false; try { foreach (ParentStatus status in statuschange) { status.UserId = Session["UserID"].ToString(); isResult = new ParentData().ParentStatusChange(status); if (isResult) { isResult = new TeacherData().InsertYakkrRouting( new YakkrRouting { AgencyID = new Guid(Session["AgencyID"].ToString()), UserID = new Guid(Session["UserID"].ToString()), RouteCode = status.RouteCode, ToSataffId = new Guid("EBF675DF-9468-4CD4-92B0-D97B7D49888D"), HouseHoldId = Convert.ToInt64(status.HouseHoldId), Email = Session["EmailID"].ToString(), ClientId = status.ClientId }, "" ); } } } catch (Exception Ex) { clsError.WriteException(Ex); //return Json("Error occured please try again."); } return(Json(isResult)); }
public JsonResult SaveAbsenceReason(string reasonId, string reason, bool reasonStatus) { bool isResult = false; List <AbsenceReason> reasonList = new List <FingerprintsModel.AbsenceReason>(); try { AbsenceReason model = new FingerprintsModel.AbsenceReason { Reason = reason, ReasonId = Convert.ToInt32(reasonId), AgencyId = (Session["AgencyId"] != null) ? new Guid(Session["AgencyId"].ToString()) : (Guid?)null, CreatedBy = new Guid(Session["UserId"].ToString()), Status = reasonStatus, ModifiedBy = new Guid(Session["UserId"].ToString()) }; reasonList = new TeacherData().SaveAbsenceReason(out isResult, model); } catch (Exception ex) { clsError.WriteException(ex); } return(Json(new { isResult, reasonList }, JsonRequestBehavior.AllowGet)); }
private void button6_Click_1(object sender, EventArgs e)//确认添加 { ad_ServicesBLL BLL = new ad_ServicesBLL(); TeacherData teacherData = new TeacherData(); teacherData.TeaNo = tbteano.Text.Trim(); teacherData.TeaPwd = tbteapwd.Text.Trim(); teacherData.TeaName = tbteaname.Text.Trim(); teacherData.Academy = tbacademy.Text.Trim(); teacherData.GroupNumber = Convert.ToInt32(tbgroupnumber.Text.Trim()); if (BLL.InsertTeabll(teacherData)) { MessageBox.Show("导入成功", "提示", MessageBoxButtons.OK); tbteano.Text = ""; tbteapwd.Text = ""; tbteaname.Text = ""; tbacademy.Text = ""; tbgroupnumber.Text = ""; DataTable table = BLL.SelectTeabll(); Teagridview.DataSource = table; } else { MessageBox.Show("导入失败", "提示", MessageBoxButtons.OKCancel); } }
// GET: Teacher/Dashboard public ActionResult Dashboard() { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); Teacher teacher = Adapting.getTeacherFromData(teacherData); return(View(teacher)); }
// GET: Teacher/Display public ActionResult Display(long Id) { //Activity activity = cloneActivity(rsContext.getActivity(Id)); //rsContext.addActivity(activity); ActivityData activityData = rsContext.getActivity(Id); if (activityData is ShortAnswerQuestionData) { return(RedirectToAction("DisplayShortAnswerQuestion", new { ActivityId = activityData.id })); } else if (activityData is TrueFalseQuestionData) { return(RedirectToAction("DisplayTrueFalseQuestion", new { ActivityId = activityData.id })); } else if (activityData is AmericanQuestionData) { return(RedirectToAction("DisplayAmericanQuestion", new { ActivityId = activityData.id })); } else if (activityData is ExperimentData) { ((ExperimentData)activityData).ActiveExpID = 0; TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); List <StudentData> studentsInRoom = rsContext.getStudentsByTeacher(teacherData.RoomId); foreach (StudentData studentData in studentsInRoom) { studentData.GroupID = 0; } //rsContext.addActiveExpLog(activeExpData); //TODO rsContext.SaveChanges(); return(RedirectToAction("DisplayExperiment", new { ActivityId = activityData.id })); } return(View()); }
/// <summary> /// Get the student data during login. /// </summary> /// <param name="localID"></param> /// <returns></returns> public async Task <bool> ChkTeacher(string localID) { bool chk = false; TeacherLoginHandler.GetTeacher(localID, teacher => { chk = true; Debug.Log("inn"); teacherData = new TeacherData(); teacherData.email = teacher.email; teacherData.userName = teacher.userName; teacherData.verified = teacher.verified; teacherData.localId = teacher.localId; Debug.Log("inn2"); }); Stopwatch sw = Stopwatch.StartNew(); var delay = Task.Delay(2000).ContinueWith(_ => { sw.Stop(); return(sw.ElapsedMilliseconds); }); await delay; int sec = (int)delay.Result; Debug.Log("Time elapsed milliseconds: {0}" + sec + ", Chk is " + chk); return(chk); }
public ActionResult RegisterStudents(List <Student> allOfStudents) { if (allOfStudents == null) { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); TempData["RoomID"] = teacherData.RoomId; return(View()); } else { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); foreach (Student s in allOfStudents) { s.RoomId = teacherData.RoomId; } List <StudentData> studentsData = Adapting.getStudentListAsData(allOfStudents); string stud = teacherData.registerStudentsFromList(studentsData); if (!stud.Equals("")) { TempData["errorMessage"] = Resources.Resources.ThoseStudentsAreAlreadyRegistered + stud + Resources.Resources.AllTheOtherStudentsWereRegistered; } else { TempData["infoMessage"] = Resources.Resources.StudentsRegisteredSuccessfully; } return(PartialView()); } }
// POST: Teacher/DisplayAmericanQuestion //[HttpPost] //[ValidateAntiForgeryToken] public ActionResult DisplayAmericanQuestion(long ActivityId) { AmericanQuestionData quesData = (AmericanQuestionData)rsContext.getActivity(ActivityId); TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); if (teacherData == null) { throw new ArgumentNullException(nameof(teacherData)); } //RoomData roomData = teacherData.getRoomData(); RoomData roomData = rsContext.getRoom(teacherData.RoomId); if (roomData == null) { throw new ArgumentNullException(nameof(roomData)); } roomData.updateCurrentActivityId(quesData.id); rsContext.SaveChanges(); AmericanQuestion ques = Adapting.getAmericanQuestionFromData(quesData); return(View(ques)); }
public ActionResult SaveAmericanQuestion(AmericanQuestion ques) { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); if (ques.expID == -1) { ques.RoomId = teacherData.RoomId; AmericanQuestionData aqData = Adapting.getAmericanQuestionAsData(ques); rsContext.addActivity(aqData); rsContext.SaveChanges(); return(RedirectToDashboard()); } else { ques.RoomId = 0; AmericanQuestionData aqData = Adapting.getAmericanQuestionAsData(ques); rsContext.addActivity(aqData); ExperimentData experimentData = (ExperimentData)rsContext.getActivity(ques.expID); aqData.experimentOrder = experimentData.activities.Count; experimentData.addStep(aqData); rsContext.SaveChanges(); return(RedirectToAction("EditExperiment", new { ExpID = ques.expID })); } }
public async Task <IHttpActionResult> AddTeacher(TeacherData model) { var processingResult = new ServiceProcessingResult <bool> { IsSuccessful = true }; var parameters = new MySqlParameter[] { new MySqlParameter("@Schcode", model.Schcode), new MySqlParameter("@Teacher", model.Teacher), new MySqlParameter("@Grade", model.Grade) }; var sqlText = @" Insert Into DropDownInfo (Schcode,Teacher,Grade) VALUES(@Schcode,@Teacher,@Grade) "; var sqlQuery = new SQLQuery(); var Result = await sqlQuery.ExecuteNonQueryAsync(CommandType.Text, sqlText, parameters); if (!Result.IsSuccessful) { processingResult.IsSuccessful = false; processingResult.Error = new ProcessingError("Error inserting teacher.", "Error inserting teacher.", true, false); return(Ok(processingResult)); } if (Result.Data < 1) { processingResult.IsSuccessful = false; processingResult.Error = new ProcessingError("Error inserting teacher.", "Error inserting teacher.", true, false); return(Ok(processingResult)); } processingResult.Data = true; return(Ok(processingResult)); }
public JsonResult InsertAttendanceType(string attendanceType, string description, string acronym, string attendanceTypeId, string status, string indexId) { AttendanceTypeModel model = new AttendanceTypeModel(); AttendanceType _attendType = new FingerprintsModel.AttendanceType(); bool isResult = false; try { _attendType.Status = Convert.ToBoolean(Convert.ToInt32(status)); _attendType.IndexId = (indexId == "" || indexId == "0") ? 0 : Convert.ToInt64(indexId); _attendType.Acronym = (_attendType.Status) ? acronym.ToUpper() : null; _attendType.Description = (_attendType.Status) ? description : null; _attendType.AttendanceTypeId = Convert.ToInt64(attendanceTypeId); _attendType.HomeBased = Convert.ToBoolean(Convert.ToInt32(attendanceType)); _attendType.UserId = new Guid(Session["UserId"].ToString()); _attendType.AgencyId = (Session["AgencyId"] != null) ? new Guid(Session["AgencyId"].ToString()) : (Guid?)null; model = new TeacherData().InsertAttendanceType(out isResult, _attendType); } catch (Exception ex) { bool ids = Convert.ToBoolean(0); clsError.WriteException(ex); } return(Json(new { model, isResult }, JsonRequestBehavior.AllowGet)); }
public TeacherData GetTeacherDetails(string username) { TeacherData stu = new TeacherData(); MySqlConnection conn = GetConnection(); conn.Open(); string query = "select * from teacherdata where username=@v1"; MySqlCommand cmd = new MySqlCommand(query, conn); cmd.Parameters.AddWithValue("@v1", username); cmd.Prepare(); MySqlDataReader reader = cmd.ExecuteReader(); if (reader.Read()) { stu.username = reader.GetString(0); stu.id = reader.GetString(1); stu.courseId = reader.GetInt32(2); stu.year = reader.GetInt32(3); stu.semester = reader.GetInt32(4); } return(stu); }
public void Visit(TeacherData data) { if (data.sex == Sex.Women) { total++; } }
// GETPOST: Teacher/SaveExperiment public ActionResult SaveExperiment(long ExpId) { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); ExperimentData experimentData = (ExperimentData)rsContext.getActivity(ExpId); rsContext.SaveChanges(); return(RedirectToDashboard()); }
// GET: Activities/ActivityLogs public ActionResult ActivityLogs() { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); List <ActivityLogData> lstData = rsContext.getHistory(teacherData.RoomId); List <ActivityLog> lst = Adapting.getActivityLogListFromData(lstData); return(View(lst)); }
private void RegisBtn_Clicked(object sender, EventArgs e) { if (LoginBox.Text == "" || PasswBox.Text == "" || PasswCheckBox.Text == "" || TypePick.Items[TypePick.SelectedIndex] == "" || NameBox.Text == "") { DependencyService.Get <IToast>().Show("Не все поля заполнены"); return; } if (PasswBox.Text != PasswCheckBox.Text) { DependencyService.Get <IToast>().Show("Пароли не совпадают"); return; } if (TypePick.Items[TypePick.SelectedIndex] == "Преподаватель") { var user = new Teacher(NameBox.Text, PasswBox.Text, LoginBox.Text, DepartBox.Text); if (TeacherData.CheckLogin(user)) { DependencyService.Get <IToast>().Show("Успешно"); } else { DependencyService.Get <IToast>().Show("Логин уже занят"); } } /* * if (RegisrationPage.LoginBox.Text=="") * DependencyService.Get<IToast>().Show("Не все поля заполнены"); * bool connect = await WebConnection.CheckConnection(); * if (connect == false) return; * * ClientService clientService = new ClientService(); * * // отправка данных регистрации на сервер * var client = await clientService. * Register(RegisrationPage.NameBox.Text, RegisrationPage.LoginBox.Text, RegisrationPage.PasswBox.Text); * * * // если сервер вернул данные пользователя - загрузить в пользователя * if (client != null) * { * Client.setClient(Int32.Parse(client["Id"]), client["Name"], client["Login"]); * DbService.SaveClient(Client.CurrentClient); // сохранили пользователя * // DbService.LoadUser(); * * GetClientPage(); * return; * } * else * { * await DisplayAlert("Ошибка", "Сервер не вернул данные", "OK"); * return; * }*/ }
protected void TeacherBind() { string sql = "select * from TeacherInfo inner join TeacherTypeInfo on TeacherInfo.TeachTypeId = TeacherTypeInfo.TypeId"; DataSet data = DataOperate.GetDataset(sql, "TeacherInfo"); TeacherData.DataSource = data; TeacherData.DataKeyField = "TeachId"; TeacherData.DataBind(); }
public async Task <ActionResult> DeleteConfirmed(Guid id) { TeacherData teacherData = await db.TeacherData.FindAsync(id); db.TeacherData.Remove(teacherData); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "Id,FirstName,LastName,Gender,DateOfBirth,MobileNumber,Address1,City,State,Country,Zip")] TeacherData teacherData) { if (ModelState.IsValid) { db.Entry(teacherData).State = System.Data.Entity.EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(teacherData)); }
public static Teacher getTeacherFromData(TeacherData teacherData) { Teacher t = new Teacher(); t.PhoneNumber = teacherData.PhoneNumber; t.FirstName = teacherData.FirstName; t.LastName = teacherData.LastName; t.Email = teacherData.Email; t.Password = teacherData.Password; t.RoomId = teacherData.RoomId; return(t); }
// GET: Teacher/CreateActivity public ActionResult CreateActivity() { TeacherData teacherData = rsContext.getTeacher(User.Identity.Name); if (teacherData == null) { throw new ArgumentNullException(nameof(teacherData)); } Teacher teacher = Adapting.getTeacherFromData(teacherData); return(View(teacher)); }
/// <summary> /// 教师表插入数据 /// </summary> /// <param name="teacherData">传参:教师对象</param> /// <returns>成功:返回true,失败:返回false</returns> public bool InsertTeabll(TeacherData teacherData) { int result = sDAL.InsertTea(teacherData); if (result != 0) { return(true);//插入成功 } else { return(false);//插入失败 } }
public async Task <ActionResult> Create([Bind(Include = "Id,FirstName,LastName,Gender,DateOfBirth,MobileNumber,Address1,City,State,Country,Zip")] TeacherData teacherData) { if (ModelState.IsValid) { teacherData.Id = Guid.NewGuid(); db.TeacherData.Add(teacherData); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(teacherData)); }
/// <summary> /// 新增教师 /// </summary> /// <returns></returns> public JsonResult AddTeach() { AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载 ajax.status = EnumAjaxStatus.Error; //默认失败 ajax.msg = "新增失败!"; //前台获取,用于显示提示信息 var data = Request["data"]; //获取前台传递的数据,主要序列化 if (string.IsNullOrEmpty(data)) { return(Json(ajax)); } Teachers teacher = (Teachers)(JsonConvert.DeserializeObject(data.ToString(), typeof(Teachers))); SYSAccount sys = (SYSAccount)(JsonConvert.DeserializeObject(data.ToString(), typeof(SYSAccount))); if (string.IsNullOrEmpty(teacher.MobilePhone)) { ajax.msg = "请输入教师手机号!"; return(Json(ajax)); } TeacherSearchModel search = new TeacherSearchModel(); search.MobilePhone = teacher.MobilePhone; int teas = TeacherData.GetTeachersList(search).Count(); if (teas > 0)//手机号重复了 { ajax.msg = "手机号重复!"; return(Json(ajax)); } RandomOperate operate = new RandomOperate(); teacher.CreateTime = DateTime.Now; teacher.CreatorId = UserSession.userid; teacher.ID = operate.GenerateCheckCode(36); teacher.BindAccountID = teacher.MobilePhone; sys.ACC_Account = teacher.MobilePhone;//用手机号作为登陆账号 sys.ACC_CreatedBy = UserSession.userid; sys.ACC_CreatedOn = DateTime.Now; sys.ACC_Password = operate.CreateMD5Hash("123"); sys.ACC_ComCode = teacher.ComCode; if (!string.IsNullOrEmpty(TeacherData.AddTeachers(teacher, sys)))//注意时间类型,而且需要在前台把所有的值 { ajax.msg = "新增成功!"; ajax.status = EnumAjaxStatus.Success; } return(Json(ajax)); }
public static Teacher Find(Guid?id = null, string email = null) { try { if (id == null && string.IsNullOrEmpty(email)) { throw new Exception("Parâmetros vazios"); } if (id != null && Equals(id, Guid.Empty)) { throw new Exception("Parâmetro 'id' inválido"); } Teacher item = null; using (Entities db = new Entities()) { IEnumerable <TeacherData> query = db.TeacherData; if (id != null) { query = query.Where(x => x.IdTeacher == id); } if (!string.IsNullOrEmpty(email)) { query = query.Where(x => x.Email.Trim() == email.Trim()); } TeacherData row = query.FirstOrDefault(); if (row == null) { throw new Exception("Professor não encontrado"); } item = Convert(row); } return(item); } catch (Exception e) { object[] parameters = { id, email }; string notes = LogHelper.Notes(parameters, e.Message); Log.Add(Log.TYPE_ERROR, "SistemaMatricula.DAO.TeacherDAO.Find", notes); } return(null); }
public IActionResult Index(string username) { TeacherDataStoreContext context = HttpContext.RequestServices.GetService(typeof(StudentMIS.Models.TeacherDataStoreContext)) as TeacherDataStoreContext; TeacherData stu = (TeacherData)context.GetTeacherDetails(username); // Course c=(Course)context.GetCourses(); ViewData["username"] = stu.username; ViewData["id"] = stu.id; ViewData["courseId"] = stu.courseId; ViewData["semester"] = stu.semester; ViewData["year"] = stu.year; return(View(context.GetCourses())); }
// GET: TeacherDatas/Delete/5 public async Task <ActionResult> Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TeacherData teacherData = await db.TeacherData.FindAsync(id); if (teacherData == null) { return(HttpNotFound()); } return(View(teacherData)); }
/// <summary> /// 根据按钮ID获取按钮详细信息 /// </summary> /// <param name="ID"></param> /// <returns></returns> public JsonResult GetTeachByID(string id) { AjaxStatusModel ajax = new AjaxStatusModel(); //功能操作类的返回类型都是AjaxStatusModel,数据放到AjaxStatusModel.data中,前台获取json后加载 ajax.status = EnumAjaxStatus.Error; //默认失败 ajax.msg = "获取失败!"; //前台获取,用于显示提示信息 Teachers btn = TeacherData.GetTeachByID(id); //业务层获取底层方法,返回数据 if (btn != null) { ajax.data = btn;//放入数据 ajax.status = EnumAjaxStatus.Success; ajax.msg = "获取成功!"; } return(Json(ajax)); }
private ParseUser[] GetTransactionUsers(TeacherData teacherData, CommissionsDto globalCommissionsTable, IMyMentorRepository repository) { var users= repository.FindUsersById(new[] { teacherData.TeacherId, teacherData.AgentId, globalCommissionsTable.MaamAccountId, globalCommissionsTable.MaamBalanceAccountId, globalCommissionsTable.SiteAccountId, }); return users; }