public static string ChangeAllTQScoreSource(string source, string ResourceToResourceFolder_Id) { try { Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; source = source.Filter(); string sql = string.Empty; ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter(); if (source == "-1") { sql = string.Format(@"delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}'", TQ_Score_AttrExtend.Source, ResourceToResourceFolder_Id); } else { sql = string.Format(@"delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{3}';insert into S_TQ_Score_AttrExtend(S_TQ_Score_Attr_Id,ResourceToResourceFolder_Id,TestQuestions_Id,TestQuestions_Score_Id,AttrEnum,Attr_Value,CreateUser,CreateTime,UpdateUser,UpdateTime) select newid(),ResourceToResourceFolder_Id,TestQuestions_Id,TestQuestions_Score_ID,'{0}','{1}','{2}',getdate(),'{2}',getdate() from TestQuestions_Score where ResourceToResourceFolder_Id='{3}'", TQ_Score_AttrExtend.Source, source, loginUser.SysUser_ID, ResourceToResourceFolder_Id); } int row = Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql); if (row > 0) { return("1"); } else { return(""); } } catch (Exception ex) { return(""); } }
public static string ChangeTQ_Type(string tqId, string TQ_Type, string ResourceToResourceFolder_Id) { try { Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; TQ_Type = TQ_Type.Filter(); tqId = tqId.Filter(); ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter(); string sql = string.Empty; if (TQ_Type == "0")//删除来源 { sql = string.Format(@" delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_AttrExtend.TQ_Type.ToString(), ResourceToResourceFolder_Id, tqId); } else { sql = string.Format(@" delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_AttrExtend.TQ_Type.ToString(), ResourceToResourceFolder_Id, tqId); sql += string.Format(@"insert into S_TQ_AttrExtend values(newId(),'{0}','{1}','{2}','{3}','{4}','{5}',getdate(),'{5}',getdate())" , ResourceToResourceFolder_Id , tqId , TQ_AttrExtend.TQ_Type.ToString() , TQ_Type , "" , loginUser.SysUser_ID ); } Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql); return("1"); } catch (Exception ex) { return(""); } }
public static string AddAtrr(string ScoreId, string AttrId, string TestQuestions_Knowledge_ID) { try { ScoreId = ScoreId.Filter(); AttrId = AttrId.Filter(); TestQuestions_Knowledge_ID = TestQuestions_Knowledge_ID.Filter(); Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; Model_TestQuestions_Score score = new BLL_TestQuestions_Score().GetModel(ScoreId); Model_S_TestQuestions_TP model = new Model_S_TestQuestions_TP(); model.S_TestQuestions_TP_Id = TestQuestions_Knowledge_ID; model.S_TestingPoint_Id = AttrId; model.TestQuestions_Score_ID = ScoreId; model.TestQuestions_Id = score.TestQuestions_Id; model.ResourceToResourceFolder_Id = score.ResourceToResourceFolder_Id; model.CreateUser = loginUser.SysUser_ID; model.CreateTime = DateTime.Now; if (new BLL_S_TestQuestions_TP().Add(model)) { return("1"); } else { return(""); } } catch (Exception ex) { return(""); } }
public static string AddData(string FirstCode, string SecondCode, string LastCode, string DictRelation_Id) { try { Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; string[] arr = LastCode.Split(','); List <Rc.Model.Resources.Model_DictRelation_Detail> list = new List <Rc.Model.Resources.Model_DictRelation_Detail>(); for (int i = 0; i < arr.Length; i++) { Rc.Model.Resources.Model_DictRelation_Detail dict = new Rc.Model.Resources.Model_DictRelation_Detail(); dict.DictRelation_Detail_Id = Guid.NewGuid().ToString(); dict.DictRelation_Id = DictRelation_Id; dict.Dict_Id = arr[i].ToString(); dict.Dict_Type = FirstCode; dict.Parent_Id = SecondCode; dict.Remark = ""; dict.CreateTime = DateTime.Now; dict.CreateUser = loginUser.SysUser_ID; list.Add(dict); } if (list.Count > 0) { if (new Rc.BLL.Resources.BLL_DictRelation_Detail().Add(DictRelation_Id, SecondCode, list)) { return("1"); } else { return(""); } } else { return(""); } } catch (Exception ex) { return(""); } }
public static string ChangeComplexityText(string scoreId, string tqId, string Source, string ResourceToResourceFolder_Id) { try { Model_TestQuestions tq = new BLL_TestQuestions().GetModel(tqId); Rc.Cloud.Model.Model_VSysUserRole loginUser = (Rc.Cloud.Model.Model_VSysUserRole)HttpContext.Current.Session["LoginUser"]; scoreId = scoreId.Filter(); Source = Source.Filter(); tqId = tqId.Filter(); ResourceToResourceFolder_Id = ResourceToResourceFolder_Id.Filter(); string sql = string.Empty; if (tq.type == "simple") { if (Source == "0")//删除空和题的难易度 { sql = string.Format(@" delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and TestQuestions_Score_Id='{1}' and ResourceToResourceFolder_Id='{2}' and TestQuestions_Id='{3}'", TQ_Score_AttrExtend.ComplexityText.ToString(), scoreId, ResourceToResourceFolder_Id, tqId); sql += string.Format(@"delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_Score_AttrExtend.ComplexityText.ToString(), ResourceToResourceFolder_Id, tqId); } else { sql = string.Format(@" delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and TestQuestions_Score_Id='{1}' and ResourceToResourceFolder_Id='{2}' and TestQuestions_Id='{3}'", TQ_Score_AttrExtend.ComplexityText.ToString(), scoreId, ResourceToResourceFolder_Id, tqId); sql += string.Format(@"delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_Score_AttrExtend.ComplexityText.ToString(), ResourceToResourceFolder_Id, tqId); sql += string.Format(@"insert into S_TQ_Score_AttrExtend values(newId(),'{0}','{1}','{2}','{3}','{4}','{5}',getdate(),'{5}',getdate())" , ResourceToResourceFolder_Id , tqId , scoreId , TQ_Score_AttrExtend.ComplexityText.ToString() , Source , loginUser.SysUser_ID ); sql += string.Format(@"insert into S_TQ_AttrExtend values(newid(),'{0}','{1}','{2}',(select top 1 Common_Dict_ID from S_TQ_Score_AttrExtend t left join Common_Dict cd on cd.Common_Dict_ID=t.Attr_Value where AttrEnum='{2}' and TestQuestions_Id='{1}' order by d_order desc),'{3}','{4}',getdate(),'{4}',getdate())" , ResourceToResourceFolder_Id , tqId , TQ_Score_AttrExtend.ComplexityText.ToString() , "" , loginUser.SysUser_ID); } } else { if (Source == "0")//删除空和题的难易度 { sql = string.Format(@" delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and TestQuestions_Score_Id='{1}' and ResourceToResourceFolder_Id='{2}' and TestQuestions_Id='{3}'", TQ_Score_AttrExtend.ComplexityText.ToString(), scoreId, ResourceToResourceFolder_Id, tqId); sql += string.Format(@"delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_Score_AttrExtend.ComplexityText.ToString(), ResourceToResourceFolder_Id, tq.Parent_Id); } else { sql = string.Format(@" delete from S_TQ_Score_AttrExtend where AttrEnum='{0}' and TestQuestions_Score_Id='{1}' and ResourceToResourceFolder_Id='{2}' and TestQuestions_Id='{3}'", TQ_Score_AttrExtend.ComplexityText.ToString(), scoreId, ResourceToResourceFolder_Id, tqId); sql += string.Format(@"delete from S_TQ_AttrExtend where AttrEnum='{0}' and ResourceToResourceFolder_Id='{1}' and TestQuestions_Id='{2}';", TQ_Score_AttrExtend.ComplexityText.ToString(), ResourceToResourceFolder_Id, tq.Parent_Id); sql += string.Format(@"insert into S_TQ_Score_AttrExtend values(newId(),'{0}','{1}','{2}','{3}','{4}','{5}',getdate(),'{5}',getdate())" , ResourceToResourceFolder_Id , tqId , scoreId , TQ_Score_AttrExtend.ComplexityText.ToString() , Source , loginUser.SysUser_ID ); sql += string.Format(@"insert into S_TQ_AttrExtend values(newid(),'{0}','{1}','{2}',(select top 1 Common_Dict_ID from S_TQ_Score_AttrExtend t left join Common_Dict cd on cd.Common_Dict_ID=t.Attr_Value where AttrEnum='{2}' and TestQuestions_Id in (select TestQuestions_Id from TestQuestions where Parent_Id='{1}') order by d_order desc),'{3}','{4}',getdate(),'{4}',getdate())" , ResourceToResourceFolder_Id , tq.Parent_Id , TQ_Score_AttrExtend.ComplexityText.ToString() , "" , loginUser.SysUser_ID); } } Rc.Common.DBUtility.DbHelperSQL.ExecuteSql(sql); return("1"); } catch (Exception ex) { return(""); } }
public static string GetResourceList(string ResourceFolder_Id, string DocName, int PageSize, int PageIndex, string Module_Id) { try { Rc.Cloud.Model.Model_Struct_Func UserFun; Rc.Cloud.Model.Model_VSysUserRole loginModel = HttpContext.Current.Session["LoginUser"] as Rc.Cloud.Model.Model_VSysUserRole; UserFun = new Rc.Cloud.BLL.BLL_clsAuth().GetUserFunc(loginModel.SysUser_ID, (loginModel == null ? "''" : clsUtility.ReDoStr(loginModel.SysRole_IDs, ',')), Module_Id); ResourceFolder_Id = ResourceFolder_Id.Filter(); DocName = DocName.Filter(); #region 资源信息 DataTable dtRes = new DataTable(); List <object> listReturn = new List <object>(); string strSql = string.Empty; string strSqlCount = string.Empty; string strWhere = string.Empty; strWhere += " and ResourceFolder_ParentId='" + ResourceFolder_Id + "' "; if (!string.IsNullOrEmpty(DocName)) { strWhere = " and ResourceFolder_Name like '%" + DocName.Filter() + "%' "; } strSqlCount = @"select count(*) from VW_ResourceAndResourceFolder A where 1=1 " + strWhere + " "; strSql = @"select * from (select ROW_NUMBER() over(ORDER BY A.RType,A.ResourceFolder_Order,A.ResourceFolder_Name) row,A.* from VW_ResourceAndResourceFolder A where 1=1 " + strWhere + " ) t where row between " + ((PageIndex - 1) * PageSize + 1) + " and " + (PageIndex * PageSize) + " "; dtRes = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0]; int rCount = Convert.ToInt32(Rc.Common.DBUtility.DbHelperSQL.GetSingle(strSqlCount).ToString()); int inum = 0; for (int i = 0; i < dtRes.Rows.Count; i++) { inum++; string strIType = string.Empty; if (dtRes.Rows[i]["Resource_Type"].ToString() == Resource_TypeConst.class类型文件 || dtRes.Rows[i]["Resource_Type"].ToString() == Resource_TypeConst.class类型微课件 || dtRes.Rows[i]["Resource_Type"].ToString() == Resource_TypeConst.ScienceWord类型文件) { strIType = "1"; } else if (dtRes.Rows[i]["Resource_Type"].ToString() == Resource_TypeConst.testPaper类型文件) { strIType = "2"; } string strOperate = string.Empty; if (Module_Id == "10100500") { if (UserFun.Delete) { strOperate = string.Format("<a href=\"javascript:;\" onclick=\"DelData('{0}','{1}');\">删除</a> " , dtRes.Rows[i]["ResourceFolder_Id"].ToString() , dtRes.Rows[i]["RType"].ToString()); } if (UserFun.Edit) { strOperate += string.Format("<a href=\"javascript:;\" onclick=\"EditData('{0}','{1}');\">编辑</a>" , dtRes.Rows[i]["ResourceFolder_Id"].ToString() , dtRes.Rows[i]["RType"].ToString()); } } listReturn.Add(new { inum = (i + 1), docId = dtRes.Rows[i]["ResourceFolder_Id"].ToString(), docName = dtRes.Rows[i]["ResourceFolder_Name"].ToString().ReplaceForFilter(), docType = dtRes.Rows[i]["File_Suffix"].ToString(), RType = dtRes.Rows[i]["RType"].ToString(), docSize = pfunction.ConvertDocSizeUnit(dtRes.Rows[i]["Resource_ContentLength"].ToString()), docTime = pfunction.ConvertToLongDateTime(dtRes.Rows[i]["CreateTime"].ToString()), IType = strIType, Operate = strOperate }); } #endregion if (inum > 0) { return(JsonConvert.SerializeObject(new { err = "null", PageIndex = PageIndex, PageSize = PageSize, TotalCount = rCount, list = listReturn })); } else { return(JsonConvert.SerializeObject(new { err = "暂无数据" })); } } catch (Exception ex) { return(JsonConvert.SerializeObject(new { err = "error"//ex.Message.ToString() })); } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { bool flag = false; Rc.Cloud.Model.Model_VSysUserRole loginUser = HttpContext.Current.Session["LoginUser"] as Rc.Cloud.Model.Model_VSysUserRole; if (ddlType.Value == "1") { List <Model_HomeWork> listHW = new BLL_HomeWork().GetModelList("HomeWork_Status='1' and HomeWork_FinishTime between '" + txtSTime.Text.Filter() + "' and '" + txtETime.Text.Filter() + "' "); foreach (var item in listHW) { #region 日期 执行数据分析,记录日志 Model_StatsLog modelLog = new Model_StatsLog(); modelLog.StatsLogId = Guid.NewGuid().ToString(); modelLog.DataId = item.HomeWork_Id; modelLog.DataName = item.HomeWork_Name; modelLog.DataType = "1"; modelLog.LogStatus = "2"; modelLog.CTime = DateTime.Now; modelLog.CUser = loginUser.SysUser_ID; flag = new BLL_StatsLog().ExecuteStatsAddLog(modelLog); #endregion } } else { string rtrfId = hidtxtRTRFName.Value.Trim().Filter(); if (string.IsNullOrEmpty(rtrfId)) { ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('请选择试卷名称!',{ time: 2000,icon:2},function(){});</script>"); return; } else { #region 试卷 执行数据分析,记录日志 Model_ResourceToResourceFolder modelRTRF = new BLL_ResourceToResourceFolder().GetModel(rtrfId); Model_StatsLog modelLog = new Model_StatsLog(); modelLog.StatsLogId = Guid.NewGuid().ToString(); modelLog.DataId = modelRTRF.ResourceToResourceFolder_Id; modelLog.DataName = txtRTRFName.Value; modelLog.DataType = "2"; modelLog.LogStatus = "2"; modelLog.CTime = DateTime.Now; modelLog.CUser = loginUser.SysUser_ID; flag = new BLL_StatsLog().ExecuteStatsAddLog(modelLog); #endregion } } if (flag) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogFromBS("10255000", "手动执行统计成功"); ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index);});</script>"); } else { new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("10255000", "手动执行统计失败:执行SQL异常"); ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>"); } } catch (Exception ex) { new Rc.Cloud.BLL.BLL_clsAuth().AddLogErrorFromBS("10255000", "手动执行统计失败:" + ex.Message.ToString()); ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('执行统计失败!',{ time: 2000,icon:2},function(){parent.loadData();parent.layer.close(index);});</script>"); } }