private void ConvertToModel2(IDataReader reader, PracticalCourseEdit model)
 {
     if (reader["Id"] != DBNull.Value)
         model.Id = Convert.ToInt32(reader["Id"]);
     if (reader["Title"] != DBNull.Value)
         model.Title = reader["Title"].ToString();
     if (reader["TraingField"] != DBNull.Value)
         model.TraingField = Convert.ToInt32(reader["TraingField"]);
     if (reader["Content"] != DBNull.Value)
         model.Content = reader["Content"].ToString();
     if (reader["IsBatch"] != DBNull.Value)
         model.IsBatch = Convert.ToBoolean(reader["IsBatch"]);
     if (reader["OrganId"] != DBNull.Value)
         model.OrganId = Convert.ToInt32(reader["OrganId"]);
     if (reader["AccountId"] != DBNull.Value)
         model.AccountId = Convert.ToInt32(reader["AccountId"]);
     if (reader["PlanId"] != DBNull.Value)
         model.PlanId = Convert.ToInt32(reader["PlanId"]);
     if (reader["People"] != DBNull.Value)
         model.People = Convert.ToInt32(reader["People"]);
     if (reader["Display"] != DBNull.Value)
         model.Display = Convert.ToBoolean(reader["Display"]);
     if (reader["Delflag"] != DBNull.Value)
         model.Delflag = Convert.ToBoolean(reader["Delflag"]);
     if (reader["CreateDate"] != DBNull.Value)
         model.CreateDate = Convert.ToDateTime(reader["CreateDate"]);
     if (reader["TraingCategory"] != DBNull.Value)
         model.TraingCategory = Convert.ToInt32(reader["TraingCategory"]);
     if (reader["TraingTopic"] != DBNull.Value)
         model.TraingTopic = Convert.ToInt32(reader["TraingTopic"]);
     if (reader["RoleId"] != DBNull.Value)
         model.Role = Convert.ToInt32(reader["RoleId"]);
     if (reader["memberPCourseid"] != DBNull.Value)
         model.MemberPCourseid = Convert.ToInt32(reader["memberPCourseid"]);
     if (reader["NationalCoursId"] != DBNull.Value)
         model.NationalCoursId = Convert.ToInt32(reader["NationalCoursId"]);
     if (reader["Status"] != DBNull.Value)
         model.Status = Convert.ToInt32(reader["Status"]);
     if (reader["ApplyRemark"] != DBNull.Value)
         model.ApplyRemark = reader["ApplyRemark"].ToString();
 }
 public PracticalCourseEdit GetPracticeModel(int MemberPracticeId)
 {
     string sql = "select pcd.*,mpc.RoleId,mpc.Id as MemberPCourseid,mpc.Status,mpc.ApplyRemark from  Member_PracticalCourse mpc left join [PracticalCourse_Detail] pcd on mpc.PracticalCourseId=pcd.Id where mpc.Id=@Id";
     SqlParameter[] cmdParams = new SqlParameter[]{
         new SqlParameter("@Id", SqlDbType.Int, 4) { Value = MemberPracticeId }
     };
     using (IDataReader reader = MSEntLibSqlHelper.ExecuteDataReaderBySql(sql, cmdParams))
     {
         if (reader.Read())
         {
             PracticalCourseEdit model = new PracticalCourseEdit();
             ConvertToModel2(reader, model);
             return model;
         }
         else
         {
             return null;
         }
     }
 }
        public ActionResult PracticalCourseEditSingle(int? Type,int? memberPCourseid)
        {
            ViewBag.Type = Type;
            //小类
            Traning_CategoryBLL traning_CategoryBLL = new Traning_CategoryBLL();
            ViewBag.TraingCategoryList = traning_CategoryBLL.GetList(" Field=3 and Delflag='false'  and Display='true'", " Sort");
            //初始化model
            PracticalCourse_DetailBLL pcBLL = new PracticalCourse_DetailBLL();
            PracticalCourseEdit data = new PracticalCourseEdit();
            PracticalCourse_AttachmentBLL practicalCourse_AttachmentBLL = new PracticalCourse_AttachmentBLL();
            if (memberPCourseid != null && memberPCourseid > 0)
            {
                ViewBag.Group = Code.SiteCache.Instance.GroupId;
                ViewBag.Title = "修改实践记录";
                data = pcBLL.GetPracticeModel((int)memberPCourseid);
                ViewBag.AttachData = practicalCourse_AttachmentBLL.GetTable("Delflag=0 and Display=1 and PracticalCourseId=" + data.Id, "");
            }

            //Member_PracticalCourseApplicationBLL member_PracticalCourseApplicationBLL = new Member_PracticalCourseApplicationBLL();
            //List<Member_PracticalCourseApplication> mPcaList = member_PracticalCourseApplicationBLL.GetList("Delflag='false' and FlowId='" + memberPCourseid + "'", "CreateDate");
            //ViewBag.mPcaList = mPcaList;

            return View(data);
        }
 public ActionResult PracticalCourseVerifyPage(int memberPCourseid)
 {
     ViewBag.Title = "实践审核";
     //小类
     Traning_CategoryBLL traning_CategoryBLL = new Traning_CategoryBLL();
     ViewBag.TraingCategoryList = traning_CategoryBLL.GetList(" Field=3 and Delflag='false'  and Display='true'", " Sort");
     //初始化model
     PracticalCourse_DetailBLL pcBLL = new PracticalCourse_DetailBLL();
     PracticalCourseEdit data = new PracticalCourseEdit();
     PracticalCourse_AttachmentBLL practicalCourse_AttachmentBLL = new PracticalCourse_AttachmentBLL();
     if ( memberPCourseid > 0)
     {
         ViewBag.Title = "实践审核";
         data = pcBLL.GetPracticeModel((int)memberPCourseid);
         ViewBag.AttachData = practicalCourse_AttachmentBLL.GetTable("Delflag=0 and Display=1 and PracticalCourseId=" + data.Id, "");
     }
     else
     {
         return RedirectToAction("PracticalCourseList", "PracticalCourse", new { area = "Practice" });
     }
     return View(data);
 }
 public ActionResult PracticalCourseAddSingle(int? memberPCourseid)
 {
     //小类
     Traning_CategoryBLL traning_CategoryBLL = new Traning_CategoryBLL();
     ViewBag.TraingCategoryList = traning_CategoryBLL.GetList(" Field=3 and Delflag='false'  and Display='true'", " Sort");
     //初始化model
     PracticalCourse_DetailBLL pcBLL = new PracticalCourse_DetailBLL();
     PracticalCourseEdit data = new PracticalCourseEdit();
     PracticalCourse_AttachmentBLL practicalCourse_AttachmentBLL = new PracticalCourse_AttachmentBLL();
     if (memberPCourseid != null && memberPCourseid > 0)
     {
         ViewBag.Type = "update";
         ViewBag.Title = "修改实践记录";
         data = pcBLL.GetPracticeModel((int)memberPCourseid);
         ViewBag.AttachData = practicalCourse_AttachmentBLL.GetTable("Delflag=0 and Display=1 and PracticalCourseId=" + data.Id, "");
     }
     else
     {
         ViewBag.Type = "insert";
         ViewBag.Title = "新增实践记录";
         ViewBag.AttachData = null;
     }
     return View(data);
 }