public static string getCID() { string CID = "000000"; try { Models.EF.LocationMaster location = (Models.EF.LocationMaster)HttpContext.Current.Session["location"]; if (location != null) { CID = location.CID; } } catch (Exception e) { Elmah.ErrorSignal.FromCurrentContext().Raise(e); } return(CID); }
public static Models.EF.LocationMaster getUserLocation(string uc) { Models.EF.LocationMaster location = null; using (Models.EF.AprManager _db = new Models.EF.AprManager()) { try { if (string.IsNullOrEmpty(uc) == false) { location = (from x in _db.LocationMasters where x.CID == uc select x).First(); } } catch (Exception e) { Elmah.ErrorSignal.FromCurrentContext().Raise(e); } } return(location); }
private void mapUserLocation() { string uc = Request.QueryString["UC"]; if (string.IsNullOrEmpty(uc) == false) { Models.EF.LocationMaster location = Helpers.UserActivity.getUserLocation(uc); if (location != null) { try { Response.Cookies["APRKeepMeIn"]["IPAddress"] = Helpers.UserActivity.getIPAdress(); Response.Cookies["APRKeepMeIn"]["CID_Print"] = location.CID; Response.Cookies["APRKeepMeIn"]["CorporateName"] = location.Name.Trim(); Response.Cookies["APRKeepMeIn"]["lastVisit"] = DateTime.Now.ToShortDateString() + DateTime.Now.ToShortTimeString(); Response.Cookies["APRKeepMeIn"].Expires = DateTime.Now.AddYears(2); } catch (Exception e) { Elmah.ErrorSignal.FromCurrentContext().Raise(e); } } } }