Пример #1
0
        public void ProcessRequest(HttpContext context)
        {
            string LanUrl      = string.Empty;
            string ExtranetUrl = Rc.Common.ConfigHelper.GetConfigString("TeachingPlanWebSiteUrl");
            string strUserId   = string.Empty;

            try
            {
                strUserId = context.Request.QueryString["UserId"].Filter();

                List <Model_ConfigSchool> listModelCS = new List <Model_ConfigSchool>();
                string strWhere = string.Format("D_Type='{0}' and School_ID in(select SchoolId from VW_UserOnClassGradeSchool where userid='{1}' and SchoolId is not null)"
                                                , ConfigSchoolTypeEnum.TeachingplanResourceHost.ToString(), strUserId);
                listModelCS = new BLL_ConfigSchool().GetModelList(strWhere);
                if (listModelCS.Count > 0)
                {
                    Model_ConfigSchool model = listModelCS[0];
                    //服务器端验证‘学校局域网是否可访问’有问题,暂时停用,直接不验证
                    //Rc.Cloud.Web.Common.pfunction.VerifyLANIsAccess(strUserId, model.D_Value, ExtranetUrl);
                    Rc.Common.DataCache.SetCache(strUserId, model.D_Value);
                }
            }
            catch (Exception ex)
            {
            }
            context.Response.Write("1");
        }
Пример #2
0
        private void VerifyUrl()
        {
            string operateIP = Rc.Cloud.Web.Common.pfunction.GetRealIP();
            string strFileSyncExecRecord_id = Guid.NewGuid().ToString();

            #region 记录同步开始信息
            Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord();
            Rc.BLL.Resources.BLL_FileSyncExecRecord     bll_FileSyncExecRecord   = new Rc.BLL.Resources.BLL_FileSyncExecRecord();
            model_FileSyncExecRecord.FileSyncExecRecord_id        = strFileSyncExecRecord_id;
            model_FileSyncExecRecord.FileSyncExecRecord_Type      = "自动提交学生答案";
            model_FileSyncExecRecord.FileSyncExecRecord_Remark    = operateIP + "正在检测...";
            model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now;
            model_FileSyncExecRecord.FileSyncExecRecord_Status    = "0";
            bll_FileSyncExecRecord.Add(model_FileSyncExecRecord);
            #endregion
            try
            {
                string basicUrl = "/AuthApi/Auto_SubmitStuAnswers.aspx?strFileSyncExecRecord_id=" + strFileSyncExecRecord_id;
                #region 检测 习题集服务器
                string strTestWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl");
                string getResult         = Rc.Common.RemotWeb.PostDataToServer(strTestWebSiteUrl + basicUrl, "", System.Text.Encoding.UTF8, "GET");
                #endregion

                #region 检测 学校服务器
                List <Model_ConfigSchool> list = new List <Model_ConfigSchool>();
                list = new BLL_ConfigSchool().GetModelList("");
                foreach (var item in list)
                {
                    if (!string.IsNullOrEmpty(item.D_PublicValue))
                    {
                        getResult = Rc.Common.RemotWeb.PostDataToServer(item.D_PublicValue + basicUrl + "&SchoolId=" + item.School_ID, "", System.Text.Encoding.UTF8, "GET");
                    }
                }
                #endregion

                #region 记录同步结束信息并保存数据
                model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now;
                model_FileSyncExecRecord.FileSyncExecRecord_Remark  = operateIP + "检测成功完成";
                model_FileSyncExecRecord.FileSyncExecRecord_Status  = "1";

                bll_FileSyncExecRecord.Update(model_FileSyncExecRecord);
                #endregion
            }
            catch (Exception ex)
            {
                model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now;
                model_FileSyncExecRecord.FileSyncExecRecord_Status  = "2";
                model_FileSyncExecRecord.FileSyncExecRecord_Remark  = operateIP + "检测失败:" + ex.Message.ToString();
                bll_FileSyncExecRecord.Update(model_FileSyncExecRecord);
            }
        }
