protected override bool writeProfileLow(bool isInsert, string data, ProfileDataCriteria crit) { if (Machines.isBuildEACache_BuildCD_Crawler) return true; LMComDataContext db = Machines.getContext(); User usr; //new DebugEvent(isInsert.ToString() + "," + crit.Id.ToString() + "," + crit.Email, 1).Raise(); if (isInsert) { usr = new User(); db.Users.InsertOnSubmit(usr); } else usr = db.Users.First<User>(u => u.Id == crit.Id); writeProfileLow(usr, data, crit); if (usr.EMail == null && usr.Login==null) { new ErrorEvent(System.Diagnostics.TraceLevel.Error, TraceCategory.All, "writeProfileLow: email==null, userId=" + usr.Id.ToString()).Raise(); return false; } db.SubmitChanges(); //usr.Save(); return true; }
protected abstract bool writeProfileLow(bool isInsert, string data, ProfileDataCriteria crit);
static void writeProfileLow(User usr, string data, ProfileDataCriteria crit) { usr.Id = crit.Id; usr.EMail = crit.Email == null ? null : crit.Email.ToLower(); usr.Password = crit.Password; usr.Created = crit.Created; usr.LastRequest = usr.Created; if (usr.Created < minValue) usr.Created = minValue; usr.ActivationMailSent = crit.ActivationMailSent; usr.Roles = crit.Roles; usr.Version = 0; // crit.Version; usr.Title = crit.Title; usr.Type = (short)crit.Type; usr.Fulltext = crit.Fulltext; usr.Male = crit.Male; usr.Data = data; usr.FirstName = crit.FirstName; usr.LastName = crit.LastName; usr.Icq = crit.ICQ; usr.Login = crit.Login; if (crit.OtherType != OtherType.no) { usr.OtherType = (short)crit.OtherType; usr.OtherId = crit.OtherId; } usr.Site = (short)crit.Site; usr.IpAddress = crit.IpAddress; }