Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            enable = WS.RequestInt("enable", -1);
            group  = WS.RequestInt("group", -1);
            url    = string.Format("List.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString());

            //删除
            var ids = WS.RequestString("id").Split(',').ToList().ToInt64();

            if (WS.RequestString("id").IsNullOrEmpty())
            {
                Js.AlertAndGoback("您没有选择任何项");
                return;
            }

            DataEntities ent = new DataEntities();

            foreach (var id in ids)
            {
                var q       = (from l in ent.User where l.ID == id select l).FirstOrDefault();
                var resumes = from l in ent.JobResumeInfo where l.UserID == q.ID select l;
                var apps    = from l in ent.JobApplicationRecord where l.UserID == q.ID select l;

                ent.DeleteObjects(resumes);
                ent.DeleteObjects(apps);
                ent.DeleteObject(q);
            }
            ent.SaveChanges();
            ent.Dispose();

            Js.AlertAndChangUrl("删除成功!", url);
        }
Example #2
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            DataEntities ent   = new DataEntities();
            var          areas = (from l in ent.Area select l).ToList();
            var          ps    = (from l in ent.Province select l).ToList();
            var          cs    = (from l in ent.City select l).ToList();


            foreach (TreeNode n_a in TreeView1.Nodes)
            {
                int aid  = n_a.Value.ToInt32();
                var area = areas.Where(o => o.ID == aid).FirstOrDefault();
                area.ShowInIndex = n_a.Checked;

                foreach (TreeNode n_p in n_a.ChildNodes)
                {
                    int pid = n_p.Value.ToInt32();
                    var p   = ps.Where(o => o.ID == pid).FirstOrDefault();

                    foreach (TreeNode n_c in n_p.ChildNodes)
                    {
                        int cid = n_c.Value.ToInt32();
                        var c   = cs.Where(o => o.id == cid).FirstOrDefault();
                        c.ShowInNav = n_c.Checked;
                    }
                }
            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndGoback("保存成功!");
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            User         u   = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndChangUrl("对不起,您没有登录,请登陆后进行投稿!", "/");
                return;
            }

            UserGroup g = //UserGroupView.GetModelByID(u.Group.ToS());
                          (from l in ent.UserGroup where l.ID == u.Group select l).FirstOrDefault();

            if (g.MaxPost <= 0)
            {
                Js.AlertAndGoback("对不起,您没有投稿的权限!如有疑问,请联系管理员");
                return;
            }

            lb_UserName.Text = u.UserName;
            txt_Author.Text  = u.UserName;
            if (!IsPostBack)
            {
                var cls = NewsAction.NewsClass;
                cls = cls.Where(p => p.EnablePost == true && p.IsLeafClass == true && p.ModelID == 1).ToList();
                ddl_Class.DataSource     = cls;
                ddl_Class.DataTextField  = "ClassName";
                ddl_Class.DataValueField = "id";
                ddl_Class.DataBind();
            }
            LoadInfo();
        }
Example #4
0
        protected void btn_UpLoad_Click(object sender, EventArgs e)
        {
            if (FileUpload1.FileName.IsNullOrEmpty())
            {
                return;
            }
            Result r = BasePage.UpLoadFile(Request.Files["FileUpload1"], WS.RequestInt("class", 0));

            if (r.Success)
            {
                Js.Jump("?");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }

            //SysSetting ss = BasePage.SystemSetting;

            //HttpPostedFile file=Request.Files["FileUpload1"];
            //string FileName=file.FileName.GetFileNameFromPath();//文件名
            //string ExtName=file.FileName.GetFileExtNameFromPath();//扩展名
            //string [email protected]()+ExtName;//新文件名

            //if(!ExtName.Replace(".","").IsInArray(ss.FileExtNameFilter.Split(',')))
            //{
            //    Js.AlertAndGoback("不允许上传此类文件");
            //    return;
            //}
            //if (file.ContentLength>ss.MaxPostFileSize)
            //{
            //    Js.AlertAndGoback("文件太大");
            //    return;
            //}

            //string Folder=ss.FileDir+"/"+DateTime.Now.ToString("yyyy-MM-dd")+"/";//文件目录
            //string FolderShotCut=Folder+"ShortCut/";//缩略图目录

            //string FilePath=Folder+NewName;//文件路径
            //string FilePath_ShortCut=FolderShotCut+NewName;//缩略图路径

            //file.SaveAs(Server.MapPath(FilePath),true);
            //ImageHelper.MakeThumbnail(Server.MapPath(FilePath),Server.MapPath(FilePath_ShortCut),105,118,"Cut");



            //FileInfo savedFile = new FileInfo(Server.MapPath(FilePath));

            //Voodoo.Model.File f = new Voodoo.Model.File();

            //f.FileDirectory = ss.FileDir;
            //f.FileExtName = ExtName;
            //f.FilePath = FilePath;
            //f.FileSize = (savedFile.Length / 1024).ToInt32();
            ////f.FileType=
            //f.SmallPath = FilePath_ShortCut;
            //f.UpTime = DateTime.Now;

            //FileView.Insert(f);
        }