Пример #3
0
        public static string GetSchoolUrl(string schoolId)
        {
            string temp = string.Empty;

            try
            {
                Model_ConfigSchool modelCS = new Model_ConfigSchool();
                BLL_ConfigSchool   bllCS   = new BLL_ConfigSchool();
                modelCS = bllCS.GetModelBySchoolId(schoolId.Filter());
                if (modelCS == null)
                {
                    temp = JsonConvert.SerializeObject(new
                    {
                        err = "学校配置信息不存在"
                    });
                }
                else
                {
                    if (string.IsNullOrEmpty(modelCS.D_PublicValue))
                    {
                        temp = JsonConvert.SerializeObject(new
                        {
                            err = "请配置学校外网地址"
                        });
                    }
                    else
                    {
                        temp = JsonConvert.SerializeObject(new
                        {
                            err            = "null",
                            SchoolIP_Local = modelCS.D_Value,
                            SchoolIP       = modelCS.D_PublicValue
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                temp = JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                });
            }
            return(temp);
        }
Пример #4
0
 public void LoadData()
 {
     try
     {
         DataTable dt = new BLL_ConfigSchool().GetList("D_PublicValue<>''").Tables[0];
         if (dt.Rows.Count > 0)
         {
             foreach (DataRow item in dt.Rows)
             {
                 string          url = item["D_PublicValue"].ToString() + "ReCloudMgr/FileSyncSchool_Auto.aspx?SchoolId=" + item["School_ID"];
                 HttpWebRequest  myHttpWebRequest  = (HttpWebRequest)WebRequest.Create(url);
                 HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
             }
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #5
0
        public static string VerifyConfigEnumIsExists(string strConfigEnum)
        {
            string strJson = string.Empty;

            try
            {
                BLL_ConfigSchool bll = new BLL_ConfigSchool();
                if (bll.GetRecordCount("ConfigEnum='" + strConfigEnum.Filter() + "'") > 0)
                {
                    strJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "error", errMsg = "标识已存在" });
                }
                else
                {
                    strJson = Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "null", errMsg = "" });
                }
            }
            catch (Exception ex)
            {
                new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90207000", "验证【学校配置标识】是否存在出现异常:" + ex.Message.ToString());
                return(Newtonsoft.Json.JsonConvert.SerializeObject(new { err = "error", errMsg = "出现异常错误" }));
            }
            return(strJson);
        }
Пример #6
0
        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);
        }
        private void VerifyUrl()
        {
            string strFileSyncExecRecord_id = Guid.NewGuid().ToString();

            #region 记录检测开始信息
            Rc.Model.Resources.Model_FileSyncExecRecord model_FileSyncExecRecord = new Rc.Model.Resources.Model_FileSyncExecRecord();
            Rc.BLL.Resources.BLL_FileSyncExecRecord     bll_FileSyncExecRecord   = new Rc.BLL.Resources.BLL_FileSyncExecRecord();
            model_FileSyncExecRecord.FileSyncExecRecord_id        = strFileSyncExecRecord_id;
            model_FileSyncExecRecord.FileSyncExecRecord_Type      = "自动检测学校公网";
            model_FileSyncExecRecord.FileSyncExecRecord_Remark    = "正在检测...";
            model_FileSyncExecRecord.FileSyncExecRecord_TimeStart = DateTime.Now;
            model_FileSyncExecRecord.FileSyncExecRecord_Status    = "0";
            bll_FileSyncExecRecord.Add(model_FileSyncExecRecord);
            #endregion
            try
            {
                Model_SendMessageTemplate model = new BLL_SendMessageTemplate().GetModelBySType(Rc.Model.Resources.SMSPAYTemplateEnum.SMS.ToString());

                #region 检测 主web服务器,教案服务器,习题集服务器
                string strName = string.Empty;
                string strStudentAnswerWebSiteUrl = Rc.Common.ConfigHelper.GetConfigString("StudentAnswerWebSiteUrl");
                string strTeachingPlanWebSiteUrl  = Rc.Common.ConfigHelper.GetConfigString("TeachingPlanWebSiteUrl");
                string strTestWebSiteUrl          = Rc.Common.ConfigHelper.GetConfigString("TestWebSiteUrl");

                if (hostPath != strStudentAnswerWebSiteUrl)
                {
                    #region 检测 主web服务器
                    strName = "主web服务器";
                    string getResult = Rc.Common.RemotWeb.PostDataToServer(strStudentAnswerWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET");
                    string schoolUrl = strStudentAnswerWebSiteUrl.Replace("http://", "").TrimEnd('/');
                    string strWhere  = string.Empty;
                    #region 给运营平台发送短信
                    if (string.IsNullOrEmpty(getResult)) // 无法访问
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false"))
                        {
                            // 180分钟内未发送短信 或 最新短信不是无法访问
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10580");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "无法访问");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", "");
                        }
                    }
                    else
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false")
                        {
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10581");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "已恢复正常");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", "");
                        }
                    }
                    #endregion
                    #endregion
                }

                if (strTeachingPlanWebSiteUrl != strStudentAnswerWebSiteUrl && strTeachingPlanWebSiteUrl != hostPath)
                {
                    #region 检测 教案服务器
                    strName = "教案服务器";
                    string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET");
                    string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/');
                    string strWhere  = string.Empty;
                    #region 给运营平台发送短信
                    if (string.IsNullOrEmpty(getResult)) // 无法访问
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false"))
                        {
                            // 180分钟内未发送短信 或 最新短信不是无法访问
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10580");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "无法访问");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", "");
                        }
                    }
                    else
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false")
                        {
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10581");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "已恢复正常");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", "");
                        }
                    }
                    #endregion
                    #endregion
                }
                if (strTestWebSiteUrl != strStudentAnswerWebSiteUrl && strTestWebSiteUrl != strTeachingPlanWebSiteUrl && strTestWebSiteUrl != hostPath)
                {
                    #region 检测 习题集服务器
                    strName = "习题集服务器";
                    string getResult = Rc.Common.RemotWeb.PostDataToServer(strTeachingPlanWebSiteUrl + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET");
                    string schoolUrl = strTeachingPlanWebSiteUrl.Replace("http://", "").TrimEnd('/');
                    string strWhere  = string.Empty;
                    #region 给运营平台发送短信
                    if (string.IsNullOrEmpty(getResult)) // 无法访问
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false"))
                        {
                            // 180分钟内未发送短信 或 最新短信不是无法访问
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10580");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "无法访问");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", "");
                        }
                    }
                    else
                    {
                        strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc "
                                                 , model.Mobile, strName);
                        DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                        if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false")
                        {
                            Dictionary <string, string> Para = new Dictionary <string, string>();
                            Para.Add("template_id", "10581");
                            Para.Add("template_para_schoolname", strName);
                            Para.Add("template_para_schoolurl", schoolUrl);
                            string msg = (strName + schoolUrl + "已恢复正常");
                            Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", "");
                        }
                    }
                    #endregion
                    #endregion
                }

                #endregion

                List <Model_ConfigSchool> list = new List <Model_ConfigSchool>();
                list = new BLL_ConfigSchool().GetModelList("");
                string    Sql      = string.Format(@" select cs.School_Id,cs.School_Name,ssp.PhoneNum from 
ConfigSchool cs
inner join [dbo].[SchoolSMS_Person] ssp on ssp.School_Id=cs.School_Id ");
                DataTable dtPerson = Rc.Common.DBUtility.DbHelperSQL.Query(Sql).Tables[0];
                foreach (var item in list)
                {
                    if (!string.IsNullOrEmpty(model.Mobile) && !string.IsNullOrEmpty(item.D_PublicValue))
                    {
                        string getResult = Rc.Common.RemotWeb.PostDataToServer(item.D_PublicValue + "AuthApi/?key=onlinecheck", "", System.Text.Encoding.UTF8, "GET");
                        string schoolUrl = item.D_PublicValue.Replace("http://", "").TrimEnd('/');
                        string strWhere  = string.Empty;
                        #region 给运营平台发送短信
                        if (string.IsNullOrEmpty(getResult)) // 无法访问
                        {
                            strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' and datediff(MI,ctime,getdate())<180 order by CTime desc "
                                                     , model.Mobile, item.School_Name);
                            DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                            if (dt.Rows.Count == 0 || (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() != "false"))
                            {
                                // 180分钟内未发送短信 或 最新短信不是无法访问
                                Dictionary <string, string> Para = new Dictionary <string, string>();
                                Para.Add("template_id", "10580");
                                Para.Add("template_para_schoolname", item.School_Name);
                                Para.Add("template_para_schoolurl", schoolUrl);
                                string msg = (item.School_Name + schoolUrl + "无法访问");
                                Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "false", item.School_ID);
                            }
                        }
                        else
                        {
                            strWhere = string.Format(" Mobile='{0}' and SType='自动检测学校公网' and Content like '%{1}%' order by CTime desc "
                                                     , model.Mobile, item.School_Name);
                            DataTable dt = new BLL_SendSMSRecord().GetList(strWhere).Tables[0];
                            if (dt.Rows.Count > 0 && dt.Rows[0]["Status"].ToString() == "false")
                            {
                                Dictionary <string, string> Para = new Dictionary <string, string>();
                                Para.Add("template_id", "10581");
                                Para.Add("template_para_schoolname", item.School_Name);
                                Para.Add("template_para_schoolurl", schoolUrl);
                                string msg = (item.School_Name + schoolUrl + "已恢复正常");
                                Rc.Cloud.Web.Common.pfunction.SendSMS_New("/sendtongzhi/", model.Mobile, Para, msg, "自动检测学校公网", "true", item.School_ID);
                            }
                        }
                        #endregion
                        #region 给学校群发短信
                        if (dtPerson.Rows.Count > 0)
                        {
                            SendMsgSchoolPerson(dtPerson, item.School_ID, model.Mobile, item.D_PublicValue, getResult, schoolUrl);
                        }
                        #endregion
                    }
                }
                #region 记录检测结束信息并保存数据
                model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now;
                model_FileSyncExecRecord.FileSyncExecRecord_Remark  = "检测成功完成";
                model_FileSyncExecRecord.FileSyncExecRecord_Status  = "1";

                bll_FileSyncExecRecord.Update(model_FileSyncExecRecord);
                #endregion
            }
            catch (Exception ex)
            {
                model_FileSyncExecRecord.FileSyncExecRecord_TimeEnd = DateTime.Now;
                model_FileSyncExecRecord.FileSyncExecRecord_Status  = "2";
                model_FileSyncExecRecord.FileSyncExecRecord_Remark  = "检测失败:" + ex.Message.ToString();
                bll_FileSyncExecRecord.Update(model_FileSyncExecRecord);
            }
        }
