Пример #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
        public bool Add(Model_ConfigSchool model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into ConfigSchool(");
            builder.Append("ConfigEnum,School_ID,School_Name,D_Name,D_Value,D_Type,D_Remark,D_Order,D_CreateTime,D_CreateUser,D_UpdateTime,D_UpdateUser,D_PublicValue,SchoolIP,Mobile)");
            builder.Append(" values (");
            builder.Append("@ConfigEnum,@School_ID,@School_Name,@D_Name,@D_Value,@D_Type,@D_Remark,@D_Order,@D_CreateTime,@D_CreateUser,@D_UpdateTime,@D_UpdateUser,@D_PublicValue,@SchoolIP,@Mobile)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ConfigEnum", SqlDbType.VarChar, 20), new SqlParameter("@School_ID", SqlDbType.VarChar, 50), new SqlParameter("@School_Name", SqlDbType.NVarChar, 250), new SqlParameter("@D_Name", SqlDbType.NVarChar, 100), new SqlParameter("@D_Value", SqlDbType.VarChar, 300), new SqlParameter("@D_Type", SqlDbType.VarChar, 50), new SqlParameter("@D_Remark", SqlDbType.NVarChar, 500), new SqlParameter("@D_Order", SqlDbType.Int, 4), new SqlParameter("@D_CreateTime", SqlDbType.DateTime), new SqlParameter("@D_CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@D_UpdateTime", SqlDbType.DateTime), new SqlParameter("@D_UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@D_PublicValue", SqlDbType.VarChar, 300), new SqlParameter("@SchoolIP", SqlDbType.VarChar, 300), new SqlParameter("@Mobile", SqlDbType.VarChar, 50) };
            cmdParms[0].Value  = model.ConfigEnum;
            cmdParms[1].Value  = model.School_ID;
            cmdParms[2].Value  = model.School_Name;
            cmdParms[3].Value  = model.D_Name;
            cmdParms[4].Value  = model.D_Value;
            cmdParms[5].Value  = model.D_Type;
            cmdParms[6].Value  = model.D_Remark;
            cmdParms[7].Value  = model.D_Order;
            cmdParms[8].Value  = model.D_CreateTime;
            cmdParms[9].Value  = model.D_CreateUser;
            cmdParms[10].Value = model.D_UpdateTime;
            cmdParms[11].Value = model.D_UpdateUser;
            cmdParms[12].Value = model.D_PublicValue;
            cmdParms[13].Value = model.SchoolIP;
            cmdParms[14].Value = model.Mobile;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Пример #3
0
        /// <summary>
        /// 第三方用户登录认证 17-12-18TS
        /// </summary>
        public static bool AuthUserLoginByIF(Model_ConfigSchool modelCS, string schoolCode, string userName, string password)
        {
            bool flag = false;

            if (schoolCode == ThirdPartyEnum.yzlyxx.ToString())
            {
                #region 扬州旅游商贸学校 用户认证
                string para = string.Format("UserName={0}&Password={1}", userName, password);
                if (Rc.Common.RemotWeb.PostDataToServer(modelCS.D_PublicValue + "/AuthApi/yzlyxx/auth.aspx", para, Encoding.UTF8, "POST") == "successful")
                {
                    flag = true;
                }

                #endregion
            }
            else if (schoolCode == ThirdPartyEnum.ahjzvs.ToString())
            {
                #region 安徽金寨职业学校
                object objUser = new BLL_F_User().GetModel(userName, Rc.Common.StrUtility.DESEncryptLogin.EncryptString(password));
                if (objUser != null)
                {
                    flag = true;
                }
                #endregion
            }

            return(flag);
        }
Пример #4
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);
        }
