/// <summary> /// 第三方用户登录认证 17-12-18TS /// </summary> public static bool AuthUserLoginByIF(Model_ConfigSchool modelCS, string schoolCode, string userName, string password) { bool flag = false; if (schoolCode == ThirdPartyEnum.yzlyxx.ToString()) { #region 扬州旅游商贸学校 用户认证 string para = string.Format("UserName={0}&Password={1}", userName, password); if (Rc.Common.RemotWeb.PostDataToServer(modelCS.D_PublicValue + "/AuthApi/yzlyxx/auth.aspx", para, Encoding.UTF8, "POST") == "successful") { flag = true; } #endregion } else if (schoolCode == ThirdPartyEnum.ahjzvs.ToString()) { #region 安徽金寨职业学校 object objUser = new BLL_F_User().GetModel(userName, Rc.Common.StrUtility.DESEncryptLogin.EncryptString(password)); if (objUser != null) { flag = true; } #endregion } return(flag); }
protected void btnConfirm_Click(object sender, EventArgs e) { try { BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); string oldPass = txtOldPass.Text.Trim(); string newPass = txtNewPass.Text.Trim(); model = bll.GetModel(FloginUser.UserName, Rc.Common.StrUtility.DESEncryptLogin.EncryptString(oldPass)); if (model == null) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('原始密码不正确',{icon:2,time:2000});</script>"); return; } model.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(newPass); if (bll.Update(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改成功',{icon:1,time:1000},function(){window.location.href='../index.aspx';});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改失败',{icon:2,time:2000});</script>"); } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('保存失败',{icon:2,time:2000});</script>"); } }
public static string GetFUserList(string UserId, int PageIndex, int PageSize) { try { UserId = UserId.Filter(); string strWhere = string.Empty; strWhere = " where 1=1"; if (!string.IsNullOrEmpty(UserId)) { strWhere += " AND UserId ='" + UserId + "'"; } int intRecordCount = 0; List <object> listReturn = new List <object>(); BLL_F_User bll_f_user = new BLL_F_User(); string sql = "select ClassId,ClassName,GradeId,GradeName,SchoolId,SchoolName from [dbo].[VW_UserOnClassGradeSchool] " + strWhere; string sqlCount = "select count(*) from VW_UserOnClassGradeSchool " + strWhere; DataTable dt = Rc.Common.DBUtility.DbHelperSQL.Query(sql).Tables[0]; intRecordCount = (int)Rc.Common.DBUtility.DbHelperSQL.GetSingle(sqlCount); foreach (DataRow item in dt.Rows) { listReturn.Add(new { ClassId = string.IsNullOrEmpty(item["ClassId"].ToString()) ? "-" : item["ClassId"].ToString(), ClassName = string.IsNullOrEmpty(item["ClassName"].ToString()) ? "-" : item["ClassName"].ToString(), GradeId = string.IsNullOrEmpty(item["GradeId"].ToString()) ? "-" : item["GradeId"].ToString(), GradeName = string.IsNullOrEmpty(item["GradeName"].ToString()) ? "-" : item["GradeName"].ToString(), SchoolId = item["SchoolId"].ToString(), SchoolName = item["SchoolName"].ToString() }); } if (dt.Rows.Count > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = intRecordCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = "error" })); } }
protected void btnSave_Click(object sender, EventArgs e) { try { string CheckCode = Session["AdminValidateCode"].ToString(); Session.Remove("AdminValidateCode"); if (TxtVerify.Value.ToUpper() != CheckCode) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('验证码输入不正确,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } BLL_F_User bll = new BLL_F_User(); Model_F_User user = new Model_F_User(); user = bll.GetModelByUserName(this.txt_username.Text.TrimEnd()); if (user != null) { if (string.IsNullOrEmpty(user.Email)) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('您没有绑定邮箱账号无法重置密码,请与网站管理员联系。', { time: 0, icon: 2 });</script>"); return; } else { if (user.Email != this.txt_emial.Text.TrimEnd()) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('请输入此账号绑定的邮箱账号(" + GetEmailSub(user.Email) + ")进行密码找回。', { time: 5000, icon: 2 });</script>"); return; } string url = string.Empty; string key = string.Empty; key = Rc.Common.DBUtility.DESEncrypt.Encrypt(this.txt_username.Text.TrimEnd() + "," + DateTime.Now.AddHours(1).ToString()); url = pfunction.getHostPath() + "/FindPwd/ResetPwd.aspx?key=" + key; if (pfunction.SendMail(this.txt_emial.Text.TrimEnd(), this.txt_username.Text.TrimEnd(), url)) { string temp = string.Empty; temp = "<b> " + GetThrowEmail(this.txt_emial.Text.TrimEnd()) == "" ? "邮箱" : GetThrowEmail(this.txt_emial.Text.TrimEnd()) + " </b>"; ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('邮件发送成功,请登录<b> " + temp + " </b>,进行重置密码。', {time:0, icon: 1 });</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('邮件发送失败,请重试。', { time: 2000, icon: 2 });</script>"); return; } } } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('账号不存在,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } } catch (Exception) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('邮件发送异常,请重试。', { time: 2000, icon: 2 });</script>"); return; } }
protected void btn_Save_Click(object sender, EventArgs e) { BLL_F_User bll_f_user = new BLL_F_User(); if (txt_password.Text.Trim() != txt_confirmPassword.Text.Trim()) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('两次输入的密码不一致,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } string CheckCode = Session["AdminValidateCode"].ToString(); Session.Remove("AdminValidateCode"); if (TxtVerify.Value.ToUpper() != CheckCode) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('验证码输入不正确,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } if (pfunction.FilterKeyWords(this.txt_username.Text)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('用户名存在敏感词汇,请重新填写。',{icon:2,time:2000});</script>"); return; } Model_F_User f_user = new Model_F_User(); f_user.UserId = Guid.NewGuid().ToString(); f_user.UserName = txt_username.Text.Trim(); f_user.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(txt_password.Text.Trim()); f_user.UserIdentity = "S";// radButType.SelectedValue; f_user.TrueName = txtTrueName.Text.Trim(); f_user.CreateTime = DateTime.Now; if (bll_f_user.Exists(f_user, "1")) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('用户名/邮箱/手机号已被注册,请重新输入。', { time: 2000, icon: 2 })</script>"); return; } bool result = bll_f_user.Add(f_user); if (result) { Session["FLoginUser"] = f_user; if (f_user.UserIdentity == "S") { Response.Redirect("/student/classList.aspx"); } else { Response.Redirect("/teacher/basicSetting.aspx"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('注册失败,请重新注册。', { time: 2000, icon: 2 })</script>"); return; } }
protected void btnSave_Click(object sender, EventArgs e) { try { if (this.txt_newpwd.Text.TrimEnd() != this.txt_confirmpwd.Text.TrimEnd()) { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('二次密码输入不一致,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } string[] str = key.Split(','); DateTime dt = Convert.ToDateTime(str[1]); if (dt > DateTime.Now) { if (str[0] == this.txt_username.Text.TrimEnd()) { BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); model = bll.GetModelByUserName(this.txt_username.Text.TrimEnd()); if (model == null) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('账号不存在,请重新填写',{icon:2,time:2000});</script>"); return; } model.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(this.txt_newpwd.Text.TrimEnd()); if (bll.Update(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码重置成功',{icon:1,time:1000},function(){window.location.href='Complete.aspx';});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码重置失败',{icon:2,time:2000});</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('非法操作,请重新输入。', { time: 2000, icon: 2 });</script>"); return; } } else { ClientScript.RegisterStartupScript(this.GetType(), "login", "<script>layer.msg('邮件链接时间超时,请重新发送邮件。', { time: 2000, icon: 2 });</script>"); return; } } catch (Exception) { } }
protected void Page_Load(object sender, EventArgs e) { userid = Request.QueryString["UserId"].Filter(); if (!IsPostBack) { DataTable dt = new DataTable(); string strWhere = string.Empty; strWhere = " D_Type='15' order by d_order "; Rc.Cloud.Web.Common.pfunction.SetDdlEmpty(ddlUserPost, new Rc.BLL.Resources.BLL_Common_Dict().GetList(strWhere).Tables[0], "D_Name", "Common_Dict_ID", "--请选择--"); BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); model = bll.GetModel(userid); txtTureName.Text = model.TrueName; txtUserName.Text = model.UserName; ddlUserPost.SelectedValue = model.UserPost; } }
protected void btnConfirm_Click(object sender, EventArgs e) { try { BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); string UserName = txtUserName.Text.Trim(); string PassWord = txtPassWord.Text.Trim(); model = bll.GetModel(UserName, Rc.Common.StrUtility.DESEncryptLogin.EncryptString(PassWord)); if (model == null) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('账号或密码不正确,请重新填写',{icon:4,time:2000,offset:'10px'})})</script>"); return; } else { BLL_StudentToParent Sbll = new BLL_StudentToParent(); Model_StudentToParent Smodel = new Model_StudentToParent(); DataTable dt = Sbll.GetList("Student_ID='" + model.UserId + "' and parent_id='" + FloginUser.UserId + "'").Tables[0]; if (model.UserIdentity == "S" && dt.Rows.Count == 0) { Smodel.StudentToParent_ID = Guid.NewGuid().ToString(); Smodel.Parent_ID = FloginUser.UserId; Smodel.Student_ID = model.UserId; Smodel.CreateTime = DateTime.Now; if (Sbll.Add(Smodel)) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('添加成功',{icon:1,time:2000,offset:'10px'},function(){parent.window.location.reload()})})</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('账号不正确或此账号已绑定',{icon:4,time:2000,offset:'10px'})})</script>"); return; } } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('" + ex.Message + "',{icon:4,time:2000,offset:'10px'})})</script>"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); model = bll.GetModel(userid); if (model != null) { string UserName = txtUserName.Text.Trim(); if (string.IsNullOrEmpty(UserName)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function () {layer.msg('请输入登录名',{icon:2,time:2000});})</script>"); return; } if (bll.GetRecordCount("UserId<>'" + userid + "' and UserName='******'") > 0) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function () {layer.msg('登录名已存在,请重新输入',{icon:2,time:2000});})</script>"); return; } model.UserName = UserName; model.TrueName = txtTureName.Text.Trim(); model.UserPost = ddlUserPost.SelectedValue; if (bll.Update(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function () {layer.msg('修改成功',{icon:1,time:1000},function(){parent.loadData();parent.layer.close(index);});})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function () {layer.msg('修改失败',{icon:2,time:2000});})</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改失败',{icon:2,time:2000});</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改失败',{icon:2,time:2000});</script>"); } }
public static string resettingPwd(string UserId) { try { Model_F_User modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"]; string userId = modelFUser.UserId; Model_F_User user = new Model_F_User(); BLL_F_User bll = new BLL_F_User(); user = bll.GetModel(UserId.Filter()); if (user != null) { user.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString("123456"); } Model_Msg modelMsg = new Model_Msg(); modelMsg.MsgId = Guid.NewGuid().ToString(); modelMsg.MsgEnum = MsgEnum.Notice.ToString(); modelMsg.MsgTypeEnum = MsgTypeEumn.Private.ToString(); modelMsg.ResourceDataId = ""; modelMsg.MsgTitle = string.Format("您的密码被【{0}】老师重置为123456", string.IsNullOrEmpty(modelFUser.TrueName) ? modelFUser.UserName : modelFUser.TrueName); modelMsg.MsgContent = string.Format("您的密码被【{0}】老师重置为123456", string.IsNullOrEmpty(modelFUser.TrueName) ? modelFUser.UserName : modelFUser.TrueName); modelMsg.MsgStatus = MsgStatus.Unread.ToString(); modelMsg.MsgSender = userId; modelMsg.MsgAccepter = UserId; modelMsg.CreateTime = DateTime.Now; modelMsg.CreateUser = userId; if (bll.resettingPwd(user, modelMsg)) { return("1"); } else { return("0"); } } catch (Exception) { return("0"); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { BLL_F_User bll = new BLL_F_User(); Model_F_User model = new Model_F_User(); model = bll.GetModel(userid); if (model != null) { //string oldPass = txt_oldpassword.Text.Trim(); string newPass = txt_newpassword.Text.Trim(); //model = bll.GetModel(model.UserName, Rc.Common.StrUtility.DESEncryptLogin.EncryptString(oldPass)); //if (model == null) //{ // ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('原始密码不正确',{icon:2,time:2000});</script>"); // return; //} model.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(newPass); if (bll.Update(model)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改成功',{icon:1,time:1000},function(){parent.layer.close(index);});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改失败',{icon:2,time:2000});</script>"); } } else { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改失败',{icon:2,time:2000});</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('密码修改失败',{icon:2,time:2000});</script>"); } }
public static string GetFUserList(string UserName, int PageIndex, int PageSize) { try { Model_VSysUserRole loginUser = (Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; Model_Struct_Func UserFun = new Rc.Cloud.BLL.BLL_clsAuth().GetUserFunc(loginUser.SysUser_ID, (loginUser == null ? "''" : clsUtility.ReDoStr(loginUser.SysRole_IDs, ',')), "90200300"); UserName = UserName.Filter(); string strWhere = string.Empty; strWhere = "1=1"; if (!string.IsNullOrEmpty(UserName)) { strWhere += " AND (UserName like '%" + UserName + "%' or TrueName like '%" + UserName + "%') "; } int intRecordCount = 0; List <object> listReturn = new List <object>(); BLL_F_User bll_f_user = new BLL_F_User(); DataTable dt = bll_f_user.GetListPage(strWhere, "CreateTime DESC", ((PageIndex - 1) * PageSize + 1), PageIndex * PageSize).Tables[0]; intRecordCount = bll_f_user.GetRecordCount(strWhere); foreach (DataRow item in dt.Rows) { string strSex = string.Empty; switch (item["Sex"].ToString()) { case "M": strSex = "男"; break; case "F": strSex = "女"; break; case "S": strSex = "保密"; break; default: strSex = ""; break; } string strOperate = string.Empty; if (UserFun.Edit) { strOperate += string.Format("<a href=\"javascript:changepwd('{0}');\">修改密码</a>", item["UserId"]); strOperate += string.Format("<a href=\"javascript:Update('{0}');\">修改账号</a>", item["UserId"]); } if (UserFun.Select) { strOperate += string.Format("<a href=\"javascript:Show('{0}');\">查看</a>", item["UserId"]); } if (UserFun.Delete) { strOperate += string.Format("<a href=\"javascript:del('{0}');\">删除</a>", item["UserId"]); } listReturn.Add(new { UserName = item["UserName"].ToString(), TrueName = item["TrueName"].ToString(), UserPostName = item["UserPostName"].ToString(), Sex = strSex, Email = item["Email"].ToString(), Mobile = item["Mobile"].ToString(), SubjectName = item["SubjectName"].ToString(), UserId = item["UserId"].ToString(), Operate = strOperate }); } if (dt.Rows.Count > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = intRecordCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = "error" })); } }
private void InputExcelDataToDB() { string strLog = string.Empty; int exData = 0; try { DataRow[] dr = excelData.Select("ErrorData='正确'"); if (dr.Count() > 0) { if (strQtype == "1") { List <Model_UserGroup> listModelUG = new List <Model_UserGroup>(); List <Model_F_User> listModelFU = new List <Model_F_User>(); List <Model_ClassPool> listModelCP = new List <Model_ClassPool>(); List <Model_UserGroup_Member> listModelUGM = new List <Model_UserGroup_Member>(); for (int i = 0; i < dr.Count(); i++) { string userId = string.Empty; #region 用户 Model_F_User modelFUser = new BLL_F_User().GetModelByUserName(dr[i]["创建人登录账号"].ToString().Trim().Filter()); if (modelFUser == null) { modelFUser = new Model_F_User(); #region 新增用户 userId = Guid.NewGuid().ToString(); modelFUser.UserId = userId; modelFUser.UserName = dr[i]["创建人登录账号"].ToString().Trim(); modelFUser.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString("123456"); modelFUser.TrueName = dr[i]["创建人登录账号"].ToString().Trim(); modelFUser.UserIdentity = "T"; modelFUser.CreateTime = DateTime.Now; modelFUser.UserPost = UserPost.年级组长; listModelFU.Add(modelFUser); #endregion } else { userId = modelFUser.UserId; } #endregion string gradeId = pfunction.GetNewUserGroupID(); #region 年级群组 Model_UserGroup modelUG = new Model_UserGroup(); modelUG.UserGroup_Id = gradeId; modelUG.UserGroup_ParentId = userGroupParentId; modelUG.User_ID = userId; modelUG.UserGroup_Name = dr[i]["年级名称"].ToString().Trim(); modelUG.UserGroup_BriefIntroduction = dr[i]["年级简介"].ToString().Trim(); modelUG.CreateTime = DateTime.Now; modelUG.UserGroup_AttrEnum = UserGroup_AttrEnum.Grade.ToString(); modelUG.GradeType = "";//导入年级时,年级类型(学段)默认为空 listModelUG.Add(modelUG); #endregion #region 群组池 Model_ClassPool modelClassPool = new BLL_ClassPool().GetModelByClass_Id(gradeId); modelClassPool.IsUsed = 1; listModelCP.Add(modelClassPool); #endregion #region 群组成员表--年级加入学校 Model_UserGroup_Member modelUGM = new Model_UserGroup_Member(); modelUGM.UserGroup_Member_Id = Guid.NewGuid().ToString(); modelUGM.UserGroup_Id = userGroupParentId; modelUGM.User_ID = gradeId; modelUGM.User_ApplicationStatus = "passed"; modelUGM.User_ApplicationTime = DateTime.Now; modelUGM.User_ApplicationReason = "导入年级"; modelUGM.User_ApplicationPassTime = DateTime.Now; modelUGM.UserStatus = 0; modelUGM.MembershipEnum = MembershipEnum.grade.ToString(); modelUGM.CreateUser = loginUser.SysUser_ID; listModelUGM.Add(modelUGM); #endregion #region 群组成员表--年级负责人建立与年级关系 modelUGM = new Model_UserGroup_Member(); modelUGM.UserGroup_Member_Id = Guid.NewGuid().ToString(); modelUGM.UserGroup_Id = gradeId; modelUGM.User_ID = userId; modelUGM.User_ApplicationStatus = "passed"; modelUGM.User_ApplicationTime = DateTime.Now; modelUGM.User_ApplicationReason = "年级负责人建立与年级关系"; modelUGM.User_ApplicationPassTime = DateTime.Now; modelUGM.UserStatus = 0; modelUGM.MembershipEnum = MembershipEnum.gradedirector.ToString(); modelUGM.CreateUser = loginUser.SysUser_ID; listModelUGM.Add(modelUGM); #endregion } exData = new BLL_UserGroup().ImportGradeData(listModelFU, listModelUG, listModelCP, listModelUGM); } strLog = "年级导入信息:操作人ID:【" + loginUser.SysUser_ID + "】"; } if (exData > 0) { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>$(function(){layer.ready(function(){layer.msg('【" + dr.Count() + "】年级被成功导入',{time:1000,icon:1},function(){historyBack();});})})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>$(function(){layer.ready(function(){layer.msg('操作失败',{time:2000,icon:2});})})</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>$(function(){layer.ready(function(){layer.msg('操作失败',{time:2000,icon:2});})})</script>"); new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("导入年级失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message)); } excelData.Clear(); }
public static string loginIndex(string UserId, string UserPost, string Subject, string ClassId, string type) { string strJson = string.Empty; string iurl = string.Empty; try { HttpContext.Current.Session["UserPublicUrl"] = null; UserId = UserId.Filter(); UserPost = UserPost.Filter(); Subject = Subject.Filter(); ClassId = ClassId.Filter(); type = type.Filter(); Model_F_User model = new BLL_F_User().GetModel(UserId); bool flag = true; if (model != null) { model.UserIdentity = type; if (!string.IsNullOrEmpty(UserPost) && UserPost != "-1") { model.UserPost = UserPost; } if (!string.IsNullOrEmpty(Subject) && Subject != "-1") { model.Subject = Subject; } flag = new BLL_F_User().Update(model); if (flag == false) { strJson = JsonConvert.SerializeObject(new { err = "操作失败请重试", iurl = "" }); return(strJson); } if (type == "T") //年级主任,年级组长 { if (!string.IsNullOrEmpty(ClassId) && ClassId != "-1" && !string.IsNullOrEmpty(Subject) && Subject != "-1") //加入年级 { #region 加入班级 BLL_UserGroup_Member bll = new BLL_UserGroup_Member(); List <Model_UserGroup_Member> listModelUGM = bll.GetModelList(string.Format("User_ID='{0}' and UserGroup_Id='{1}'", UserId, ClassId)); bool isExistDataClass = false;//是否已存在成员数据 if (listModelUGM.Count != 0) { isExistDataClass = true; } Model_UserGroup_Member UserGroup_Member_Class = new Model_UserGroup_Member(); UserGroup_Member_Class.UserGroup_Member_Id = Guid.NewGuid().ToString(); UserGroup_Member_Class.UserGroup_Id = ClassId; UserGroup_Member_Class.User_ID = UserId; UserGroup_Member_Class.User_ApplicationStatus = "passed"; UserGroup_Member_Class.UserStatus = 0; UserGroup_Member_Class.User_ApplicationTime = DateTime.Now; UserGroup_Member_Class.User_ApplicationReason = "完善信息-加入班级"; UserGroup_Member_Class.MembershipEnum = MembershipEnum.teacher.ToString(); UserGroup_Member_Class.CreateUser = UserId; UserGroup_Member_Class.User_ApplicationPassTime = DateTime.Now; if (isExistDataClass == false) { flag = bll.Add(UserGroup_Member_Class); if (flag == false) { strJson = JsonConvert.SerializeObject(new { err = "操作失败请重试", iurl = "" }); return(strJson); } } #endregion } } else { if (!string.IsNullOrEmpty(ClassId) && ClassId != "-1") { #region 加入班级 BLL_UserGroup_Member bll = new BLL_UserGroup_Member(); List <Model_UserGroup_Member> listModelUGM = bll.GetModelList(string.Format("User_ID='{0}' and UserGroup_Id='{1}'", UserId, ClassId)); bool isExistDataClass = false;//是否已存在成员数据 if (listModelUGM.Count != 0) { isExistDataClass = true; } Model_UserGroup_Member UserGroup_Member_Class = new Model_UserGroup_Member(); UserGroup_Member_Class.UserGroup_Member_Id = Guid.NewGuid().ToString(); UserGroup_Member_Class.UserGroup_Id = ClassId; UserGroup_Member_Class.User_ID = UserId; UserGroup_Member_Class.User_ApplicationStatus = "passed"; UserGroup_Member_Class.UserStatus = 0; UserGroup_Member_Class.User_ApplicationTime = DateTime.Now; UserGroup_Member_Class.User_ApplicationReason = "完善信息-加入班级"; UserGroup_Member_Class.MembershipEnum = MembershipEnum.student.ToString(); UserGroup_Member_Class.CreateUser = UserId; UserGroup_Member_Class.User_ApplicationPassTime = DateTime.Now; if (isExistDataClass == false) { flag = bll.Add(UserGroup_Member_Class); if (flag == false) { strJson = JsonConvert.SerializeObject(new { err = "操作失败请重试", iurl = "" }); return(strJson); } } #endregion } } #region 登录 HttpContext.Current.Session["FLoginUser"] = model; if (type == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (type == "S") { iurl = "/student/oHomework.aspx"; } #endregion string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } strJson = JsonConvert.SerializeObject(new { err = "null", iurl = iurl }); } else { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "用户密码错误,请重新登录。", iurl = "" }); } } catch (Exception) { strJson = JsonConvert.SerializeObject(new { err = "null", iurl = "/ErrorPageF.aspx?errorType=6" }); } return(strJson); }
private void InputExcelDataToDB() { string strLog = string.Empty; int exData = 0; try { DataRow[] dr = excelData.Select("ErrorData='正确'"); if (dr.Count() > 0) { if (strQtype == "1") { Model_UserGroup modelUG = new Model_UserGroup(); List <Model_F_User> listModelFU = new List <Model_F_User>(); List <Model_UserGroup_Member> listModelUGM = new List <Model_UserGroup_Member>(); for (int i = 0; i < dr.Count(); i++) { string userId = string.Empty; #region 用户 Model_F_User modelFUser = new BLL_F_User().GetModelByUserName(dr[i]["登录账号"].ToString().Trim().Filter()); if (modelFUser == null) { modelFUser = new Model_F_User(); #region 新增用户 userId = Guid.NewGuid().ToString(); modelFUser.UserId = userId; modelFUser.UserName = dr[i]["登录账号"].ToString().Trim(); string pass = dr[i]["密码"].ToString().Trim(); if (string.IsNullOrEmpty(pass)) { pass = "******"; } modelFUser.Password = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(pass); modelFUser.TrueName = dr[i]["姓名"].ToString().Trim(); modelFUser.CreateTime = DateTime.Now; if (dr[i]["身份"].ToString().Trim() == "学生") { modelFUser.UserIdentity = "S"; } else { modelFUser.UserIdentity = "T"; modelFUser.UserPost = UserPost.普通老师; modelFUser.Subject = pfunction.GetCommon_DictId("7", dr[i]["学科"].ToString().Trim()); } listModelFU.Add(modelFUser); #endregion } else { userId = modelFUser.UserId; } #endregion #region 更新群组User_Id if (dr[i]["身份"].ToString().Trim() == "班主任") { modelUG = new BLL_UserGroup().GetModel(userGroupParentId); modelUG.User_ID = userId; } #endregion #region 群组成员表 Model_UserGroup_Member modelUGM = new Model_UserGroup_Member(); modelUGM.UserGroup_Member_Id = Guid.NewGuid().ToString(); modelUGM.UserGroup_Id = userGroupParentId; modelUGM.User_ID = userId; modelUGM.User_ApplicationStatus = "passed"; modelUGM.User_ApplicationTime = DateTime.Now; modelUGM.User_ApplicationReason = "导入用户"; modelUGM.User_ApplicationPassTime = DateTime.Now; modelUGM.UserStatus = 0; if (dr[i]["身份"].ToString().Trim() == "学生") { modelUGM.MembershipEnum = MembershipEnum.student.ToString(); } else if (dr[i]["身份"].ToString().Trim() == "班主任") { modelUGM.MembershipEnum = MembershipEnum.headmaster.ToString(); } else if (dr[i]["身份"].ToString().Trim() == "代课老师") { modelUGM.MembershipEnum = MembershipEnum.teacher.ToString(); } modelUGM.CreateUser = loginUser.SysUser_ID; listModelUGM.Add(modelUGM); #endregion } exData = new BLL_UserGroup_Member().ImportClassMemberData(listModelFU, listModelUGM, modelUG); } strLog = "班级成员导入信息 : 操作人ID:【" + loginUser.SysUser_ID + "】"; } if (exData > 0) { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>layer.msg('【" + dr.Count() + "】班级成员被成功导入',{time:1000,icon:1},function(){historyBack();});</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>layer.msg('操作失败',{time:2000,icon:2});</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(this.GetType(), "handle", "<script type='text/javascript'>layer.msg('操作失败',{time:2000,icon:2});</script>"); new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("导入班级成员失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message)); } excelData.Clear(); }
public static string loginIndex(string userName, string passWord, string backUrl) { string strJson = string.Empty; string iurl = string.Empty; try { HttpContext.Current.Session["UserPublicUrl"] = null; string loginName = string.Empty; string loginPassWord = string.Empty; loginName = userName.Trim(); loginPassWord = Rc.Common.StrUtility.DESEncryptLogin.EncryptString(passWord.Trim()); Model_F_User loginModel = new Model_F_User(); object objFUser = new BLL_F_User().GetModelByUserName(loginName); object objIFUser = new BLL_TPIFUser().GetModelByUserName(loginName); if (objFUser == null && objIFUser == null) { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "该账号不存在,请重新登录。", iurl = "" }); return(strJson); } #region 验证第三方接口用户 if (objIFUser != null) { Model_TPIFUser modelIFUser = objIFUser as Model_TPIFUser; Model_TPSchoolIF modelSIF = new BLL_TPSchoolIF().GetModelBySchoolIF_Code(modelIFUser.School); if (modelSIF == null) { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "学校接口配置不存在,请重新登录。", iurl = "" }); return(strJson); } Model_ConfigSchool modelCS = new BLL_ConfigSchool().GetModelBySchoolIdNew(modelSIF.SchoolId); if (modelCS == null) { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "学校配置不存在,请重新登录。", iurl = "" }); return(strJson); } if (modelSIF.SchoolIF_Code == ThirdPartyEnum.ahjzvs.ToString()) { #region 安徽金寨职业学校 loginModel = new BLL_F_User().GetModel(modelIFUser.UserName, loginPassWord); if (loginModel == null) { Model_F_User loginModelNew = (Model_F_User)objFUser; if (loginModelNew.Password == Rc.Common.StrUtility.DESEncryptLogin.EncryptString(Rc.Common.Config.Consts.DefaultPassword)) { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "当前密码123456,过于简单,建议在个人中心中修改。", iurl = "" }); return(strJson); } HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "用户密码错误,请重新登录。", iurl = "" }); return(strJson); } HttpContext.Current.Session["FLoginUser"] = loginModel; if (loginModel.UserIdentity == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + loginModel.UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (loginModel.UserIdentity == "S") { iurl = "/student/oHomework.aspx"; } else if (loginModel.UserIdentity == "P") { iurl = "/parent/student.aspx"; } string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(loginModel.UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } if (string.IsNullOrEmpty(iurl)) { iurl = string.Format("/RE_Register/PerfectInformation.aspx?SchoolId={0}&UserId={1}" , modelCS.School_ID, loginModel.UserId); } strJson = JsonConvert.SerializeObject(new { err = "null", iurl = iurl }); return(strJson); #endregion } else { #region 其他学校 if (Rc.Interface.AuthAPI_pfunction.AuthUserLoginByIF(modelCS, modelIFUser.School, userName, passWord)) { #region 登录 loginModel = new BLL_F_User().GetModelByUserName(modelIFUser.School + modelIFUser.UserName); HttpContext.Current.Session["FLoginUser"] = loginModel; if (loginModel.UserIdentity == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + loginModel.UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (loginModel.UserIdentity == "S") { iurl = "/student/oHomework.aspx"; } else if (loginModel.UserIdentity == "P") { iurl = "/parent/student.aspx"; } string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(loginModel.UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } if (string.IsNullOrEmpty(iurl)) { iurl = string.Format("/RE_Register/PerfectInformation.aspx?SchoolId={0}&UserId={1}", modelCS.School_ID, loginModel.UserId); } strJson = JsonConvert.SerializeObject(new { err = "null", iurl = iurl }); return(strJson); #endregion } else { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "接口用户密码错误,请重新登录。", iurl = "" }); return(strJson); } #endregion } } #endregion #region 验证作业平台用户 if (objFUser != null) { objFUser = new BLL_F_User().GetModel(loginName, loginPassWord); if (objFUser != null) { #region 登录 loginModel = objFUser as Model_F_User; HttpContext.Current.Session["FLoginUser"] = loginModel; if (loginModel.UserIdentity == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + loginModel.UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (loginModel.UserIdentity == "S") { iurl = "/student/oHomework.aspx"; } else if (loginModel.UserIdentity == "P") { iurl = "/parent/student.aspx"; } if (!string.IsNullOrEmpty(backUrl)) { iurl = backUrl; } #endregion if (string.IsNullOrEmpty(loginModel.TrueName)) { loginModel.TrueName = loginModel.UserName; new BLL_F_User().Update(loginModel); } string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(loginModel.UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } strJson = JsonConvert.SerializeObject(new { err = "null", iurl = iurl }); } else { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "用户密码错误,请重新登录。", iurl = "" }); } } else { HttpContext.Current.Session.Clear(); strJson = JsonConvert.SerializeObject(new { err = "该账号不存在,请重新登录。。", iurl = "" }); } #endregion } catch (Exception ex) { strJson = JsonConvert.SerializeObject(new { err = "null", iurl = "/ErrorPageF.aspx?errorType=6" }); Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS("", "用户登录", ex.Message.ToString()); } return(strJson); }
/// <summary> /// 处理用户信息,返回用户登录后网页地址 18-01-03TS /// </summary> public static string HandelUserInfo(string schoolCode, string loginName, string trueName) { string iurl = string.Empty; string schoolId = string.Empty; List <Model_TPIFUser> listIFUser = new BLL_TPIFUser().GetModelList("UserName='******'"); Model_TPIFUser modelIFUser = new BLL_TPIFUser().GetModelBySchoolUserName(schoolCode, loginName); if (schoolCode == ThirdPartyEnum.ahjzvs.ToString()) { #region 安徽金寨职业学校 if (modelIFUser != null)//用户已登录过 { #region 登录 Model_F_User loginModel = new BLL_F_User().GetModelByUserName(modelIFUser.UserName); HttpContext.Current.Session["FLoginUser"] = loginModel; if (loginModel.UserIdentity == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + loginModel.UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (loginModel.UserIdentity == "S") { iurl = "/student/oHomework.aspx"; } else if (loginModel.UserIdentity == "P") { iurl = "/parent/student.aspx"; } string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(loginModel.UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } if (string.IsNullOrEmpty(iurl)) { Model_TPSchoolIF modelSIF = new BLL_TPSchoolIF().GetModelBySchoolIF_Code(schoolCode); if (modelSIF != null) { schoolId = modelSIF.SchoolId; } iurl = string.Format("/RE_Register/PerfectInformation.aspx?SchoolId={0}&UserId={1}", schoolId, loginModel.UserId); } #endregion } else { #region 第一次登录,写入用户数据 Model_TPSchoolIF modelSIF = new BLL_TPSchoolIF().GetModelBySchoolIF_Code(schoolCode); if (modelSIF != null) { schoolId = modelSIF.SchoolId; } string userId = Guid.NewGuid().ToString(); #region TPIFUser modelIFUser = new Model_TPIFUser(); modelIFUser.ThirdPartyIFUser_Id = Guid.NewGuid().ToString(); modelIFUser.School = schoolCode; modelIFUser.UserName = loginName; modelIFUser.CreateTime = DateTime.Now; new BLL_TPIFUser().Add(modelIFUser); #endregion #region F_User Model_F_User modelFUser = new Model_F_User(); modelFUser.UserId = userId; modelFUser.UserName = loginName; modelFUser.TrueName = trueName; modelFUser.Password = DESEncryptLogin.EncryptString(Rc.Common.Config.Consts.DefaultPassword); modelFUser.CreateTime = DateTime.Now; new BLL_F_User().Add(modelFUser); #endregion iurl = string.Format("/RE_Register/PerfectInformation.aspx?userId={0}&schoolId={1}", userId, schoolId); #endregion } #endregion } else { #region 其他学校 if (modelIFUser != null)//用户已登录过 { #region 登录 Model_F_User loginModel = new BLL_F_User().GetModelByUserName(modelIFUser.School + modelIFUser.UserName); HttpContext.Current.Session["FLoginUser"] = loginModel; if (loginModel.UserIdentity == "T") { //是否带班 int classCount = new BLL_UserGroup().GetRecordCount(" UserGroup_AttrEnum='Class' and UserGroup_Id in(select UserGroup_Id from UserGroup_Member where USER_ID='" + loginModel.UserId + "' and User_ApplicationStatus='passed' and UserStatus='0') "); if (classCount > 0 && (Rc.Cloud.Web.Common.pfunction.GetWebMdlIsShow("cTeachPlan"))) { iurl = "/teacher/cTeachPlan.aspx"; } else { iurl = "/teacher/basicSetting.aspx"; } } else if (loginModel.UserIdentity == "S") { iurl = "/student/oHomework.aspx"; } else if (loginModel.UserIdentity == "P") { iurl = "/parent/student.aspx"; } string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrl = new BLL_ConfigSchool().GetSchoolPublicUrl(loginModel.UserId).Tables[0]; if (dtUrl.Rows.Count > 0) { HttpContext.Current.Session["UserPublicUrl"] = dtUrl.Rows[0]["publicUrl"]; local_url = dtUrl.Rows[0]["apiUrlList"].ToString(); } #endregion string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrl.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } if (string.IsNullOrEmpty(iurl)) { Model_TPSchoolIF modelSIF = new BLL_TPSchoolIF().GetModelBySchoolIF_Code(schoolCode); if (modelSIF != null) { schoolId = modelSIF.SchoolId; } iurl = string.Format("/RE_Register/PerfectInformation.aspx?SchoolId={0}&UserId={1}", schoolId, loginModel.UserId); } #endregion } else { #region 第一次登录,写入用户数据 Model_TPSchoolIF modelSIF = new BLL_TPSchoolIF().GetModelBySchoolIF_Code(schoolCode); if (modelSIF != null) { schoolId = modelSIF.SchoolId; } string userId = Guid.NewGuid().ToString(); #region TPIFUser modelIFUser = new Model_TPIFUser(); modelIFUser.ThirdPartyIFUser_Id = Guid.NewGuid().ToString(); modelIFUser.School = schoolCode; modelIFUser.UserName = loginName; modelIFUser.CreateTime = DateTime.Now; new BLL_TPIFUser().Add(modelIFUser); #endregion #region F_User Model_F_User modelFUser = new Model_F_User(); modelFUser.UserId = userId; modelFUser.UserName = schoolCode + loginName; modelFUser.TrueName = trueName; modelFUser.CreateTime = DateTime.Now; new BLL_F_User().Add(modelFUser); #endregion iurl = "/RE_Register/PerfectInformation.aspx?userId=" + userId + "&schoolId=" + schoolId; #endregion } #endregion } return(iurl); }
protected void Page_Load(object sender, EventArgs e) { string strToken = string.Empty; string strUserId = string.Empty; string strError = string.Empty; string strProductType = string.Empty; if (!String.IsNullOrEmpty(Request["token"]) && !String.IsNullOrEmpty(Request["userId"]) && !String.IsNullOrEmpty(Request["productType"])) { strToken = Request["token"].ToString().Filter(); strUserId = Request["userId"].ToString().Filter(); strProductType = Request["productType"].ToString().Filter(); Model_F_User_Client model = new Model_F_User_Client(); model = new BLL_F_User_Client().GetUserModelByClientToken(strUserId, strToken, strProductType); if (model != null) { string iurl = string.Empty; //用户信息 Model_F_User loginUser = new Model_F_User(); loginUser = new BLL_F_User().GetModel(strUserId); if (loginUser != null) { #region 前台用户 Session["FLoginUser"] = loginUser; Session["modlist"] = null; string local_url = string.Empty; // 局域网地址 #region 学校配置URL DataTable dtUrlLICH = new BLL_ConfigSchool().GetSchoolPublicUrl(loginUser.UserId).Tables[0]; if (dtUrlLICH.Rows.Count > 0) { Session["UserPublicUrl"] = dtUrlLICH.Rows[0]["publicUrl"]; local_url = dtUrlLICH.Rows[0]["apiUrlList"].ToString(); } #endregion if (loginUser.UserIdentity == "T") { iurl = "/teacher/Comment.aspx"; } else { iurl = "/student/basicSetting.aspx"; } string rurl = string.Format("/onlinecheck.aspx?iurl={0}&local_url={1}" , HttpContext.Current.Server.UrlEncode(iurl) , HttpContext.Current.Server.UrlEncode(local_url)); if (dtUrlLICH.Rows.Count > 0) // 有局域网配置数据,验证是否局域网 { iurl = rurl; } Response.Redirect(iurl); Response.End(); #endregion } else { #region 后台用户 Rc.Cloud.Model.Model_VSysUserRole loginModel = new Model.Model_VSysUserRole(); loginModel = new Rc.Cloud.BLL.BLL_VSysUserRole().GetSysUserInfoModelBySysUserId(strUserId); if (loginModel != null) { DataTable dt = new Rc.Cloud.BLL.BLL_SysModule().GetOwenModuleListByCacheBySysCode(loginModel.SysUser_ID, Rc.Common.StrUtility.clsUtility.ReDoStr(loginModel.SysRole_IDs, ',')); DataRow[] drs = dt.Select("isLast='1' and url<>'#'", "DefaultOrder desc"); if (drs.Count() > 0) { Session["LoginUser"] = loginModel; if (Request["iurl"] != null) { Response.Redirect(Request["iurl"].ToString()); } else { Response.Redirect("/" + drs[0]["url"].ToString()); } } else { Rc.Common.StrUtility.clsUtility.ErrorDispose(this.Page, 6, false); } } #endregion } } else { strError = "对不起,此账号已在其他机器登录。"; } } else { strError = "参数无效"; } Response.Write(strError); Response.End(); }
protected string GetHtmlData() { try { StringBuilder strSql = new StringBuilder(); if (!string.IsNullOrEmpty(Request["name"])) { strSql.Append(" and (UserName like '" + Request["name"].ToString() + "%')"); } BLL_F_User bll = new BLL_F_User(); DataTable dt = bll.GetListPaged(strSql.ToString(), PageIndex, PageSize, out rCount, out pCount).Tables[0]; StringBuilder strHtmlData = new StringBuilder(); strHtmlData.Append("<table class='table_list' cellpadding='0' cellspacing='0' >"); strHtmlData.Append("<tr class='tr_title'>"); strHtmlData.Append("<td style='width:8%;'>账号</td>"); strHtmlData.Append("<td style='width:8%;'>真实姓名</td>"); strHtmlData.Append("<td style='width:8%;'>邮箱</td>"); strHtmlData.Append("<td style='width:8%;'>手机</td>"); //if (UserFun.Edit) //{ strHtmlData.Append("<td style='width:8%;'>操作</td>"); //} strHtmlData.Append("</tr>"); for (int i = 0; i < dt.Rows.Count; i++) { string css = string.Empty; if (i % 2 == 0) { css = "tr_con_001"; } else { css = "tr_con_002"; } strHtmlData.Append("<tr class='" + css + "'>"); strHtmlData.Append("<td>" + dt.Rows[i]["UserName"].ToString() + "</td>"); strHtmlData.Append("<td>" + dt.Rows[i]["TrueName"].ToString() + "</td>"); strHtmlData.Append("<td>" + dt.Rows[i]["Email"].ToString() + "</td>"); strHtmlData.Append("<td>" + dt.Rows[i]["Mobile"].ToString() + "</td>"); strHtmlData.Append("<td>"); if (UserFun.Edit) { strHtmlData.AppendFormat(" <input type=\"button\" title='编辑用户信息' class=\"btn_modify\" onclick=\"showPopAddDepartment('{0}',1);\" />", dt.Rows[i]["UserId"].ToString()); } else { strHtmlData.Append(" <input type=\"button\" title='没有权限编辑用户信息' class=\"btn_modify2\" />"); } strHtmlData.AppendFormat("|"); if (UserFun.Delete) { strHtmlData.AppendFormat("<input type=\"button\" class=\"btn_delete\" title='删除用户信息' onclick=\"Delete('{0}')\" />", dt.Rows[i]["UserId"].ToString()); } else { strHtmlData.Append(" <input type=\"button\" title='没有权限删除用户信息' class=\"btn_delete2\" />"); } strHtmlData.Append("</td>"); strHtmlData.Append("</tr>"); } if (dt.Rows.Count <= 0) { strHtmlData.Append(" <tr><td colspan=\"8\"><div class='nodata_div'>暂无数据!</td></td></tr>"); } strHtmlData.Append("</table>"); return(strHtmlData.ToString()); } catch (Exception ex) { new BLL_clsAuth().AddLogErrorFromBS(Module_Id, string.Format("类:{0},方法:{1},错误信息:{2}, 详细:{3}", ex.TargetSite.DeclaringType.ToString(), ex.TargetSite.Name.ToString(), ex.Message, ex.StackTrace)); throw ex; } }