Пример #8
0
        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();
        }
        /// <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);
        }
Пример #10
0
        /// <summary>
        /// 文件同步
        /// </summary>
        protected void btnDataAnalysis_Click(object sender, EventArgs e)
        {
            try
            {
                string strDate           = txtBeginTime.Text.Trim();
                string strSchool         = hidtxtSchool.Value.Trim();
                string strSchoolExtranet = string.Empty;
                if (string.IsNullOrEmpty(strDate))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('请选择日期',{icon: 2, time: 2000 });", true);
                    return;
                }
                if (string.IsNullOrEmpty(strSchool))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('请选择学校',{icon: 2, time: 2000 });", true);
                    return;
                }
                Model_ConfigSchool modelCS = new Model_ConfigSchool();
                BLL_ConfigSchool   bllCS   = new BLL_ConfigSchool();
                modelCS = bllCS.GetModelBySchoolId(hidtxtSchool.Value);
                if (modelCS == null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('学校配置信息不存在',{icon: 2, time: 2000 });", true);
                    return;
                }
                else
                {
                    if (string.IsNullOrEmpty(modelCS.D_PublicValue))
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('请配置学校外网IP',{icon: 2, time: 2000 });", true);
                        return;
                    }
                    else
                    {
                        strSchoolExtranet = modelCS.D_PublicValue;
                    }
                }

                try
                {
                    Model_FileSyncRecord modelSync = new Model_FileSyncRecord();
                    modelSync.FileSyncRecord_Id = Guid.NewGuid().ToString();
                    modelSync.SyncTime          = DateTime.Now;

                    Stopwatch timer = new System.Diagnostics.Stopwatch();
                    timer.Start();

                    #region  步

                    Rc.Model.Resources.Model_SystemLogFileSync model = new Rc.Model.Resources.Model_SystemLogFileSync();
                    Rc.BLL.Resources.BLL_SystemLogFileSync     bll   = new Rc.BLL.Resources.BLL_SystemLogFileSync();
                    model.SystemLogFileSyncID = Guid.NewGuid().ToString();
                    //model.FileSize = ls;
                    // model.SyncUrl = strFilePath;
                    model.MsgType    = "Start";
                    model.ErrorMark  = DateTime.Now.ToString();
                    model.CreateTime = DateTime.Now;
                    bll.Add(model);

                    //for (int i = 0; i < 30; i++)
                    //{
                    //string strDate = DateTime.Now.ToString("yyyy-MM-dd");

                    // Date = DateTime.Now.ToString("yyyy-MM-dd");
                    //Rc.Model.Resources.Model_SystemLogFileSync model = new Rc.Model.Resources.Model_SystemLogFileSync();
                    // Rc.BLL.Resources.BLL_SystemLogFileSync bll = new Rc.BLL.Resources.BLL_SystemLogFileSync();
                    model.SystemLogFileSyncID = Guid.NewGuid().ToString();
                    //model.FileSize = ls;
                    // model.SyncUrl = strFilePath;
                    model.MsgType    = "Start";
                    model.ErrorMark  = strDate;
                    model.CreateTime = DateTime.Now;
                    bll.Add(model);

                    strLog = new StringBuilder();

                    //同步文件
                    if (ddlType.SelectedValue == "1")//教案
                    {
                        ResSynchroTeachingPlan(strSchoolExtranet, strDate, strSchool);
                        ResSynchroTeachingPlanView(strSchoolExtranet, strDate, strSchool);
                    }
                    else if (ddlType.SelectedValue == "2")//习题集
                    {
                        ResSynchroTest(strSchoolExtranet, strDate, strSchool);
                    }
                    else
                    {
                        ResSynchroTeachingPlan(strSchoolExtranet, strDate, strSchool);
                        ResSynchroTeachingPlanView(strSchoolExtranet, strDate, strSchool);
                        ResSynchroTest(strSchoolExtranet, strDate, strSchool);
                    }

                    model.SystemLogFileSyncID = Guid.NewGuid().ToString();
                    //model.FileSize = ls;
                    // model.SyncUrl = strFilePath;
                    model.MsgType = "End";
                    // model.ErrorMark = ex.Message;
                    model.CreateTime = DateTime.Now;
                    bll.Add(model);
                    //}
                    #endregion

                    timer.Stop();
                    string lenght = timer.Elapsed.ToString();
                    modelSync.SyncUserId   = loginUser.SysUser_ID;
                    modelSync.SyncUserName = loginUser.SysUser_Name == "" ? loginUser.SysUser_LoginName : loginUser.SysUser_Name;
                    modelSync.SyncLong     = lenght;
                    modelSync.SyncType     = FileSyncType.SyncSchool.ToString();


                    if (new BLL_FileSyncRecord().Add(modelSync))
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('文件同步成功',{icon: 1, time: 1000 },function(){loadData();});", true);
                        return;
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('文件同步失败',{icon: 2, time: 2000 });", true);
                        return;
                    }
                }
                catch (Exception ex)
                {
                    Rc.Model.Resources.Model_SystemLogFileSync model = new Rc.Model.Resources.Model_SystemLogFileSync();
                    Rc.BLL.Resources.BLL_SystemLogFileSync     bll   = new Rc.BLL.Resources.BLL_SystemLogFileSync();
                    model.SystemLogFileSyncID = Guid.NewGuid().ToString();
                    //model.FileSize = ls;
                    // model.SyncUrl = strFilePath;
                    model.MsgType    = "Error";
                    model.ErrorMark  = ex.Message;
                    model.CreateTime = DateTime.Now;
                    bll.Add(model);
                    throw;
                }
            }
            catch (Exception ex)
            {
                new BLL_clsAuth().AddLogErrorFromBS("文件同步失败:", string.Format("类:{0},方法{1},错误信息:{2}", ex.TargetSite.DeclaringType.ToString()
                                                                             , ex.TargetSite.Name.ToString(), ex.Message));
                ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.closeAll();layer.msg('文件同步失败,出现异常',{icon: 2, time: 2000 });", true);
            }
        }
