/// <summary>
        /// 获取当前登录老师(班主任、代课老师)2016-04-22
        /// </summary>
        /// <returns></returns>
        public static string GetAllTeacher()
        {
            StringBuilder strHtml = new StringBuilder();

            try
            {
                Model_F_User loginUser   = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                string       classActive = string.Empty;
                string       strSql      = string.Format(@"select distinct hw.HomeWork_AssignTeacher as TeacherId ,isnull(fu.TrueName,fu.UserName) as TeacherName from HomeWork hw
left join f_user fu on fu.userId=hw.HomeWork_AssignTeacher
where hw.UserGroup_Id in(select UserGroup_Id from UserGroup_Member where UserStatus='0' and MemberShipEnum='{2}' and User_Id='{0}')
or (hw.SubjectId='{1}' and hw.HomeWork_AssignTeacher='{0}')"
                                                         , loginUser.UserId
                                                         , loginUser.Subject
                                                         , MembershipEnum.headmaster);
                DataTable dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    classActive = i == 0 ? "active" : "";
                    strHtml.AppendFormat("<li>");
                    strHtml.AppendFormat("<a href=\"javascript:;\" ajax-value=\"{0}\" class=\"{2}\" \">{1}</a>"
                                         , dt.Rows[i]["TeacherId"]
                                         , dt.Rows[i]["TeacherName"]
                                         , classActive);
                    strHtml.AppendFormat("</li>");
                }
            }
            catch (Exception)
            {
                strHtml = new StringBuilder();
            }
            return(strHtml.ToString());
        }
        /// <summary>
        ///  当前登录老师获取数据的时候加上自有班级条件(班主任、代课老师) 2016-05-12 讲评
        /// </summary>
        /// <param name="SubjectId"></param>
        /// <returns></returns>
        public static string GetStrWhereBySelfClassForComment(string SubjectId)
        {
            string strWhere = string.Empty;

            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                //                if (SubjectId != loginUser.Subject)
                //                {
                //                    strWhere = @" and T.UserGroup_Id in(select ClassId from (
                //select distinct vw.ClassId,AnalysisDataCount=(select COUNT(1) from HomeWork where UserGroup_Id=vw.ClassId)
                //from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum='" + MembershipEnum.headmaster + "' and UserId='" + loginUser.UserId + "') t where AnalysisDataCount>0) ";
                //                }
                //                else
                //                {
                strWhere = @" and T.UserGroup_Id in(select ClassId from (
select distinct vw.ClassId,AnalysisDataCount=(select COUNT(1) from HomeWork where UserGroup_Id=vw.ClassId)
from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum in('" + MembershipEnum.headmaster + "','" + MembershipEnum.teacher + "') and UserId='" + loginUser.UserId + "') t where AnalysisDataCount>0) ";
                //}
            }
            catch (Exception)
            {
            }
            return(strWhere);
        }
