private void btnAddFacilitatorAddress_Click(object sender, EventArgs e) { frmAddUpdateAddresses frm = new frmAddUpdateAddresses(); Address NewAddress = new Address { AddressID = 0 }; //frm.CurrentAddress = NewAddress; frm.ShowDialog(); if (frm.CurrentAddress != null) { if (frm.CurrentAddress.AddressID != 0) { using (var Dbconnection = new MCDEntities()) { Facilitator CurrentFacilitator = ((Facilitator)facilitatorBindingSource.Current); Dbconnection.Facilitators.Attach(CurrentFacilitator); Dbconnection.Addresses.Attach(frm.CurrentAddress); CurrentFacilitator.Individual.Addresses.Add(frm.CurrentAddress); Dbconnection.SaveChanges(); //Dbconnection.Entry(CurrentFacilitator).Reference(a => a.Individual.Addresses).Load(); // Dbconnection.Entry(CurrentFacilitator).Reference(a => a.LookupProvince).Load(); //// Dbconnection.Entry(CurrentFacilitator).Reference(a => a.LookupCountry).Load(); }; refreshFacilitatorAddressDetails(); } } }
public Favorite CreateFavoriate(FavoriteCreateDTO create) { Facilitator f = Data.Facilitators.Where(w => w.Email == create.Username).FirstOrDefault(); Favorite favor = Data.Favorites.Where(w => w.DocumentID == create.DocumentId && w.FacilitatorID == f.FacilitatorID).FirstOrDefault(); if (favor != null) { return(null); } Favorite favorite = new Favorite() { DocumentID = create.DocumentId, FacilitatorID = Data.Facilitators.Where(w => w.Email == create.Username).First().FacilitatorID, DocumentType = DetermineDocumentType(create.DocumentId) }; Data.Database.OpenConnection(); try { Data.Add(favorite); //Data.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Favorites ON"); Data.SaveChanges(); //Data.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Favorites OFF"); } finally { Data.Database.CloseConnection(); } return(favorite); }
protected void ButtonLogin_Click(object sender, EventArgs e) { //only validate if user has agreed to terms if (consentCheck.Checked) { CSS RequestManager = new CSS(); //validate user login info if (RequestManager.IsAuthenticated(EmailTxt.Text, PasswordTxt.Text)) { //if //get info for email input Facilitator pullFacilitator = RequestManager.GetFacilitatorByEmail(EmailTxt.Text); string roles = pullFacilitator.Roles; //create authentication cookie FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, RequestManager.GetFacilitatorByEmail(EmailTxt.Text).FacilitatorID.ToString(), DateTime.Now, DateTime.Now.AddHours(24), RememberChk.Checked, roles); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); //create consent cookie if there isn't one var consentCookie = Request.Cookies["ConsentCookie"]; if (consentCookie == null) { HttpCookie newConsent = new HttpCookie("ConsentCookie", "true"); //set cookie to expire in 100 days newConsent.Expires = DateTime.UtcNow.AddDays(100); Response.Cookies.Add(newConsent); } string Redirect; Redirect = Request["ReturnUrl"]; if (Redirect == null) { Redirect = "Default.aspx"; } Response.Redirect(Redirect, true); } else { MsgLbl.Text = "Your email or password is incorrect"; } } else { consentCheck.ForeColor = System.Drawing.Color.Red; } }
protected void ButtonSubmit_Click(object sender, EventArgs e) { Facilitator newFac = new Facilitator(); CSS RequestDirector = new CSS(); bool Confirmation; //if getfacilitator returns default facilitator values, that email has not been used if (RequestDirector.GetFacilitatorByEmail(EmailTxt.Text).Email == default(string)) { newFac.FirstName = FirstNameTxt.Text; newFac.LastName = LastNameTxt.Text; newFac.Title = TitleTxt.Text; newFac.Email = EmailTxt.Text; newFac.Organization = OrgTxt.Text; newFac.Location = LocTxt.Text; //generate password hash newFac.Salt = RequestDirector.CreateSalt(5); newFac.Password = RequestDirector.CreatePasswordHash(PasswordTxt.Text, newFac.Salt); newFac.Roles = "Facilitator|"; //attempt to create an account Confirmation = RequestDirector.CreateFacilitator(newFac); //if account creation successful, log in and redirect to home if (Confirmation) { if (RequestDirector.IsAuthenticated(EmailTxt.Text, PasswordTxt.Text)) { Facilitator pullFacilitator = RequestDirector.GetFacilitatorByEmail(EmailTxt.Text); string roles = pullFacilitator.Roles; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, RequestDirector.GetFacilitatorByEmail(EmailTxt.Text).FacilitatorID.ToString(), DateTime.Now, DateTime.Now.AddMinutes(60), false, roles); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); Response.Redirect("Default.aspx"); } else { MsgLbl.Text = "Your email or password is incorrect"; } } else { MsgLbl.Text = "Error creating account."; } } else { MsgLbl.Text = "This email is already associated with an account."; } }
private void btnAddEmployee_Click(object sender, EventArgs e) { using (var Dbconnection = new MCDEntities()) { CurrentFaclilitator = new Facilitator { Individual = new Individual { TitleID = Convert.ToInt32(cboEmployeeTitle.SelectedValue), IndividualFirstName = txtEmployeeFirstName.Text.ToString(), IndividualSecondName = txtEmployeeSecondName.Text.ToString(), IndividualLastname = txtEmployeeLastName.Text.ToString(), } }; Dbconnection.Facilitators.Add(CurrentFaclilitator); Dbconnection.SaveChanges(); this.CurrentFaclilitator = (from a in Dbconnection.Facilitators where a.FacilitatorID == CurrentFaclilitator.FacilitatorID select a).FirstOrDefault <Facilitator>(); // Dbconnection.Entry(NewIndividual).Reference(a => a.LookupTitle).Load(); }; this.Close(); }
private void populateFacilitatorAddressDetails() { Facilitator CurrentFacilitator = (Facilitator)this.facilitatorBindingSource.Current; addressesBindingSource.DataSource = (from a in CurrentFacilitator.Individual.Addresses select a).ToList <Address>(); }
/// <summary> /// Initializes a new instance of the <see cref="ExperimentPage"/> class. /// </summary> /// <param name="name">The name.</param> public ExperimentPage(string name) { InitializeComponent(); Facilitator.UI = this; _experiment = Experiment.Load(name); Facilitator.RunExperiment(_experiment); }
/// <summary> /// 技术服务商个人信息并返回id /// </summary> /// <param name="fqualification"></param> /// <returns></returns> public int AddFacilitator(Facilitator_Qualification fqualification) { using (SqlSugarClient db = BaseDB.GetClient()) { Facilitator facilitator = new Facilitator() { ApplicantEmail = fqualification.ApplicantEmail, ApplicantName = fqualification.ApplicantName, CellPhone = fqualification.CellPhone, CompanyName = fqualification.CompanyName, ContactEmail = fqualification.ContactEmail, ContactName = fqualification.ContactName, ContactNumber = fqualification.ContactNumber, ContactPhone = fqualification.ContactPhone, CreditCode = fqualification.CreditCode, Email = fqualification.Email, Postcode = fqualification.Postcode, QualificationId = fqualification.QualificationId, RegistrationAddres = fqualification.RegistrationAddres, RegistrationCode = fqualification.RegistrationCode, RepresentativeName = fqualification.RepresentativeName, ServiceType = fqualification.ServiceType }; var result = db.Insertable <Facilitator>(facilitator).ExecuteReturnIdentity(); return(result); } }
//update facilitator password protected void UpdatePasswordBtn_Click(object sender, EventArgs e) { CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; CSS requestDirector = new CSS(); //get facilitator info Facilitator activeFac = new Facilitator(); activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name); activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID); //if valid password, update facilitator account with new hash if (activeFac.Password == requestDirector.CreatePasswordHash(oldPasswordtxt.Text, activeFac.Salt)) { activeFac.Password = requestDirector.CreatePasswordHash(Passwordtxt.Text, activeFac.Salt); if (requestDirector.UpdateFacilitator(activeFac)) { Pswdlbl.Text = "Account Password Updated"; } else { Pswdlbl.Text = "Account Password Update Failed"; } } }
private FacilitatorDetailViewModel GetDetailViewModel(Facilitator facilitator) { var detailViewModel = new FacilitatorDetailViewModel(); detailViewModel.Load(facilitator); return(detailViewModel); }
public async Task <IActionResult> Edit(int id, [Bind("FacilitatorId,Name,LastName,Observations")] Facilitator facilitator) { if (id != facilitator.FacilitatorId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(facilitator); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FacilitatorExists(facilitator.FacilitatorId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(facilitator)); }
public bool DeleteFacilitator(Facilitator fac) { bool Confirmation; FacilitatorDirector Controller = new FacilitatorDirector(); Confirmation = Controller.DeleteFacilitator(fac); return(Confirmation); }
public bool UpdateFacilitator(Facilitator newFacilitator) { bool Confirmation; FacilitatorDirector Controller = new FacilitatorDirector(); Confirmation = Controller.UpdateFacilitator(newFacilitator); return(Confirmation); }
public Facilitator GetFacilitator(int id) { Facilitator newFac = new Facilitator(); FacilitatorDirector Controller = new FacilitatorDirector(); newFac = Controller.GetFacilitator(id); return(newFac); }
public bool CreateFacilitator(Facilitator newFacilitator) { bool confirmation; FacilitatorDirector Controller = new FacilitatorDirector(); confirmation = Controller.CreateFacilitator(newFacilitator); return(confirmation); }
public ActionResult DeleteConfirmed(int id) { Facilitator facilitator = db.Facilitators.Find(id); db.Facilitators.Remove(facilitator); db.SaveChanges(); return(RedirectToAction("Index")); }
/// <summary> /// 修改账号信息 /// </summary> /// <param name="facilitator"></param> /// <returns></returns> public int UpdateFacilitator(Facilitator facilitator) { using (SqlSugarClient db = BaseDB.GetClient()) { var i = db.Updateable(facilitator).ExecuteCommand(); return(i); } }
//update facilitator account info protected void UpdateBtn_Click(object sender, EventArgs e) { CustomPrincipal cp = HttpContext.Current.User as CustomPrincipal; CSS requestDirector = new CSS(); //get facilitator info Facilitator activeFac = new Facilitator(); activeFac.FacilitatorID = Convert.ToInt32(cp.Identity.Name); activeFac = requestDirector.GetFacilitator(activeFac.FacilitatorID); //check if facilitator changed email if (Emailtxt.Text != activeFac.Email) { //if new email, check if email already in use if (requestDirector.GetFacilitatorByEmail(Emailtxt.Text).Email == default(string)) { activeFac.Email = Emailtxt.Text; activeFac.FirstName = FNametxt.Text; activeFac.LastName = LNametxt.Text; activeFac.Title = Titletxt.Text; activeFac.Organization = Orgtxt.Text; activeFac.Location = Loctxt.Text; if (requestDirector.UpdateFacilitator(activeFac)) { Msglbl.Text = "Account Information Updated"; } else { Msglbl.Text = "Account Information Update Failed"; } } else { Msglbl.Text = "That email is used by another account"; } } else { activeFac.Email = Emailtxt.Text; activeFac.FirstName = FNametxt.Text; activeFac.LastName = LNametxt.Text; activeFac.Title = Titletxt.Text; activeFac.Organization = Orgtxt.Text; activeFac.Location = Loctxt.Text; if (requestDirector.UpdateFacilitator(activeFac)) { Msglbl.Text = "Account Information Updated"; } else { Msglbl.Text = "Account Information Update Failed"; } } }
public Facilitator GetFacilitatorByEmail(string email) { Facilitator pullFacilitator = new Facilitator(); FacilitatorDirector Controller = new FacilitatorDirector(); pullFacilitator = Controller.GetFacilitatorByEmail(email); return(pullFacilitator); }
/// <summary> /// 显示用户详情信息 /// </summary> /// <returns></returns> public string UserInfo() { Facilitator facilitator = new Facilitator(); int id = RedisHelper.Get <UserInfo>("userinfo").UserInfoId; var list = JsonConvert.DeserializeObject <List <Facilitator> >(WebApiHelper.GetApiResult("get", "UserInfo", "GetList", null)).Find(m => m.Id == id); var info = JsonConvert.SerializeObject(list); return(info); }
public FacilitatorDetailViewModel Insert(FacilitatorInputModel inputModel) { FieldsValidations(inputModel); var facilitator = new Facilitator(inputModel.RestaurantId, inputModel.LaunchDate, inputModel.UserId); facilitator = _facilitatorService.Insert(facilitator); return(GetDetailViewModel(facilitator)); }
private void populateFacilitatorContactDetails() { Facilitator CurrentEmpolyeeObj = (Facilitator)facilitatorBindingSource.Current; List <ContactDetail> result = (from a in CurrentEmpolyeeObj.Individual.ContactDetails select a).ToList <ContactDetail>(); contactDetailsBindingSource.DataSource = result; }
public void GeneratePassword(Facilitator facilitator, string Password = "******") { using (var hmac = new System.Security.Cryptography.HMACSHA512()) { byte[] passwordSalt = hmac.Key; /*Currently this method uses a non secure version of semetric key enncryption*/ facilitator.PasswordSalt = passwordSalt; facilitator.Password = hmac.ComputeHash(Encoding.UTF8.GetBytes(Password)); } }
public async Task <IActionResult> Create([Bind("FacilitatorId,Name,LastName,Observations")] Facilitator facilitator) { if (ModelState.IsValid) { _context.Add(facilitator); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(facilitator)); }
public IActionResult RecieveUserData([FromBody] CreateDTO loginDTO) { Facilitator facilitator = userManager.DoesFacilitatorExist(loginDTO.Username); if (facilitator == null) { //userManager.CreateFacilitator(loginDTO.Username); return(Ok($"A Fascilitator with the email {facilitator.Email} has been created")); } return(Ok("A User With This Email Already Exists")); }
void Start() { isInit = true; isFinishedExpSliderAnimation = false; timeElapsed = 0.0f; // Exercise name exerciseName = GameObject.Find("ExerciseName"); exerciseCurName = TitleSceneManager.GetCurrentExerciseName(); // Avg time if (exerciseCurName == "Raise and Lower Exercise") { float tmp = (float)Facilitator.GetAvgProcessingTime() * 0.001f; avgTimeText.text = tmp.ToString("f1") + "(s)"; } else if (exerciseCurName == "Raise and Lower Exercise (Elbowless version)") { float tmp = (float)Facilitator4RL_Elbowless.GetAvgProcessingTime() * 0.001f; avgTimeText.text = tmp.ToString("f1") + "(s)"; } // Exp expSlider.value = 0.0f; if (exerciseCurName == "Raise and Lower Exercise") { TitleSceneManager.expCurValue += Facilitator.GetCurrentScore(); } else if (exerciseCurName == "Raise and Lower Exercise (Elbowless version)") { TitleSceneManager.expCurValue += Facilitator4RL_Elbowless.GetCurrentScore(); } expPercent = TitleSceneManager.expCurValue / expMaxValue; expCurValueText.text = (expMaxValue * expPercent).ToString(); expMaxValueText.text = (expMaxValue).ToString(); // Circle Slider if (exerciseCurName == "Raise and Lower Exercise") { circleSlider[0].Rate = Facilitator.GetAccuracyRate(); } else if (exerciseCurName == "Raise and Lower Exercise (Elbowless version)") { circleSlider[0].Rate = Facilitator4RL_Elbowless.GetAccuracyRate(); } circleSlider[1].Rate = 1.0f; circleSlider[2].Rate = 0.0f; // Audio audioSource = GetComponent <AudioSource>(); isFinishedAll = new bool[circleSlider.Length]; }
public ActionResult Create([Bind(Include = "Facilitator_ID,Facilitator_Name,Facilitator_Last_Name,Facilitator_Date_Of_Birth,GenderID,Facilitator_Phone,Facilitator_Email,Facilitator_Registration_Date,Facilitator_Biodata")] Facilitator facilitator) { if (ModelState.IsValid) { facilitator.Facilitator_Registration_Date = DateTime.Today; db.Facilitators.Add(facilitator); db.SaveChanges(); return(RedirectToAction("Create", "Facilitators")); } ViewBag.GenderID = new SelectList(db.Genders, "Gender_ID", "Gender_Name", facilitator.GenderID); return(View(facilitator)); }
public Facilitator ChangeRole(ChangeRoleDTO roleDTO) { Facilitator facilitator = Data.Facilitators.Where(w => w.FacilitatorID == roleDTO.FacilitatorId).FirstOrDefault(); if (facilitator == null) { return(facilitator); } facilitator.Role = roleDTO.NewRole; Data.Update(facilitator); Data.SaveChanges(); return(facilitator); }
// GET: Facilitators/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Facilitator facilitator = db.Facilitators.Find(id); if (facilitator == null) { return(HttpNotFound()); } return(View(facilitator)); }
private void btnSelectFacilitator_Click(object sender, EventArgs e) { frmStudentSearchForFacilitator frm = new frmStudentSearchForFacilitator(); frm.ShowDialog(); currentFacilitator = frm.CurrentFacilitator; if (currentFacilitator != null) { setFacilitatorDetails(); refreshDepartment(); refreshAvailableCourses(); refreshLinkedCourses(); } }