Пример #11
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);
        }
Пример #12
0
        public static string GetDataList(string Key, string Name, int PageIndex, int PageSize)
        {
            try
            {
                BLL_ConfigSchool bll = new BLL_ConfigSchool();
                Key  = Key.Filter();
                Name = Name.Filter();

                DataTable     dt         = new DataTable();
                List <object> listReturn = new List <object>();
                string        strWhere   = " 1=1 ";
                if (!string.IsNullOrEmpty(Key))
                {
                    strWhere += " and ConfigEnum='" + Key + "' ";
                }
                if (!string.IsNullOrEmpty(Name))
                {
                    strWhere += string.Format(" and (D_Name like '%{0}%' or School_Name like '%{0}%') ", Name);
                }

                string orderBy = "D_Order";
                dt = bll.GetListByPage(strWhere, orderBy, ((PageIndex - 1) * PageSize + 1), (PageIndex * PageSize)).Tables[0];
                int rCount = bll.GetRecordCount(strWhere);

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    listReturn.Add(new
                    {
                        ConfigEnum    = dt.Rows[i]["ConfigEnum"].ToString(),
                        School_Id     = dt.Rows[i]["School_Id"].ToString(),
                        School_Name   = dt.Rows[i]["School_Name"].ToString(),
                        D_Name        = dt.Rows[i]["D_Name"].ToString(),
                        D_Value       = dt.Rows[i]["D_Value"].ToString(),
                        D_PublicValue = dt.Rows[i]["D_PublicValue"].ToString(),
                        D_Type        = dt.Rows[i]["D_Type"].ToString(),
                        D_TypeName    = Rc.Common.EnumService.GetDescription <ConfigSchoolTypeEnum>(dt.Rows[i]["D_Type"].ToString()),
                        D_Order       = dt.Rows[i]["D_Order"].ToString(),
                        D_Remark      = dt.Rows[i]["D_Remark"].ToString(),
                        SchoolIP      = dt.Rows[i]["SchoolIP"].ToString(),
                        CreateTime    = pfunction.ConvertToLongDateTime(dt.Rows[i]["D_CreateTime"].ToString())
                    });
                }

                if (dt.Rows.Count > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        PageIndex = PageIndex,
                        PageSize = PageSize,
                        TotalCount = rCount,
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = ex.Message.ToString()
                }));
            }
        }