Beispiel #3
0
        public bool Add(Model_F_User model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into F_User(");
            builder.Append("UserId,UserName,Password,TrueName,UserIdentity,Birthday,Sex,Email,Mobile,Province,City,County,School,CreateTime)");
            builder.Append(" values (");
            builder.Append("@UserId,@UserName,@Password,@TrueName,@UserIdentity,@Birthday,@Sex,@Email,@Mobile,@Province,@City,@County,@School,@CreateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@UserId", SqlDbType.Char, 0x24), new SqlParameter("@UserName", SqlDbType.VarChar, 20), new SqlParameter("@Password", SqlDbType.Char, 0x20), new SqlParameter("@TrueName", SqlDbType.NVarChar, 250), new SqlParameter("@UserIdentity", SqlDbType.Char, 1), new SqlParameter("@Birthday", SqlDbType.DateTime), new SqlParameter("@Sex", SqlDbType.Char, 1), new SqlParameter("@Email", SqlDbType.VarChar, 200), new SqlParameter("@Mobile", SqlDbType.VarChar, 20), new SqlParameter("@Province", SqlDbType.NVarChar, 250), new SqlParameter("@City", SqlDbType.NVarChar, 250), new SqlParameter("@County", SqlDbType.NVarChar, 250), new SqlParameter("@School", SqlDbType.NVarChar, 250), new SqlParameter("@CreateTime", SqlDbType.DateTime) };
            cmdParms[0].Value  = model.UserId;
            cmdParms[1].Value  = model.UserName;
            cmdParms[2].Value  = model.Password;
            cmdParms[3].Value  = model.TrueName;
            cmdParms[4].Value  = model.UserIdentity;
            cmdParms[5].Value  = model.Birthday;
            cmdParms[6].Value  = model.Sex;
            cmdParms[7].Value  = model.Email;
            cmdParms[8].Value  = model.Mobile;
            cmdParms[9].Value  = model.Province;
            cmdParms[10].Value = model.City;
            cmdParms[11].Value = model.County;
            cmdParms[12].Value = model.School;
            cmdParms[13].Value = model.CreateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Beispiel #4
0
 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>");
     }
 }
        /// <summary>
        /// 当前登录老师获取数据的时候加上自有班级条件(班主任、代课老师) 2016-04-22
        /// </summary>
        public static string GetStrWhereBySelfClassForTeacherData(string SubjectId)
        {
            string strWhere = string.Empty;

            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                if (SubjectId != loginUser.Subject)
                {
                    //                    strWhere = @" and ClassId in(select ClassId from (
                    //select distinct vw.ClassId,AnalysisDataCount=(select COUNT(1) from StatsClassHW_Score where ClassID=vw.ClassId)
                    //from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum='" + MembershipEnum.headmaster + "' and UserId='" + loginUser.UserId + "') t where AnalysisDataCount>0) ";
                    strWhere = @" and ClassId in(
select distinct vw.ClassId
from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum='" + MembershipEnum.headmaster + "' and UserId='" + loginUser.UserId + "' ) ";
                }
                else
                {
                    strWhere = @" and ClassId in(
select distinct vw.ClassId
from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum in('" + MembershipEnum.headmaster + "','" + MembershipEnum.teacher + "') and UserId='" + loginUser.UserId + "' ) ";
                }
            }
            catch (Exception)
            {
            }
            return(strWhere);
        }
