public ActionResult Show_Profile() { PDBC db = new PDBC("PandaMarketCMS", true); db.Connect(); var id_Admin = Session["id_Admin"]; using (DataTable dt = db.Select($"SELECT [id_Admin],[ad_type_name],[ad_password],[ad_firstname],[ad_lastname],[ad_avatarprofile],[ad_email],[ad_phone],[ad_mobile],[ad_NickName]FROM [dbo].[tbl_ADMIN_main] inner join [dbo].[tbl_ADMIN_types] on [dbo].[tbl_ADMIN_main].ad_typeID = [dbo].[tbl_ADMIN_types].ad_typeID where [id_Admin] ={id_Admin.ToString()}")) { db.DC(); Session["pass"] = dt.Rows[0]["ad_password"].ToString(); profile data_pro = new profile() { ad_avatarprofile = dt.Rows[0]["ad_avatarprofile"].ToString(), ad_type_name = dt.Rows[0]["ad_type_name"].ToString(), ad_firstname = dt.Rows[0]["ad_firstname"].ToString(), ad_lastname = dt.Rows[0]["ad_lastname"].ToString(), ad_NickName = dt.Rows[0]["ad_NickName"].ToString(), ad_phone = dt.Rows[0]["ad_phone"].ToString(), ad_mobile = dt.Rows[0]["ad_mobile"].ToString(), ad_email = dt.Rows[0]["ad_email"].ToString() }; ViewBag.Show_Pro = data_pro; }; return(View()); }
private Dictionary <int, List <profile> > OrderProfilesByRank(out List <int> OrderedInduces) { Dictionary <int, List <profile> > profilesByRank = new Dictionary <int, List <profile> >(); List <profile> list; for (int i = 0; i < profiles.Count; i++) { profile p = profiles[i]; if (!profilesByRank.TryGetValue(p.rank.Value, out list)) { list = new List <profile>(); profilesByRank.Add(p.rank.Value, list); } list.Add(p); } OrderedInduces = new List <int>(profilesByRank.Keys); OrderedInduces.Sort(); //for (int i = 0; i < OrderedInduces.Count; i++) { // int index = OrderedInduces[i]; // yield return profilesByRank[index]; //} return(profilesByRank); }
private void CmdSave(Command Cmd) { if (this.ValidateChildren() == true) { profile p = this.ToProfile(); if (this.IsNew == true) { string sFileName = p.name.EndsWith(".xml", StringComparison.CurrentCultureIgnoreCase) == true ? p.name : p.name + ".xml"; if (Directory.Exists(AppCommon.Instance.PathProfiles) == false) { Directory.CreateDirectory(AppCommon.Instance.PathProfiles); } string sPath = Path.Combine(AppCommon.Instance.PathProfiles, sFileName); p.File = sPath; p.schemaVersion = AppCommon.Instance.MinAllowSchemaVersion; } XmlSerializer writer = new XmlSerializer(typeof(profile)); FileStream file = File.Create(pf.File); writer.Serialize(file, p); file.Close(); if (frmProfile.IsInstance == true) { if (this.MainWindow != null) { this.MainWindow.Init(); } this.Close(); } else { this.DialogResult = DialogResult.OK; } } }
public async Task update() { Isenabled = false; Patientdata patientdata = JsonConvert.DeserializeObject <Patientdata>(Settings.GeneralSettings) as Patientdata; var client = new HttpClient(); profile Profile = new profile(); Profile.Id = patientdata.ID; Profile.Email = Email; Profile.Username = Username; Profile.NationalId = NationalID; Profile.PhoneNumber = PhoneNumber; Profile.History = History; Profile.BloodType = BloodType; Profile.Birthdate = Birthdate; String Userdata = JsonConvert.SerializeObject(Profile); var content = new StringContent(Userdata, Encoding.UTF8, "application/json"); HttpResponseMessage response = await client.PutAsync(Helper.Settings.Ngrok + "Patient/UpdatePatientProfile", content); if (response.IsSuccessStatusCode) { DependencyService.Get <Toast>().Show("Data updated successfully"); } else { DependencyService.Get <Toast>().Show("Check Data Again"); } }
public static int authentification(profile prof) { int id = 0; try { Connexion con = new Connexion(); con.OpenConnection(); string req = "SELECT id FROM profile WHERE login='******' AND mdp='" + prof.MDP + "' AND etat=true ;"; ////MySql.Data.MySqlClient.MySqlCommand m1 = new MySql.Data.MySqlClient.MySqlCommand(req,con.connexion); ////m1.Connection.Open(); MySqlCommand cmd = new MySqlCommand(req, con.connexion); MySqlDataReader dt = cmd.ExecuteReader(); while (dt.Read()) { id = dt.GetInt16(0); } cmd.Connection.Close(); con.CloseConnection(); return(id); } catch (Exception e) { MessageBox.Show(e.Message + " 888 " + e.Data); return(-1); } }
public static profile GetProfileFromLogin(string log) { profile prof = new profile(); try { Connexion con = new Connexion(); con.OpenConnection(); string req = " SELECT id,login,mdp,mail,role,etat FROM profile WHERE login ='******';"; MySqlCommand cmd = new MySqlCommand(req, con.connexion); MySqlDataReader dt = cmd.ExecuteReader(); while (dt.Read()) { prof.ID = dt.GetInt16(0); prof.MDP = dt.GetString(1); prof.MAIL = dt.GetString(2); prof.ROLE = dt.GetString(3); prof.ETAT = dt.GetBoolean(4); } con.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); prof.ID = -1; return(null); } //MessageBox.Show("prof id"+prof.ID +" prof mail "+ prof.MAIL+" prof service "+prof.SERVICE ); return(prof); }
public IActionResult OnGet() { sUsername += "2"; Username = sUsername; industries = getIndustries(); products = getProducts(); string apiCode = "ERROR"; bool cookieFound = Request.Cookies.TryGetValue("UserAPICode", out apiCode); userData = getUserData(apiCode); //JsonConvert.DefaultSettings = () => new JsonSerializerSettings //{ // Converters = new List<JsonConverter> { new BigIntegerConverter() } //}; //sIndustries = JsonConvert.SerializeObject(industries); //sProducts = JsonConvert.SerializeObject(products); //sUserData = JsonConvert.SerializeObject(userData); if (userData.username != null) { return(Page()); } else { return(Redirect("BadCode")); } }
public void UpdateProfileAvailabilityTHS() { //Read data from excel data file ExcelLib.PopulateInCollection(Base.ExcelPath, "profile"); //string profileDescription = GlobalDefinitions.ExcelLib.ReadData(2, "Description"); //string profileLanguage = GlobalDefinitions.ExcelLib.ReadData(2, "Language"); string profileAvailabilityTime = GlobalDefinitions.ExcelLib.ReadData(2, "AvailabilityType"); string profileAvailabilityHours = GlobalDefinitions.ExcelLib.ReadData(2, "AvailabilityHours"); string profileSalaryExpected = GlobalDefinitions.ExcelLib.ReadData(2, "SalaryTarget"); profile profileObj = new profile(); profileObj.EditProfile(profileAvailabilityTime, profileAvailabilityHours, profileSalaryExpected); try { String ActualTitle = GlobalDefinitions.driver.Title; String ExpectedTitle = "Profile"; Assert.AreEqual(ExpectedTitle, ActualTitle); // validate availability time ex. part/full time String ExpectedAvailability = GlobalDefinitions.ExcelLib.ReadData(2, "AvailabilityType"); String ActualAvailability = "Full Time"; Assert.AreEqual(ExpectedAvailability, ActualAvailability); Base.test.Log(LogStatus.Info, "Profile validated successfully"); } catch (AssertionException) { //JoinBtn.Click(); Base.test.Log(LogStatus.Info, "Profile exception handeled successfully"); } }
public profile generatetoken(string email, string password) { string token = Guid.NewGuid().ToString(); DateTime createdon = DateTime.Now; DateTime expiredon = DateTime.Now.AddSeconds(50000000); var tokendomain = new profile { email = email, authtoken = token, createdon = createdon, expiredon = expiredon }; profile tk = new profile(); annuEntities3 sd = new annuEntities3(); tk = sd.profiles.Where(x => x.email == email & x.password == password).FirstOrDefault(); if (tk.email != null) { tk.authtoken = tokendomain.authtoken; tk.createdon = tokendomain.createdon; tk.expiredon = tokendomain.expiredon; sd.SaveChanges(); } return(tokendomain); }
private void Traverse(profile p, int currentCheckedLevel, bool depthFirst, Action <bool, profile, profile> callback) { List <profile> uncheckedProfiles = null; if (depthFirst) { uncheckedProfiles = new List <profile>(); } for (int i = 0; i < p.forward.Count; i++) { profile f = p.forward[i]; if (f.Checked(currentCheckedLevel)) { continue; } callback.Invoke(true, p, f); if (depthFirst) { uncheckedProfiles.Add(f); } else { Traverse(f, currentCheckedLevel, false, callback); } } for (int i = 0; i < p.backward.Count; i++) { profile b = p.backward[i]; if (b.Checked(currentCheckedLevel)) { continue; } callback.Invoke(false, p, b); if (depthFirst) { uncheckedProfiles.Add(b); } else { Traverse(b, currentCheckedLevel, false, callback); } } if (depthFirst) { for (int i = 0; i < uncheckedProfiles.Count; i++) { Traverse(uncheckedProfiles[i], currentCheckedLevel, true, callback); } } }
public ActionResult DeleteConfirmed(int id) { profile profile = db.profiles.Find(id); db.profiles.Remove(profile); db.SaveChanges(); return(RedirectToAction("Index")); }
public void updprofile() { // Creates a toggle for the given test, adds all log events under it test = extent.StartTest("profile", "verify user able to updateprofile in Grabone"); profile proobj = new profile(); proobj.updateprofilebutton(); }
/// <summary> /// Constructor used to populate this object from an xml deserialized version of same data /// </summary> public FacebookProfile(profile p) { this.id = p.id; this.name = p.name; this.pic_square = p.pic_square; this.url = p.url; this.type = p.type; }
private static void DisplayProfile(profile p) { WriteLine("Profile Details:"); WriteLine("Hello, " + p.name + ", Ho Ho Ho!"); WriteLine("I bet it's cold up in " + p.Town); WriteLine("I see you've been a " + p.Good + " " + p.Gender + " this year!"); WriteLine(); WriteLine("Have a belting Christmas. Love, Santa!"); }
private static bool Sizing_PrepareDocument(string path_TBD, bool excludeOutdoorAir = true) { if (string.IsNullOrWhiteSpace(path_TBD) || !global::System.IO.File.Exists(path_TBD)) { return(false); } bool result = false; using (SAMTBDDocument sAMTBDDocument = new SAMTBDDocument(path_TBD)) { TBDDocument tBDDocument = sAMTBDDocument.TBDDocument; Building building = tBDDocument?.Building; if (building != null) { SizingType sizingType = SizingType.tbdSizing; List <zone> zones = building.Zones(); foreach (zone zone in zones) { zone.sizeCooling = (int)sizingType; zone.sizeHeating = (int)sizingType; zone.maxCoolingLoad = 0; zone.maxHeatingLoad = 0; } List <TBD.InternalCondition> internalConditions = building.InternalConditions(); for (int i = internalConditions.Count - 1; i >= 0; i--) { TBD.InternalCondition internalCondition = building.GetIC(i); if (internalCondition.name.EndsWith("HDD")) { if (excludeOutdoorAir) { profile profile = internalCondition.GetInternalGain()?.GetProfile((int)Profiles.ticV); if (profile != null) { profile.factor = 0; } } //while (internalCondition.GetZone(0) != null) //{ // zone zone = internalCondition.GetZone(0); // zone.AssignIC(internalCondition, false); //} } } sAMTBDDocument.Save(); result = true; } } return(result); }
public ActionResult Edit([Bind(Include = "id,profile_name")] profile profile) { if (ModelState.IsValid) { db.Entry(profile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profile)); }
public async Task <ActionResult> DeleteConfirmed(int id) { profile pro = await db.profile.FindAsync(id); pro.status = 0; db.Entry(pro).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
// // GET: /Admin/profile/ public ActionResult Index() { List <profile> imagelst = new List <profile>(); SqlDataReader rdr = null; var profileinfo = new profile(); TempData["userId"] = System.Web.HttpContext.Current.Session["userId"]; TempData["userName"] = System.Web.HttpContext.Current.Session["userName"]; ViewBag.sectionName = "Dashboard"; string cs = ConfigurationManager.ConnectionStrings["cs"].ConnectionString; SqlConnection con = new SqlConnection(cs); con.Open(); string usersp2 = "sp_ProfileInfo"; SqlCommand cmd4 = new SqlCommand(usersp2, con); cmd4.CommandType = CommandType.StoredProcedure; cmd4.Parameters.AddWithValue("@empid", System.Web.HttpContext.Current.Session["userId"]); //cmd4.ExecuteNonQuery(); // MISSING //getting reference_user_Id try { rdr = cmd4.ExecuteReader(); // iterate through results, printing each to console while (rdr.Read()) { profileinfo = new profile { sponsorid = rdr["sponsor_id"].ToString(), userid = rdr["user_id"].ToString(), pin = rdr["pin_no"].ToString(), city = rdr["city"].ToString(), pancardno = rdr["pancardno"].ToString(), state = rdr["state"].ToString(), nominee = rdr["nomineename"].ToString(), address = rdr["address"].ToString(), name = rdr["name"].ToString(), mobileno = rdr["mobileno"].ToString(), password = rdr["user_pw"].ToString(), bankname = rdr["bankaccount"].ToString(), accountno = rdr["accountno"].ToString(), holdername = rdr["holdername"].ToString(), ifsccode = rdr["ifsccode"].ToString(), }; } rdr.Close(); } catch (Exception e1) { //reference_user_id = null; } return(View(profileinfo)); }
public void GivenIAddOrUpdateTheDescriptionOnProfilePage() { // ScenarioContext.Current.Pending(); //Read data from excel data file ExcelLib.PopulateInCollection(ExcelPath, "profile"); string profileDescription = ExcelLib.ReadData(2, "Description"); // Add/edit/update description profile profileObj = new profile(); profileObj.EditProfileDesc(profileDescription); }
private profile getUserData(string code) { var deserializer = new XmlSerializer(typeof(profile)); profile root = null; using (var reader = XmlReader.Create(new StringReader(getXML("https://businessgame.be/xml/profile/" + code + ".xml")))) { root = (profile)deserializer.Deserialize(reader); } return(root); }
public ActionResult Create([Bind(Include = "id,profile_name")] profile profile) { if (ModelState.IsValid) { db.profiles.Add(profile); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(profile)); }
public IHttpActionResult update(profile p) { using (var db = new annuEntities2()) { var pro = (from pr in db.profiles where p.id == pr.id select pr).FirstOrDefault(); pro.email = p.email; pro.password = p.password; db.SaveChanges(); } return(Ok()); }
public void GivenIEditOrUpdateLanguageOnProfilePage() { //Read data from excel data file ExcelLib.PopulateInCollection(Base.ExcelPath, "profile"); string profileLangName = ExcelLib.ReadData(2, "Language"); string profileLangLevel = ExcelLib.ReadData(2, "LangLevel"); // edit/update language name and level profile profileObj = new profile(); profileObj.EditProfileLang(profileLangName, profileLangLevel); }
public ProfileModel Create(profile profile) { return(new ProfileModel() { Id = profile.Id, ProfileId = profile.ProfileId, Firstname = profile.Firstname, Lastname = profile.Lastname, DOB = profile.DOB, Contact = profile.contacts.Select(C => Create(C)) }); }
public ActionResult show_user() { PDBC db = new PDBC("PandaMarketCMS", true); var id_Admin = Session["id_Admin1"]; string ad_typeID = " "; db.Connect(); using (DataTable dt = db.Select($"SELECT [id_Admin],[ad_typeID],[ad_typeID],[ad_password],[ad_firstname],[ad_lastname],[ad_avatarprofile],[ad_email],[ad_phone],[ad_mobile],[ad_NickName],[ad_personalColorHexa] FROM [dbo].[tbl_ADMIN_main] where [id_Admin] ={id_Admin.ToString()}")) { Session["pass"] = dt.Rows[0]["ad_password"].ToString(); ad_typeID = dt.Rows[0]["ad_typeID"].ToString(); ModelFiller MF = new ModelFiller(); profile data_pro = new profile() { ad_avatarprofile = MF.AppendServername(dt.Rows[0]["ad_avatarprofile"].ToString()), ad_type_name = dt.Rows[0]["ad_typeID"].ToString(), ad_firstname = dt.Rows[0]["ad_firstname"].ToString(), ad_lastname = dt.Rows[0]["ad_lastname"].ToString(), ad_NickName = dt.Rows[0]["ad_NickName"].ToString(), ad_phone = dt.Rows[0]["ad_phone"].ToString(), ad_mobile = dt.Rows[0]["ad_mobile"].ToString(), ad_email = dt.Rows[0]["ad_email"].ToString(), ad_personalColorHexa = dt.Rows[0]["ad_personalColorHexa"].ToString(), ad_Types = MF.AdminTypes() }; ViewBag.Show_Pro = data_pro; } using (DataTable dt = db.Select($"SELECT [ad_typeID],[rulerouteID],(SELECT [ruleRouteURL]FROM [PandaMarketCMS].[dbo].[tbl_ADMIN_ruleRoutes_Main]where [rulerouteID]=[PandaMarketCMS].[dbo].[tbl_ADMIN_types_ruleRoute_Connection].[rulerouteID])as[ruleRouteURL],[HasAccess]FROM [PandaMarketCMS].[dbo].[tbl_ADMIN_types_ruleRoute_Connection] where [ad_typeID] ={ad_typeID}")) { for (int i = 0; i < dt.Rows.Count; i++) { data_ADMIN = new ADMIN_types_ruleRoute_Connection(); data_ADMIN.ad_typeID = dt.Rows[i]["ad_typeID"].ToString(); data_ADMIN.HasAccess = dt.Rows[i]["HasAccess"].ToString(); data_ADMIN.rulerouteID = dt.Rows[i]["rulerouteID"].ToString(); data_ADMIN.ruleRouteURL = dt.Rows[i]["ruleRouteURL"].ToString(); list_ADMIN.Add(data_ADMIN); } ViewBag.Show_ADMIN = list_ADMIN; } db.DC(); return(View()); }
public IHttpActionResult delete(int id) { profile p = new profile(); p.id = id; using (var db = new annuEntities2()) { var pro = (from pr in db.profiles where p.id == pr.id select pr).FirstOrDefault(); db.profiles.Remove(pro); db.SaveChanges(); } return(Ok()); }
public ActionResult Edit([Bind(Include = "id_user,name,sername,birth,avatar,about,id_sex,id_country")] profile profile) { if (ModelState.IsValid) { db.Entry(profile).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.id_country = new SelectList(db.countries, "id_country", "name", profile.id_country); ViewBag.id_sex = new SelectList(db.sexs, "id_sex", "name", profile.id_sex); ViewBag.id_user = new SelectList(db.users, "id_user", "login", profile.id_user); return(View(profile)); }
public ActionResult profile() { string user = Request.Cookies["userName"].Value; mycontext data = new mycontext(); var DB = data.users.FirstOrDefault(m => m.UserName == user); profile pf = new profile(); pf.ferstname = DB.ferstname; pf.LastName = DB.LastName; pf.UserName = DB.UserName; pf.email = DB.email; return(View(pf)); }
public JsonResult GetDetails(string searchId) { List <profile> imagelst = new List <profile>(); SqlDataReader rdr = null; var profileinfo = new profile(); string cs = ConfigurationManager.ConnectionStrings["cs"].ConnectionString; SqlConnection con = new SqlConnection(cs); con.Open(); string usersp2 = "sp_ProfileInfo"; SqlCommand cmd4 = new SqlCommand(usersp2, con); cmd4.CommandType = CommandType.StoredProcedure; cmd4.Parameters.AddWithValue("@empid", searchId); //cmd4.ExecuteNonQuery(); // MISSING //getting reference_user_Id try { rdr = cmd4.ExecuteReader(); // iterate through results, printing each to console while (rdr.Read()) { profileinfo = new profile { sponsorid = rdr["sponsor_id"].ToString(), userid = rdr["user_id"].ToString(), pin = rdr["pin_no"].ToString(), city = rdr["city"].ToString(), pancardno = rdr["pancardno"].ToString(), state = rdr["state"].ToString(), nominee = rdr["nomineename"].ToString(), address = rdr["address"].ToString(), name = rdr["name"].ToString(), mobileno = rdr["mobileno"].ToString(), password = rdr["user_pw"].ToString(), bankname = rdr["bankaccount"].ToString(), accountno = rdr["accountno"].ToString(), holdername = rdr["holdername"].ToString(), ifsccode = rdr["ifsccode"].ToString(), }; } rdr.Close(); } catch (Exception e1) { //reference_user_id = null; } return(Json(profileinfo, JsonRequestBehavior.AllowGet)); }
// GET: profiles/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } profile profile = db.profiles.Find(id); if (profile == null) { return(HttpNotFound()); } return(View(profile)); }
/// <summary> /// Метод, возвращающий массив пользовательского типа /// profile с полями uid, f_name, l_name, online. /// Создаёт в папке с программой файл списка контактов. /// </summary> public void getProfiles() { string s = ""; StreamReader list; WebClient webClient = new WebClient(); Hashtable jsonResp = new Hashtable(); profile userProf = new profile(); vars.VARS.SmallPhoto.ColorDepth = ColorDepth.Depth32Bit; vars.VARS.SmallPhoto.ImageSize = new Size(26, 26); WebClient user = new WebClient(); string uri = url + "friends.get?" + "fields=uid,first_name,last_name,online,photo" + "&access_token=" + vars.VARS.Token; try { if (!Directory.Exists(vars.VARS.Directory)) { Directory.CreateDirectory(vars.VARS.Directory); } if (vars.VARS.UpdateFriends) if (File.Exists(vars.VARS.Directory + "сontact.pro")) { if (File.Exists(vars.VARS.Directory + "contact.last")) File.Delete(vars.VARS.Directory + "contact.last"); File.Move(vars.VARS.Directory + "сontact.pro", vars.VARS.Directory + "contact.last"); } user.DownloadFile(uri, vars.VARS.Directory + "сontact.pro"); // загружаем файл со списком контактов list = new StreamReader(vars.VARS.Directory + "сontact.pro"); s = list.ReadToEnd(); // читаем файл list.Close(); } catch (WebException exe) { GeneralMethods.WriteError(exe.Source, exe.Message, exe.TargetSite); MessageBox.Show("Не удалось загрузить с сервера список контактов! Проверьте подключение!\nДанные ошибки записаны в errors.txt", "Ошибка сети!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (s != "" && s.IndexOf("error") == -1) { jsonResp = (Hashtable)JSON.JsonDecode(s); ArrayList users = (ArrayList)jsonResp["response"]; foreach (Hashtable item in users) { userProf.uid = Convert.ToUInt32(item["uid"]); userProf.f_name = Convert.ToString(item["first_name"]); userProf.l_name = Convert.ToString(item["last_name"]); userProf.online = Convert.ToBoolean(item["online"]); userProf.photo = Convert.ToString(item["photo"]); vars.VARS.Contact.Add(userProf.uid, userProf); if (vars.VARS.Frequency) vars.VARS.FrequencyUse.Add(userProf.uid, 0); } if (!Directory.Exists(vars.VARS.Directory)) Directory.CreateDirectory(vars.VARS.Directory + "photo"); } }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { profile n = new profile(); n.username = username; n.password = password; n.email = email; n.verificationpending = true; n.verficationpendingdatetime = DateTime.Now; var ctx = new QuaackEntities(); ctx.profile.Add(n); ctx.SaveChanges(); var link = string.Format("http://*****:*****@gmail.com", n.email, "Welkom", link); mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.EnableSsl = true; smtp.Port = 587; System.Net.NetworkCredential c = new System.Net.NetworkCredential(); c.UserName = "******"; //Password hardcoded. Andere manier verzinnen. c.Password = "******"; smtp.Credentials = c; // Exception handling toevoegen. smtp.Send(mail); status = MembershipCreateStatus.Success; return GetUser(username, true); }
public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { profile n = new profile(); n.username = username; n.password = password; n.email = email; n.avatarlocation = "~/Images/default/threatened_duck.jpg"; n.verificationpending = true; n.verficationpendingdatetime = DateTime.Now; var ctx = new QuaackEntities(); ctx.profile.Add(n); ctx.SaveChanges(); var link = string.Format("http://Quaack.system-Engineer.nl:8080/CheckMe.aspx?id={0}", n.profileid.ToString()); MailMessage mail = new MailMessage("*****@*****.**", n.email, "Welkom, klik binnen 10 minuten op de link ter activatie.", link); mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient("smtp.gmail.com"); smtp.EnableSsl = true; smtp.Port = 587; System.Net.NetworkCredential c = new System.Net.NetworkCredential(); c.UserName = "******"; //Password hardcoded. Andere manier verzinnen. c.Password = "******"; smtp.Credentials = c; try { smtp.Send(mail); } catch (Exception e) { //console vervangen door label Console.Write(e); } status = MembershipCreateStatus.Success; return GetUser(username, false); }