Пример #1
0
        public JsonResult /*string*/ Create(string U_UserName, string U_UserPassWord, string U_UserEmail, string Verification_Code)
        {
            try
            {
                using (剧享网Entities db = new 剧享网Entities())
                {
                    if (Verification_Code != Session["Digital"].ToString())
                    {
                        return(Json("验证码错误"));
                    }
                    // TODO: Add insert logic here

                    T_User user = new T_User();
                    user.R_Id           = "R1";
                    user.U_RoleIsOpen   = 1;
                    user.U_HeadImgPath  = "dragonball.jpg";//注册时默认一个头像
                    user.U_UserName     = U_UserName;
                    user.U_UserPassWord = U_UserPassWord;
                    user.U_UserTelNum   = null;
                    user.U_Email        = U_UserEmail;
                    user.U_SendSpace    = 1024 * 1024 * 50;//默认为50M可使用
                    user.U_RegisterTime = DateTime.Now;
                    //将输入的数据放入表中
                    db.T_User.Add(user);
                    //将放入表中的数据进行保存,完成数据改动实现
                    db.SaveChanges();
                    return(Json("注册成功"));
                }
            }
            catch (Exception e)
            {
                string message = e.Message;
                return(Json(message));
            }
        }
Пример #2
0
 public void ClickFunction(string click, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取send点击事件进行操作
         var   GetClick = from list in db.T_Function where list.F_SubId == "3F3" && list.F_Function == "ClickFunction" && list.F_FatherId == "2F3" select list;
         Int32 ClickId  = 0;
         foreach (var list in GetClick)
         {
             ClickId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindClick = db.T_Function.Find(ClickId);
         if (click == "启用")
         {
             GetFindClick.F_IsOpen = 1;
             GetManInfo("ClickFunction", null, "1");
             NotifyInfo("点赞功能被管理员启用,现在所有用户可以为用户的发布信息进行点赞反对", "系统公告:", 0, null, null);
         }
         if (click == "禁止")
         {
             GetFindClick.F_IsOpen = 0;
             GetManInfo("ClickFunction", null, "0");
             NotifyInfo("点赞功能被管理员禁用,现在所有用户禁止为用户的发布信息进行点赞反对", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
 //更新浏览数
 public void UpdateViewCount(string AuthorName, int W_Id, string WorkName, string WorkTime)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取文章内容
         var Info = from currentinfo in db.T_SendWork where currentinfo.U_UserName == AuthorName && currentinfo.W_Id == W_Id && currentinfo.S_WorkName == WorkName && currentinfo.S_SendTime == WorkTime select currentinfo;
         //作者名
         string userName = null;
         //当前的浏览数
         int ViewCount = 0;
         //信息id,用于更新数据
         int InfoId = 0;
         foreach (var info in Info)
         {
             userName  = info.U_UserName;
             ViewCount = info.S_WorkViewCount;
             InfoId    = info.S_InfoId;
         }
         //用户不登录也可以访问,但没有浏览增加
         try
         {
             //如果是本人访问自己的文章则不修改浏览数
             if (userName == Session["UserName"].ToString())
             {
                 return;
             }
         }
         catch { return; }
         var UpdateViewCount = db.T_SendWork.Find(InfoId);
         UpdateViewCount.S_WorkViewCount = (++ViewCount);
         db.SaveChanges();
     }
 }
Пример #4
0
        public List <T_AgreeDisagree> CountInfo(int U_Id, int W_Id, int C_InfoId)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                List <T_AgreeDisagree> Count = new List <T_AgreeDisagree>();
                var GetCountInfo             = from countinfo in db.T_AgreeDisagree where countinfo.A_InfoId == C_InfoId && countinfo.U_Id == U_Id && countinfo.W_Id == W_Id select countinfo;
                int GetCountInfoCount        = (from countinfocount in db.T_AgreeDisagree where countinfocount.A_InfoId == C_InfoId && countinfocount.U_Id == U_Id && countinfocount.W_Id == W_Id select countinfocount).Count();
                if (GetCountInfoCount == 0)
                {
                    T_AgreeDisagree agreeDisagree = new T_AgreeDisagree();
                    agreeDisagree.A_AgreeCount    = 0;
                    agreeDisagree.A_DisAgreeCount = 0;
                    Count.Add(agreeDisagree);
                    return(Count);
                }

                foreach (var tem in GetCountInfo)
                {
                    T_AgreeDisagree agreeDisagree = new T_AgreeDisagree();
                    agreeDisagree.A_AgreeCount    = tem.A_AgreeCount;
                    agreeDisagree.A_DisAgreeCount = tem.A_DisAgreeCount;
                    Count.Add(agreeDisagree);
                }
                return(Count);
            }
        }