Beispiel #6
0
        /// <summary>
        /// 班级
        /// </summary>
        public static string GetClass(string SubjectID, string TeacherID)
        {
            try
            {
                string       StrWhere  = string.Empty;
                string       TempDate  = string.Empty;
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                //                if (SubjectID != loginUser.Subject)
                //                {
                //                    StrWhere = @" and ClassId in(select ClassId from (
                //select distinct vw.ClassId,AnalysisDataCount=(select COUNT(1) from HomeWork where UserGroup_Id=vw.ClassId)
                //from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum='" + MembershipEnum.headmaster + "' and UserId='" + loginUser.UserId + "') t where AnalysisDataCount>0) ";
                //                }
                //                else
                //                {
                StrWhere = @" and ClassId in(select ClassId from (
select distinct vw.ClassId,AnalysisDataCount=(select COUNT(1) from HomeWork where UserGroup_Id=vw.ClassId)
from VW_UserOnClassGradeSchool vw where ClassMemberShipEnum in('" + MembershipEnum.headmaster + "','" + MembershipEnum.teacher + "') and UserId='" + loginUser.UserId + "') t where AnalysisDataCount>0) ";
                //}
                TempDate = StatsCommonHandle.GetTeacherClassByTeacherIdForCommon(TeacherID, StrWhere);
                return(TempDate);
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void btn_Save_Click(object sender, EventArgs e)
        {
            Model_F_User model = new Model_F_User();

            model          = bll_f_user.GetModel(FloginUser.UserId);
            model.TrueName = txtTrueUserName.Text.Trim();
            if (txtAge.Text != "")
            {
                model.Birthday = Convert.ToDateTime(txtAge.Text.Trim());
            }
            else
            {
                model.Birthday = null;
            }
            model.Sex      = ddlSex.SelectedValue;
            model.Mobile   = txtMoblie.Text.Trim();
            model.Email    = txtEmail.Text.Trim();
            model.School   = txtSchool.Text.Trim();
            model.Province = ddlProvince.SelectedValue;
            model.City     = ddlCity.SelectedValue;
            model.County   = ddlCountry.SelectedValue;
            bool result = bll_f_user.Update(model);

            if (result)
            {
                Session["FLoginUser"] = model;
                ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('保存成功',{icon:1,time:1000},function(){window.location.href='basicSetting.aspx';});</script>");
            }
            else
            {
                ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('保存失败',{icon:2,time:2000});</script>");
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SchoolId = Request["SchoolId"].Filter();
     UserId   = Request["UserId"].Filter();
     if (!IsPostBack)
     {
         if (string.IsNullOrEmpty(UserId))
         {
             Response.Write("参数错误!");
         }
         else
         {
             user = bll_user.GetModel(UserId);
             DataTable dt       = new DataTable();
             string    strWhere = string.Empty;
             //学科
             strWhere = " D_Type='7' order by d_order";
             dt       = new BLL_Common_Dict().GetList(strWhere).Tables[0];
             Rc.Cloud.Web.Common.pfunction.SetDdlEmpty(ddlSubject, dt, "D_Name", "Common_Dict_ID", "--请选择--");
             //身份
             strWhere = " D_Type='15' order by d_order ";
             Rc.Cloud.Web.Common.pfunction.SetDdlEmpty(ddlUserPost, new BLL_Common_Dict().GetList(strWhere).Tables[0], "D_Name", "Common_Dict_ID", "--请选择--");
         }
     }
 }
 private void init_load()
 {
     if (FloginUser != null)
     {
         Model_F_User model = new Model_F_User();
         model = bll_f_user.GetModel(FloginUser.UserId);
         if (model == null)
         {
             return;
         }
         labUserName.Text         = model.UserName;
         txtTrueUserName.Text     = model.TrueName;
         ddlSex.SelectedValue     = model.Sex;
         txtEmail.Text            = model.Email;
         txtMoblie.Text           = model.Mobile;
         ddlSubject.SelectedValue = model.Subject;
         txtAge.Text = (model.Birthday != null ? DateTime.Parse(model.Birthday.ToString()).ToString("yyyy-MM-dd") : "");
         BindProvince();
         ddlProvince.SelectedValue = model.Province;
         BindCity();
         ddlCity.SelectedValue = model.City;
         BindCountry();
         ddlCountry.SelectedValue = model.County;
     }
 }
Beispiel #10
0
        public static string QuitSchool(string PugroupId, string UgroupId, string UserId, string UserName)
        {
            try
            {
                Model_F_User    modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
                Model_UserGroup model      = new BLL_UserGroup().GetModel(PugroupId);
                Model_Msg       modelMsg   = new Model_Msg();
                modelMsg.MsgId          = Guid.NewGuid().ToString();
                modelMsg.MsgEnum        = MsgEnum.QuitGrade.ToString();
                modelMsg.MsgTypeEnum    = MsgTypeEumn.Private.ToString();
                modelMsg.ResourceDataId = model.UserGroup_Id;
                modelMsg.MsgTitle       = string.Format("成员{0}已退出学校:{1}({2})", UserName, model.UserGroup_Name, model.UserGroup_Id);
                modelMsg.MsgContent     = string.Format("成员{0}已退出学校:{1}({2})", UserName, model.UserGroup_Name, model.UserGroup_Id);
                modelMsg.MsgStatus      = MsgStatus.Unread.ToString();
                modelMsg.MsgSender      = modelFUser.UserId;
                modelMsg.MsgAccepter    = model.User_ID;
                modelMsg.CreateTime     = DateTime.Now;
                modelMsg.CreateUser     = modelFUser.UserId;

                if (new BLL_UserGroup_Member().QuitGradeSchool(PugroupId, UgroupId, modelMsg))
                {
                    return("1");
                }
                else
                {
                    return("0");
                }
            }
            catch (Exception ex)
            {
                return(ex.Message.ToString());
            }
        }
Beispiel #11
0
        public static string UpdateC(string Id)
        {
            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;

                Id = Id.Filter();
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();
                model = bll.GetModel(Id);
                model.HomeWork_Status     = 0;
                model.HomeWork_FinishTime = null;

                if (loginUser.UserId != model.HomeWork_AssignTeacher)//当前登录用户和布置改作业的老师不一致
                {
                    return("");
                }
                else
                {
                    if (bll.Update(model))
                    {
                        return("1");
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
        public static string GetClassNotice(string UserGroup_Id, int PageIndex, int PageSize)
        {
            try
            {
                UserGroup_Id = UserGroup_Id.Filter();
                Model_F_User  FloginUser        = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
                bool          bool_IsGroupOwner = pfunction.CheckUserIsGroupOwner(UserGroup_Id, FloginUser.UserId);
                DataTable     dt          = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSqlCount = string.Empty;
                string        strWhere    = string.Format("User_ApplicationStatus='applied' and UserGroup_Id='{0}'", UserGroup_Id);
                dt = new BLL_UserGroup_Member().GetGradeMemberListByPageEX(strWhere, "User_ApplicationTime desc", ((PageIndex - 1) * PageSize + 1), (PageIndex * PageSize)).Tables[0];
                int rCount = new BLL_UserGroup_Member().GetRecordCount(strWhere);
                int inum   = 0;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    inum++;
                    listReturn.Add(new
                    {
                        inum = (i + 1),
                        UserGroup_Member_Id    = dt.Rows[i]["UserGroup_Member_Id"],
                        UserGroup_Id           = dt.Rows[i]["User_Id"].ToString(),
                        UserGroup_Name         = dt.Rows[i]["UserGroup_Name"].ToString(),
                        User_ApplicationReason = dt.Rows[i]["User_ApplicationReason"],
                        User_ApplicationTime   = pfunction.ConvertToLongDateTime(dt.Rows[i]["User_ApplicationTime"].ToString()),
                        User_ApplicationStatus = dt.Rows[i]["User_ApplicationStatus"],
                        IType        = dt.Rows[i]["IType"],
                        PostName     = dt.Rows[i]["PostName"],
                        IsGroupOwner = bool_IsGroupOwner
                    });
                }

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     loginUser = FloginUser;
     if (!IsPostBack)
     {
         LoadSubject();
     }
 }
Beispiel #14
0
 public static string GetGradeList()
 {
     try
     {
         Model_F_User  modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
         DataTable     dt         = new BLL_UserGroup().GetGradeListByUserIdMembershipEnum(modelFUser.UserId, UserGroup_AttrEnum.Grade.ToString()).Tables[0];
         List <object> listReturn = new List <object>();
         int           inum       = 0;
         DataRow[]     dr         = dt.Select("", "JoinApplicationStatus desc,JoinStatus");
         for (int i = 0; i < dr.Length; i++)
         {
             inum++;
             listReturn.Add(new
             {
                 User_ID                     = dr[i]["User_ID"],
                 User_Name                   = dr[i]["UserName"],
                 UserGroup_Id                = dr[i]["UserGroup_Id"],
                 UserGroup_Name              = dr[i]["UserGroup_Name"],
                 UserGroup_NameSubstring     = pfunction.GetSubstring(dr[i]["UserGroup_Name"].ToString(), 9, false),
                 UserGroupp_Type             = dr[i]["UserGroupp_Type"],
                 UserGroup_BriefIntroduction = string.Format("{0}"
                                                             , string.IsNullOrEmpty(dr[i]["UserGroup_BriefIntroduction"].ToString()) ? "这家伙很懒,什么都没留下~~" : dr[i]["UserGroup_BriefIntroduction"].ToString()),
                 CreateTime  = pfunction.ConvertToLongDateTime(dr[i]["CreateTime"].ToString()),
                 MesCount    = dr[i]["MsgCount"],
                 MemberCount = dr[i]["MemberCount"],
                 PGroupId    = dr[i]["PGroupId"].ToString(),                                        //学校号
                 PGroup_User_ApplicationStatus = dr[i]["PGroup_User_ApplicationStatus"].ToString(), //申请加入学校状态
                 PGroup_UserStatus             = dr[i]["PGroup_UserStatus"].ToString(),             //在学校中的状态
                 PGroupName            = dr[i]["PGroupName"].ToString(),
                 JoinApplicationStatus = dr[i]["JoinApplicationStatus"].ToString(),
                 JoinStatus            = dr[i]["JoinStatus"].ToString(),
                 IsGroupOwner          = pfunction.CheckUserIsGroupOwner(dr[i]["UserGroup_Id"].ToString(), modelFUser.UserId)
             });
         }
         if (inum > 0)
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "null",
                 list = listReturn
             }));
         }
         else
         {
             return(JsonConvert.SerializeObject(new
             {
                 err = "暂无数据"
             }));
         }
     }
     catch (Exception)
     {
         return(JsonConvert.SerializeObject(new
         {
             err = "error"//ex.Message.ToString()
         }));
     }
 }
