• 在同一个数据库表中添加不同的数据(笛卡尔积)


           /// <summary>
            /// 添加检测项目
            /// </summary>
            private void PbitemCodeSubmit()
            {
                string msg = "0";
                string[] oldPBItems = Request.Form["ipt_pbitemcode"].Split(',');
                string strWhere = string.Format("BioTestPlanHeaderID={0}", Request.Form["ipt_biotestplanheaderid"]);
                List<Model.BioTestPlanBody> bioTestPlanBodyModelList = bioTestPlanBodyBll.GetModelList(strWhere);//根据检测计划ID查询学生检测信息
                strWhere = string.Format("BioTestPlanHeaderID={0}", Request.Form["ipt_biotestplanheaderid"]);
                DataSet dsPBItem = dhBll.GetList("V_PBItemOfBioTestPlanBody", "*", "", strWhere);
                strWhere = string.Format("BioTestPlanHeaderID={0}", Request.Form["ipt_biotestplanheaderid"]);
                DataSet dsAthlete = dhBll.GetList("V_AthleteStudentBYBioTestPlanBody", "*", "", strWhere);
                List<string> newPBItemList = oldPBItems.ToList<string>();
                foreach (DataRow itemRow in dsPBItem.Tables[0].Rows)
                {
                    if (!newPBItemList.Contains(itemRow["PBItemCode"].ToString()))
                    {
                        newPBItemList.Add(itemRow["PBItemCode"].ToString());
                        break;
                    }
                }
                if (dsAthlete.Tables[0].Rows.Count > 0)
                {
                    for (int num = 0; num < newPBItemList.Count; num++)
                    {
                        foreach (DataRow itemRow in dsAthlete.Tables[0].Rows)
                        {
                            Model.BioTestPlanBody bioTestPlanModel = new Model.BioTestPlanBody();
                            bioTestPlanModel.BioTestPlanHeaderID = Convert.ToInt32(Request.Form["ipt_biotestplanheaderid"]);
                            bioTestPlanModel.AthleteStudentID = Convert.ToInt32(itemRow["AthleteStudentID"].ToString());
                            bioTestPlanModel.PBItemCode = newPBItemList[num];
                            bioTestPlanBodyBll.Add(bioTestPlanModel);
                        }
                    }
                }
                else
                {
                    for (int num = 0; num < newPBItemList.Count; num++)
                    {
                        Model.BioTestPlanBody bioTestPlanModel = new Model.BioTestPlanBody();
                        bioTestPlanModel.BioTestPlanHeaderID = Convert.ToInt32(Request.Form["ipt_biotestplanheaderid"]);
                        bioTestPlanModel.PBItemCode = newPBItemList[num];
                        bioTestPlanBodyBll.Add(bioTestPlanModel);
                    }
                }
                foreach (Model.BioTestPlanBody itemModel in bioTestPlanBodyModelList)
                {
                    bioTestPlanBodyBll.Delete(itemModel.BioTestPlanBodyID);
                }
                WebCommon.WriteMsg(msg);
            }

  • 相关阅读:
    TeamWork#3,Week5,Introduction to the "take-away" Sale Selection Project
    TeamWork#3,Week5,The First Meeting of Our Team
    TeamWork#2,Week 5,Our Measurement of Contribution to the Team
    TeamWork#1,Week 5,Suggestions for Team Project
    TeamWork#2,Week 2,We are sixsix!
    TeamWork#1,Week 2,Learn In Team
    必应词典手机版(IOS版)与有道词典(IOS版)之软件分析【功能篇】【用户体验篇】
    Daily Scrum1 11.3
    团队项目之分工
    团队项目之开题scrum meeting
  • 原文地址:https://www.cnblogs.com/IT1517/p/4956045.html
Copyright © 2020-2023  润新知