Пример #5
0
 public void Notify(string notify, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取send点击事件进行操作
         var   GetNotify = from list in db.T_Function where list.F_SubId == "3F5" && list.F_Function == "Notify" && list.F_FatherId == "2F3" select list;
         Int32 NotifyId  = 0;
         foreach (var list in GetNotify)
         {
             NotifyId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindNotifyId = db.T_Function.Find(NotifyId);
         if (notify == "启用")
         {
             GetFindNotifyId.F_IsOpen = 1;
             GetManInfo("Notify", null, "1");
             NotifyInfo("通知功能被管理员启用,现在管理员可以发布通知信息", "系统公告:", 0, null, null);
         }
         if (notify == "禁止")
         {
             GetFindNotifyId.F_IsOpen = 0;
             GetManInfo("Notify", null, "0");
             NotifyInfo("通知功能被管理员禁用,现在管理员禁止发布通知信息", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
Пример #6
0
 public string ModifyRole_Select(string OptionRadio, FormCollection collection)
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             //获取用户角色
             string username = collection["UserName"];
             string telnum   = collection["TelNum"];
             if (username == "" || telnum == "")
             {
                 return("用户名、电话号码不能为空");
             }
             //通过对应用户的用户名和电话号码查询其角色编号
             var    SelectR_Id = from selectId in db.T_User where selectId.U_UserName == username && selectId.U_UserTelNum == telnum select selectId;
             string R_Id       = null;
             foreach (var selectid in SelectR_Id)
             {
                 R_Id = selectid.R_Id;
             }
             //通过其角色编号查询对应的角色
             var    SelectRole = from selectrole in db.T_Role where selectrole.R_Id == R_Id select selectrole;
             string Role       = null;
             foreach (var selectrole in SelectRole)
             {
                 Role = selectrole.R_role;
             }
             //返回角色
             return(Role);
         }
     }
     catch {
         return("error");
     }
 }
Пример #7
0
 public List <int> WebInitGetAgreeCount(string AuthorName, int W_Id, string WorkName, string WorkTime)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         var selectinfo = from info in db.T_SendWork where info.U_UserName == AuthorName && info.S_WorkName == WorkName && info.W_Id == W_Id && info.S_SendTime == WorkTime select info;
         int U_Id       = 0;
         int S_InfoId   = 0;
         foreach (var info in selectinfo)
         {
             U_Id     = info.U_Id;
             S_InfoId = info.S_InfoId;
         }
         var list     = new List <int>();
         var Count    = from count in db.T_AgreeDisagree where count.U_Id == U_Id && count.A_InfoId == S_InfoId && count.W_Id == W_Id select count;
         int CountCal = (from countcal in db.T_AgreeDisagree where countcal.U_Id == U_Id && countcal.A_InfoId == S_InfoId && countcal.W_Id == W_Id select countcal).Count();
         if (CountCal == 0)
         {
             list.Add(0);
             list.Add(-1);
             list.Add(0);
             return(list);
         }
         foreach (var count in Count)
         {
             list.Add(count.A_AgreeCount);
             list.Add(-1);
             list.Add(count.A_DisAgreeCount);
         }
         return(list);
     }
 }
Пример #8
0
 public ActionResult LogOut(FormCollection collection)
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             string username = (string)Session["UserName"];
             string password = (string)Session["PassWord"];
             //通过对应用户名和密码选出对应用户的所有信息
             var SelectUser = from user in db.T_User where user.U_UserName == username && user.U_UserPassWord == password select user;
             int U_Id       = 0;
             //获取选出的用户的ID
             foreach (var user in SelectUser)
             {
                 U_Id = user.U_Id;
             }
             //保存修改记录
             db.SaveChanges();
             Session["UserName"] = null;
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         return(RedirectToAction("Index"));
     }
 }
Пример #9
0
 //关注信息
 public ActionResult FollowInfo()
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         string CurrentUserName = Session["UserName"].ToString();
         string Email           = Session["Email"].ToString();
         string PassWord        = Session["PassWord"].ToString();
         //string CurrentUserName = "******";
         //string Email = "*****@*****.**";
         //string PassWord = "******";
         ViewBag.MyHeadImg = GetMyHeadImg();
         //获取当前用户的Id/
         var selectId      = from info in db.T_User where info.U_UserName == CurrentUserName && info.U_UserPassWord == PassWord && info.U_Email == Email select info;
         int CurrentUserId = 0;
         foreach (var info in selectId)
         {
             CurrentUserId = info.U_Id;
         }
         //找当前用户的粉丝数量
         int selectCurrentUserFansCount = (from fansCount in db.T_FollowUsers where fansCount.F_BeFollowerId == CurrentUserId select fansCount).Count();
         //找当前用户的关注人的数量
         int selectCurrentUserFollowersCount = (from FollowersCount in db.T_FollowUsers where FollowersCount.F_FollowerId == CurrentUserId select FollowersCount).Count();
         ViewBag.FansCount      = selectCurrentUserFansCount;
         ViewBag.FollowersCount = selectCurrentUserFollowersCount;
     }
     return(View());
 }