Beispiel #15
0
        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;
            }
        }
Beispiel #16
0
        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;
            }
        }
Beispiel #17
0
        /// <summary>
        /// 获取当前登录人年级数据(班主任和代课老师除外)2016-04-23
        /// </summary>
        /// <returns></returns>
        public static DataTable GetTeacherGradeData()
        {
            DataTable     dtReturn = new DataTable();
            StringBuilder strHtml  = new StringBuilder();

            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                string       strSql    = string.Empty;
                strSql = string.Format(@"select * from (
select vw.UserId,UserName,ug.UserGroupOrder as GradeOrder,GradeId as GroupId,GradeName as GroupName,GradeMemberShipEnum as GroupMemberShipEnum,GradeGradeType as GroupGradeType from VW_UserOnClassGradeSchool vw 
left join [dbo].[UserGroup] ug on ug.UserGroup_Id=vw.GradeId 
where IType='grade' and GradeMemberShipEnum!='' 

union all
select UserId,UserName,NULL as GradeOrder,SchoolId,SchoolName,SchoolMemberShipEnum,NULL GroupGradeType from VW_UserOnClassGradeSchool where IType='school' and SchoolMemberShipEnum!=''
) t where UserId='{0}'", loginUser.UserId);
                DataTable     dt             = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                StringBuilder strSubjectHtml = new StringBuilder();
                foreach (DataRow itemRow in dt.Rows)
                {
                    if (itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.principal.ToString() || itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.vice_principal.ToString() || itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.Dean.ToString() || itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.TeachingLeader.ToString())
                    {
                        //strSubjectHtml.AppendFormat("select distinct Gradeid,GradeName,ug.GradeType as GroupGradeType from StatsGradeHW_Score hw left join UserGroup ug on ug.UserGroup_Id=hw.Gradeid where SchoolId='{0}' union all "
                        //    , itemRow["GroupId"]);
                        strSubjectHtml.AppendFormat("select distinct GradeOrder,Gradeid,GradeName,GradeGradeType as GroupGradeType from dbo.VW_ClassGradeSchool where SchoolId='{0}' union all ", itemRow["GroupId"]);
                    }
                    else if (itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.gradedirector.ToString() || itemRow["GroupMemberShipEnum"].ToString() == MembershipEnum.GroupLeader.ToString())
                    {
                        strSubjectHtml.AppendFormat("select '{0}'as GradeOrder,'{1}' as Gradeid,'{2}' as GradeName, '{3}' as GroupGradeType union all ", itemRow["GradeOrder"], itemRow["GroupId"], itemRow["GroupName"], itemRow["GroupGradeType"]);
                    }
                }
                strSql = string.Empty;
                if (strSubjectHtml.ToString().Length > 10)
                {
                    strSql = string.Format("select distinct * from ({0}) t", strSubjectHtml.ToString().Substring(0, strSubjectHtml.ToString().Length - 10));
                }

                if (!string.IsNullOrEmpty(strSql))
                {
                    strSql = string.Format(@"select *,dict.D_Name as GroupGradeTypeName
,ClassCount=(select count(1) from UserGroup_Member where MembershipEnum='classrc' and UserGroup_Id=t.GradeId and UserStatus=0 )
,StudentCount=(select count(1) from VW_UserOnClassGradeSchool where ClassMemberShipEnum='student' and GradeId=t.GradeId )
from ({0}) t 
left join Common_Dict dict on dict.Common_Dict_Id=t.GroupGradeType order by GradeOrder
", strSql);

                    dtReturn = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                }
            }
            catch (Exception)
            {
            }
            return(dtReturn);
        }
