public static void Update(int idPhotographer) { int idPh = Session().Id; if (idPh == idPhotographer) { return; } DataTable dt = new DataTable(); int r = new Core.DB.Photographer().P..._...(idPhotographer, ref dt); if (r < 0) { return; } if (dt.Rows.Count == 0) { return; } Photographer ph = Session(); ph.Id = idPhotographer; ph.FirstName = dt.Rows[0][""].ToString(); ph.LastName = dt.Rows[0][""].ToString(); ph.Email = dt.Rows[0][""].ToString(); string phImage = dt.Rows[0]["pi"].ToString(); if (!string.IsNullOrWhiteSpace(phImage)) { ph.Image = Core.Pictures.SolveImageUrl(..., true); } else { ph.Image = Core.Pictures.SolveImageUrl(-1, false); } List <PhAvailabilityDay> phal = new List <PhAvailabilityDay>(); for (int i = 1; i <= 7; i++) { PhAvailabilityDay pha = new PhAvailabilityDay(...); phal.Add(pha); } ph.PhAvailability = phal; System.Web.HttpContext.Current.Session["..."] = ph; var j = Models.Job.Session(); j.PhotographerId = idPhotographer; Models.Job.Update(j); }
public static DateTime Session() { DateTime sd = Job.Session().SessionDateTime; if (sd.Year <= 2000) { sd = DateTime.Now.AddDays(3); for (int i = 1; i <= 7; i++) { if (Photographer.AvailableDate(sd.AddDays(i))) { sd = sd.AddDays(i); break; } } } return(sd); }