Example #5
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int          id  = WS.RequestInt("id");
            DataEntities ent = new DataEntities();
            TemplateList tl;

            try
            {
                tl = (from l in ent.TemplateList where l.ID == id select l).First();
            }
            catch
            {
                tl = new TemplateList();
            }


            tl.TempName        = txt_TempName.Text;
            tl.CutKeywords     = txt_CutKeywords.Text.ToInt32();
            tl.CutTitle        = txt_CutTitle.Text.ToInt32();
            tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32();
            tl.TimeFormat      = txt_TimeFormat.Text;
            tl.Content         = txt_Content.Text.Replace("'", "''");;
            tl.ListVar         = txt_Listvar.Text.Replace("'", "''");;
            tl.SysModel        = ddl_SysModel.SelectedValue.ToInt32();
            if (tl.ID <= 0)
            {
                tl.GroupID  = 1;
                tl.SysModel = 1;
                ent.AddToTemplateList(tl);
            }
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndGoback("保存成功!");
        }
Example #6
0
        protected void btn_enable_Click(object sender, EventArgs e)
        {
            enable = WS.RequestInt("enable", -1);
            group  = WS.RequestInt("group", -1);
            url    = string.Format("List.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString());

            var ids = WS.RequestString("id").Split(',').ToList();;

            if (WS.RequestString("id").IsNullOrEmpty())
            {
                Js.AlertAndGoback("您没有选择任何项");
                return;
            }

            DataEntities ent = new DataEntities();

            var qs = from l in ent.User where ids.IndexOf(l.ID.ToString()) > 0 select l;

            foreach (var q in qs)
            {
                q.Enable = true;
            }
            ent.Dispose();
            BindList();
            Js.AlertAndChangUrl("设置成功!", url);
        }
Example #7
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int    selectID   = ddl_Province.SelectedValue.ToInt32();
            string selectText = ddl_Province.SelectedItem.Text;
            var    ps         = txt_Provinces.Text.Split('\n');

            using (DataEntities ent = new DataEntities())
            {
                var cts = (from l in ent.City where l.ProvinceID == selectID select l).ToList();
                foreach (var p in ps)
                {
                    var str_p = p.Trim();
                    if (cts.Where(o => o.city1 == str_p).Count() == 0)
                    {
                        var ct = new City();
                        ct.city1      = str_p;
                        ct.Hot        = 0;
                        ct.ProvinceID = selectID;
                        ct.Rome       = "";
                        ct.state      = selectText;
                        ct.sz_code    = "";
                        ct.zm_code    = "";

                        ent.AddToCity(ct);
                    }
                }

                ent.SaveChanges();
                Js.AlertAndGoback("保存成功!");
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User u = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndGoback("对不起,您还没有登录,不能上传简历!");
            }


            HttpPostedFile file = Request.Files[0];

            string extName = Path.GetExtension(file.FileName).ToLower();
            int    size    = file.ContentLength;

            if (extName != ".doc" && extName != ".docx")
            {
                Js.AlertAndGoback("对不起,简历文件只允许上传微软Word格式(.doc|.docx)");
                return;
            }
            if (size > 500 * 1024)
            {
                Js.AlertAndGoback("对不起,简历大小请限制在500K以内!");
                return;
            }

            JobAction.SaveResume(file, u.ID);

            Js.AlertAndChangUrl("简历上传成功!", "/Dynamic/Job/ResumeBasic.aspx");
        }