Пример #10
0
 public List <T_Comment> ChildrenInfo(int JudgeObject)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         List <T_Comment> SubList = new List <T_Comment>();//存放C_Response!=0的列表
         var GetSubInfo           = from subinfo in db.T_Comment where subinfo.C_Response == JudgeObject select subinfo;
         int GetSubInfoCount      = (from subinfocount in db.T_Comment where subinfocount.C_Response == JudgeObject select subinfocount).Count();
         if (GetSubInfoCount == 0)
         {
             return(SubList);
         }
         //string str1 = ":";
         foreach (var subinfo in GetSubInfo)
         {
             T_Comment comment = new T_Comment();
             comment.U_UserName = subinfo.U_UserName;
             comment.C_Info     = subinfo.C_Info;
             SubList.Add(comment);
             //SubList.Add(subinfo.U_UserName);//1:子信息的用户名
             //SubList.Add(str1);//2:冒号
             //SubList.Add(subinfo.C_Info);//3:子信息的用户评论内容
         }
         return(SubList);
     }
 }
Пример #11
0
 public void DeleteFunction(string delete, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取send点击事件进行操作
         var   GetDelete = from list in db.T_Function where list.F_SubId == "3F4" && list.F_Function == "DeleteFunction" && list.F_FatherId == "2F3" select list;
         Int32 DeleteId  = 0;
         foreach (var list in GetDelete)
         {
             DeleteId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindDelete = db.T_Function.Find(DeleteId);
         if (delete == "启用")
         {
             GetFindDelete.F_IsOpen = 1;
             GetManInfo("DeleteFunction", null, "1");
             NotifyInfo("删除功能被管理员启用,现在VIP用户可以删除其他用户的评论,管理员可以删除其他用户的评论以及删除不合乎规范的发布信息", "系统公告:", 0, null, null);
         }
         if (delete == "禁止")
         {
             GetFindDelete.F_IsOpen = 0;
             GetManInfo("DeleteFunction", null, "0");
             NotifyInfo("删除功能被管理员禁用,现在禁止VIP用户删除其他用户的评论,管理员禁止删除其他用户的评论以及删除不合乎规范的发布信息", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
Пример #12
0
 public void CheckFunction(string check, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取审查事件进行操作
         var   GetCheck = from list in db.T_Function where list.F_SubId == "3F2" && list.F_Function == "CheckFunction" && list.F_FatherId == "2F3" select list;
         Int32 CheckId  = 0;
         foreach (var list in GetCheck)
         {
             CheckId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindCheck = db.T_Function.Find(CheckId);
         if (check == "启用")
         {
             GetFindCheck.F_IsOpen = 1;
             GetManInfo("CheckFunction", null, "1");
             NotifyInfo("审查功能被管理员启用,现在管理员用户可以审查用户各种信息合法规范", "系统公告:", 0, null, null);
         }
         if (check == "禁止")
         {
             GetFindCheck.F_IsOpen = 0;
             GetManInfo("CheckFunction", null, "0");
             NotifyInfo("审查功能被管理员禁用,现在禁止审查用户的信息", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
Пример #13
0
 public void SendFunction(string send, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //获取send点击事件进行操作
         var   GetSend = from list in db.T_Function where list.F_SubId == "3F1" && list.F_Function == "SendFunction" && list.F_FatherId == "2F3" select list;
         Int32 SendId  = 0;
         foreach (var list in GetSend)
         {
             SendId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindSend = db.T_Function.Find(SendId);
         if (send == "启用")
         {
             GetFindSend.F_IsOpen = 1;
             GetManInfo("SendFunction", null, "1");
             NotifyInfo("发送功能被管理员启用,现在可以发送文章、视频、评论", "系统公告:", 0, null, null);
         }
         if (send == "禁止")
         {
             GetFindSend.F_IsOpen = 0;
             GetManInfo("SendFunction", null, "0");
             NotifyInfo("发送功能被管理员禁用,现在禁止发送文章、视频、评论", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
Пример #14
0
 //用户中心每个页面加载对应用户的头像
 public string GetMyHeadImg()
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             string Name  = Session["UserName"].ToString();
             string PWD   = Session["PassWord"].ToString();
             string Email = Session["Email"].ToString();
             //选出当前用户
             var GetUserInfo = from info in db.T_User where info.U_Email == Email && info.U_UserName == Name && info.U_UserPassWord == PWD select info;
             //获取当前用户的头像路径
             string headimgpath = null;
             foreach (var info in GetUserInfo)
             {
                 headimgpath = info.U_HeadImgPath;
             }
             var    img       = System.IO.Directory.GetFiles(Server.MapPath("~/head_img/"), "*.*", SearchOption.TopDirectoryOnly).Where(type => type.EndsWith(".jpg") || type.EndsWith(".png") || type.EndsWith(".gif") || type.EndsWith(".bmp"));
             string MyHeadImg = null;
             foreach (var imginfo in img)
             {
                 FileInfo fi = new FileInfo(imginfo);
                 if (fi.Name == headimgpath)
                 {
                     MyHeadImg = "/head_img/" + fi.Name;
                     break;
                 }
             }
             return(MyHeadImg);
         }
     }
     catch { return("/ALL_IMAGE/Gao_Fu/h1.png"); }
 }
Пример #15
0
 public string SubmitComment(string BeCommentedUserName, string BeCommentedInfo, string Time, string AuthorName, int W_Id, string WorkName, string ResponseInfo, string GetTime)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //判断用户是否登录
         if (Session["UserName"] == null)
         {
             return("Warning");
         }
         //判断该功能权限是否关闭
         var JudgePermission = from judge in db.T_Function where judge.F_SubId == "3F1" && judge.F_Function == "SendFunction" && judge.F_FatherId == "2F3" select judge;
         int F_IsOpen        = 1;
         foreach (var open in JudgePermission)
         {
             F_IsOpen = open.F_IsOpen;
         }
         if (F_IsOpen == 0)
         {
             return("Close");
         }
         string UserName = Session["UserName"].ToString();
         string PassWord = Session["PassWord"].ToString();
         //查询出当前用户的信息表
         var SelectUserInfo = from userinfo in db.T_User where userinfo.U_UserName == UserName && userinfo.U_UserPassWord == PassWord select userinfo;
         //获取当前评论用户的Id
         int U_Id = 0;
         foreach (var info in SelectUserInfo)
         {
             U_Id = info.U_Id;
         }
         //查询出被评论的人的所有信息
         var SelectBeCommented = from becomment in db.T_Comment where becomment.U_UserName == BeCommentedUserName && becomment.C_Info == BeCommentedInfo && becomment.C_CommentTime == Time && becomment.C_WorkTime == GetTime select becomment;
         //获取被评论的人的编号
         int C_InfoId = 0;
         //获取本作品的发表时间,为下面插入提供
         string C_WorkTime = null;
         foreach (var getInfoId in SelectBeCommented)
         {
             C_InfoId   = getInfoId.C_InfoId;
             C_WorkTime = getInfoId.C_WorkTime;
         }
         string    NowTime   = Convert.ToString(DateTime.Now);
         T_Comment t_Comment = new T_Comment();
         t_Comment.U_UserName    = UserName;
         t_Comment.U_Id          = U_Id;
         t_Comment.C_Id          = 3;
         t_Comment.C_UserName    = AuthorName;
         t_Comment.W_Id          = W_Id;
         t_Comment.C_WorkName    = WorkName;
         t_Comment.C_WorkTime    = GetTime;
         t_Comment.C_Info        = ResponseInfo;
         t_Comment.C_Response    = C_InfoId;//对应对象唯一Id
         t_Comment.C_CommentTime = NowTime;
         db.T_Comment.Add(t_Comment);
         db.SaveChanges();
         ManagerController manager = new ManagerController();
         manager.NotifyInfo(ResponseInfo, AuthorName, W_Id, UserName, WorkName);
         return(UserName + " :" + ResponseInfo);
     }
 }
Пример #16
0
 public void ModifyRole(string modify, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //这是修改所有用户的功能权限
         var   GetModify = from list in db.T_Function where list.F_SubId == "3F6" && list.F_Function == "ModifyRole" && list.F_FatherId == "2F3" select list;
         Int32 ModifyId  = 0;
         foreach (var list in GetModify)
         {
             ModifyId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindModify = db.T_Function.Find(ModifyId);
         if (modify == "启用")
         {
             GetFindModify.F_IsOpen = 1;
             GetManInfo("ModifyRole", null, "1");
             NotifyInfo("修改角色功能被管理员启用,现在管理员可以在一定信息下修改用户角色", "系统公告:", 0, null, null);
         }
         if (modify == "禁止")
         {
             GetFindModify.F_IsOpen = 0;
             GetManInfo("ModifyRole", null, "0");
             NotifyInfo("修改角色功能被管理员禁用,现在管理员禁止修改角色信息", "系统公告:", 0, null, null);
         }
         db.SaveChanges();
     }
 }
Пример #17
0
 public ActionResult Load(FormCollection collection)
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             UserName = collection["U_UserName"];
             string PassWord = collection["U_UserPassWord"];
             string Email    = collection["U_UserEmail"];
             //将邮箱存入session使用
             Session["Email"] = Email;
             //将密码存入session使用
             Session["PassWord"] = PassWord;
             //当用户登录成功后获取用户的角色
             var GetRole = from exist in db.T_User where exist.U_UserName == UserName && exist.U_UserPassWord == PassWord && exist.U_Email == Email select exist;
             //获取该用户是否有登录权限
             int U_RoleIsOpen = (from exist in db.T_User where exist.U_RoleIsOpen == 1 && exist.U_UserName == UserName && exist.U_UserPassWord == PassWord && exist.U_Email == Email select exist).Count();
             //获取该用户的密码和用户名是否匹配
             var UserJudge = (from exist in db.T_User where exist.U_UserName == UserName && exist.U_UserPassWord == PassWord && exist.U_Email == Email select exist).Count();
             if (UserJudge != 1)
             {
                 return(Content("<script>alert('登录失败');history.go(-1);</script>"));
             }
             else
             {
                 //获取角色字段
                 string Role = null;
                 foreach (var getrole in GetRole)
                 {
                     Role = getrole.R_Id;
                     //将用户ID放入session使用
                     Session["U_Id"] = getrole.U_Id;
                 }
                 //方法一:(只满足一次HTTP请求,之后会置空)
                 //TempData["Role"] = Role;
                 //方法二 :
                 Session["Role"] = Role;
                 if (U_RoleIsOpen != 1)
                 {
                     return(Content("<script>alert('该用户已被禁止登录');history.go(-1);</script>"));
                 }
                 else
                 {
                     //修改状态
                     db.SaveChanges();
                     //通过session来暂时保存用户名的值(默认20Min)
                     Session["UserName"] = UserName;
                     return(RedirectToAction("Index"));
                 }
             }
         }
     }
     catch
     {
         return(View());
     }
 }
Пример #18
0
 public string SelfComment(string AuthorName, int W_Id, string WorkName, string Comment, string GetTime)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //判断用户是否登录
         if (Session["UserName"] == null)
         {
             return("Warning");
         }
         //判断该功能权限是否关闭
         var JudgePermission = from judgepermission in db.T_Function where judgepermission.F_SubId == "3F1" && judgepermission.F_Function == "SendFunction" && judgepermission.F_FatherId == "2F3" select judgepermission;
         int F_IsOpen        = 1;
         foreach (var open in JudgePermission)
         {
             F_IsOpen = open.F_IsOpen;
         }
         if (F_IsOpen == 0)
         {
             return("Close");
         }
         string UserName = Session["UserName"].ToString();
         string PassWord = Session["PassWord"].ToString();
         //查询出当前用户的信息表
         var SelectUserInfo = from userinfo in db.T_User where userinfo.U_UserName == UserName && userinfo.U_UserPassWord == PassWord select userinfo;
         //获取当前评论用户的Id
         int    U_Id    = 0;
         string NowTime = Convert.ToString(DateTime.Now);
         foreach (var info in SelectUserInfo)
         {
             U_Id = info.U_Id;
         }
         T_Comment t_Comment = new T_Comment();
         t_Comment.U_UserName    = UserName;
         t_Comment.U_Id          = U_Id;
         t_Comment.C_Id          = 3;
         t_Comment.C_UserName    = AuthorName;
         t_Comment.W_Id          = W_Id;
         t_Comment.C_WorkName    = WorkName;
         t_Comment.C_WorkTime    = GetTime;
         t_Comment.C_Info        = Comment;
         t_Comment.C_Response    = 0;//自己评论对象是0
         t_Comment.C_CommentTime = NowTime;
         db.T_Comment.Add(t_Comment);
         db.SaveChanges();
         ManagerController manager = new ManagerController();
         if (W_Id == 1)
         {
             manager.NotifyInfo(Comment, AuthorName, W_Id, UserName, WorkName);
         }
         else
         {
             manager.NotifyInfo(Comment, AuthorName, W_Id, UserName, WorkName);
         }
         return("");
     }
 }
        //文章区
        public ActionResult EassyZone()
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                //获取所有非官方的文章路径
                var GetAllPath = from path in db.T_SendWork where path.W_Id == 1 && path.U_Id != 0 select path;
                //没有文章
                if (GetAllPath.Count() <= 0)
                {
                    return(View());
                }
                //存放用户名、文章名、发布时间、图片路径四个为一组
                List <string> InfoContent = new List <string>();
                foreach (var Info in GetAllPath)
                {
                    //找到每行的用户ID
                    int U_Id = Info.U_Id;
                    //用户名
                    string UserName = null;

                    //找对应用户的用户名
                    var GetUserName = from username in db.T_User where username.U_Id == U_Id select username;
                    foreach (var user in GetUserName)
                    {
                        UserName = user.U_UserName;
                    }

                    //获取文章图片的名字
                    string eassyimgName = null;
                    string Example      = Info.S_WorkPath;
                    for (int j = 10; j < Info.S_WorkPath.Length; ++j)
                    {
                        eassyimgName += Example[j];
                    }

                    //根据相对路径,读取所有文件,并且不查找子文件夹。之后筛选格式是图片的文件
                    var strs = System.IO.Directory.GetFiles(Server.MapPath(Info.S_WorkPath), "*.*", System.IO.SearchOption.TopDirectoryOnly).Where(s => s.EndsWith(".jpg") || s.EndsWith(".gif") || s.EndsWith(".bmp") || s.EndsWith(".png"));
                    foreach (string imgpath in strs)
                    {
                        FileInfo fileInfo = new FileInfo(imgpath);
                        //记住一定不能是~/MyEassy/,我们要相对路径
                        InfoContent.Add("/MyEassy/" + eassyimgName + "/" + fileInfo.Name);
                    }
                    //添加用户名
                    InfoContent.Add(UserName);
                    //添加文章名
                    InfoContent.Add(Info.S_WorkName);
                    //添加发布时间
                    InfoContent.Add(Info.S_SendTime);
                }
                ViewBag.InfoContent      = InfoContent;
                ViewBag.InfoContentCount = InfoContent.Count();
                return(View());
            }
        }