Beispiel #18
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            Session.Timeout = 20;
            ////自动登录 只可在测试时开发此功能,此功能开放时严禁把此文件签入SVN
#if DEBUG
            //UserLoginAuto.UserAutoLogin();
#endif
            strPageName        = GetPageName();
            strPageNameAndParm = strPageName + "?" + Rc.Cloud.Web.Common.pfunction.getPageParam();
            loginUser          = Rc.Common.StrUtility.clsUtility.IsFPageFlag(this.Page) as Model_F_User;
        }
Beispiel #19
0
 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)
     {
     }
 }
Beispiel #20
0
 /// <summary>
 /// 班级
 /// </summary>
 public static string GetClass(string TeacherID)
 {
     try
     {
         string       StrWhere  = string.Empty;
         string       TempDate  = string.Empty;
         Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
         TempDate = StatsCommonHandle.GetTeacherClassByTeacherId(TeacherID, "");
         return(TempDate);
     }
     catch (Exception)
     {
         return("");
     }
 }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request["psdTips"].Filter() == "1")
            //{
            //    Page.ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function(){layer.confirm('密码过于简单,请修改密码!', {}, function () { window.location.href = '/parent/safeSetting.aspx'; });});</script>");
            //}

            if (pfunction.GetWebMdlIsShow("FAQ"))
            {
                ahelp.Visible = true;
            }
            Model_F_User modelFUser = (Model_F_User)Session["FLoginUser"];

            ltlUserPost.Text = string.IsNullOrEmpty(modelFUser.TrueName) ? modelFUser.UserName : modelFUser.TrueName;
        }