Example #9
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            var ps = txt_Provinces.Text.Split('\n');

            using (DataEntities ent = new DataEntities())
            {
                var qs = (from l in ent.Province select l).ToList();
                foreach (var p in ps)
                {
                    var str_p = p.Trim();
                    if (qs.Where(o => o.province1 == str_p).Count() == 0)
                    {
                        var pro = new Province();
                        pro.province1 = str_p;
                        pro.sz_code   = "";
                        pro.Rome      = "";
                        pro.zm_code   = "";
                        ent.AddToProvince(pro);
                    }
                }

                ent.SaveChanges();
                Js.AlertAndGoback("保存成功!");
            }
        }
Example #10
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            string action = WS.RequestString("action", "IndexContent");

            GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("update TemplatePublic set {0}=N'{1}'", action, txt_Content.Text.Replace("'", "''")));
            Js.AlertAndGoback("保存成功!");
        }
Example #11
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int          id = WS.RequestInt("id");
            TemplateList tl = TemplateListView.GetModelByID(id.ToS());

            tl.TempName        = txt_TempName.Text;
            tl.CutKeywords     = txt_CutKeywords.Text.ToInt32();
            tl.CutTitle        = txt_CutTitle.Text.ToInt32();
            tl.ShowRecordCount = txt_ShowRecordCount.Text.ToInt32();
            tl.TimeFormat      = txt_TimeFormat.Text;
            tl.Content         = txt_Content.Text.Replace("'", "''");;
            tl.ListVar         = txt_Listvar.Text.Replace("'", "''");;
            tl.SysModel        = ddl_SysModel.SelectedValue.ToInt32();
            if (tl.ID > 0)
            {
                TemplateListView.Update(tl);
            }
            else
            {
                tl.GroupID  = 1;
                tl.SysModel = 1;
                TemplateListView.Insert(tl);
            }
            Js.AlertAndGoback("保存成功!");
        }
Example #12
0
        protected void btn_Submit_Click(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            if (UserAction.HasPostRight(ddl_Class.SelectedValue.ToInt32()) == false)
            {
                Js.AlertAndGoback("对不起,对于本栏目您没有提问的权限!如有疑问,请联系管理员");
                ent.Dispose();
                return;
            }

            User   u       = UserAction.opuser;
            int    rclass  = WS.RequestInt("ddl_Class", WS.RequestInt("class"));
            string content = WS.RequestString("txt_Content").TrimDbDangerousChar().Trim().HtmlDeCode();
            string title   = WS.RequestString("txt_Title").TrimDbDangerousChar().Trim();

            if (rclass < 0)
            {
                Js.AlertAndGoback("栏目不能为空");
                return;
            }
            if (content.IsNullOrEmpty())
            {
                Js.AlertAndGoback("提问内容不能为空");
                return;
            }
            if (title.IsNullOrEmpty())
            {
                Js.AlertAndGoback("标题不能为空");
                return;
            }

            Question qs = new Question();

            qs.AskTime    = DateTime.Now;
            qs.ClassID    = rclass;
            qs.ClickCount = 0;
            qs.Content    = content;
            qs.Title      = title;
            qs.UserID     = u.ID;
            qs.UserName   = u.UserName;
            qs.ZtID       = 0;
            ent.AddToQuestion(qs);
            ent.SaveChanges();

            CreatePage.CreateContentPage(qs, qs.GetClass());
            CreatePage.CreateListPage(qs.GetClass(), 1);
            string url = BasePage.GetQuestionUrl(qs, qs.GetClass());

            ent.Dispose();

            Js.AlertAndChangUrl("提问发布成功!", url);
        }