Пример #20
0
        public string FollowOKUsers(string SearchUserName, string Email)
        {
            //string UserName = "******";
            //string PassWord = "******";
            //string SelfEmail = "*****@*****.**";
            string SelfEmail = Session["Email"].ToString();
            string PassWord  = Session["PassWord"].ToString();
            string UserName  = Session["UserName"].ToString();

            using (剧享网Entities db = new 剧享网Entities())
            {
                //查找被关注人的Id
                var selectBeFollowerUser = from info in db.T_User where info.U_UserName == SearchUserName && info.U_Email == Email select info;
                int BeFollowerU_Id       = 0;
                foreach (var info in selectBeFollowerUser)
                {
                    BeFollowerU_Id = info.U_Id;
                }
                //获取当前用户的Id
                var selectCurrentUser = from info in db.T_User where info.U_UserName == UserName && info.U_Email == SelfEmail && info.U_UserPassWord == PassWord select info;
                int FollowerU_Id      = 0;
                foreach (var info in selectCurrentUser)
                {
                    FollowerU_Id = info.U_Id;
                }
                //关注自己判断
                if (FollowerU_Id == BeFollowerU_Id)
                {
                    return("Laugh");
                }
                //关注的时间
                string FollowTime = Convert.ToString(DateTime.Now);
                //先找关注表是否有对应关注信息了
                int FollowCount = (from info in db.T_FollowUsers where info.F_FollowerId == FollowerU_Id && info.F_BeFollowerId == BeFollowerU_Id select info).Count();
                if (FollowCount > 0)
                {
                    return("Followed");
                }
                //保存数据
                T_FollowUsers followUsers = new T_FollowUsers();
                followUsers.F_FollowerId   = FollowerU_Id;
                followUsers.F_BeFollowerId = BeFollowerU_Id;
                followUsers.F_FollowTime   = FollowTime;
                db.T_FollowUsers.Add(followUsers);
                db.SaveChanges();
                //通知被关注者关注信息,W_Id依旧是0,类似系统通知,作品名是null
                ManagerController manager = new ManagerController();
                manager.NotifyInfo("关注了你", SearchUserName, 0, UserName, null);
                return("Success");
            }
        }
