コード例 #1
0
        private List <Bulletin> GetBulletin()
        {
            List <Bulletin>   bulletinList = new List <Bulletin>();
            Bulletin          bulletin1    = new Bulletin(1, "1", "", Convert.ToDateTime("2009-1-1")); //dept1212
            Bulletin          bulletin2    = new Bulletin(2, "2", "", Convert.ToDateTime("2009-1-2")); //dept1211
            Bulletin          bulletin3    = new Bulletin(3, "3", "", Convert.ToDateTime("2009-2-1")); //dept121
            Bulletin          bulletin4    = new Bulletin(4, "4", "", Convert.ToDateTime("2009-1-5")); //dept12
            Bulletin          bulletin5    = new Bulletin(5, "5", "", Convert.ToDateTime("2009-3-1")); //dept11
            Bulletin          bulletin6    = new Bulletin(6, "6", "", Convert.ToDateTime("2009-1-6")); //dept1
            List <Department> actualList   = BllInstance.DepartmentBllInstance.GetAllDepartment();

            foreach (Department department in actualList)
            {
                if (department.Name == "dept1212")
                {
                    bulletin1.Dept = department;
                }
                else if (department.Name == "dept1211")
                {
                    bulletin2.Dept = department;
                }
                else if (department.Name == "dept121")
                {
                    bulletin3.Dept = department;
                }
                else if (department.Name == "dept12")
                {
                    bulletin4.Dept = department;
                }
                else if (department.Name == "dept11")
                {
                    bulletin5.Dept = department;
                }
                else if (department.Name == "dept1")
                {
                    bulletin6.Dept = department;
                }
            }
            bulletinList.Add(bulletin1);
            bulletinList.Add(bulletin2);
            bulletinList.Add(bulletin3);
            bulletinList.Add(bulletin4);
            bulletinList.Add(bulletin5);
            bulletinList.Add(bulletin6);
            foreach (Bulletin bulletin in bulletinList)
            {
                _BulletinBll.CreateBulletin(bulletin, null);
            }
            return(bulletinList);
        }
コード例 #2
0
 public void btnOKClick(object sender, EventArgs e)
 {
     _View.ErrorMessageFromBll = "";
     if (!Valid())
     {
         return;
     }
     try
     {
         Bulletin bulletin = new Bulletin(0, _View.Title, _View.Content, _PublishTime);
         bulletin.Dept         = new Department(_View.DepartmentId, "");
         bulletin.AppendixList = _View.AppendixList;
         _IBulletinBll.CreateBulletin(bulletin, LoginUser);
         _AddBulletinCompleteEvent(this, EventArgs.Empty);
     }
     catch (ApplicationException ex)
     {
         _View.ErrorMessageFromBll = ex.Message;
     }
 }