Example #13
0
        /// <summary>
        /// 保存资料
        /// </summary>
        protected void SaveInfo()
        {
            SysUser su = SysUserAction.LocalUser;

            DataEntities ent  = new DataEntities();
            int          id   = WS.RequestInt("id");
            SysUser      user = new SysUser();

            if (id > 0)
            {
                user = (from l in ent.SysUser where l.ID == id select l).FirstOrDefault();
            }
            else if (txt_Password.Text.Length == 0)
            {
                Js.AlertAndGoback("新增用户时,密码不能为空");
            }

            user.UserName = txt_UserName.Text;
            if (txt_Password.Text.Length > 0)
            {
                user.UserPass = Voodoo.Security.Encrypt.Md5(txt_Password.Text);
            }

            user.Email       = txt_Email.Text;
            user.TelNumber   = txt_TelNumber.Text;
            user.Department  = su.Department;
            user.UserGroup   = su.UserGroup;
            user.ChineseName = txt_ChineseName.Text;
            user.Enabled     = chk_Enable.Checked;

            if (id <= 0)
            {
                user.LastLoginTime = DateTime.Now;
                user.LastLoginIP   = WS.GetIP();
                Result r = SysUserAction.UserAdd(user);

                if (r.Success)
                {
                    Js.AlertAndChangUrl(r.Text, "List.aspx");
                }
                else
                {
                    Js.AlertAndGoback(r.Text);
                }
            }
            else
            {
                ent.SaveChanges();
                Js.AlertAndChangUrl("修改成功!", "List.aspx");
            }
            ent.Dispose();
        }
Example #14
0
        /// <summary>
        /// 保存资料
        /// </summary>
        protected void SaveInfo()
        {
            SysUser user = new SysUser();

            if (WS.RequestInt("id") > 0)
            {
                user = SysUserView.GetModelByID(WS.RequestInt("id").ToString());
            }
            else if (txt_Password.Text.Length == 0)
            {
                Js.AlertAndGoback("新增用户时,密码不能为空");
            }

            user.UserName = txt_UserName.Text;
            if (txt_Password.Text.Length > 0)
            {
                user.UserPass = Voodoo.Security.Encrypt.Md5(txt_Password.Text);
            }

            user.SafeQuestion = ddl_Question.SelectedValue;
            user.SafeAnswer   = txt_Answer.Text;
            user.Email        = txt_Email.Text;
            user.TelNumber    = txt_TelNumber.Text;
            user.Department   = ddl_Department.SelectedValue.ToInt32();
            user.UserGroup    = ddl_Group.SelectedValue.ToInt32();
            user.ChineseName  = txt_ChineseName.Text;
            user.Enabled      = chk_Enable.Checked;

            if (WS.RequestInt("id") > 0)
            {
                //修改
                SysUserView.Update(user);
                Js.AlertAndChangUrl("修改成功!", "SysUserList.aspx");
            }
            else
            {
                user.LastLoginTime = DateTime.Now;
                user.LastLoginIP   = WS.GetIP();
                Result r = SysUserAction.UserAdd(user);

                if (r.Success)
                {
                    Js.AlertAndChangUrl(r.Text, "SysUserList.aspx");
                }
                else
                {
                    Js.AlertAndGoback(r.Text);
                }
            }
        }
Example #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User u = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndGoback("对不起,您没有登录,请登录后回答!");
                return;
            }

            int    qid     = WS.RequestInt("qid");
            string content = WS.RequestString("content");

            if (qid <= 0)
            {
                Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!");
                return;
            }

            Class cls = QuestionView.GetModelByID(qid.ToS()).GetClass();

            if (UserAction.HasPostRight(cls.ID) == false)
            {
                Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!");
                return;
            }

            Answer a = new Answer();

            a.Agree      = 0;
            a.AnswerTime = DateTime.Now;
            a.Content    = content;
            a.QuestionID = qid;
            a.UserID     = u.ID;
            a.UserName   = u.UserName;

            AnswerView.Insert(a);


            Question q = QuestionView.GetModelByID(a.QuestionID.ToS());

            CreatePage.CreateContentPage(q, q.GetClass());//创建内容页



            string url = BasePage.GetQuestionUrl(q, q.GetClass());

            Js.AlertAndChangUrl("回答成功!", url);
        }