Пример #21
0
 public string ModifyRole_updaterole(string OptionRadio, FormCollection collection)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         var   GetModify = from list in db.T_Function where list.F_SubId == "3F6" && list.F_Function == "ModifyRole" && list.F_FatherId == "2F3" select list;
         Int32 ModifyId  = 0;
         foreach (var list in GetModify)
         {
             ModifyId = list.F_Id;
         }
         //此时Find()里面的Id 不能加引号,不然会去找"Id"这个值不是Id了,而且页面不会报错只是不会往下面运行了
         var GetFindModify = db.T_Function.Find(ModifyId);
         //先判断该功能是否启用
         if (GetFindModify.F_IsOpen == 0)
         {
             return("功能被禁用");
         }
         //获取用户角色
         string username = collection["UserName"];
         string telnum   = collection["TelNum"];
         //通过该用户用户名和电话查询出其用户编号
         var SelectU_Id = from id in db.T_User where id.U_UserName == username && id.U_UserTelNum == telnum select id;
         int U_Id       = 0;
         foreach (var list in SelectU_Id)
         {
             U_Id = list.U_Id;
         }
         //通过用户编号获取该用户的所有信息列表
         var UpdateU_Id = db.T_User.Find(U_Id);
         if (OptionRadio == "Normal")
         {
             UpdateU_Id.R_Id        = "R1";
             UpdateU_Id.U_SendSpace = 1024 * 1024 * 50;
             GetManInfo("CheckFunction", username, "R1");
         }
         if (OptionRadio == "VIP")
         {
             UpdateU_Id.R_Id        = "R2";
             UpdateU_Id.U_SendSpace = 1024 * 1024 * 100;
             GetManInfo("CheckFunction", username, "R2");
         }
         if (OptionRadio == "Manager")
         {
             UpdateU_Id.R_Id        = "R3";
             UpdateU_Id.U_SendSpace = 1024 * 1024 * 200;
             GetManInfo("CheckFunction", username, "R3");
         }
         db.SaveChanges();
         return("修改成功");
     }
 }
