protected void Page_Load(object sender, EventArgs e) { string str = new WeiSha.Common.Param.Method.ConvertToAnyValue(DateTime.Now.ToString()).JavascriptTime; Response.Write(str); Response.End(); }
public bool LoginCheck(int orgid, string acc, string pw) { pw = new WeiSha.Common.Param.Method.ConvertToAnyValue(pw).MD5; WhereClip wc = EmpAccount._.Acc_Pw == pw; wc.And(EmpAccount._.Org_ID == orgid); Song.Entities.EmpAccount ea; //先用帐号 ea = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_AccName == acc).ToFirst <EmpAccount>(); //如果帐号不正确,用手机号 if (ea == null) { ea = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_MobileTel == acc).ToFirst <EmpAccount>(); } //用员工编号 if (ea == null) { ea = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_EmpCode == acc).ToFirst <EmpAccount>(); } if (ea == null) { return(false); } //判断是否在职 return(ea.Acc_IsUse); }
/// <summary> /// 验证图片验证是否正确 /// </summary> /// <returns></returns> private bool isCodeImg() { //取图片验证码 string imgCode = WeiSha.Common.Request.Cookies["vpaycode"].ParaValue; //取员工输入的验证码 string userCode = new WeiSha.Common.Param.Method.ConvertToAnyValue(vpaycode).MD5; //验证 return(imgCode == userCode); }
public Teacher TeacherSingle(string accname, string pw, int orgid) { pw = new WeiSha.Common.Param.Method.ConvertToAnyValue(pw).MD5; WhereClip wc = new WhereClip(); if (orgid > 0) { wc.And(Teacher._.Org_ID == orgid); } wc.And(Teacher._.Th_AccName == accname || Teacher._.Th_IDCardNumber == accname); wc.And(Teacher._.Th_Pw == pw); return(Gateway.Default.From <Teacher>().Where(wc).ToFirst <Teacher>()); }
/// <summary> /// 根据键,获取值 /// </summary> /// <param name="key">键值</param> /// <returns></returns> public WeiSha.Common.Param.Method.ConvertToAnyValue this[string key] { get { SystemPara curr = GetSingle(key); if (curr == null) { return(new WeiSha.Common.Param.Method.ConvertToAnyValue(null)); } string val = !string.IsNullOrWhiteSpace(curr.Sys_Value) ? curr.Sys_Value.Trim() : curr.Sys_Default; WeiSha.Common.Param.Method.ConvertToAnyValue p = new WeiSha.Common.Param.Method.ConvertToAnyValue(val); p.Unit = curr.Sys_Unit; return(p); } }
/// <summary> /// 实现代迭器的功能,可以引用时用foreach循环 /// </summary> /// <returns></returns> public IEnumerator GetEnumerator() { //从缓存中读取 List <SystemPara> list = WeiSha.Common.Cache <SystemPara> .Data.List; if (list == null) { list = this.Refresh(); } for (int i = 0; i < list.Count; i++) { WeiSha.Common.Param.Method.ConvertToAnyValue p = new WeiSha.Common.Param.Method.ConvertToAnyValue(); p.ParaKey = list[i].Sys_Key; p.ParaValue = list[i].Sys_Value; p.Unit = list[i].Sys_Unit; yield return(p); } }
/// <summary> /// 登录 /// </summary> /// <param name="acc">账号,或身份证,或手机</param> /// <param name="pw">密码</param> /// <param name="orgid"></param> /// <returns></returns> public EmpAccount EmpLogin(string acc, string pw, int orgid) { WhereClip wc = EmpAccount._.Org_ID == orgid; string pwMd5 = new WeiSha.Common.Param.Method.ConvertToAnyValue(pw).MD5; wc.And(EmpAccount._.Acc_Pw == pwMd5); Song.Entities.EmpAccount entity = null; if (entity == null) { entity = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_AccName == acc).ToFirst <EmpAccount>(); } if (entity == null) { entity = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_MobileTel == acc).ToFirst <EmpAccount>(); } if (entity == null) { entity = Gateway.Default.From <EmpAccount>().Where(wc && EmpAccount._.Acc_IDCardNumber == acc).ToFirst <EmpAccount>(); } return(entity); }
protected override void InitPageTemplate(HttpContext context) { if (Request.ServerVariables["REQUEST_METHOD"] == "GET") { if (Extend.LoginState.Accounts.IsLogin) { int accid = Extend.LoginState.Accounts.CurrentUserId; Song.Entities.TeacherComment cmt = Business.Do <ITeacher>().CommentSingle(thid, accid, day); if (cmt != null) { //服务器端时间 string time = new WeiSha.Common.Param.Method.ConvertToAnyValue(DateTime.Now.ToString()).JavascriptTime; string last = new WeiSha.Common.Param.Method.ConvertToAnyValue(cmt.Thc_CrtTime.AddDays(day).ToString()).JavascriptTime; this.Document.Variables.SetValue("Time", time); this.Document.Variables.SetValue("Last", last); //最近一次评价 this.Document.SetValue("comment", cmt); } } } //此页面的ajax提交,全部采用了POST方式 if (Request.ServerVariables["REQUEST_METHOD"] == "POST") { string action = WeiSha.Common.Request.Form["action"].String; switch (action) { case "vcode": vcode_verify(); //验证验证码 break; case "submit": submit(); break; } Response.End(); } }
protected override void InitPageTemplate(HttpContext context) { //服务器端时间 string time = new WeiSha.Common.Param.Method.ConvertToAnyValue(DateTime.Now.ToString()).JavascriptTime; this.Document.Variables.SetValue("Time", time); //当前试卷 Song.Entities.TestPaper paper = null; paper = Business.Do <ITestPaper>().PagerSingle(tpid); if (paper != null) { paper.Tp_Logo = string.IsNullOrWhiteSpace(paper.Tp_Logo) ? paper.Tp_Logo : Upload.Get["TestPaper"].Virtual + paper.Tp_Logo; //判断Logo是否存在 string hylogo = WeiSha.Common.Server.MapPath(paper.Tp_Logo); if (!System.IO.File.Exists(hylogo)) { paper.Tp_Logo = string.Empty; } this.Document.SetValue("pager", paper); //试卷所属课程 Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(paper.Cou_ID); this.Document.SetValue("course", course); } }
protected override void InitPageTemplate(HttpContext context) { this.Document.SetValue("action", action); this.Document.SetValue("tpid", tpid); //唯一值 string uid = WeiSha.Common.Request.UniqueID(); this.Document.Variables.SetValue("uid", uid); //服务器端时间 string time = new WeiSha.Common.Param.Method.ConvertToAnyValue(DateTime.Now.ToString()).JavascriptTime; this.Document.Variables.SetValue("Time", time); if (!Extend.LoginState.Accounts.IsLogin) { this.Response.Redirect("Login.ashx"); } //当前试卷 paper = Business.Do <ITestPaper>().PagerSingle(tpid); this.Document.SetValue("pager", paper); //试卷所属课程 Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(paper.Cou_ID); this.Document.SetValue("course", course); //启始页状态 if (string.IsNullOrWhiteSpace(action)) { // } //开始考试 if (action == "start") { //题型 this.Document.SetValue("quesType", WeiSha.Common.App.Get["QuesType"].Split(',')); //取果是第一次打开,则随机生成试题,此为获取试卷 //难度区间 int diff1 = paper.Tp_Diff > paper.Tp_Diff2 ? (int)paper.Tp_Diff2 : (int)paper.Tp_Diff; int diff2 = paper.Tp_Diff > paper.Tp_Diff2 ? (int)paper.Tp_Diff : (int)paper.Tp_Diff2; //当前选中的课程 Song.Entities.Course currCourse = Extend.LoginState.Accounts.Course(); //开始抽题 List <Song.Entities.Questions> ques = new List <Entities.Questions>(); Dictionary <TestPaperItem, Song.Entities.Questions[]> dic = Business.Do <ITestPaper>().Putout(paper); foreach (var d in dic) { Song.Entities.Questions[] qs = (Song.Entities.Questions[])d.Value; for (int n = 0; n < qs.Length; n++) { qs[n].Qus_Explain = ""; qs[n].Qus_Answer = ""; qs[n] = Extend.Questions.TranText(qs[n]); qs[n].Qus_Title = qs[n].Qus_Title.Replace("<", "<"); qs[n].Qus_Title = qs[n].Qus_Title.Replace(">", ">"); qs[n].Qus_Title = Extend.Html.ClearHTML(qs[n].Qus_Title, "p", "div"); ques.Add(qs[n]); } } this.Document.SetValue("ques", ques); this.Document.RegisterGlobalFunction(this.getQuesType); this.Document.RegisterGlobalFunction(this.AnswerItems); this.Document.RegisterGlobalFunction(this.GetOrder); this.Document.RegisterGlobalFunction(this.IsCollect); } }
protected override void InitPageTemplate(HttpContext context) { if (!Extend.LoginState.Accounts.IsLogin) { context.Response.Redirect("~/student/index.ashx"); return; } this.Document.SetValue("tpid", tpid); //自定义配置项 WeiSha.Common.CustomConfig config = CustomConfig.Load(Organ.Org_Config); //如果需要学员登录后才能学习 bool isTraningLogin = config["IsTraningLogin"].Value.Boolean ?? false; this.Document.SetValue("isTraningLogin", isTraningLogin); //当前试卷 pager = Business.Do <ITestPaper>().PagerSingle(tpid); if (pager != null) { this.Document.SetValue("pager", pager); this.Document.SetValue("path", Upload.Get["TestPaper"].Virtual); //是否学习当前课程 if (this.Account != null) { if (pager != null) { Song.Entities.Course cou = Business.Do <ICourse>().CourseSingle(pager.Cou_ID); if (cou != null) { isStudy = Business.Do <ICourse>().StudyIsCourse(this.Account.Ac_ID, cou.Cou_ID); this.Document.Variables.SetValue("isStudy", isStudy); } } } //唯一值 string uid = WeiSha.Common.Request.UniqueID(); this.Document.Variables.SetValue("uid", uid); //服务器端时间 string time = new WeiSha.Common.Param.Method.ConvertToAnyValue(DateTime.Now.ToString()).JavascriptTime; this.Document.Variables.SetValue("Time", time); //试卷所属课程 Song.Entities.Course course = Business.Do <ICourse>().CourseSingle(pager.Cou_ID); this.Document.SetValue("course", course); //题型 this.Document.SetValue("quesType", WeiSha.Common.App.Get["QuesType"].Split(',')); //取果是第一次打开,则随机生成试题,此为获取试卷 //难度区间 int diff1 = pager.Tp_Diff > pager.Tp_Diff2 ? (int)pager.Tp_Diff2 : (int)pager.Tp_Diff; int diff2 = pager.Tp_Diff > pager.Tp_Diff2 ? (int)pager.Tp_Diff : (int)pager.Tp_Diff2; //开始抽题 List <Song.Entities.Questions> ques = new List <Entities.Questions>(); Dictionary <TestPaperItem, Questions[]> dic = Business.Do <ITestPaper>().Putout(pager); foreach (var d in dic) { Song.Entities.Questions[] qs = (Song.Entities.Questions[])d.Value; for (int n = 0; n < qs.Length; n++) { qs[n].Qus_Explain = ""; qs[n].Qus_Answer = ""; qs[n] = Extend.Questions.TranText(qs[n]); qs[n].Qus_Title = qs[n].Qus_Title.Replace("<", "<"); qs[n].Qus_Title = qs[n].Qus_Title.Replace(">", ">"); qs[n].Qus_Title = Extend.Html.ClearHTML(qs[n].Qus_Title, "p", "div"); ques.Add(qs[n]); } } this.Document.SetValue("ques", ques); this.Document.RegisterGlobalFunction(this.getQuesType); this.Document.RegisterGlobalFunction(this.AnswerItems); this.Document.RegisterGlobalFunction(this.GetOrder); this.Document.RegisterGlobalFunction(this.IsCollect); } }