Пример #5
0
        public List <Model_ConfigSchool> DataTableToList(DataTable dt)
        {
            List <Model_ConfigSchool> list = new List <Model_ConfigSchool>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_ConfigSchool item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Пример #6
0
 /// <summary>
 /// 修改时的默认值
 /// </summary>
 protected void loadData()
 {
     model = bll.GetModel(ConfigEnum);
     if (model == null)
     {
         return;
     }
     else
     {
         txtConfigEnum.Attributes.Add("readonly", "true");
         txtConfigEnum.Text     = model.ConfigEnum;
         hidtxtSchool.Value     = model.School_ID;
         txtSchool.Value        = model.School_Name;
         txtDName.Text          = model.D_Name;
         txtDValue.Text         = model.D_Value;
         txtSchoolIP.Text       = model.SchoolIP;
         txtDPublicValue.Text   = model.D_PublicValue;
         ddlDType.SelectedValue = model.D_Type;
         txtRemark.Text         = model.D_Remark;
     }
 }
Пример #7
0
        public bool Update(Model_ConfigSchool model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ConfigSchool set ");
            builder.Append("School_ID=@School_ID,");
            builder.Append("School_Name=@School_Name,");
            builder.Append("D_Name=@D_Name,");
            builder.Append("D_Value=@D_Value,");
            builder.Append("D_Type=@D_Type,");
            builder.Append("D_Remark=@D_Remark,");
            builder.Append("D_Order=@D_Order,");
            builder.Append("D_CreateTime=@D_CreateTime,");
            builder.Append("D_CreateUser=@D_CreateUser,");
            builder.Append("D_UpdateTime=@D_UpdateTime,");
            builder.Append("D_UpdateUser=@D_UpdateUser,");
            builder.Append("D_PublicValue=@D_PublicValue,");
            builder.Append("SchoolIP=@SchoolIP,");
            builder.Append("Mobile=@Mobile");
            builder.Append(" where ConfigEnum=@ConfigEnum ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@School_ID", SqlDbType.VarChar, 50), new SqlParameter("@School_Name", SqlDbType.NVarChar, 250), new SqlParameter("@D_Name", SqlDbType.NVarChar, 100), new SqlParameter("@D_Value", SqlDbType.VarChar, 300), new SqlParameter("@D_Type", SqlDbType.VarChar, 50), new SqlParameter("@D_Remark", SqlDbType.NVarChar, 500), new SqlParameter("@D_Order", SqlDbType.Int, 4), new SqlParameter("@D_CreateTime", SqlDbType.DateTime), new SqlParameter("@D_CreateUser", SqlDbType.Char, 0x24), new SqlParameter("@D_UpdateTime", SqlDbType.DateTime), new SqlParameter("@D_UpdateUser", SqlDbType.Char, 0x24), new SqlParameter("@D_PublicValue", SqlDbType.VarChar, 300), new SqlParameter("@SchoolIP", SqlDbType.VarChar, 300), new SqlParameter("@Mobile", SqlDbType.VarChar, 50), new SqlParameter("@ConfigEnum", SqlDbType.VarChar, 20) };
            cmdParms[0].Value  = model.School_ID;
            cmdParms[1].Value  = model.School_Name;
            cmdParms[2].Value  = model.D_Name;
            cmdParms[3].Value  = model.D_Value;
            cmdParms[4].Value  = model.D_Type;
            cmdParms[5].Value  = model.D_Remark;
            cmdParms[6].Value  = model.D_Order;
            cmdParms[7].Value  = model.D_CreateTime;
            cmdParms[8].Value  = model.D_CreateUser;
            cmdParms[9].Value  = model.D_UpdateTime;
            cmdParms[10].Value = model.D_UpdateUser;
            cmdParms[11].Value = model.D_PublicValue;
            cmdParms[12].Value = model.SchoolIP;
            cmdParms[13].Value = model.Mobile;
            cmdParms[14].Value = model.ConfigEnum;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
Пример #8
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         int intOrder = 0;
         int.TryParse(txtDSort.Text, out intOrder);
         if (string.IsNullOrEmpty(ConfigEnum))
         {
             #region 添加
             model               = new Model_ConfigSchool();
             model.ConfigEnum    = txtConfigEnum.Text.Trim();
             model.School_ID     = hidtxtSchool.Value.Trim();
             model.School_Name   = txtSchool.Value.Trim();
             model.D_Name        = txtDName.Text.Trim();
             model.D_Value       = txtDValue.Text.Trim();
             model.D_PublicValue = txtDPublicValue.Text.Trim();
             model.D_Type        = ddlDType.SelectedValue;
             model.D_Order       = intOrder;
             model.D_Remark      = txtRemark.Text.Trim();
             model.D_CreateUser  = loginUser.SysUser_ID;
             model.D_CreateTime  = DateTime.Now;
             model.SchoolIP      = txtSchoolIP.Text.Trim();
             //验证标识是否已存在
             if (bll.GetRecordCount("ConfigEnum='" + txtConfigEnum.Text.Trim() + "'") > 0)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('标识已存在', { time: 2000, icon: 2})</script>");
                 return;
             }
             //验证学校是否已配置某一类型的数据
             if (bll.GetRecordCount("School_ID='" + hidtxtSchool.Value.Trim() + "' and D_Type='" + ddlDType.SelectedValue + "'") > 0)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该学校已添加此类型数据', { time: 2000, icon: 2})</script>");
                 return;
             }
             if (bll.Add(model))
             {
                 new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90207000", "新增学校配置标识成功");
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('新增成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
                 return;
             }
             #endregion
         }
         else
         {
             #region 修改
             model               = bll.GetModel(ConfigEnum);
             model.School_ID     = hidtxtSchool.Value.Trim();
             model.School_Name   = txtSchool.Value.Trim();
             model.D_Name        = txtDName.Text.Trim();
             model.D_Value       = txtDValue.Text.Trim();
             model.D_PublicValue = txtDPublicValue.Text.Trim();
             model.D_Type        = ddlDType.SelectedValue;
             model.D_Order       = intOrder;
             model.D_Remark      = txtRemark.Text.Trim();
             model.D_UpdateUser  = loginUser.SysUser_ID;
             model.D_UpdateTime  = DateTime.Now;
             model.SchoolIP      = txtSchoolIP.Text.Trim();
             //验证学校是否已配置某一类型的数据
             if (bll.GetRecordCount("ConfigEnum!='" + txtConfigEnum.Text.Trim() + "' and School_ID='" + hidtxtSchool.Value.Trim() + "' and D_Type='" + ddlDType.SelectedValue + "'") > 0)
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script>layer.msg('该学校已添加此类型数据', { time: 2000, icon: 2})</script>");
                 return;
             }
             if (bll.Update(model))
             {
                 new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("90207000", "修改学校配置标识成功");
                 ClientScript.RegisterStartupScript(this.GetType(), "update", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>");
             }
             #endregion
         }
     }
     catch (Exception)
     {
         new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("90207000", "操作学校配置标识失败");
         ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>");
     }
 }