Пример #22
0
        public string FollowOverUsers(string SearchUserName, string Email)
        {
            //string UserName = "******";//session["UserName"]
            //string SelfEmail = "*****@*****.**";//session["Email"]
            //string PassWord = "******";//session["PassWord"]
            string SelfEmail = Session["Email"].ToString();
            string PassWord  = Session["PassWord"].ToString();
            string UserName  = Session["UserName"].ToString();

            using (剧享网Entities db = new 剧享网Entities())
            {
                //查找被关注人的Id
                var selectBeFollowerUser = from info in db.T_User where info.U_UserName == SearchUserName && info.U_Email == Email select info;
                int BeFollowerU_Id       = 0;
                foreach (var info in selectBeFollowerUser)
                {
                    BeFollowerU_Id = info.U_Id;
                }
                //获取当前用户的Id
                var selectCurrentUser = from info in db.T_User where info.U_UserName == UserName && info.U_Email == SelfEmail && info.U_UserPassWord == PassWord select info;
                int FollowerU_Id      = 0;
                foreach (var info in selectCurrentUser)
                {
                    FollowerU_Id = info.U_Id;
                }
                //先找关注表是否有对应关注信息了
                int FollowCount = (from info in db.T_FollowUsers where info.F_FollowerId == FollowerU_Id && info.F_BeFollowerId == BeFollowerU_Id select info).Count();
                if (FollowCount <= 0)
                {
                    return("NoneFollow");
                }
                //获取对应关注信息的自增ID
                var GetId = from info in db.T_FollowUsers where info.F_FollowerId == FollowerU_Id && info.F_BeFollowerId == BeFollowerU_Id select info;
                //通过ID,删除的对应数据
                int DeleteId = 0;
                foreach (var info in GetId)
                {
                    DeleteId = info.F_Id;
                }
                //先实例化表的对象
                T_FollowUsers followUsers = new T_FollowUsers();
                //接着绑定该ID
                followUsers = db.T_FollowUsers.Find(DeleteId);
                //然后删除该ID对应的信息
                db.T_FollowUsers.Remove(followUsers);
                //最后保存操作即可
                db.SaveChanges();
                return("Success");
            }
        }
