protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Model_UserGroup_Member model = new Model_UserGroup_Member();
                BLL_UserGroup_Member   bll   = new BLL_UserGroup_Member();
                string userGroupId           = txtUserGroup_Id.Text.Trim().Filter();
                if (new BLL_UserGroup().GetRecordCount("UserGroup_Id='" + userGroupId + "' and UserGroup_AttrEnum='" + UserGroup_AttrEnum.School.ToString() + "' ") == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('学校号" + userGroupId + "不存在',{icon:2,time:2000});", true);
                    return;
                }
                List <Model_UserGroup_Member> listModelUGM = bll.GetModelList(string.Format("User_ID='{0}' and UserGroup_Id='{1}'", FloginUser.UserId, userGroupId));
                bool isExistData = false;//是否已存在成员数据
                if (listModelUGM.Count != 0)
                {
                    isExistData = true;
                    model       = listModelUGM[0];
                    if (model.User_ApplicationStatus == "applied")
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('已经申请加入学校" + userGroupId + ",正在等待审核',{icon:2,time:2000});", true);
                        return;
                    }
                    if (model.User_ApplicationStatus == "passed" && model.UserStatus == 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('已经加入学校" + userGroupId + ",请更换学校号重新操作',{icon:2,time:2000});", true);
                        return;
                    }
                    else if (model.User_ApplicationStatus == "passed" && model.UserStatus == 1)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('不可加入此学校(退出),请联系您的校长',{icon:2,time:2000});", true);
                        return;
                    }
                }
                if (!isExistData)
                {
                    model.UserGroup_Member_Id = Guid.NewGuid().ToString();
                }
                model.UserGroup_Id           = userGroupId;
                model.User_ID                = FloginUser.UserId;
                model.User_ApplicationStatus = "applied";
                model.User_ApplicationTime   = DateTime.Now;
                model.User_ApplicationReason = txtUser_ApplicationReason.Text.Trim().Filter();
                string strMembershipEnum = string.Empty;
                switch (FloginUser.UserPost)
                {
                case "32514c70-d669-4c9f-b487-f19fea569ff0":
                    strMembershipEnum = MembershipEnum.principal.ToString();
                    break;

                case "d022a507-bea8-4cfe-9d8d-80e7fcea88b9":
                    strMembershipEnum = MembershipEnum.vice_principal.ToString();
                    break;

                case "a96fc2c4-09fc-4b5e-ac10-b22c925aa45e":
                    strMembershipEnum = MembershipEnum.Dean.ToString();
                    break;

                case "851D680A-930A-47DB-85DD-76D6AEEAB5AA":
                    strMembershipEnum = MembershipEnum.TeachingLeader.ToString();
                    break;
                }
                model.MembershipEnum = strMembershipEnum;
                model.CreateUser     = FloginUser.UserId;
                bool flag = false;
                if (isExistData)
                {
                    flag = bll.Update(model);
                }
                else
                {
                    flag = bll.Add(model);
                }
                if (flag)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.msg('申请成功',{icon:1,time:1000},function(){parent.loadData();parent.layer.closeAll();})</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>");
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         Model_UserGroup_Member model = new Model_UserGroup_Member();
         BLL_UserGroup_Member   bll   = new BLL_UserGroup_Member();
         string userGroupId           = txtUserGroup_Id.Text.Trim().Filter();
         if (new BLL_UserGroup().GetRecordCount("UserGroup_Id='" + userGroupId + "' and UserGroup_AttrEnum='" + UserGroup_AttrEnum.School.ToString() + "' ") == 0)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.ready(function(){layer.msg('学校号不存在',{icon:2,time:2000,offset:'10px'})});", true);
             return;
         }
         List <Model_UserGroup_Member> listModelUGM = bll.GetModelList(string.Format("User_ID='{0}' and UserGroup_Id='{1}'", reqGroupId, userGroupId));
         bool isExistData = false;//是否已存在成员数据
         if (listModelUGM.Count != 0)
         {
             isExistData = true;
             model       = listModelUGM[0];
             if (model.User_ApplicationStatus == "applied")
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.ready(function(){layer.msg('您已申请加入此学校,请等待审核',{icon:2,time:2000,offset:'10px'})});", true);
                 return;
             }
             if (model.User_ApplicationStatus == "passed" && model.UserStatus == 0)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.ready(function(){layer.msg('您已加入此学校,请更换学校号重新操作',{icon:2,time:2000,offset:'10px'})});", true);
                 return;
             }
             else if (model.User_ApplicationStatus == "passed" && model.UserStatus == 1)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.ready(function(){layer.msg('不可加入此学校(退出),请联系您的老师',{icon:2,time:2000,offset:'10px'})});", true);
                 return;
             }
         }
         if (!isExistData)
         {
             model.UserGroup_Member_Id = Guid.NewGuid().ToString();
         }
         model.UserGroup_Id           = userGroupId;
         model.User_ID                = reqGroupId;
         model.User_ApplicationStatus = "applied";
         model.User_ApplicationTime   = DateTime.Now;
         model.User_ApplicationReason = txtUser_ApplicationReason.Text.Trim().Filter();
         model.MembershipEnum         = MembershipEnum.grade.ToString();
         model.CreateUser             = FloginUser.UserId;
         bool flag = false;
         if (isExistData)
         {
             flag = bll.Update(model);
         }
         else
         {
             flag = bll.Add(model);
         }
         if (flag)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('申请成功',{icon:1,time:1000,offset:'10px'},function(){parent.location.reload();parent.layer.closeAll();})})</script>");
         }
         else
         {
             ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('申请失败',{icon:2,time:2000,offset:'10px'})})</script>");
         }
     }
     catch (Exception)
     {
         ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.ready(function(){layer.msg('操作失败',{icon:2,time:2000,offset:'10px'})})</script>");
     }
 }
