Exemplo n.º 1
0
        public int AddStuClass1(int ID, int BjID)
        {
            XueShengBiao xs = context.Set <XueShengBiao>().Where(p => p.ID == ID).OrderByDescending(p => p.ID).First();
            BanJiBiao    bj = context.Set <BanJiBiao>().Where(p => p.ID == BjID).First();

            return(GetXsBj1(xs, bj));
        }
Exemplo n.º 2
0
        //
        ////新增学生与班级关联表
        #region 增加关联表 学生-班级
        public int AddStuClass()
        {
            XueShengBiao xs = context.Set <XueShengBiao>().OrderByDescending(p => p.ID).First();
            BanJiBiao    bj = context.Set <BanJiBiao>().Where(p => p.ID == xs.StudentClassID).First();

            return(GetXsBj(xs, bj));
        }
Exemplo n.º 3
0
        //增加学生时,判断是否增加班级
        #region 班级人数查询
        public BjRenShu GetRenShu()
        {
            BjRenShu         br     = new BjRenShu();
            List <BanJiBiao> bjList = context1.Set <BanJiBiao>().ToList();

            if (bjList.Count() > 0)
            {
                int i = this.jd(1).ID;
                List <BanJiBiao> List = context1.Set <BanJiBiao>().Where(p => p.JieDuanID == i).OrderByDescending(p => p.ID).ToList();
                if (List.Count() > 0)
                {
                    BanJiBiao bj = context1.Set <BanJiBiao>().Where(p => p.JieDuanID == 1).OrderByDescending(p => p.ID).First();
                    if (bj.JieDuanID == 1)
                    {
                        List <SqlParameter> spls1 = new List <SqlParameter>();
                        string       sql          = " select * From XueShengBiao A,BanJiBiao B where A.StudentClassID = B.ID and B.JieDuanID = 1 and  A.StudentClassID = @ID ";
                        SqlParameter p1           = new SqlParameter("@ID", bj.ID);
                        spls1.Add(p1);
                        List <XueShengBiao> xs1 = context1.Database.SqlQuery <XueShengBiao>(sql, spls1.ToArray()).ToList();
                        br.BanJiMing   = bj.BanJiMing;
                        br.banjirenshu = xs1.Count();
                    }
                }
            }
            return(br);
        }
Exemplo n.º 4
0
        public ActionResult BjEdit(int ID)
        {
            BanJiBiao nj = bjb.JieDuan(ID);

            ViewBag.Name   = nj.BanJiMing;
            ViewBag.ID     = nj.ID;
            ViewBag.BeiZhu = nj.BeiZhu;
            return(View());
        }
Exemplo n.º 5
0
        //升阶段时:班级与学生表的新增
        #region 升阶段时:班级与学生表的新增
        public int AddUP()
        {
            BanJiBiao           bj     = mbll.Getfrist();
            List <XueShengBiao> xsList = mbll.getXueS(bj.ID);

            for (int i = 0; i < xsList.Count(); i++)
            {
                xsDAL.GetXsBj(xsList[i], bj);
            }
            return(1);
        }
Exemplo n.º 6
0
        //升阶段时修改学生表的班级ID 1.正在学习  2.已毕业  3.已退学
        #region 修改班级ID 修改学生表的班级ID
        public int UpdateStu(int BanJiID, BanJiBiao bj)
        {
            List <SqlParameter> spls1 = new List <SqlParameter>();
            string       sql1         = "Update XueShengBiao Set StudentClassID = @ID where StudentClassID = @BJID  and ZhuangTai = 1 ";
            SqlParameter p1           = new SqlParameter("@ID", bj.ID);
            SqlParameter p2           = new SqlParameter("@BJID", BanJiID);

            spls1.Add(p1);
            spls1.Add(p2);
            return(context1.Database.ExecuteSqlCommand(sql1, spls1.ToArray()));
        }
Exemplo n.º 7
0
        //增加学生时,查询班级id
        #region 返回班级ID
        public int GetOneID(string BanJiMing)
        {
            string sql = "select * From BanJiBiao where BanJiMing = @banjiming";
            List <SqlParameter> spls = new List <SqlParameter>();
            SqlParameter        p    = new SqlParameter("@banjiming", BanJiMing);

            spls.Add(p);
            BanJiBiao stuList = context1.Database.SqlQuery <BanJiBiao>(sql, spls.ToArray()).First();

            return(stuList.ID);
        }
Exemplo n.º 8
0
        //增加学生,删除学生时,班级人数的变动
        #region 2修改班级人数
        public int Update1(BanJiBiao bj)
        {
            string sql = "update BanJiBiao Set BanJiRenShu = @rs where ID = @id";
            List <SqlParameter> spls = new List <SqlParameter>();
            SqlParameter        p1   = new SqlParameter("@rs", bj.BanJiRenShu);
            SqlParameter        p2   = new SqlParameter("@id", bj.ID);

            spls.Add(p1);
            spls.Add(p2);
            int n = context1.Database.ExecuteSqlCommand(sql, spls.ToArray());

            return(n);
        }