Пример #23
0
 //获取统计查询的结果
 public JsonResult GetStatisticalResult()
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //一个组合查询出来的结果的字符串
         string Combination = null;
         //查询统计视图里面的信息,其实就只有1条,多个字段
         var statistical = from result in db.V_Statistical select result;
         foreach (var info in statistical)
         {
             Combination = info.UserCount.ToString() + "," + info.IndexCount.ToString() + "," + info.AccessRate;
         }
         return(Json(Combination));
     }
 }
Пример #24
0
 //计算对自己所有的未读通知数量
 public int InfoCount()
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             string UserName = Session["UserName"].ToString();
             //计算对自己所有的未读通知数量
             int UnreadInfoCount = (from info in db.T_NotifyInfo where info.N_ReplyObject == UserName && info.N_ReadStatus == 0 select info).Count();
             return(UnreadInfoCount);
         }
     }
     catch
     { return(0); }
 }
        //打开文章
        public ActionResult OpenMyEassy(string AuthorName, string W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                int w_id = Convert.ToInt32(W_Id);
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.List = list;
                //打开文章前先更新浏览数
                UpdateViewCount(AuthorName, w_id, WorkName, WorkTime);

                //获取文章内容
                var GetCurrentInfo = from currentinfo in db.T_SendWork where currentinfo.U_UserName == AuthorName && currentinfo.W_Id == w_id && currentinfo.S_WorkName == WorkName && currentinfo.S_SendTime == WorkTime select currentinfo;
                ViewBag.EassyName     = WorkName;
                ViewBag.Author        = AuthorName;
                ViewBag.EassySendTime = WorkTime;
                string WorkPath = null;
                //浏览数
                int ViewCount = 0;
                foreach (var info in GetCurrentInfo)
                {
                    WorkPath  = info.S_WorkPath;
                    ViewCount = info.S_WorkViewCount;
                }
                string EassyName = null;
                for (int i = 10; i < WorkPath.Length; ++i)
                {
                    EassyName += WorkPath[i];
                }
                FileStream   fs     = new FileStream(Server.MapPath(WorkPath + "\\" + EassyName + ".txt"), FileMode.Open, FileAccess.Read);
                StreamReader reader = new StreamReader(fs);
                ViewBag.EassyContent = reader.ReadToEnd();
                ViewBag.ViewCount    = ViewCount;
                //给定作品类型
                ViewBag.WorkType = "MyEssay";
                //必须关掉文件流
                fs.Close();
                reader.Close();
            }
            return(View());
        }
Пример #26
0
 public JsonResult GetVerificationCode(string U_UserEmail)
 {
     using (剧享网Entities db = new 剧享网Entities())
     {
         //判断邮箱是否注册
         int judgemail = (from mail in db.T_User where mail.U_Email == U_UserEmail select mail).Count();
         if (judgemail != 0)
         {
             return(Json("该邮箱已被注册,请换邮箱"));
         }
         else if (MailContent(U_UserEmail) == "邮箱不可用")
         {
             return(Json("邮箱不可用"));
         }
         return(Json("验证码已发送到您的邮箱,请获取填写"));
     }
 }
Пример #27
0
        public ActionResult YangWanJing_bojeck(string AuthorName, string W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                int w_id = Convert.ToInt32(W_Id);
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, w_id, WorkName, WorkTime);
                ViewBag.List = list;
                return(View());
            }
        }