Example #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();

            User u = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndGoback("对不起,您没有登录,请登录后回答!");
                return;
            }

            int    qid     = WS.RequestInt("qid");
            string content = WS.RequestString("content");

            if (qid <= 0)
            {
                Js.AlertAndGoback("对不起,参数错误,如有疑问,请联系管理员!");
                return;
            }

            Question q   = (from l in ent.Question where l.ID == qid select l).FirstOrDefault();
            Class    cls = q.GetClass();

            if (UserAction.HasPostRight(cls.ID) == false)
            {
                Js.AlertAndGoback("对不起,对于本栏目您没有回答权限,如有疑问,请联系管理员!");
                return;
            }

            Answer a = new Answer();

            a.Agree      = 0;
            a.AnswerTime = DateTime.Now;
            a.Content    = content;
            a.QuestionID = qid;
            a.UserID     = u.ID;
            a.UserName   = u.UserName;

            ent.AddToAnswer(a);
            CreatePage.CreateContentPage(q, q.GetClass());//创建内容页


            ent.Dispose();
            string url = BasePage.GetQuestionUrl(q, q.GetClass());

            Js.AlertAndChangUrl("回答成功!", url);
        }
Example #17
0
        protected void btn_enable_Click(object sender, EventArgs e)
        {
            enable = WS.RequestInt("enable", -1);
            group  = WS.RequestInt("group", -1);
            url    = string.Format("UserList.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString());

            string ids = WS.RequestString("id");

            if (ids.IsNullOrEmpty())
            {
                Js.AlertAndGoback("您没有选择任何项");
                return;
            }
            GetHelper().ExecuteNonQuery(CommandType.Text, string.Format("update [User] set Enable=1 where id in({0})", ids));
            Js.AlertAndChangUrl("设置成功!", url);
        }
Example #18
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            enable = WS.RequestInt("enable", -1);
            group  = WS.RequestInt("group", -1);
            url    = string.Format("UserList.aspx?ebable={0}&group={1}", enable.ToString(), group.ToString());

            //删除
            string ids = WS.RequestString("id");

            if (ids.IsNullOrEmpty())
            {
                Js.AlertAndGoback("您没有选择任何项");
                return;
            }
            UserView.Del(string.Format("id in {0}", ids));
            Js.AlertAndChangUrl("删除成功!", url);
        }
Example #19
0
        protected void btn_UpLoad_Click(object sender, EventArgs e)
        {
            if (FileUpload1.FileName.IsNullOrEmpty())
            {
                return;
            }
            Result r = BasePage.UpLoadFile(Request.Files["FileUpload1"], WS.RequestInt("class", 0));

            if (r.Success)
            {
                Js.Jump("?");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }
        }
Example #20
0
        protected void btn_ClearAll_Click(object sender, EventArgs e)
        {
            Response.Buffer = false;

            DirectoryInfo dir = new DirectoryInfo(Server.MapPath("~/Book/"));

            if (dir.Exists)
            {
                FileInfo[] files = dir.GetFiles();
                foreach (FileInfo file in files)
                {
                    Response.Write(string.Format("正在删除文件:{0}<br/>", file.Name));
                    file.Delete();
                }

                DirectoryInfo[] subdirs = dir.GetDirectories();
                foreach (DirectoryInfo subdir in subdirs)
                {
                    Response.Write(string.Format("正在删除目录:{0}<br/>", subdir.Name));
                    subdir.Delete(true);
                }
            }

            dir = new DirectoryInfo(Server.MapPath(SystemSetting.ClassFolder));
            if (dir.Exists)
            {
                FileInfo[] files = dir.GetFiles();
                foreach (FileInfo file in files)
                {
                    Response.Write(string.Format("正在删除文件:{0}<br/>", file.Name));
                    file.Delete();
                }

                DirectoryInfo[] subdirs = dir.GetDirectories();
                foreach (DirectoryInfo subdir in subdirs)
                {
                    Response.Write(string.Format("正在删除目录:{0}<br/>", subdir.Name));
                    subdir.Delete(true);
                }
            }

            Js.AlertAndGoback("成功!");
        }