Exemplo n.º 9
0
        public int biao(string banji, string beizhu, int Renshu, int jieDuan)
        {
            BanJiBiao bj = new BanJiBiao();

            bj.BanJiMing         = banji;
            bj.BanJiRenShu       = Renshu;
            bj.KaiBanShiJian     = DateTime.Now;
            bj.BeiZhu            = beizhu;
            bj.YuJiJieShuShiJian = DateTime.Parse(GetTime1());
            bj.BanJiZhuangTai    = 1;
            bj.JieDuanID         = jieDuan;
            bj.JiaoXuePlan       = false;
            return(AddBanJi1(bj));
        }
Exemplo n.º 10
0
        public int UpdateNum(XueShengBiao st, int i)
        {
            BanJiBiao bj = context1.Set <BanJiBiao>().Find(st.StudentClassID);

            if (i == 1)
            {
                bj.BanJiRenShu = bj.BanJiRenShu - 1;
            }
            else
            {
                bj.BanJiRenShu = bj.BanJiRenShu + 1;
            }
            return(Update1(bj));
        }
Exemplo n.º 11
0
        public int GetXsBj1(XueShengBiao xs, BanJiBiao bj)
        {
            XueShengYuBanJiDuiYingBiao xb = new XueShengYuBanJiDuiYingBiao
            {
                StudentID      = xs.ID,
                StudentName    = xs.StudentName,
                StudentClassID = bj.ID,
                StudentClass   = bj.BanJiMing,
                StartTiem      = bj.KaiBanShiJian
            };

            context.XueShengYuBanJiDuiYingBiao.Add(xb);
            return(context.SaveChanges());
        }
        public BanJiBanZhuRen GetBjBzrOne(int BjID)
        {
            BanZhuRenSuoDaiBanJiBiao xsb = context.Set <BanZhuRenSuoDaiBanJiBiao>().Find(BjID);
            YuanGongBiao             yg  = context.Set <YuanGongBiao>().Find(xsb.BanZhuRenBianHao);
            BanJiBiao      bjb           = context.Set <BanJiBiao>().Find(xsb.BanJiBianHao);
            BanJiBanZhuRen bz            = new BanJiBanZhuRen();

            bz.BanZhuRenMing    = yg.Name;
            bz.BanJiBeiZhu      = bjb.BeiZhu;
            bz.BanJiBianHao     = bjb.ID;
            bz.BanJiMing        = bjb.BanJiMing;
            bz.BanZhuRenBianHao = Convert.ToInt32(xsb.BanZhuRenBianHao);
            bz.BanZhuRenDaiID   = xsb.ID;
            bz.BeiZhu           = xsb.BeiZhu;
            return(bz);
        }
Exemplo n.º 13
0
 public string GetGradeID(string strData, int jd, int BanJiID)
 {
     if (jd == 2)
     {
         BanJiBiao bj = mbll.YjDate(BanJiID);
         return(bj.BanJiMing);
     }
     else if (jd == 3)
     {
         return(mbll.GetGradeID("Java"));
     }
     else if (jd == 4)
     {
         return(mbll.GetGradeID("IT"));
     }
     return(null);
 }