Beispiel #22
0
        public static string UpdateS(string Id)
        {
            try
            {
                Model_F_User loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;

                Id = Id.Filter();
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();
                model = bll.GetModel(Id);
                model.HomeWork_Status     = 1;
                model.HomeWork_FinishTime = DateTime.Now;

                if (loginUser.UserId != model.HomeWork_AssignTeacher)//当前登录用户和布置改作业的老师不一致
                {
                    return("");
                }
                else
                {
                    if (bll.Update(model))
                    {
                        //#region 执行数据分析,记录日志

                        //Model_StatsLog modelLog = new Model_StatsLog();
                        //modelLog.StatsLogId = Guid.NewGuid().ToString();
                        //modelLog.DataId = model.HomeWork_Id;
                        //modelLog.DataName = model.HomeWork_Name;
                        //modelLog.DataType = "1";
                        //modelLog.LogStatus = "2";
                        //modelLog.CTime = DateTime.Now;
                        //modelLog.CUser = loginUser.UserId;

                        //new BLL_StatsLog().ExecuteStatsAddLog(modelLog);
                        //#endregion

                        return("1");
                    }
                    else
                    {
                        return("");
                    }
                }
            }
            catch (Exception)
            {
                return("");
            }
        }
Beispiel #23
0
        /// <summary>
        /// 获取当前登录老师可展示学科(班主任、代课老师,代课老师显示自有学科,班主任显示负责班级所有学科)2016-04-22
        /// </summary>
        /// <returns></returns>
        public static string GetTeacherSubject()
        {
            StringBuilder strHtml = new StringBuilder();

            try
            {
                Model_F_User loginUser   = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
                string       classActive = string.Empty;
                //                string strSql = string.Format(@"select distinct SubjectID,SubjectName,TeacherID from StatsClassHW_Score
                //where ClassId in(select UserGroup_Id from UserGroup_Member where UserStatus='0' and MemberShipEnum='{2}' and User_Id='{0}')
                //or (SubjectID='{1}' and TeacherID='{0}')"
                //                    , loginUser.UserId
                //                    , loginUser.Subject
                //                    , MembershipEnum.headmaster);
                string strSql = string.Format(@"select distinct hw.SubjectId,cd.D_Name as SubjectName from HomeWork hw
left join Common_Dict cd on cd.Common_Dict_Id=hw.SubjectId
where hw.UserGroup_Id in(select UserGroup_Id from UserGroup_Member where UserStatus='0' and MemberShipEnum='{2}' and User_Id='{0}')
or (hw.SubjectId='{1}' and hw.HomeWork_AssignTeacher='{0}')"
                                              , loginUser.UserId
                                              , loginUser.Subject
                                              , MembershipEnum.headmaster);
                DataTable dt = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                //BLL_Common_Dict bll_common_dict = new BLL_Common_Dict();
                //bll_common_dict.GetList("Common_Dict_ID = '" + FloginUser.Subject + "' ORDER BY D_CreateTime").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    if (HttpContext.Current.Session["StatsClassSubject"] == null || HttpContext.Current.Session["StatsClassSubject"].ToString() == "")
                    {
                        HttpContext.Current.Session["StatsClassSubject"] = dt.Rows[i]["SubjectID"];
                    }
                    classActive = (HttpContext.Current.Session["StatsClassSubject"].ToString() == dt.Rows[i]["SubjectID"].ToString()) ? "active" : "";
                    //classActive = (i == 0) ? "active" : "";
                    strHtml.AppendFormat("<li>");
                    strHtml.AppendFormat("<a href=\"javascript:;\" ajax-value=\"{0}\" class=\"{2}\" \">{1}</a>"
                                         , dt.Rows[i]["SubjectID"]
                                         , dt.Rows[i]["SubjectName"]
                                         , classActive);
                    strHtml.AppendFormat("</li>");
                }
            }
            catch (Exception)
            {
                strHtml = new StringBuilder();
            }
            return(strHtml.ToString());
        }
 public static string Empowers(string TeacherList, string ResourceFolder_Id)
 {
     try
     {
         Model_F_User                   loginUser = HttpContext.Current.Session["FLoginUser"] as Model_F_User;
         BLL_PrpeLesson_Person          bll       = new BLL_PrpeLesson_Person();
         List <Model_PrpeLesson_Person> listModel = new List <Model_PrpeLesson_Person>();
         ResourceFolder_Id = ResourceFolder_Id.TrimEnd(',').Filter();
         TeacherList       = TeacherList.TrimEnd(',').Filter();
         string _dSql = @"delete PrpeLesson_Person where ResourceFolder_Id = '" + ResourceFolder_Id + @"' 
         and ChargePerson in ('" + TeacherList.Replace(",", "','") + "')";
         foreach (string item in TeacherList.Split(','))
         {
             if (!string.IsNullOrEmpty(item))
             {
                 Model_PrpeLesson_Person model = new Model_PrpeLesson_Person();
                 model.PrpeLesson_Person_Id = Guid.NewGuid().ToString();
                 model.ResourceFolder_Id    = ResourceFolder_Id;
                 model.ChargePerson         = item;
                 model.CreateUser           = loginUser.UserId;
                 model.CreateTime           = DateTime.Now;
                 listModel.Add(model);
             }
         }
         if (listModel.Count > 0)
         {
             //Rc.Common.DBUtility.DbHelperSQL.Query(_dSql);
             if (bll.AddPerson(listModel))
             {
                 return("1");
             }
             else
             {
                 return("");
             }
         }
         else
         {
             return("1");
         }
     }
     catch (Exception ex)
     {
         return("2");
     }
 }
