public ActionResult CreatePracticalCourse(string Title, string TraingField, string CreatetraingCategory, string CreatetraingTopic, string Content, string Members, string Roles, string AttachPathList, string createtraingNation)
        {
            try
            {
                string[] sMembers = Members.Trim(',').Split(',');
                string[] sRoles = Roles.Trim(',').Split(',');
                PracticalCourse_Detail pCourseModel = new PracticalCourse_Detail();
                pCourseModel.Title = Title;
                pCourseModel.TraingField = TraingField.ToInt();
                pCourseModel.TraingCategory = CreatetraingCategory.ToInt();
                pCourseModel.TraingTopic = CreatetraingTopic.ToInt();
                pCourseModel.Content = Content;
                pCourseModel.IsBatch = true;
                pCourseModel.OrganId = Code.SiteCache.Instance.OrganId;
                pCourseModel.PlanId = Code.SiteCache.Instance.PlanId;
                pCourseModel.People = sMembers.Length;
                pCourseModel.Display = true;
                pCourseModel.Delflag = false;
                pCourseModel.CreateDate = DateTime.Now;
                pCourseModel.NationalCoursId = Convert.ToInt32(createtraingNation);
                PracticalCourse_DetailBLL practicalCourse_DetailBLL = new PracticalCourse_DetailBLL();

                //实践课程
                int PracticalCourseId = practicalCourse_DetailBLL.Add(pCourseModel);

                PracticalCourse_AttachmentBLL practicalCourse_AttachmentBLL = new PracticalCourse_AttachmentBLL();
                if (!string.IsNullOrEmpty(AttachPathList))
                {
                    DataTable dt = practicalCourse_AttachmentBLL.GetTable("1=0", "");
                    foreach (string s in AttachPathList.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        DataRow row = dt.NewRow();
                        string[] file = s.Split('|');
                        row["Id"] = file[0];
                        row["PracticalCourseId"] = pCourseModel.Id;
                        row["Title"] = file[1].Replace("'", "''");
                        row["Link"] = file[2];
                        row["Sort"] = 50;
                        row["Display"] = 1;
                        row["Delflag"] = 0;
                        row["CreateDate"] = DateTime.Now;
                        dt.Rows.Add(row);
                    }
                    //实践课程附件表
                    practicalCourse_AttachmentBLL.BatchAttach(dt);
                }

                for (int i = 0; i < sMembers.Length; i++)
                {

                    Member_PracticalCourseBLL member_PracticalCourseBLL = new Member_PracticalCourseBLL();
                    Member_PracticalCourse memPCourseModel = new Member_PracticalCourse();
                    Member_PracticalCourseApplication mpcamodel = new Member_PracticalCourseApplication();
                    memPCourseModel.PracticalCourseId = PracticalCourseId;
                    memPCourseModel.AccountId = Convert.ToInt32(sMembers[i]);
                    memPCourseModel.OrganId = Code.SiteCache.Instance.OrganId;
                    memPCourseModel.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                    memPCourseModel.Status = 2;
                    memPCourseModel.RoleId = Convert.ToInt32(sRoles[i]);
                    memPCourseModel.Delflag = false;
                    memPCourseModel.CreateDate = DateTime.Now;
                    //用户实践课程申请表
                    mpcamodel.FlowId = member_PracticalCourseBLL.Add(memPCourseModel);
                    mpcamodel.Status = 2;
                    mpcamodel.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                    mpcamodel.AccountId = Convert.ToInt32(sMembers[i]);
                    mpcamodel.CreateDate = DateTime.Now;
                    mpcamodel.Delflag = false;
                    if (mpcamodel.FlowId > 0)
                    {
                        Member_PracticalCourseApplicationBLL member_PracticalCourseApplicationBLL = new Member_PracticalCourseApplicationBLL();
                        //用户实践课程流程表
                        member_PracticalCourseApplicationBLL.Add(mpcamodel);
                    }
                    //用户培训计划课程大类学时表
                    Member_TrainingReditBLL member_TrainingReditBLL = new Member_TrainingReditBLL();
                    List<Member_TrainingRedit> Listmember_TrainingRedit = new List<Member_TrainingRedit>();
                    Listmember_TrainingRedit = member_TrainingReditBLL.GetList(" TrainingField=3 and Delflag='false' and PlanId='" + Code.SiteCache.Instance.PlanId + "' and AccountId='" + Convert.ToInt32(sMembers[i]) + "' ", "");
                    if (Listmember_TrainingRedit == null || Listmember_TrainingRedit.Count == 0)
                    {
                        Member_TrainingRedit member_TrainingRedit = new Member_TrainingRedit();
                        member_TrainingRedit.TrainingField = 3;
                        member_TrainingRedit.PlanId = Code.SiteCache.Instance.PlanId;
                        member_TrainingRedit.AccountId = Convert.ToInt32(sMembers[i]);
                        PracticalCourse_RoleCreditsBLL practicalCourse_RoleCreditsBLL = new PracticalCourse_RoleCreditsBLL();
                        member_TrainingRedit.Credits = practicalCourse_RoleCreditsBLL.GetList(" TraingField=3 and TraingCategory='" + CreatetraingCategory.ToInt() + "' and TraingTopic='" + CreatetraingTopic.ToInt() + "' and RoleId='" + Convert.ToInt32(sRoles[i]) + "'", "")[0].Credits;
                        member_TrainingRedit.Delflag = false;
                        member_TrainingRedit.CreateDate = DateTime.Now;
                        member_TrainingReditBLL.Add(member_TrainingRedit);
                    }
                    else
                    {
                        Member_TrainingRedit member_TrainingRedit = Listmember_TrainingRedit[0];
                        PracticalCourse_RoleCreditsBLL practicalCourse_RoleCreditsBLL = new PracticalCourse_RoleCreditsBLL();
                        member_TrainingRedit.Credits += practicalCourse_RoleCreditsBLL.GetList(" TraingField=3 and TraingCategory='" + CreatetraingCategory.ToInt() + "' and TraingTopic='" + CreatetraingTopic.ToInt() + "' and RoleId='" + Convert.ToInt32(sRoles[i]) + "'", "")[0].Credits;
                        member_TrainingReditBLL.Update(member_TrainingRedit);
                    }

                }
                TempData["Msg"] = "提交成功!";
                return RedirectToAction("PracticalCourseList");
            }
            catch (Exception ex)
            {
                TempData["Msg"] = "提交失败!";
                return RedirectToAction("PracticalCourseList");
            }
        }
        public ActionResult CreatePracticalCourseSingle(string Title, string TraingField, string CreatetraingCategory, string CreatetraingTopic, string Content, string createroleList, string AttachPathList, string createtraingNation)
        {
            try
            {
                PracticalCourse_Detail pCourseModel = new PracticalCourse_Detail();
                pCourseModel.Title = Server.UrlDecode(Title);
                pCourseModel.TraingField = TraingField.ToInt();
                pCourseModel.TraingCategory = CreatetraingCategory.ToInt();
                pCourseModel.TraingTopic = CreatetraingTopic.ToInt();
                pCourseModel.Content = Content;
                int length = Content.Length;
                pCourseModel.IsBatch = false;
                pCourseModel.OrganId = Code.SiteCache.Instance.OrganId;
                pCourseModel.AccountId = Code.SiteCache.Instance.LoginInfo.UserId;
                pCourseModel.PlanId = Code.SiteCache.Instance.PlanId;
                pCourseModel.People = 1;
                pCourseModel.Display = true;
                pCourseModel.Delflag = false;
                pCourseModel.CreateDate = DateTime.Now;
                pCourseModel.NationalCoursId = Convert.ToInt32(createtraingNation);
                PracticalCourse_DetailBLL practicalCourse_DetailBLL = new PracticalCourse_DetailBLL();

                Member_PracticalCourseBLL member_PracticalCourseBLL = new Member_PracticalCourseBLL();
                Member_PracticalCourse memPCourseModel = new Member_PracticalCourse();
                Member_PracticalCourseApplication mpcamodel = new Member_PracticalCourseApplication();
                //实践课程
                memPCourseModel.PracticalCourseId = practicalCourse_DetailBLL.Add(pCourseModel);

                PracticalCourse_AttachmentBLL practicalCourse_AttachmentBLL = new PracticalCourse_AttachmentBLL();
                if (!string.IsNullOrEmpty(AttachPathList))
                {
                    DataTable dt = practicalCourse_AttachmentBLL.GetTable("1=0", "");
                    foreach (string s in AttachPathList.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries))
                    {
                        DataRow row = dt.NewRow();
                        string[] file = s.Split('|');
                        row["Id"] = file[0];
                        row["PracticalCourseId"] = pCourseModel.Id;
                        row["Title"] = file[1];
                        row["Link"] = file[2];
                        row["Sort"] = 50;
                        row["Display"] = 1;
                        row["Delflag"] = 0;
                        row["CreateDate"] = DateTime.Now;
                        dt.Rows.Add(row);
                    }
                    //实践课程附件表
                    practicalCourse_AttachmentBLL.BatchAttach(dt);
                }

                memPCourseModel.AccountId = Code.SiteCache.Instance.LoginInfo.UserId;
                memPCourseModel.OrganId = Code.SiteCache.Instance.OrganId;
                memPCourseModel.Status = 1;
                memPCourseModel.RoleId = Convert.ToInt32(createroleList);
                memPCourseModel.Delflag = false;
                memPCourseModel.CreateDate = DateTime.Now;
                //用户实践课程申请表
                mpcamodel.FlowId = member_PracticalCourseBLL.Add(memPCourseModel);
                mpcamodel.Status = 1;
                mpcamodel.Creater = Code.SiteCache.Instance.LoginInfo.UserId;
                mpcamodel.AccountId = Code.SiteCache.Instance.LoginInfo.UserId;
                mpcamodel.CreateDate = DateTime.Now;
                mpcamodel.Delflag = false;
                if (mpcamodel.FlowId > 0)
                {
                    Member_PracticalCourseApplicationBLL member_PracticalCourseApplicationBLL = new Member_PracticalCourseApplicationBLL();
                    //用户实践课程流程表
                    member_PracticalCourseApplicationBLL.Add(mpcamodel);
                }
                TempData["Msg"] = "提交成功!";
                return RedirectToAction("../../Learn/MyPractice/List");
            }
            catch (Exception)
            {
                TempData["Msg"] = "提交失败!";
                return RedirectToAction("../../Learn/MyPractice/List");
            }
        }