Пример #28
0
        public ActionResult OpenVideo(string AuthorName, int W_Id, string WorkName, string WorkTime)
        {
            using (剧享网Entities db = new 剧享网Entities())
            {
                剧享网.Comment_cs.FatherNode father     = new Comment_cs.FatherNode();
                List <T_Comment>          FatherNode = new List <T_Comment>();
                FatherNode         = father.FatherInfo(AuthorName, W_Id, WorkName, WorkTime);
                ViewBag.FatherNode = FatherNode;

                TestController test = new TestController();
                List <int>     list = new List <int>();
                list         = test.WebInitGetAgreeCount(AuthorName, W_Id, WorkName, WorkTime);
                ViewBag.List = list;

                //获取视频内容
                var GetCurrentInfo = from currentinfo in db.T_SendWork where currentinfo.U_UserName == AuthorName && currentinfo.W_Id == W_Id && currentinfo.S_WorkName == WorkName && currentinfo.S_SendTime == WorkTime select currentinfo;
                ViewBag.Title         = "MyVideo";
                ViewBag.VideoName     = WorkName;
                ViewBag.Author        = AuthorName;
                ViewBag.VideoSendTime = WorkTime;
                string WorkPath = null;
                foreach (var info in GetCurrentInfo)
                {
                    WorkPath = info.S_WorkPath;
                }
                //视频名(内容介绍名和视频封面图片名及父文件夹名都是一样的)
                string VideoName = null;
                for (int i = 10; i < WorkPath.Length; ++i)
                {
                    VideoName += WorkPath[i];
                }
                //获取介绍的内容
                FileStream   fs     = new FileStream(Server.MapPath(WorkPath + "\\" + VideoName + ".txt"), FileMode.Open, FileAccess.Read);
                StreamReader reader = new StreamReader(fs);
                ViewBag.VideoContent = reader.ReadToEnd();
                //获取当前打开的视频的路径
                var getVideoInfo = System.IO.Directory.GetFiles(Server.MapPath("/MyVideo/" + VideoName), "*.*", SearchOption.TopDirectoryOnly).Where(s => s.EndsWith(".mp4") || s.EndsWith(".flv") || s.EndsWith(".avi") || s.EndsWith(".wmv"));
                foreach (string info in getVideoInfo)
                {
                    FileInfo fileInfo = new FileInfo(info);
                    ViewBag.VideoPath = "/MyVideo/" + VideoName + "/" + fileInfo.Name;
                }
            }
            return(View());
        }
Пример #29
0
        //向数据库插入管理员操作的日志
        public void GetManInfo(string FuncName, string Object, string Content)
        {
            string Name      = Session["UserName"].ToString();
            string EnterTime = DateTime.Now.ToString();

            using (剧享网Entities db = new 剧享网Entities())
            {
                T_ManOperLog operLog = new T_ManOperLog();
                operLog.U_UserName    = Name;
                operLog.M_OperFunc    = FuncName;
                operLog.M_OperObject  = Object;
                operLog.M_OperContent = Content;
                operLog.M_EnterTime   = Convert.ToDateTime(EnterTime);
                operLog.M_QuitTime    = null;
                db.T_ManOperLog.Add(operLog);
                db.SaveChanges();
            }
        }
Пример #30
0
 //向IpReport表插入信息
 public void InsertIp(string EnTime, string QuitTime, string ipv4)
 {
     try
     {
         using (剧享网Entities db = new 剧享网Entities())
         {
             //当对应Ip进入网页则取出其对应的Id
             var SelectId = from id in db.T_IpReport where id.I_Ipv4 == ipv4 select id;
             int Id       = 0;
             foreach (var id in SelectId)
             {
                 Id = id.I_Id;
             }
             //通过Id取出该Ip退出网页的时间
             var GetTime = from time in db.T_IpReport where time.I_Id == Id select time;
             //随便赋予的一直时间值,可以不用修改该值了,其目的是获得退出时间
             DateTime QTime = Convert.ToDateTime("2018-11-21 20:13:50");
             //获取当前时间
             DateTime NowTime = DateTime.Now;
             foreach (var gettime in GetTime)
             {
                 QTime = (DateTime)gettime.I_QuitTime;
             }
             //获取两时间的跨度
             TimeSpan ts = NowTime - QTime;
             //通过totalseconds获取跨度的秒数差,还有totaldays等
             double hours = Math.Round(ts.TotalHours, 0);
             //当该Ip距离上次访问间隔六小时及以上便可插入当前访问的数据等
             if (hours >= 6)
             {
                 T_IpReport ipReport = new T_IpReport();
                 ipReport.I_Ipv4     = ipv4;
                 ipReport.C_TypeId   = 1;//在该控制器里面,向该表插入的是对主页的访问Ip
                 ipReport.I_EnTime   = Convert.ToDateTime(EnTime);
                 ipReport.I_QuitTime = Convert.ToDateTime(QuitTime);
                 db.T_IpReport.Add(ipReport);
                 db.SaveChanges();
             }
         }
     }
     catch
     { }
 }