예제 #1
0
        public ActionResult Create(Bemp_GongGao bemp_gonggao)
        {
            if (ModelState.IsValid)
            {
                db.Bemp_GongGaos.Add(bemp_gonggao);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.UserId = new SelectList(db.BEmplyees, "EmpID", "NumberEmp", bemp_gonggao.UserId);
            ViewBag.GongGaoId = new SelectList(db.Tender_GongGaos, "TaskID", "SN", bemp_gonggao.GongGaoId);
            return View(bemp_gonggao);
        }
예제 #2
0
        public ActionResult TenderRequest(int id=0)
        {
            //************* 添加  验证  已不能审核 时间超等****
            Tender_GongGao tender_gonggao = db.Tender_GongGaos.Include("Bemp_GongGaos.bemplyees").Single(m => m.TaskID == id);
            //if (tender_gonggao != null && tender_gonggao.Bemp_GongGaos.Count > 0)
            //{
            //    //if (tender_gonggao.Bemp_GongGaos.Contains(db.Bemp_GongGaos.Single(m => m.bemplyees.NumberEmp == User.Identity.Name&&m.GongGaoId==id)))
            //    //{
            //    //    return Content("请不要重复申请");
            //    //}
            if(tender_gonggao.IsShenhe!=null&&tender_gonggao.IsShenhe==true)
            {
                return Content("投标申请已结束!");
            }
                if (tender_gonggao.Bemp_GongGaos.Where(m=>m.GongGaoId==id&&m.UserName==User.Identity.Name).Count()>0)
                {
                    return Content("请不要重复申请");
                }

            //}
            Bemp_GongGao empG=new Bemp_GongGao();
            empG.GongGaoId=id;
            empG.UserId=db.BEmplyees.Single(emp=>emp.NumberEmp== User.Identity.Name).EmpID;
            empG.UserName =User.Identity.Name;
            tender_gonggao.Bemp_GongGaos.Add(empG);

            //db.Entry(tender_gonggao).State = EntityState.Modified;
            db.Configuration.ValidateOnSaveEnabled = false;
            db.SaveChanges();
            db.Configuration.ValidateOnSaveEnabled = true;
            return Content("申请成功,等待审核");
        }