Пример #9
0
        public Model_ConfigSchool DataRowToModel(DataRow row)
        {
            Model_ConfigSchool school = new Model_ConfigSchool();

            if (row != null)
            {
                if (row["ConfigEnum"] != null)
                {
                    school.ConfigEnum = row["ConfigEnum"].ToString();
                }
                if (row["School_ID"] != null)
                {
                    school.School_ID = row["School_ID"].ToString();
                }
                if (row["School_Name"] != null)
                {
                    school.School_Name = row["School_Name"].ToString();
                }
                if (row["D_Name"] != null)
                {
                    school.D_Name = row["D_Name"].ToString();
                }
                if (row["D_Value"] != null)
                {
                    school.D_Value = row["D_Value"].ToString();
                }
                if (row["D_Type"] != null)
                {
                    school.D_Type = row["D_Type"].ToString();
                }
                if (row["D_Remark"] != null)
                {
                    school.D_Remark = row["D_Remark"].ToString();
                }
                if ((row["D_Order"] != null) && (row["D_Order"].ToString() != ""))
                {
                    school.D_Order = new int?(int.Parse(row["D_Order"].ToString()));
                }
                if ((row["D_CreateTime"] != null) && (row["D_CreateTime"].ToString() != ""))
                {
                    school.D_CreateTime = new DateTime?(DateTime.Parse(row["D_CreateTime"].ToString()));
                }
                if (row["D_CreateUser"] != null)
                {
                    school.D_CreateUser = row["D_CreateUser"].ToString();
                }
                if ((row["D_UpdateTime"] != null) && (row["D_UpdateTime"].ToString() != ""))
                {
                    school.D_UpdateTime = new DateTime?(DateTime.Parse(row["D_UpdateTime"].ToString()));
                }
                if (row["D_UpdateUser"] != null)
                {
                    school.D_UpdateUser = row["D_UpdateUser"].ToString();
                }
                if (row["D_PublicValue"] != null)
                {
                    school.D_PublicValue = row["D_PublicValue"].ToString();
                }
                if (row["SchoolIP"] != null)
                {
                    school.SchoolIP = row["SchoolIP"].ToString();
                }
                if (row["Mobile"] != null)
                {
                    school.Mobile = row["Mobile"].ToString();
                }
            }
            return(school);
        }
Пример #10
0
 public bool Update(Model_ConfigSchool model)
 {
     return(this.dal.Update(model));
 }
Пример #11
0
 public bool Add(Model_ConfigSchool model)
 {
     return(this.dal.Add(model));
 }
Пример #12
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);
            }
        }