Example #21
0
        protected void ClientLogin(string userName, string userPass, string vCode)
        {
            if (vCode.ToLower() != Session["SafeCode"].ToS().ToLower())
            {
                Js.AlertAndGoback("验证码错误!");
                return;
            }

            Result r = SysUserAction.UserLogin(userName, userPass, "", "");

            if (r.Success)
            {
                Response.Redirect("~/e/admin/");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }
        }
Example #22
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            int         id = WS.RequestInt("id");
            TemplateVar tl = TemplateVarView.GetModelByID(id.ToS());

            tl.VarName = txt_VarName.Text;
            tl.Content = txt_Content.Text.Replace("'", "''");

            if (tl.ID > 0)
            {
                TemplateVarView.Update(tl);
            }
            else
            {
                tl.GroupID = 1;
                TemplateVarView.Insert(tl);
            }
            Js.AlertAndGoback("保存成功!");
        }
Example #23
0
        protected void SaveAnswer(int QuestionID, string UserName, string Tel, string Content)
        {
            DataEntities ent = new DataEntities();
            Answer       a   = new Answer();

            a.Agree      = 0;
            a.AnswerTime = DateTime.UtcNow.AddHours(8);
            a.Content    = Content;
            //a.Email = "";
            a.QuestionID = QuestionID;
            //a.Tel = Tel;
            a.UserName = UserName;
            a.UserID   = 0;

            ent.AddToAnswer(a);
            ent.SaveChanges();
            ent.Dispose();
            Js.AlertAndGoback("消息已经发送,感谢您的支持!");
        }
Example #24
0
        protected void btn_Chapter_Click(object sender, EventArgs e)
        {
            Response.Buffer = false;
            var chapters = BookChapterView.GetModelList();

            foreach (var c in chapters)
            {
                try
                {
                    Response.Write(string.Format("正在生成章节:{0}<br/>", c.Title));
                    CreatePage.CreateBookChapterPage(c, BookView.GetBook(c), BookView.GetClass(c));
                    Js.ScrollEndStart();
                }
                catch (Exception ex)
                {
                    Response.Write(string.Format("{0}<br/>", ex.Message));
                }
            }

            Js.AlertAndGoback("成功!");
        }
Example #25
0
        protected void btn_List_Click(object sender, EventArgs e)
        {
            var cls = ClassAction.Classes;

            //cls = cls.Where(p => p.IsLeafClass).ToList();
            Response.Buffer = false;
            foreach (var c in cls)
            {
                try
                {
                    Response.Write(string.Format("正在生成列表页:{0}<br/>", c.ClassName));
                    CreatePage.CreateListPage(c, 1);
                }
                catch (Exception ex)
                {
                    Response.Write(string.Format("{0}<br/>{1}<br />", ex.Message, Server.MapPath(BasePage.GetClassUrl(c))));
                }
            }

            Js.AlertAndGoback("成功!");
        }
Example #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = new User();

            user.Address     = WS.RequestString("address");
            user.Cent        = WS.RequestInt("cent", 0);
            user.ChineseName = WS.RequestString("chinesename");
            user.Email       = WS.RequestString("email");
            user.Group       = WS.RequestInt("group", SystemSetting.RegisterDefaultGroup);
            user.GTalk       = WS.RequestString("gtalk");
            user.ICQ         = WS.RequestString("icq");
            user.Image       = WS.RequestString("image");
            user.Intro       = WS.RequestString("intro");
            user.Mobile      = WS.RequestString("mobile");
            user.MSN         = WS.RequestString("msn");
            user.QQ          = WS.RequestString("qq");
            user.Tel         = WS.RequestString("tel");
            user.Twitter     = WS.RequestString("twitter");
            user.UserName    = WS.RequestString("username");
            user.UserPass    = Voodoo.Security.Encrypt.Md5(WS.RequestString("userpass"));
            user.WebSite     = WS.RequestString("website");
            user.Weibo       = WS.RequestString("weibo");
            user.ZipCode     = WS.RequestString("zipcode");
            user.StudentNo   = WS.RequestString("studentno");
            user.TeachNo     = WS.RequestString("teachno");

            UserAction ua = new UserAction();

            Result r = ua.UserRegister(user);

            if (r.Success)
            {
                ua.UserLogin(user.UserName, WS.RequestString("userpass"), 1);
                Js.AlertAndChangUrl("注册成功!", "/");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }
        }