Beispiel #25
0
        public static string DelClassMember(string UserGroup_Member_Id, string UserId, string UserGroup_Id)
        {
            try
            {
                BLL_UserGroup_Member bll = new BLL_UserGroup_Member();
                if (new BLL_Student_HomeWork().GetRecordCount("Student_Id='" + UserId + "' and HomeWork_Id in(select HomeWork_Id from HomeWork where UserGroup_Id='" + UserGroup_Id + "')") > 0)
                {
                    return("2");//成员已布置作业
                }
                else
                {
                    Model_F_User modelFUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
                    string       userId     = modelFUser.UserId;

                    Model_UserGroup_Member model = bll.GetModel(UserGroup_Member_Id);
                    model.UserStatus = 1;

                    Model_Msg modelMsg = new Model_Msg();
                    modelMsg.MsgId          = Guid.NewGuid().ToString();
                    modelMsg.MsgEnum        = MsgEnum.QuitClass.ToString();
                    modelMsg.MsgTypeEnum    = MsgTypeEumn.Private.ToString();
                    modelMsg.ResourceDataId = model.UserGroup_Id;
                    modelMsg.MsgTitle       = string.Format("您被退班{0}", model.UserGroup_Id);
                    modelMsg.MsgContent     = string.Format("您被退班{0}", model.UserGroup_Id);
                    modelMsg.MsgStatus      = MsgStatus.Unread.ToString();
                    modelMsg.MsgSender      = userId;
                    modelMsg.MsgAccepter    = model.User_ID;
                    modelMsg.CreateTime     = DateTime.Now;
                    modelMsg.CreateUser     = userId;

                    if (bll.TeacherRemoveStudent(model, modelMsg))
                    {
                        return("1");
                    }
                    else
                    {
                        return("0");
                    }
                }
            }
            catch (Exception)
            {
                return("0");
            }
        }