Exemplo n.º 14
0
        public ActionResult SoY(int ID)
        {
            int       BanJiID = ID;
            BanJiBiao nj      = bjb.JieDuan(BanJiID);
            int       id      = bjb.jd(-1).ID;

            if (nj.JieDuanID < id && nj.JieDuanID > 0)
            {
                string BanJiMing = null;
                string strdate   = DateTime.Now.ToString("yyyy");
                BanJiMing    = bjb.GetGradeID(strdate, bjb.njID1(Convert.ToInt32(nj.JieDuanID)), BanJiID);
                ViewBag.Name = BanJiMing;
                ViewBag.ID   = BanJiID;
                return(View());
            }
            int n = bjb.BiYe(BanJiID);

            return(Json(new { errorNo = "0", errorInfo = "毕业成功" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 15
0
        public Student GetOneInfo(object XID)
        {
            XueShengBiao xsb = context.Set <XueShengBiao>().Find(XID);
            BanJiBiao    bjb = context.Set <BanJiBiao>().Find(xsb.StudentClassID);
            Student      st  = new Student
            {
                XID            = xsb.ID,
                StudentName    = xsb.StudentName,
                Address        = xsb.Address,
                Age            = xsb.Age,
                BanJiMing      = bjb.BanJiMing,
                HomePhone      = xsb.HomePhone,
                Phone          = xsb.Phone,
                Sex            = xsb.Sex,
                StudentClassID = xsb.StudentClassID,
                JieDuanID      = Convert.ToInt32(bjb.JieDuanID)
            };

            return(st);
        }
Exemplo n.º 16
0
        public ActionResult ShengJieDuanAction(BanJiBanZhuRen bb)
        {
            BanJiBiao bj1       = bjb.JieDuan(bb.BanJiBianHao);
            int       jieduanID = Convert.ToInt32(bj1.JieDuanID) + 1;
            int       RenShu    = Convert.ToInt32(bj1.BanJiRenShu);
            //新增升阶段后班级
            int n = bjb.biao(bb.BanJiMing, bb.BanJiBeiZhu, RenShu, jieduanID);

            //修改学生的班级ID
            bjb.UpdateStu(bb.BanJiBianHao);
            //修改原班级状态
            bjb.UpdateZT(bb.BanJiBianHao);
            //新增学生与班级关联表
            bjb.AddUP();
            if (n > 0)
            {
                return(Json(new { errorNo = "0", errorInfo = "执行成功" }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { errorNo = "1", errorInfo = "执行失败" }, JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 17
0
        //获取最新班级信息
        #region 获取最新班级信息
        public BanJiBiao Getfrist()
        {
            BanJiBiao bj1 = context1.Set <BanJiBiao>().OrderByDescending(p => p.ID).First();

            return(bj1);
        }
Exemplo n.º 18
0
 public int AddBanJi1(BanJiBiao bj)
 {
     context1.BanJiBiao.Add(bj);
     return(context1.SaveChanges());
 }
Exemplo n.º 19
0
        public int UpdateStu(int BanJiID)
        {
            BanJiBiao bj = mbll.Getfrist();

            return(mbll.UpdateStu(BanJiID, bj));
        }
Exemplo n.º 20
0
        public BanJiBiao JieDuan(int BanJiID)
        {
            BanJiBiao bj = mbll.YjDate(BanJiID);

            return(bj);
        }
Exemplo n.º 21
0
        /// <summary>
        ///  业务过程:1)根据班级查询班主任带班表 2)如果存在,说明该表已有班主任
        ///  3)修改班主任结束时间为当前时间  4)该表增加一条新数据  5)修改班级课程分配表中,Cot课程中没有()
        ///  开展的为新班主任,已开展的课程班主任信息不要改
        /// </summary>
        /// <param name="bjId">班级Id</param>
        /// <param name="bjzId">班主任ID</param>
        /// <returns></returns>
        public bool BzrFpBJ(int bjId, int bjzId)
        {
            bool             f     = false;
            TransactionScope trans = null;

            using (trans = new TransactionScope())
            {
                try
                {
                    YuanGongBiao bzrObj = YuanGongBiao.GetOneData(bjzId);
                    BanJiBiao    bjObj  = bjbDAL.GetOneData(bjId);//班级对象
                    //////////1 步骤1//////////////
                    var aa = bzrsdbjbDAL.GetAllData().Where(p => p.BanJiBianHao == bjId);
                    if (aa.Count() > 0)                       //班级已有班主任
                    {
                        var LastObj = aa.Last();              //最后一条
                        LastObj.JieShuShiJian = DateTime.Now; //结束时间为当前时间
                        LastObj.BeiZhu        = "中间换班主任";
                        bzrsdbjbDAL.Modify(LastObj);          //修改下写回
                        bzrsdbjbDAL.Save();
                    }
                    int an = aa.Count();
                    ///////////////////////
                    BanZhuRenSuoDaiBanJiBiao bzrsdbjb = new BanZhuRenSuoDaiBanJiBiao
                    {
                        BanJiBianHao        = bjId,
                        KaiShiDaiBanShiJian = DateTime.Now,
                        BanZhuRenBianHao    = bjzId,
                        BeiZhu = an > 0 ? "班级换班主任" : "新开班安排班主任"
                    };
                    bzrsdbjbDAL.Add(bzrsdbjb);//调用增加
                    bzrsdbjbDAL.Save();
                    ////////////////////////////////////

                    var Class = bjkskcjhb.GetAllData().Where(p => p.BanJiID == bjId).First();
                    var KC    = jxkcDAL.GetAllData().Where(p => p.ID == Class.KeChengMing.Value).First();

                    var KCc = bjkskcjhb.GetAllData().Where(p => p.KeChengMing.Value == KC.ID && p.BanJiID == bjId).ToList();
                    //循环修改
                    foreach (var gobj in KCc)
                    {
                        if (gobj.BeiZhu != "")
                        {
                            gobj.BeiZhu = "由班主任" + gobj.AnPaiJiaoYuan + "替换为" + bjzId + "";
                        }
                        gobj.AnPaiJiaoYuan = bjzId;
                        gobj.AnPaiShiJian  = DateTime.Now;
                        bjkskcjhb.Modify(gobj);
                        bjkskcjhb.Save();
                    }
                    ;
                    trans.Complete();//提交事务
                    f = true;
                }
                catch (Exception ex)
                {
                    trans.Dispose();//回溯事务
                }
            }
            return(f);
        }