Example #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataEntities ent = new DataEntities();
            User         u   = UserAction.opuser;

            if (u.ID <= 0)
            {
                Js.AlertAndChangUrl("对不起,您没有登录,请登陆后进行提问!", "/");
                return;
            }

            UserGroup g = (from l in ent.UserGroup where l.ID == u.Group select l).FirstOrDefault();

            if (g.MaxPost <= 0)
            {
                Js.AlertAndGoback("对不起,您没有提问的权限!如有疑问,请联系管理员");
                return;
            }



            if (!IsPostBack)
            {
                var cls = NewsAction.NewsClass;
                cls = cls.Where(p => p.EnablePost == true && p.IsLeafClass == true && p.ModelID == 3).ToList();
                ddl_Class.DataSource     = cls;
                ddl_Class.DataTextField  = "ClassName";
                ddl_Class.DataValueField = "id";
                ddl_Class.DataBind();

                int rclass = WS.RequestInt("class");
                if (rclass > 0)
                {
                    ddl_Class.SelectedValue = rclass.ToS();
                    ddl_Class.Enabled       = false;
                }
            }
            ent.Dispose();
        }
Example #28
0
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            if (txt_New.Text != txt_NewConf.Text)
            {
                Js.AlertAndGoback("两次密码输入不一致");
                return;
            }
            else if (Voodoo.Security.Encrypt.Md5(txt_Old.Text) != u.UserPass)
            {
                Js.AlertAndGoback("密码错误,请重新输入!");
                return;
            }
            else
            {
                DataEntities ent = new DataEntities();

                var user = (from l in ent.User where l.ID == u.ID select l).FirstOrDefault();
                user.UserPass = Voodoo.Security.Encrypt.Md5(txt_New.Text);
                ent.SaveChanges();
                ent.Dispose();
                Js.AlertAndChangUrl("密码修改成功,请重新登录系统!", "/e/member/Logout.aspx");
            }
        }
Example #29
0
        protected void btn_Login_Click(object sender, EventArgs e)
        {
            string userName = txt_UserName.Text.TrimDbDangerousChar();
            string userPass = txt_Userpass.Text.TrimDbDangerousChar();
            string vCode    = txt_VCode.Text.TrimDbDangerousChar();

            if (vCode.ToLower() != Session["SafeCode"].ToS())
            {
                Js.AlertAndGoback("验证码错误!");
                return;
            }

            Result r = SysUserAction.UserLogin(userName, userPass, "", "");

            if (r.Success)
            {
                Response.Redirect("~/e/admin/");
            }
            else
            {
                Js.AlertAndGoback(r.Text);
            }
        }
Example #30
0
        protected void btn_Chapter_Click(object sender, EventArgs e)
        {
            Response.Buffer = false;
            DataEntities ent      = new DataEntities();
            var          chapters = from l in ent.BookChapter select l;

            ent.Dispose();
            foreach (var c in chapters)
            {
                try
                {
                    Response.Write(string.Format("正在生成章节:{0}<br/>", c.Title));
                    CreatePage.CreateBookChapterPage(c, c.GetBook(), c.GetClass());
                    Js.ScrollEndStart();
                }
                catch (Exception ex)
                {
                    Response.Write(string.Format("{0}<br/>", ex.Message));
                }
            }

            Js.AlertAndGoback("成功!");
        }