protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Model_Two_WayChecklistDetail model = new BLL_Two_WayChecklistDetail().GetModel(Two_WayChecklistDetail_Id);

                model.TestQuestions_NumStr = this.txtTestQuestions_NumStr.Text.TrimEnd();
                model.TestQuestions_Num    = Convert.ToInt32(this.txtSort.Text.TrimEnd());
                model.Score = Convert.ToDecimal(this.txtScore.Text.TrimEnd());
                //model.KnowledgePoint = ddlKnowledgePoint.SelectedValue;
                //model.TargetText = ddlTargetText.SelectedValue;
                //model.Remark = this.txtRemark.Text.TrimEnd();
                //model.ComplexityText = ddlComplexityText.SelectedValue;
                //model.TestQuestions_Type = ddlTestQuestions_Type.SelectedValue;
                //model.Two_WayChecklistType = ddlTestQuestions_Type.SelectedValue == "complex" ? "complex" : "simple";
                if (new BLL_Two_WayChecklistDetail().Update(model))
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改失败!',{ time: 2000,icon:2});</script>");
                    return;
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     try
     {
         if (new BLL_Two_WayChecklistToTestpaper().GetRecordCount("Two_WayChecklist_Id='" + Two_WayChecklist_Id + "'") > 0)
         {
             ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('操作失败,此双向细目表已关联试卷无法操作。',{ time: 2000,icon:2});</script>");
             return;
         }
         if (!string.IsNullOrEmpty(Two_WayChecklistDetail_Id))
         {
             Model_Two_WayChecklistDetail model = new BLL_Two_WayChecklistDetail().GetModel(Two_WayChecklistDetail_Id);
             if (model != null)
             {
                 //model.Remark = txtRemark.Text.TrimEnd();
                 model.TestQuestions_NumStr = txtBigNum.Text.TrimEnd();
                 model.TestQuestions_Num    = Convert.ToInt32(txtSort.Text.TrimEnd());
                 //model.TestQuestions_Type = ddlTestQuestions_Type.SelectedValue;
                 if (new BLL_Two_WayChecklistDetail().Update(model))
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改成功!',{ time: 2000,icon:1},function(){parent.loadData('" + Two_WayChecklist_Id + "');parent.layer.close(index)});</script>");
                 }
                 else
                 {
                     ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('修改失败!',{ time: 2000,icon:2});</script>");
                     return;
                 }
             }
         }
         else
         {
             Model_Two_WayChecklistDetail model = new Model_Two_WayChecklistDetail();
             model.Two_WayChecklistDetail_Id = Guid.NewGuid().ToString();
             model.Two_WayChecklist_Id       = Two_WayChecklist_Id;
             //model.Remark = txtRemark.Text.TrimEnd();
             model.TestQuestions_NumStr = txtBigNum.Text.TrimEnd();
             model.TestQuestions_Num    = Convert.ToInt32(txtSort.Text.TrimEnd());
             model.ParentId             = "0";
             model.CreateUser           = FloginUser.UserId;
             model.CreateTime           = DateTime.Now;
             //model.TestQuestions_Type = ddlTestQuestions_Type.SelectedValue;
             if (new BLL_Two_WayChecklistDetail().Add(model))
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('增加成功!',{ time: 2000,icon:1},function(){parent.loadData();parent.layer.close(index)});</script>");
             }
             else
             {
                 ClientScript.RegisterStartupScript(this.GetType(), "save", "<script type='text/javascript'>layer.msg('增加失败!',{ time: 2000,icon:2});</script>");
                 return;
             }
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemple #3
0
        public static string GetSxxmbList(string Two_WayChecklist_Id)
        {
            try
            {
                #region 双向细目表
                DataTable     dt          = new DataTable();
                List <object> listReturn  = new List <object>();
                string        strSql      = string.Empty;
                string        strSqlCount = string.Empty;
                //strSql = @"select * from Two_WayChecklistDetail where Two_WayChecklist_Id ='" + Two_WayChecklist_Id + "' and ParentId<>'0' order by TestQuestions_Num,CreateTime";
                dt = new BLL_Two_WayChecklistDetail().GetList("Two_WayChecklist_Id ='" + Two_WayChecklist_Id + "' and ParentId<>'0' order by TestQuestions_Num,CreateTime").Tables[0];
                //Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                int       inum   = 0;
                DataTable dtAttr = new BLL_Two_WayChecklistDetailToAttr().GetList("Two_WayChecklist_Id='" + Two_WayChecklist_Id + "'").Tables[0];
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    inum++;
                    listReturn.Add(new
                    {
                        inum = (i + 1),
                        TestQuestions_NumStr = dt.Rows[i]["TestQuestions_NumStr"].ToString(),
                        TestQuestions_Type   = Rc.Common.EnumService.GetDescription <Rc.Model.Resources.TestQuestions_Type>(dt.Rows[i]["TestQuestions_Type"].ToString()),
                        KnowledgePoint       = GetAttr(dtAttr, dt.Rows[i]["Two_WayChecklistDetail_Id"].ToString(), "1").TrimEnd(','),
                        TargetText           = GetAttr(dtAttr, dt.Rows[i]["Two_WayChecklistDetail_Id"].ToString(), "2").TrimEnd(','),
                        ComplexityText       = GetAttr(dtAttr, dt.Rows[i]["Two_WayChecklistDetail_Id"].ToString(), "3").TrimEnd(','),
                        Score = dt.Rows[i]["Score"].ToString().clearLastZero(),
                    });
                }
                #endregion

                if (inum > 0)
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "null",
                        list = listReturn
                    }));
                }
                else
                {
                    return(JsonConvert.SerializeObject(new
                    {
                        err = "暂无数据"
                    }));
                }
            }
            catch (Exception)
            {
                return(JsonConvert.SerializeObject(new
                {
                    err = "error"//ex.Message.ToString()
                }));
            }
        }
