コード例 #1
0
        public Model_Student_HomeWork DataRowToModel(DataRow row)
        {
            Model_Student_HomeWork work = new Model_Student_HomeWork();

            if (row != null)
            {
                if (row["Student_HomeWork_Id"] != null)
                {
                    work.Student_HomeWork_Id = row["Student_HomeWork_Id"].ToString();
                }
                if (row["HomeWork_Id"] != null)
                {
                    work.HomeWork_Id = row["HomeWork_Id"].ToString();
                }
                if (row["Student_Id"] != null)
                {
                    work.Student_Id = row["Student_Id"].ToString();
                }
                if ((row["CreateTime"] != null) && (row["CreateTime"].ToString() != ""))
                {
                    work.CreateTime = new DateTime?(DateTime.Parse(row["CreateTime"].ToString()));
                }
            }
            return(work);
        }
コード例 #2
0
        public bool Add(Model_Student_HomeWork model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into Student_HomeWork(");
            builder.Append("Student_HomeWork_Id,HomeWork_Id,Student_Id,CreateTime)");
            builder.Append(" values (");
            builder.Append("@Student_HomeWork_Id,@HomeWork_Id,@Student_Id,@CreateTime)");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@Student_HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@Student_Id", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime) };
            cmdParms[0].Value = model.Student_HomeWork_Id;
            cmdParms[1].Value = model.HomeWork_Id;
            cmdParms[2].Value = model.Student_Id;
            cmdParms[3].Value = model.CreateTime;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #3
0
        public bool Update(Model_Student_HomeWork model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update Student_HomeWork set ");
            builder.Append("HomeWork_Id=@HomeWork_Id,");
            builder.Append("Student_Id=@Student_Id,");
            builder.Append("CreateTime=@CreateTime");
            builder.Append(" where Student_HomeWork_Id=@Student_HomeWork_Id ");
            SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@HomeWork_Id", SqlDbType.Char, 0x24), new SqlParameter("@Student_Id", SqlDbType.Char, 0x24), new SqlParameter("@CreateTime", SqlDbType.DateTime), new SqlParameter("@Student_HomeWork_Id", SqlDbType.Char, 0x24) };
            cmdParms[0].Value = model.HomeWork_Id;
            cmdParms[1].Value = model.Student_Id;
            cmdParms[2].Value = model.CreateTime;
            cmdParms[3].Value = model.Student_HomeWork_Id;
            return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
コード例 #4
0
        public List <Model_Student_HomeWork> DataTableToList(DataTable dt)
        {
            List <Model_Student_HomeWork> list = new List <Model_Student_HomeWork>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Model_Student_HomeWork item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
コード例 #5
0
        private bool LoadData()
        {
            bool flag = false;

            try
            {
                Stream         resStream   = HttpContext.Current.Request.InputStream;
                StreamReader   sr          = new StreamReader(resStream, System.Text.Encoding.UTF8);
                string         testJsion   = sr.ReadToEnd();
                string         resInfo     = testJsion;
                tchAssignModel modelAssign = JsonConvert.DeserializeObject <tchAssignModel>(resInfo);
                Model_HomeWork model       = new Model_HomeWork();
                model.SubjectId = modelAssign.SubjectId;

                #region 布置作业表
                model.HomeWork_Id = modelAssign.HomeWork_Id;
                model.ResourceToResourceFolder_Id = modelAssign.ResourceToResourceFolder_Id;
                model.HomeWork_Name          = modelAssign.HomeWork_Name;
                model.HomeWork_AssignTeacher = modelAssign.HomeWork_AssignTeacher;
                model.BeginTime       = modelAssign.BeginTime;
                model.StopTime        = modelAssign.StopTime;
                model.IsHide          = modelAssign.IsHide;
                model.HomeWork_Status = modelAssign.HomeWork_Status;
                model.CreateTime      = modelAssign.CreateTime;
                model.UserGroup_Id    = modelAssign.UserGroup_Id;
                model.isTimeLimt      = modelAssign.isTimeLimt;
                model.isTimeLength    = modelAssign.isTimeLength;
                model.SubjectId       = modelAssign.SubjectId;
                model.IsShowAnswer    = modelAssign.IsShowAnswer;
                #endregion

                #region 学生作业表
                List <Model_Student_HomeWork>         listSHomwWork        = new List <Model_Student_HomeWork>();
                List <Model_Student_HomeWork_Submit>  listSHomwWorkSubmit  = new List <Model_Student_HomeWork_Submit>();
                List <Model_Student_HomeWork_Correct> listSHomwWorkCorrect = new List <Model_Student_HomeWork_Correct>();
                string   strStudent    = modelAssign.stuInfo;
                string[] strArrStudent = strStudent.Split(',');
                for (int i = 0; i < strArrStudent.Length; i++)
                {
                    string ShwGuid = Guid.NewGuid().ToString();
                    Model_Student_HomeWork modelSHomeWork = new Model_Student_HomeWork();
                    modelSHomeWork.Student_HomeWork_Id = ShwGuid;
                    modelSHomeWork.HomeWork_Id         = modelAssign.HomeWork_Id;
                    modelSHomeWork.Student_Id          = strArrStudent[i];
                    modelSHomeWork.CreateTime          = modelAssign.CreateTime;
                    listSHomwWork.Add(modelSHomeWork);
                    #region 作业提交状态
                    Model_Student_HomeWork_Submit modelSHomeWorkSubmit = new Model_Student_HomeWork_Submit();
                    modelSHomeWorkSubmit.Student_HomeWork_Id     = ShwGuid;
                    modelSHomeWorkSubmit.Student_HomeWork_Status = 0;
                    listSHomwWorkSubmit.Add(modelSHomeWorkSubmit);
                    #endregion
                    #region 作业批改状态
                    Model_Student_HomeWork_Correct modelSHomeWorkCorrect = new Model_Student_HomeWork_Correct();
                    modelSHomeWorkCorrect.Student_HomeWork_Id            = ShwGuid;
                    modelSHomeWorkCorrect.Student_HomeWork_CorrectStatus = 0;
                    listSHomwWorkCorrect.Add(modelSHomeWorkCorrect);
                    #endregion
                }
                #endregion

                #region 统计帮助表
                DataTable dtHWDetail = Rc.Common.DBUtility.DbHelperSQL.Query("select * from VW_ClassGradeSchool where ClassId='" + modelAssign.UserGroup_Id + "' and GradeId is not null and SchoolId is not null ").Tables[0];

                Model_StatsHelper modelSH_HW = new Model_StatsHelper();
                modelSH_HW.StatsHelper_Id = Guid.NewGuid().ToString();
                modelSH_HW.ResourceToResourceFolder_Id = model.ResourceToResourceFolder_Id;
                modelSH_HW.Homework_Id   = model.HomeWork_Id;
                modelSH_HW.Exec_Status   = "0";
                modelSH_HW.SType         = "1";
                modelSH_HW.CreateUser    = modelAssign.HomeWork_AssignTeacher;
                modelSH_HW.SchoolId      = dtHWDetail.Rows[0]["SchoolId"].ToString();
                modelSH_HW.GradeId       = dtHWDetail.Rows[0]["GradeId"].ToString();
                modelSH_HW.ClassId       = modelAssign.UserGroup_Id;
                modelSH_HW.TeacherId     = modelAssign.HomeWork_AssignTeacher;
                modelSH_HW.HW_CreateTime = modelAssign.CreateTime;

                #endregion
                Rc.Common.SystemLog.SystemLog.AddLogFromBS(modelAssign.HomeWork_AssignTeacher, "", "布置作业(学校服务器):4开始写入数据123");
                if (new BLL_HomeWork().AddHomework(model, listSHomwWork, listSHomwWorkSubmit, listSHomwWorkCorrect, modelSH_HW))
                {
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS(modelAssign.HomeWork_AssignTeacher, "", "布置作业(学校服务器):4结束写入数据");
                    if (GenerateTestPaperFileForStudent(modelAssign.HomeWork_AssignTeacher, modelAssign.HomeWork_Id))
                    {
                        flag = true;
                    }
                    else
                    {
                        //RevokeHW 生成学生作业文件失败 撤销作业
                        new BLL_HomeWork().RevokeHW(model.HomeWork_Id);
                        Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(modelAssign.HomeWork_AssignTeacher, "", "布置作业失败(学校服务器):生成学生作业文件失败");
                    }
                }
                else
                {
                    //RevokeHW 写入数据失败 撤销作业
                    new BLL_HomeWork().RevokeHW(model.HomeWork_Id);
                    Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(modelAssign.HomeWork_AssignTeacher, "", "布置作业失败(学校服务器):写入数据失败");
                }
            }
            catch (Exception ex)
            {
                Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS("", "", "布置作业失败(学校服务器):" + ex.Message.ToString());
            }
            return(flag);
        }
コード例 #6
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                Model_HomeWork model = new Model_HomeWork();
                BLL_HomeWork   bll   = new BLL_HomeWork();

                #region 布置作业表
                string guid = HomeWork_Id;
                model          = bll.GetModel(guid);
                model.StopTime = Convert.ToDateTime(txtStopTime.Text);
                #endregion

                #region 学生作业表
                List <Model_Student_HomeWork>         listSHomwWork        = new List <Model_Student_HomeWork>();
                List <Model_Student_HomeWork_Submit>  listSHomwWorkSubmit  = new List <Model_Student_HomeWork_Submit>();
                List <Model_Student_HomeWork_Correct> listSHomwWorkCorrect = new List <Model_Student_HomeWork_Correct>();
                string strStudent = Rc.Cloud.Web.Common.pfunction.CheckImp(hidStudentId.Value);
                strStudent = strStudent.TrimEnd(',');
                string[] strArrStudent = strStudent.Split(',');
                for (int i = 0; i < strArrStudent.Length; i++)
                {
                    string ShwGuid = Guid.NewGuid().ToString();
                    Model_Student_HomeWork modelSHomeWork = new Model_Student_HomeWork();
                    modelSHomeWork.Student_HomeWork_Id = ShwGuid;
                    modelSHomeWork.HomeWork_Id         = guid;
                    modelSHomeWork.Student_Id          = strArrStudent[i];
                    modelSHomeWork.CreateTime          = DateTime.Now;
                    listSHomwWork.Add(modelSHomeWork);
                    #region 作业提交状态
                    Model_Student_HomeWork_Submit modelSHomeWorkSubmit = new Model_Student_HomeWork_Submit();
                    modelSHomeWorkSubmit.Student_HomeWork_Id     = ShwGuid;
                    modelSHomeWorkSubmit.Student_HomeWork_Status = 0;
                    listSHomwWorkSubmit.Add(modelSHomeWorkSubmit);
                    #endregion
                    #region 作业批改状态
                    Model_Student_HomeWork_Correct modelSHomeWorkCorrect = new Model_Student_HomeWork_Correct();
                    modelSHomeWorkCorrect.Student_HomeWork_Id            = ShwGuid;
                    modelSHomeWorkCorrect.Student_HomeWork_CorrectStatus = 0;
                    listSHomwWorkCorrect.Add(modelSHomeWorkCorrect);
                    #endregion
                }
                #endregion

                #region 统计帮助表
                DataTable         dtHWDetail = bll.GetHWDetail(HomeWork_Id).Tables[0];
                Model_StatsHelper modelSH_HW = new Model_StatsHelper();
                modelSH_HW.ResourceToResourceFolder_Id = model.ResourceToResourceFolder_Id;
                modelSH_HW.Homework_Id = model.HomeWork_Id;
                modelSH_HW.SchoolId    = dtHWDetail.Rows[0]["SchoolId"].ToString();
                modelSH_HW.GradeId     = dtHWDetail.Rows[0]["GradeId"].ToString();
                #endregion

                if (bll.UpdateHomework(model, listSHomwWork, listSHomwWorkSubmit, listSHomwWorkCorrect, modelSH_HW))
                {
                    string strJ = "layer.msg('布置作业成功',{time:1000,icon:1},function(){";
                    if (Request.QueryString["tp"] != "1")
                    {
                        strJ += "window.parent.loadData();";
                    }
                    else
                    {
                        strJ += "window.parent.location.reload();";
                    }
                    strJ += "parent.layer.close(parent.layer.getFrameIndex(window.name));});";
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", strJ, true);
                    Rc.Common.SystemLog.SystemLog.AddLogFromBS(FloginUser.UserId, "", "布置作业成功");
                }
                else
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业失败',{time:2000,icon:2});", true);
                    Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败");
                }
            }
            catch (Exception ex)
            {
                ClientScript.RegisterStartupScript(this.GetType(), "temp", "layer.msg('布置作业失败',{time:2000,icon:2});", true);
                Rc.Common.SystemLog.SystemLog.AddLogErrorFromBS(FloginUser.UserId, "", "布置作业失败:" + ex.Message.ToString());
            }
        }
コード例 #7
0
 public bool Update(Model_Student_HomeWork model)
 {
     return(this.dal.Update(model));
 }
コード例 #8
0
 public bool Add(Model_Student_HomeWork model)
 {
     return(this.dal.Add(model));
 }