public static void updateProfileLow(LMComData2.User user, ProfileData profile) { writeProfileLow(user, profile.getAsString(), new ProfileDataCriteria(profile)); }
public static void WriteProfileEx(ProfileData data, bool saveAnonymous) { if (Machines.isBuildEACache_BuildCD_Crawler) return; if (data == null) throw new Exception(); if (!saveAnonymous && data.Id < 0) return; string s = data.getAsString(); bool isInsert = data.oldAsString == null; if (!isInsert && s == data.oldAsString) return; /*{ if (s == data.oldAsString) return; //data.Version = data.Version + 1; //s = data.getAsString(); //nova serializace kvuli zvyseni verze }*/ try { Instance.writeProfileLow(isInsert, s, new ProfileDataCriteria(data)); } catch (Exception exp) { if (exp == null) return; try { if (isInsert) Instance.writeProfileLow(false, s, new ProfileDataCriteria(data)); } catch { } } data.oldAsString = s; }
/// <summary> /// Zkontroluje, zdali se profil zmenil. Kdyz ano, ulozi jej /// </summary> public static void WriteProfile(ProfileData data) { WriteProfileEx(data, false); }
public static ProfileData getProfileFromCache(Int64 id) { ProfileData res = getProfileFromCache(HttpContext.Current); if (res != null && res.Id == id) return res; if (id < 0) { res = new ProfileData(); res.Id = id; res.Created = DateTime.UtcNow; } else res = readProfile(id); setProfileToCache(res); return res; }
public static void setProfileToCache(ProfileData data) { if (data == null) { HttpContext.Current.Items.Remove(c_ProfileKey); if (HttpContext.Current.Session != null) HttpContext.Current.Items.Remove(c_ProfileKey); return; } if (HttpContext.Current.Session == null) HttpContext.Current.Items[c_ProfileKey] = data; else HttpContext.Current.Session[c_ProfileKey] = data; }
public static ProfileData createProfileStart(Domains site) { ProfileData res = new ProfileData(); res.Created = DateTime.UtcNow; res.Site = site; //res.Version = 1; if (Machines.isBuildEACache_BuildCD_Crawler) { res.Id = 12345; } else { res.Id = getUniqueId(LMComDataProvider.uiUserId); res.Referer = HttpContext.Current.Request.UrlReferrer == null ? null : HttpContext.Current.Request.UrlReferrer.AbsolutePath; } return res; }
public static ProfileData readProfileEx(Int64 id, bool readAnonymous) { if (Machines.isBuildEACache_BuildCD_Crawler) { ProfileData res = new ProfileData(); res.Created = DateTime.UtcNow; //res.Version = 1; res.Id = -Math.Abs(id); return res; } if (!readAnonymous && id < 0) throw new Exception(); return fromString(Instance.readProfileLow(id)); }
public ProfileDataCriteria(ProfileData prof) { Id = prof.Id; Email = prof.Email == null ? null : prof.Email.ToLower(); Created = prof.Created; ActivationMailSent = prof.ActivationMailSent; Password = prof.Password; Roles = prof.Roles; //Version = prof.Version; Title = prof.Address.Title; Fulltext = prof.Fulltext; Type = prof.Type; Male = prof.Male; OtherType = prof.OtherType; OtherId = prof.OtherId; ICQ = prof.ICQ; FirstName = prof.Address.FirstName; LastName = prof.Address.LastName; Site = prof.Site; IpAddress = prof.IpAddress; Login = prof.Login; }
public static void loginProfile(ProfileData prof) { if (prof == null) return; //10.7.2009, nektere profily v DB maji Site=0, pro jistotu... urlInfo ui = urlInfo.GetUrlInfo(); if (ui != null) prof.Site = ui.SiteId; LMComDataProvider.setProfileToCache(prof); //PZ 12.7.08: cookie se pro noveho uzivatele musi vytvorit kompletne znova LMCookie cook = new LMCookie(); HttpContext.Current.Items[LowUtils.c_cookieName] = cook; cook.id = prof.Id; cook.EMail = prof.Anonymous ? null : prof.Email; cook.FirstName = prof.Address.FirstName; cook.LastName = prof.Address.LastName; cook.Login = prof.Login; cook.LoginEMail = prof.LoginEMail; cook.roles = prof.Roles == null ? 0 : (Int64)prof.Roles; cook.TypeId = prof.OtherId; cook.Type = prof.OtherType; LMStatus.saveCookie(HttpContext.Current); LMStatus.autenticate(cook); }
public static void loginAndSaveProfile(ProfileData prof) { loginProfile(prof); LMComDataProvider.WriteProfile(prof); }