예제 #1
0
        public ActionResult AddTeaGroup()
        {
            TeaGroupDal tgdal   = new TeaGroupDal();
            string      depname = Request["dep"];
            string      tgname  = Request["tgname"];

            if (string.IsNullOrEmpty(tgname))
            {
                Response.Write("小组名不能为空");
                Response.End();
                return(null);
            }
            IQueryable <TeaGroup> iq = tgdal.GetEntities(u => u.TG_Name == tgname);

            if (iq.Count() > 0)
            {
                Response.Write("小组已存在不能重复添加");
                Response.End();
                return(null);
            }
            DepartmentService depser = new DepartmentService();
            Department        dep    = depser.GetDepartmentByName(depname);
            TeaGroup          tg     = new TeaGroup();

            tg.TG_Name    = tgname;
            tg.Department = dep;
            TeaGroupService tgser = new TeaGroupService();

            tgser.Add(tg);
            Response.Write("添加成功");
            Response.End();
            return(null);
        }
예제 #2
0
        public ActionResult DeleteTg()
        {
            TeaGroupService tgser = new TeaGroupService();
            int             tgid  = Convert.ToInt32(Request["tgid"]);

            tgser.DeleteTg(tgid);
            Response.Write("删除成功");
            Response.End();
            return(null);
        }
예제 #3
0
        public ActionResult GetTeaListByTgId()
        {
            TeaGroupService      tgser  = new TeaGroupService();
            TeacherDal           teadal = new TeacherDal();
            int                  tgid   = Convert.ToInt32(Request["tgid"]);
            TeaGroup             tg     = tgser.GetTeaGroupById(tgid);
            string               str    = tg.TG_Name + "-";
            IQueryable <Teacher> teaiq  = teadal.GetEntities(u => u.TeaGroup == tg);

            foreach (var item in teaiq)
            {
                str = str + item.Tea_Name + "-";
            }
            Response.Write(str);
            Response.End();
            return(null);
        }