Beispiel #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Request["psdTips"].Filter() == "1")
            //{
            //    Page.ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.ready(function(){layer.confirm('密码过于简单,请修改密码!', {}, function () { window.location.href = '/student/safeSetting.aspx'; });});</script>");
            //}

            if (pfunction.GetWebMdlIsShow("FAQ"))
            {
                ahelp.Visible = true;
            }
            Model_F_User modelFUser = (Model_F_User)Session["FLoginUser"];
            int          MsgCount   = new BLL_Msg().GetRecordCount("MsgAccepter='" + modelFUser.UserId + "' and MsgStatus='Unread' ");

            ltlUserPost.Text = string.IsNullOrEmpty(modelFUser.TrueName) ? modelFUser.UserName : modelFUser.TrueName;
            ltlMsgCount.Text = string.Format("{0}"
                                             , (MsgCount > 0) ? "<span class='badge'>" + MsgCount + "</span>" : "");
        }
Beispiel #27
0
        public List <Model_F_User> DataTableToList(DataTable dt)
        {
            List <Model_F_User> list = new List <Model_F_User>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_F_User item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Beispiel #28
0
        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;
            }
        }
    public static string AddAttr(string Two_WayChecklist_Id, string Two_WayChecklistDetail_Id, string Type, string arrId, string arrKnowledge)
    {
        try
        {
            string       sql       = string.Empty;
            Model_F_User loginUser = (Model_F_User)HttpContext.Current.Session["FLoginUser"];
            string       temp      = @"INSERT INTO [dbo].[Two_WayChecklistDetailToAttr]
       ([Two_WayChecklistDetailToAttr_Id]
       ,[Two_WayChecklist_Id]
       ,[Two_WayChecklistDetail_Id]
       ,[Attr_Type]
       ,[Attr_Value]
       ,[CreateUser]
       ,[CreateTime])
 VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}');";
            string[]     ArrAttr   = arrKnowledge.Filter().Split(',');
            string[]     ArrId     = arrId.Split(',');
            for (int i = 0; i < ArrAttr.Length; i++)
            {
                sql += string.Format(temp
                                     , ArrId[i]
                                     , Two_WayChecklist_Id.Filter()
                                     , Two_WayChecklistDetail_Id.Filter()
                                     , Type
                                     , ArrAttr[i]
                                     , loginUser.UserId
                                     , DateTime.Now);
            }
            if (Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql) > 0)
            {
                int j = Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime("exec [P_SelectQuestions] '" + Two_WayChecklist_Id + "','" + Two_WayChecklistDetail_Id + "'", 7200);
                return(j.ToString());
            }
            else
            {
                return("0");
            }
        }
        catch (Exception ex)
        {
            return("");
        }
    }
Beispiel #30
0
        public bool Exists(Model_F_User f_user, string type)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select count(1) from F_User where 1=1 ");
            if (type == "1")
            {
                builder.AppendFormat(" and UserName='******'", f_user.UserName);
            }
            if (type == "2")
            {
                builder.AppendFormat(" and UserId!='{0}' and UserName='******'", f_user.UserId, f_user.UserName);
            }
            if (Convert.ToInt32(DbHelperSQL.GetSingle(builder.ToString())) <= 1)
            {
                return(false);
            }
            return(true);
        }