Exemple #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Two_WayChecklistDetail_Id = Request["Two_WayChecklistDetail_Id"].Filter();
     Two_WayChecklist_Id       = Request["Two_WayChecklist_Id"].Filter();
     type = Request["type"].Filter();
     if (!IsPostBack)
     {
         //InitInfo();
         Model_Two_WayChecklistDetail model = new Model_Two_WayChecklistDetail();
         model = new BLL_Two_WayChecklistDetail().GetModel(Two_WayChecklistDetail_Id);
         ///ddlTestQuestions_Type.Enabled = false;
         LoadData();
     }
 }
 public void LoadData()
 {
     try
     {
         Model_Two_WayChecklistDetail model = new BLL_Two_WayChecklistDetail().GetModel(Two_WayChecklistDetail_Id);
         if (model != null)
         {
             this.txtBigNum.Text = model.TestQuestions_NumStr;
             this.txtSort.Text   = model.TestQuestions_Num.ToString();
             //this.txtRemark.Text = model.Remark;
             //ddlTestQuestions_Type.SelectedValue = model.TestQuestions_Type;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
 public void LoadData()
 {
     try
     {
         Model_Two_WayChecklistDetail model = new BLL_Two_WayChecklistDetail().GetModel(Two_WayChecklistDetail_Id);
         if (model != null)
         {
             txtSort.Text = model.TestQuestions_Num.ToString();
             this.txtTestQuestions_NumStr.Text = model.TestQuestions_NumStr;
             this.txtScore.Text = model.Score.ToString();
             //ddlKnowledgePoint.SelectedValue = model.KnowledgePoint.TrimEnd();
             //ddlTargetText.SelectedValue = model.TargetText.TrimEnd();
             //this.txtRemark.Text = model.Remark;
             //ddlComplexityText.SelectedValue = model.ComplexityText.TrimEnd();
             //ddlTestQuestions_Type.SelectedValue = model.TestQuestions_Type;
         }
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Exemple #7
0
        /// <summary>
        /// 验证试卷是否有效
        /// </summary>
        /// <param name="Two_WayChecklist_Id"></param>
        /// <param name="arrRTRF"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        private static bool VerifyTestpaper(string TestPaper_Frame_Id, string TestPaper_FrameDetail_Id, string[] arrRTRF, out string msg)
        {
            bool flag = true;

            msg = string.Empty;
            try
            {
                TestPaper_Frame_Id       = TestPaper_Frame_Id.Filter();
                TestPaper_FrameDetail_Id = TestPaper_FrameDetail_Id.Filter();
                BLL_Two_WayChecklistDetail bll        = new BLL_Two_WayChecklistDetail();
                BLL_TestQuestions_Score    bllTQScore = new BLL_TestQuestions_Score();
                DataTable          dtTWC_Count        = new DataTable(); // 双向细目表总分、试题数量
                DataTable          dtTWC      = new DataTable();         // 双向细目表明细
                DataTable          dtTQ_Count = new DataTable();         // 习题集资源总分、试题数量
                DataTable          dtTQScore  = new DataTable();         // 习题集试题明细
                Model_VSysUserRole loginUser  = (Model_VSysUserRole)HttpContext.Current.Session["LoginUser"];
                string             strSql     = string.Empty;
                strSql      = string.Format(@"select count(1) as ICount,sum(Score) as SumScore from TestPaper_FrameDetail 
where ParentId!='0' and TestPaper_FrameDetail_Id='{0}' ", TestPaper_FrameDetail_Id);
                dtTWC_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                DataRow drTWC_Count = dtTWC_Count.Rows[0];
                int     twCount     = 0;
                double  twSumScore  = 0;
                int.TryParse(drTWC_Count["ICount"].ToString(), out twCount);
                double.TryParse(drTWC_Count["SumScore"].ToString(), out twSumScore);

                strSql = string.Empty;
                strSql = string.Format(@"select t.* from TestPaper_FrameDetail t 
where t.ParentId!='0' and t.TestPaper_FrameDetail_Id='{0}' order by t.TestQuestions_Num,t.CreateTime ", TestPaper_FrameDetail_Id);
                dtTWC  = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];

                foreach (var rtrfId in arrRTRF)
                {
                    List <Model_TestPaper_FrameDetailToTestQuestions> listmodel = new List <Model_TestPaper_FrameDetailToTestQuestions>();
                    string strSqlTQ = string.Empty;
                    strSqlTQ   = string.Format(@"select max(rtrf.Resource_Name) as Resource_Name,count(1) as ICount ,sum(t.TestQuestions_SumScore) as SumScore from (
select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq 
where tq.TestQuestions_Type!='title' and tq.TestQuestions_Type<>'' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' 
union all
select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq 
where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' 
)  t inner join ResourceToResourceFolder rtrf on rtrf.ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id", rtrfId);
                    dtTQ_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTQ).Tables[0];
                    DataRow drTQ_Count = dtTQ_Count.Rows[0];
                    int     tqCount    = 0;
                    double  tqSumScore = 0;
                    int.TryParse(drTQ_Count["ICount"].ToString(), out tqCount);
                    double.TryParse(drTQ_Count["SumScore"].ToString(), out tqSumScore);

                    if (flag)
                    {
                        string strSqlScore = string.Empty;
                        strSqlScore = string.Format(@"select * from (
select tq.TestQuestions_Id,tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq 
where tq.TestQuestions_Type!='title' and tq.TestQuestions_Type<>'' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' 
union all
select tq.TestQuestions_Id,tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq 
where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}'
) t order by TestQuestions_Num ", rtrfId);
                        dtTQScore   = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0];
                        int row = 0;
                        foreach (DataRow item in dtTQScore.Rows)
                        {
                            if (flag && dtTWC.Rows[0]["TestPaper_FrameType"].ToString() == "simple" && item["type"].ToString() == "complex")
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , dtTQScore.Rows[row]["topicNumber"]
                                                     , "试题类型");
                            }
                            if (flag && dtTWC.Rows[0]["TestPaper_FrameType"].ToString() == "complex" && item["type"].ToString() != "complex")
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , dtTQScore.Rows[row]["topicNumber"]
                                                     , "试题类型");
                            }



                            double twScore = 0; // 双向细目表分值
                            double tqScore = 0; // 试题分值
                            double.TryParse(dtTWC.Rows[0]["Score"].ToString(), out twScore);
                            double.TryParse(item["TestQuestions_SumScore"].ToString(), out tqScore);
                            if (flag && twScore != tqScore)
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , item["topicNumber"]
                                                     , "试题分值");
                            }
                            Model_TestPaper_FrameDetailToTestQuestions model = new Model_TestPaper_FrameDetailToTestQuestions();
                            model.TestPaper_FrameDetailToTestQuestions_Id = Guid.NewGuid().ToString();
                            model.TestPaper_Frame_Id          = dtTWC.Rows[0]["TestPaper_Frame_Id"].ToString();
                            model.TestPaper_FrameDetail_Id    = dtTWC.Rows[0]["TestPaper_FrameDetail_Id"].ToString();
                            model.ResourceToResourceFolder_Id = rtrfId;
                            model.TestQuestions_Id            = item["TestQuestions_Id"].ToString();
                            model.CreateTime = DateTime.Now;
                            model.CreateUser = loginUser.SysUser_ID;
                            listmodel.Add(model);
                            row++;
                        }
                    }
                    if (flag)
                    {
                        if (new BLL_TestPaper_FrameToTestpaper().GetRecordCount("TestPaper_Frame_Id='" + TestPaper_FrameDetail_Id + "' and ResourceToResourceFolder_Id='" + rtrfId + "'") > 0)
                        {
                            Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(string.Format("exec P_GenerateTF_Attr '{0}','{1}'", TestPaper_Frame_Id, loginUser.SysUser_ID), 7200);
                            flag = true;
                        }
                        else
                        {
                            Rc.Model.Resources.Model_TestPaper_FrameToTestpaper model = new Rc.Model.Resources.Model_TestPaper_FrameToTestpaper();
                            model.CreateTime = DateTime.Now;
                            model.CreateUser = loginUser.SysUser_ID;
                            model.ResourceToResourceFolder_Id     = rtrfId;
                            model.TestPaper_FrameToTestpaper_Id   = Guid.NewGuid().ToString();
                            model.TestPaper_Frame_Id              = TestPaper_FrameDetail_Id;
                            model.TestPaper_FrameToTestpaper_Type = "1";
                            if (new BLL_TestPaper_FrameToTestpaper().AddRelationPaper(model, listmodel) > 0)
                            {
                                Rc.Common.DBUtility.DbHelperSQL.ExecuteSqlByTime(string.Format("exec P_GenerateTF_Attr '{0}','{1}'", TestPaper_Frame_Id, loginUser.SysUser_ID), 7200);
                                flag = true;
                            }
                            else
                            {
                                flag = false;
                                msg  = "关联试卷失败";
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = ex.Message.ToString();
            }
            return(flag);
        }
Exemple #8
0
        //276d7051-ac19-4f8b-baa6-6257c088ea58
        private bool VerifyTestpaper(string Two_WayChecklist_Id, string[] arrRTRF, out string msg)
        {
            bool flag = true;

            msg = string.Empty;
            try
            {
                BLL_Two_WayChecklistDetail bll        = new BLL_Two_WayChecklistDetail();
                BLL_TestQuestions_Score    bllTQScore = new BLL_TestQuestions_Score();
                DataTable dtTWC_Count = new DataTable(); // 双向细目表总分、试题数量
                DataTable dtTWC       = new DataTable(); // 双向细目表明细
                DataTable dtTQ_Count  = new DataTable(); // 习题集资源总分、试题数量
                DataTable dtTQScore   = new DataTable(); // 习题集试题明细

                string strSql = string.Empty;
                strSql      = string.Format(@"select count(1) as ICount,sum(Score) as SumScore from Two_WayChecklistDetail 
where ParentId!='0' and Two_WayChecklist_Id='{0}' ", Two_WayChecklist_Id);
                dtTWC_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];
                DataRow drTWC_Count = dtTWC_Count.Rows[0];
                int     twCount     = 0;
                double  twSumScore  = 0;
                int.TryParse(drTWC_Count["ICount"].ToString(), out twCount);
                double.TryParse(drTWC_Count["SumScore"].ToString(), out twSumScore);

                strSql = string.Empty;
                strSql = string.Format(@"select t.* from Two_WayChecklistDetail t 
inner join Two_WayChecklistDetail t2 on t.ParentId=t2.Two_WayChecklistDetail_Id 
where t.ParentId!='0' and t.Two_WayChecklist_Id='{0}' order by t2.TestQuestions_Num,t.TestQuestions_Num ", Two_WayChecklist_Id);
                dtTWC  = Rc.Common.DBUtility.DbHelperSQL.Query(strSql).Tables[0];

                foreach (var rtrfId in arrRTRF)
                {
                    string strSqlTQ = string.Empty;
                    strSqlTQ   = string.Format(@"select max(rtrf.Resource_Name) as Resource_Name,count(1) as ICount ,sum(t.TestQuestions_SumScore) as SumScore from (
select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq 
where tq.Parent_Id!='0' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' 
union all
select TestQuestions_SumScore,tq.ResourceToResourceFolder_Id from TestQuestions tq 
where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}' 
)  t inner join ResourceToResourceFolder rtrf on rtrf.ResourceToResourceFolder_Id=t.ResourceToResourceFolder_Id", rtrfId);
                    dtTQ_Count = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlTQ).Tables[0];
                    DataRow drTQ_Count = dtTQ_Count.Rows[0];
                    int     tqCount    = 0;
                    double  tqSumScore = 0;
                    int.TryParse(drTQ_Count["ICount"].ToString(), out tqCount);
                    double.TryParse(drTQ_Count["SumScore"].ToString(), out tqSumScore);
                    if (flag && tqCount != twCount)
                    {
                        flag = false;
                        msg  = string.Format("资源【{0}】试题数不等于双向细目表明细数", drTQ_Count["Resource_Name"].ToString().ReplaceForFilter());
                    }
                    if (flag && tqSumScore != twSumScore)
                    {
                        flag = false;
                        msg  = string.Format("资源【{0}】总分不等于双向细目表总分", drTQ_Count["Resource_Name"].ToString().ReplaceForFilter());
                    }
                    if (flag)
                    {
                        string strSqlScore = string.Empty;
                        strSqlScore = string.Format(@"select * from (
select tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq 
where tq.Parent_Id!='0' and tq.[type]='simple' and tq.ResourceToResourceFolder_Id='{0}' 
union all
select tq.TestQuestions_Type,tq.[type],tq.TestQuestions_Num,tq.topicNumber,tq.TestQuestions_SumScore from TestQuestions tq 
where tq.Parent_Id='0' and tq.[type]='complex' and tq.ResourceToResourceFolder_Id='{0}'
) t order by TestQuestions_Num ", rtrfId);
                        dtTQScore   = Rc.Common.DBUtility.DbHelperSQL.Query(strSqlScore).Tables[0];
                        int row = 0;
                        foreach (DataRow item in dtTWC.Rows)
                        {
                            if (flag && item["Two_WayChecklistType"].ToString() == "simple" && item["TestQuestions_Type"].ToString() != dtTQScore.Rows[row]["TestQuestions_Type"].ToString())
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , dtTQScore.Rows[row]["topicNumber"]
                                                     , "试题类型");
                            }
                            if (flag && item["Two_WayChecklistType"].ToString() == "complex" && item["Two_WayChecklistType"].ToString() != dtTQScore.Rows[row]["type"].ToString())
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , dtTQScore.Rows[row]["topicNumber"]
                                                     , "试题类型");
                            }

                            double twScore = 0; // 双向细目表分值
                            double tqScore = 0; // 试题分值
                            double.TryParse(item["Score"].ToString(), out twScore);
                            double.TryParse(dtTQScore.Rows[row]["TestQuestions_SumScore"].ToString(), out tqScore);
                            if (flag && twScore != tqScore)
                            {
                                flag = false;
                                msg  = string.Format("资源【{0}】第{1}题{2}与双向细目表不匹配"
                                                     , drTQ_Count["Resource_Name"].ToString().ReplaceForFilter()
                                                     , dtTQScore.Rows[row]["topicNumber"]
                                                     , "试题分值");
                            }

                            row++;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                flag = false;
                msg  = ex.Message.ToString();
            }
            return(flag);
        }