Esempio n. 4
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Model_UserGroup_Member model = new Model_UserGroup_Member();
                BLL_UserGroup_Member   bll   = new BLL_UserGroup_Member();
                string userGroupId           = txtUserGroup_Id.Text.Trim().Filter();
                if (new BLL_UserGroup().GetRecordCount("UserGroup_Id='" + userGroupId + "' and UserGroup_AttrEnum='" + UserGroup_AttrEnum.Grade.ToString() + "' ") == 0)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('年级号" + userGroupId + "不存在',{icon:2,time:2000});", true);
                    return;
                }
                List <Model_UserGroup_Member> listModelUGM = bll.GetModelList(string.Format("User_ID='{0}' and UserGroup_Id='{1}'", FloginUser.UserId, userGroupId));
                bool isExistData = false;//是否已存在成员数据
                if (listModelUGM.Count != 0)
                {
                    isExistData = true;
                    model       = listModelUGM[0];
                    if (model.User_ApplicationStatus == "applied")
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('已经申请加入年级" + userGroupId + ",正在等待审核',{icon:2,time:2000});", true);
                        return;
                    }
                    if (model.User_ApplicationStatus == "passed" && model.UserStatus == 0)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('已经加入年级" + userGroupId + ",请更换年级号重新操作',{icon:2,time:2000});", true);
                        return;
                    }
                    else if (model.User_ApplicationStatus == "passed" && model.UserStatus == 1)
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "Save", "layer.msg('不可加入此年级(退出),请联系您的年级组长',{icon:2,time:2000});", true);
                        return;
                    }
                }
                if (!isExistData)
                {
                    model.UserGroup_Member_Id = Guid.NewGuid().ToString();
                }
                model.UserGroup_Id           = userGroupId;
                model.User_ID                = FloginUser.UserId;
                model.User_ApplicationStatus = "applied";
                model.User_ApplicationTime   = DateTime.Now;
                model.User_ApplicationReason = txtUser_ApplicationReason.Text.Trim().Filter();
                string strMembershipEnum = string.Empty;
                switch (FloginUser.UserPost)
                {
                case "b159d237-197d-49ea-ac7b-c4df817a1d5b":
                    strMembershipEnum = MembershipEnum.gradedirector.ToString();
                    break;

                case "adbd4fc0-24d0-418c-aade-e988f8aeabdd":
                    strMembershipEnum = MembershipEnum.GroupLeader.ToString();
                    break;
                }
                model.MembershipEnum = strMembershipEnum;
                model.CreateUser     = FloginUser.UserId;
                bool flag = false;
                if (isExistData)
                {
                    flag = bll.Update(model);
                }
                else
                {
                    flag = bll.Add(model);
                }
                if (flag)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "Save", "<script type='text/javascript'>layer.msg('申请成功',{icon:1,time:1000},function(){parent.loadData();parent.layer.closeAll();})</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>");
            }
        }