Exemple #1
0
        private void AppLogin(HttpContext context)
        {
            string user  = context.Request.Params["user"];
            string pass  = context.Request.Params["pass"];
            string match = Common.GetHash(pass);
            var    obj   = (from o in GetEyeShadowContext2.AppUsers
                            where (o.Email == user || o.Name == user) && o.Password == match
                            select new
            {
                o.Email,
                o.Name,
                o.Avatar,
                o.ID
            }).SingleOrDefault();

            if (obj == null)
            {
                context.Response.Write("Invalid Email Address and/or Password");
            }
            else
            {
                CookieUtil.WriteCookie(Common.AuthCookie, EncDec.Encrypt(JsonConvert.SerializeObject(new { ID = obj.ID }), Common.DefaultPassword), false);
                CookieUtil.WriteCookie(Common.InfoCookie, JsonConvert.SerializeObject(new
                {
                    email  = obj.Email,
                    name   = obj.Name,
                    avatar = string.IsNullOrWhiteSpace(obj.Avatar) ? null : Common.UploadedImageRelPath + obj.Avatar
                }), false);
                GetEyeShadowContext3.UpdatePoints(obj.ID, Common.SessionID).Execute();
                JObject jobj   = JObject.Parse(context.Server.UrlDecode(CookieUtil.ReadCookie(Common.sessioncookie)));
                int?    points = (from o in GetEyeShadowContext4.AppUsers where o.ID == obj.ID select o.Points).First();
                var     ids    = (from o in GetEyeShadowContext4.Reviews where o.ID == obj.ID select o.BIMID);
                jobj["pts"] = JObject.FromObject(new
                {
                    ids,
                    total = points
                });
                CookieUtil.WriteCookie(Common.sessioncookie, jobj.ToString(), false);
            }
        }
Exemple #2
0
        private void SaveEditBoard(HttpContext context)
        {
            int    boardid  = int.Parse(context.Request.Params["boardid"]);
            string catid    = context.Request.Params["catid"];
            string name     = context.Request.Params["name"];
            JArray removebc = JArray.Parse(context.Request.Params["removebc"]);
            JArray bc       = JArray.Parse(context.Request.Params["bc"]);

            using (TransactionScope ts = new TransactionScope())
            {
                try
                {
                    foreach (JObject obj in removebc)
                    {
                        GetEyeShadowContext3.DeleteBoardContributor((string)obj["Name"], boardid).Execute();
                    }
                    foreach (JObject obj in bc)
                    {
                        GetEyeShadowContext3.AddBoardContributor((string)obj["Name"], boardid).Execute();
                    }
                    SubSonic.POCOS.Board board = GetEyeShadowContext3.Boards.SingleOrDefault(o => o.ID == boardid);
                    if (!string.IsNullOrEmpty(catid) && catid != _null)
                    {
                        board.CatID = int.Parse(catid);
                    }
                    board.Name = name;
                    board.Save();
                    ts.Complete();
                }
                catch (Exception ex)
                {
                    context.Response.WriteError(ex.Message);
                }
                finally
                {
                    ts.Dispose();
                }
            }
        }
Exemple #3
0
        private void DeletePin(HttpContext context)
        {
            int BIMID = int.Parse(context.Request.Params["BIMID"]);

            GetEyeShadowContext3.DeletePin(BIMID, Common.UserID.Value);
        }
Exemple #4
0
        private void DelBoard(HttpContext context)
        {
            int boardid = int.Parse(context.Request.Params["boardid"]);

            GetEyeShadowContext3.DeleteBoard(boardid).Execute();
        }