public ActionResult DeleteConfirmed(int id) { Tender_ModelManage1 tender_modelmanage1 = db.Tender_ModelManage1.Find(id); db.Tender_ModelManage1.Remove(tender_modelmanage1); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /Tender_ModelManage1/Details/5 public ActionResult Details(int id = 0) { Tender_ModelManage1 tender_modelmanage1 = db.Tender_ModelManage1.Find(id); if (tender_modelmanage1 == null) { return(HttpNotFound()); } return(View(tender_modelmanage1)); }
public ActionResult Edit(Tender_ModelManage1 tender_modelmanage1) { if (ModelState.IsValid) { db.Entry(tender_modelmanage1).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN", tender_modelmanage1.Tid); return(View(tender_modelmanage1)); }
// // GET: /Tender_ModelManage1/Edit/5 public ActionResult Edit(int id = 0) { Tender_ModelManage1 tender_modelmanage1 = db.Tender_ModelManage1.Find(id); if (tender_modelmanage1 == null) { return(HttpNotFound()); } ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN", tender_modelmanage1.Tid); return(View(tender_modelmanage1)); }
public ActionResult Create(int TaskID = 1) { if (TaskID != 1) { Tender_GongGao tg = db.Tender_GongGaos.Find(TaskID); if (tg != null) { if (tg.IsShenhe != true) { return(Content("尚未进行供应商投标审核,不能投标~!")); } Tender_GongGao tgonggao = db.Tender_GongGaos.Find(TaskID); if (tgonggao.TenderModel != null && tgonggao.TenderModel.Trim().Equals("竞价模式")) { //return Content("您已选择竞价模式,不能再选择三轮报价模式"); if (db.Tender_ModelManage2.FirstOrDefault(m => m.Tid == TaskID) != null) { return(Content("您已选择竞价模式并已操作,不能再选择三轮报价模式")); } } tgonggao.TenderModel = "三轮报价模式"; db.Entry(tgonggao).State = EntityState.Modified; db.SaveChanges(); int mcount = db.Tender_ModelManage1.Where(m => m.Tid == TaskID).Count(); if (mcount > 0) { ViewBag.ggM = tg; Tender_ModelManage1 mod2 = db.Tender_ModelManage1.Single(m => m.Tid == TaskID); mod2.Tid = TaskID; return(View(mod2)); //return Content("已经投标 请不要重复投标"); } ViewBag.ggM = tg; Tender_ModelManage1 mod1 = new Tender_ModelManage1(); mod1.PriceUnit = "元/标"; mod1.Tid = TaskID; return(View(mod1)); //mod1.tenderGonggao = tg; //ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN"); //return View(mod1); } else { return(Content("请求页面异常~!")); } } return(Content("如有问题 请联系管理员")); //ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN"); //return View(); }
public ActionResult Create(Tender_ModelManage1 tender_modelmanage1, string btnAction = "") { Tender_ModelManage1 tender_modelmanage2; switch (btnAction) { case "btn1": if (db.Tender_ModelManage1.Where(m => m.Tid == tender_modelmanage1.Tid).Count() > 0) { tender_modelmanage2 = db.Tender_ModelManage1.Single(m => m.Tid == tender_modelmanage1.Tid); tender_modelmanage2.BeginTime1 = tender_modelmanage1.BeginTime1; tender_modelmanage2.EndTime1 = tender_modelmanage1.EndTime1; tender_modelmanage2.PriceUnit = tender_modelmanage1.PriceUnit; db.Entry(tender_modelmanage2).State = EntityState.Modified; db.SaveChanges(); return(Content("第一轮时间确认")); } var empGs = db.Bemp_GongGaos.Where(m => m.GongGaoId == tender_modelmanage1.Tid); if (empGs.Count() > 0) { foreach (Bemp_GongGao bemp in empGs) { bemp.PriceUnit = tender_modelmanage1.PriceUnit; db.Entry(bemp).State = EntityState.Modified; } } tender_modelmanage1.DateToday = System.DateTime.Now.Date; db.Tender_ModelManage1.Add(tender_modelmanage1); db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; return(Content("第一轮时间确认")); break; case "btn2": tender_modelmanage2 = db.Tender_ModelManage1.Single(m => m.Tid == tender_modelmanage1.Tid); tender_modelmanage2.BeginTime2 = tender_modelmanage1.BeginTime2; tender_modelmanage2.EndTime2 = tender_modelmanage1.EndTime2; db.Entry(tender_modelmanage2).State = EntityState.Modified; db.SaveChanges(); return(Content(" 时间确认")); default: tender_modelmanage2 = db.Tender_ModelManage1.Single(m => m.Tid == tender_modelmanage1.Tid); tender_modelmanage2.BeginTime3 = tender_modelmanage1.BeginTime3; tender_modelmanage2.EndTime3 = tender_modelmanage1.EndTime3; db.Entry(tender_modelmanage2).State = EntityState.Modified; db.SaveChanges(); return(Content(" 时间确认")); } //if (ModelState.IsValid) //{ // db.Tender_ModelManage1.Add(tender_modelmanage1); // db.SaveChanges(); // return RedirectToAction("Index"); //} //ViewBag.Tid = new SelectList(db.Tender_GongGaos, "TaskID", "SN", tender_modelmanage1.Tid); //return View(tender_modelmanage1); }
public ActionResult LoadData(int id = 0) { Tender_CustomerData data = new Tender_CustomerData(); data.StrServ = ""; data.PriceShang = 0; data.PriceShangLow = 0; //Bemp_GongGao empGong = db.Bemp_GongGaos.Include(m => m.Tender_GongGaos).Single(m => m.BGid == id); Tender_ModelManage1 modelM = null; try { modelM = db.Tender_ModelManage1.Single(m => m.Tid == id); } catch (Exception ex) { } if (modelM != null) { //Tender_ModelCustomer1 cust; //cust = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Single(m => m.EmpGonggaoID == empGong.BGid); if ((!string.IsNullOrEmpty(modelM.BeginTime1)) && (!string.IsNullOrEmpty(modelM.EndTime1)) && TimeSpan.Parse(modelM.EndTime1) >= System.DateTime.Now.TimeOfDay) { data.Lunci = "一 未开始"; data.TimeXia = modelM.BeginTime1; if ((TimeSpan.Parse(modelM.BeginTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime1))) { //第一轮进行中 data.Lunci = "一"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime1) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.PriceShang = 0; data.PriceShangLow = 0; data.TimeXia = modelM.BeginTime2; } //第一轮未开始 } else if ((!string.IsNullOrEmpty(modelM.BeginTime2)) && (!string.IsNullOrEmpty(modelM.EndTime2)) && (TimeSpan.Parse(modelM.EndTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { data.Lunci = "二 未开始"; //data.PriceShang = cust.PriceOne; //if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Count() > 0) //{ // data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Min(m => m.PriceOne); // if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne == data.PriceShangLow).Count() > 1) // { // data.StrServ = "请注意,此刻有多家供应商报出了相同的最低价。"; // } //} //else //{ // data.PriceShangLow = 0; //} //data.TimeXia = modelM.BeginTime2; if ((TimeSpan.Parse(modelM.BeginTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { //第二轮进行中 data.Lunci = "二"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime2) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.TimeXia = modelM.BeginTime3; } //第二轮未开始 } else if ((!string.IsNullOrEmpty(modelM.BeginTime3)) && (!string.IsNullOrEmpty(modelM.EndTime3)) && (TimeSpan.Parse(modelM.EndTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { data.Lunci = "三 未开始"; //data.PriceShang = cust.PriceTwo; data.TimeXia = modelM.BeginTime3; //if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Count() > 0) //{ // data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Min(m => m.PriceTwo); // if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo == data.PriceShangLow).Count() > 1) // { // data.StrServ = "请注意,此刻有多家供应商报出了相同的最低价。"; // } //} //else //{ // data.PriceShangLow = 0; //} if ((TimeSpan.Parse(modelM.BeginTime3) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { //第三轮进行中 data.Lunci = "三"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime3) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.TimeXia = ""; } } } return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult LoadData(int id = 0) { Tender_CustomerData data = new Tender_CustomerData(); data.StrServ = ""; data.PriceShang = 0; data.PriceShangLow = 0; Bemp_GongGao empGong = db.Bemp_GongGaos.Include(m => m.Tender_GongGaos).Single(m => m.BGid == id); isSmall = isSmallByid(empGong.GongGaoId); ViewBag.IsSmall = isSmall; Tender_ModelManage1 modelM = db.Tender_ModelManage1.Single(m => m.Tid == empGong.GongGaoId); if (empGong != null) { Tender_ModelCustomer1 cust; cust = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Single(m => m.EmpGonggaoID == empGong.BGid); if ((!string.IsNullOrEmpty(modelM.BeginTime1)) && (!string.IsNullOrEmpty(modelM.EndTime1)) && TimeSpan.Parse(modelM.EndTime1) >= System.DateTime.Now.TimeOfDay) { data.Lunci = "一 未开始"; data.TimeXia = modelM.BeginTime1; if ((TimeSpan.Parse(modelM.BeginTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime1))) { //第一轮进行中 data.Lunci = "一"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime1) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.PriceShang = 0; data.PriceShangLow = 0; data.TimeXia = modelM.BeginTime2; } //第一轮未开始 } else if ((!string.IsNullOrEmpty(modelM.BeginTime2)) && (!string.IsNullOrEmpty(modelM.EndTime2)) && (TimeSpan.Parse(modelM.EndTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { data.Lunci = "二 未开始"; data.PriceShang = cust.PriceOne; if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Count() > 0) { if (isSmall) { data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Min(m => m.PriceOne); } else { data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Max(m => m.PriceOne); } if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne == data.PriceShangLow).Count() > 1) { data.StrServ = "请注意,此刻有多家供应商报出了相同的最低价。"; } } else { data.PriceShangLow = 0; } data.TimeXia = modelM.BeginTime2; if ((TimeSpan.Parse(modelM.BeginTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { //第二轮进行中 data.Lunci = "二"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime2) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.TimeXia = modelM.BeginTime3; } //第二轮未开始 } else if ((!string.IsNullOrEmpty(modelM.BeginTime3)) && (!string.IsNullOrEmpty(modelM.EndTime3)) && (TimeSpan.Parse(modelM.EndTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { data.Lunci = "三 未开始"; data.PriceShang = cust.PriceTwo; data.TimeXia = modelM.BeginTime3; if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Count() > 0) { if (isSmall) { data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Min(m => m.PriceTwo); } else { data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Max(m => m.PriceTwo); } if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo == data.PriceShangLow).Count() > 1) { data.StrServ = "请注意,此刻有多家供应商报出了相同的最低价。"; } } else { data.PriceShangLow = 0; } if ((TimeSpan.Parse(modelM.BeginTime3) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { //第三轮进行中 data.Lunci = "三"; data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime3) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); data.TimeXia = ""; } } //Tender_ModelCustomer1 cust; //var qv = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.EmpGonggaoID == empGong.BGid); //if (qv.Count() > 0) //{ // cust = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Single(m => m.EmpGonggaoID == empGong.BGid); // if (cust.PriceThree != null && cust.PriceThree > 0) // { // return Content("此项目已投标~!"); // } // else if (cust.PriceTwo != null && cust.PriceTwo > 0) // { // data.Lunci = "三"; // data.TimeXia=modeM.BeginTime3; // TimeSpan ts; // if(TimeSpan.TryParse(modeM.BeginTime3,out ts)) // { // if (ts <= System.DateTime.Now.TimeOfDay.Add(new TimeSpan(0,0,2))) // { // data.EndTime = (TimeSpan.Parse(modeM.EndTime3) - System.DateTime.Now.TimeOfDay).ToString("C"); // } // } // data.PriceShang = cust.PriceTwo; // data.PriceShangLow = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId).Max(m => m.PriceTwo); // } // else if (cust.PriceOne != null && cust.PriceOne > 0) // { // ViewBag.Lunci = "二"; // ViewBag.Jieshu = System.DateTime.Now.TimeOfDay.ToString(); // ViewBag.Shanglun = cust.PriceTwo; // ViewBag.ShangDi = ""; // } // else // { // ViewBag.Lunci = "一"; // ViewBag.Jieshu = System.DateTime.Now.TimeOfDay.ToString(); // ViewBag.Shanglun = cust.PriceTwo; // ViewBag.ShangDi = ""; // } //} //else //{ // if (modeM != null) // { // try // { // data.Lunci = "一"; // data.TimeXia = modeM.BeginTime3; // TimeSpan ts; // if (TimeSpan.TryParse(modeM.BeginTime3, out ts)) // { // if (ts <= System.DateTime.Now.TimeOfDay.Add(new TimeSpan(0, 0, 2))) // { // data.EndTime = (TimeSpan.Parse(modeM.EndTime3) - System.DateTime.Now.TimeOfDay).ToString("C"); // } // } // } // catch (Exception ex) // { return Content(ex.Message + " " + modeM.BeginTime1 + " " + System.DateTime.Now.TimeOfDay + " " + System.DateTime.Now.ToShortTimeString()); } // cust = new Tender_ModelCustomer1(); // cust.bemp_Gonggao = empGong; // } // else // { // data.Lunci = "一"; // } //} } return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Tender_ModelCustomer1 tender_modelcustomer1, string LunciLab = "") { if (ModelState.IsValid) { int ttid = db.Bemp_GongGaos.Single(n => n.BGid == tender_modelcustomer1.EmpGonggaoID).GongGaoId; //**2014/4/1** isSmall = isSmallByid(ttid); //********** end ********** Tender_ModelManage1 modelM = db.Tender_ModelManage1.Single(m => m.Tid == ttid); Tender_ModelCustomer1 tender_modelcustomer2 = db.Tender_ModelCustomer1.Single(m => m.EmpGonggaoID == tender_modelcustomer1.EmpGonggaoID); switch (LunciLab) { case "": break; case "一": if (TimeSpan.Parse(modelM.BeginTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime1)) { if (tender_modelcustomer2.PriceOne > 0) { return(Content("每轮只能报价一次!")); } //Bemp_GongGao bempG1 = db.Bemp_GongGaos.Single(n => n.BGid == tender_modelcustomer1.EmpGonggaoID); tender_modelcustomer2.bemp_Gonggao.PayType = tender_modelcustomer1.bemp_Gonggao.PayType; tender_modelcustomer2.bemp_Gonggao.HandDate = tender_modelcustomer1.bemp_Gonggao.HandDate; tender_modelcustomer2.PriceOne = tender_modelcustomer1.PriceThree; db.Entry(tender_modelcustomer2).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; return(Content("投标完成!")); } break; case "二": if (TimeSpan.Parse(modelM.BeginTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2)) { if (tender_modelcustomer2.PriceTwo > 0) { //ceshi 要删掉 //tender_modelcustomer2.bemp_Gonggao.PayType = tender_modelcustomer1.bemp_Gonggao.PayType; //db.Entry(tender_modelcustomer2).State = EntityState.Modified; //db.Configuration.ValidateOnSaveEnabled = false; //db.SaveChanges(); //db.Configuration.ValidateOnSaveEnabled = true; return(Content("每轮只能报价一次!")); } if (isSmall) { if (tender_modelcustomer2.PriceOne != 0 && tender_modelcustomer1.PriceThree >= tender_modelcustomer2.PriceOne) { return(Content("投标价格必须小于上一轮")); } } else { if (tender_modelcustomer2.PriceOne != 0 && tender_modelcustomer1.PriceThree <= tender_modelcustomer2.PriceOne) { return(Content("投标价格必须大于上一轮")); } } tender_modelcustomer2.PriceTwo = tender_modelcustomer1.PriceThree; tender_modelcustomer2.bemp_Gonggao.PayType = tender_modelcustomer1.bemp_Gonggao.PayType; tender_modelcustomer2.bemp_Gonggao.HandDate = tender_modelcustomer1.bemp_Gonggao.HandDate; db.Entry(tender_modelcustomer2).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; return(Content("投标完成!")); } break; case "三": if (TimeSpan.Parse(modelM.BeginTime3) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3)) { if (tender_modelcustomer2.PriceThree > 0) { return(Content("每轮只能报价一次!")); } if (isSmall) { if ((tender_modelcustomer2.PriceTwo != 0 && tender_modelcustomer1.PriceThree >= tender_modelcustomer2.PriceTwo) || (tender_modelcustomer2.PriceOne != 0 && tender_modelcustomer1.PriceThree >= tender_modelcustomer2.PriceOne)) { return(Content("投标价格必须小于上一轮")); } } else { if ((tender_modelcustomer2.PriceTwo != 0 && tender_modelcustomer1.PriceThree <= tender_modelcustomer2.PriceTwo) || (tender_modelcustomer2.PriceOne != 0 && tender_modelcustomer1.PriceThree <= tender_modelcustomer2.PriceOne)) { return(Content("投标价格必须大于上一轮")); } } tender_modelcustomer2.PriceThree = tender_modelcustomer1.PriceThree; tender_modelcustomer2.bemp_Gonggao.PayType = tender_modelcustomer1.bemp_Gonggao.PayType; tender_modelcustomer2.bemp_Gonggao.HandDate = tender_modelcustomer1.bemp_Gonggao.HandDate; db.Entry(tender_modelcustomer2).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; return(Content("投标完成!")); } else { return(Content("投标未开始")); } //db.Entry(tender_modelcustomer1).State = EntityState.Modified; break; } return(Content("投标未开始~!")); //db.SaveChanges(); } ViewBag.EmpGonggaoID = new SelectList(db.Bemp_GongGaos, "BGid", "BGid", tender_modelcustomer1.EmpGonggaoID); return(View(tender_modelcustomer1)); }
public ActionResult Create(int id = 0) { ViewBag.EmpGonggaoID = new SelectList(db.Bemp_GongGaos, "BGid", "BGid"); if (id != 0) { Bemp_GongGao empGong = null; try { empGong = db.Bemp_GongGaos.Include(m => m.Tender_GongGaos).Single(m => m.BGid == id && m.IsPassShen != null && m.IsPassShen == true); isSmall = isSmallByid(empGong.GongGaoId); ViewBag.IsSmall = isSmall; }catch (Exception ex) { return(Content("不能投标,您可能审核未通过。")); } Tender_ModelManage1 modelM = db.Tender_ModelManage1.Single(m => m.Tid == empGong.GongGaoId); if (modelM == null) { return(Content("投标未开始")); } TimeSpan tsEnd3; if (TimeSpan.TryParse(modelM.EndTime3, out tsEnd3)) { if (tsEnd3 <= System.DateTime.Now.TimeOfDay) { return(Content("投标已结束")); } } if (modelM.DateToday.Date < System.DateTime.Now.Date) { return(Content("投标已结束~!")); } if (modelM.DateToday.Date > System.DateTime.Now.Date) { return(Content("投标未开始~!")); } if (empGong != null) { Tender_ModelCustomer1 cust; cust = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Single(m => m.EmpGonggaoID == empGong.BGid); if (cust == null) { return(Content("请联系管理")); //cust=new Tender_ModelCustomer1(); //cust.EmpGonggaoID=id; //cust.PriceUnit = modelM.PriceUnit; //cust.LinkMan=empGong //db.Tender_ModelCustomer1.Add(cust); //db.SaveChanges(); } cust.PriceUnit = modelM.PriceUnit; db.Entry(cust).State = EntityState.Modified; db.Configuration.ValidateOnSaveEnabled = false; db.SaveChanges(); db.Configuration.ValidateOnSaveEnabled = true; if ((!string.IsNullOrEmpty(modelM.BeginTime1)) && (!string.IsNullOrEmpty(modelM.EndTime1)) && TimeSpan.Parse(modelM.EndTime1) >= System.DateTime.Now.TimeOfDay) { ViewBag.Lunci = "一 未开始"; ViewBag.TimeXia = modelM.BeginTime1; if ((TimeSpan.Parse(modelM.BeginTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime1))) { //第一轮进行中 ViewBag.Lunci = "一"; ViewBag.Jieshu = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime1) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); ViewBag.Shanglun = ""; ViewBag.ShangDi = ""; ViewBag.TimeXia = modelM.BeginTime2; } //第一轮未开始 ViewBag.TimeXia = modelM.BeginTime1; } else if ((!string.IsNullOrEmpty(modelM.BeginTime2)) && (!string.IsNullOrEmpty(modelM.EndTime2)) && (TimeSpan.Parse(modelM.EndTime1) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { ViewBag.Lunci = "二 未开始"; ViewBag.Shanglun = cust.PriceOne; if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Count() > 0) { if (isSmall) { ViewBag.ShangDi = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Min(m => m.PriceOne); } else { ViewBag.ShangDi = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceOne > 0).Max(m => m.PriceOne); } } else { ViewBag.ShangDi = ""; } ViewBag.TimeXia = modelM.BeginTime2; if ((TimeSpan.Parse(modelM.BeginTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime2))) { //第二轮进行中 ViewBag.Lunci = "二"; ViewBag.Jieshu = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime2) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); ViewBag.TimeXia = modelM.BeginTime3; } //第二轮未开始 } else if ((!string.IsNullOrEmpty(modelM.BeginTime3)) && (!string.IsNullOrEmpty(modelM.EndTime3)) && (TimeSpan.Parse(modelM.EndTime2) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { ViewBag.Lunci = "三 未开始"; ViewBag.Shanglun = cust.PriceTwo; ViewBag.TimeXia = modelM.BeginTime3; if (db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Count() > 0) { if (isSmall) { ViewBag.ShangDi = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Min(m => m.PriceTwo); } else { ViewBag.ShangDi = db.Tender_ModelCustomer1.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceTwo > 0).Max(m => m.PriceTwo); } } else { ViewBag.ShangDi = ""; } if ((TimeSpan.Parse(modelM.BeginTime3) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime3))) { //第三轮进行中 ViewBag.Lunci = "三"; ViewBag.Jieshu = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime3) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss"); ViewBag.TimeXia = ""; } } else { return(Content("投标已结束。。。")); } //if (qv.Count()>0) //{ // cust = qv.ElementAt(0); // if (cust.PriceThree != null && cust.PriceThree > 0) // { // return Content("此项目已投标~!"); // } // else if (cust.PriceTwo != null && cust.PriceTwo > 0) // { // ViewBag.Lunci = "三"; // ViewBag.Jieshu = System.DateTime.Now.TimeOfDay.ToString(); // ViewBag.Shanglun = cust.PriceTwo; // ViewBag.ShangDi = ""; // } // else if (cust.PriceOne != null && cust.PriceOne > 0) // { // ViewBag.Lunci = "二"; // ViewBag.Jieshu = System.DateTime.Now.TimeOfDay.ToString(); // ViewBag.Shanglun = cust.PriceTwo; // ViewBag.ShangDi = ""; // } // else // { // ViewBag.Lunci = "一"; // ViewBag.Jieshu = System.DateTime.Now.TimeOfDay.ToString(); // ViewBag.Shanglun = cust.PriceTwo; // ViewBag.ShangDi = ""; // } //} //else //{ // if (modeM != null) // { // try // { // TimeSpan tsp = TimeSpan.Parse("10:35:00"); // ViewBag.Lunci = "一"; // ViewBag.Jieshu = tsp; // ViewBag.Shanglun = ""; // ViewBag.ShangDi = ""; // } // catch(Exception ex) // { return Content(ex.Message +" "+ modeM.BeginTime1+" "+System.DateTime.Now.TimeOfDay+" "+System.DateTime.Now.ToShortTimeString()); } // cust = new Tender_ModelCustomer1(); // cust.bemp_Gonggao = empGong; // cust.EmpGonggaoID = empGong.BGid; // } // else // { // ViewBag.Lunci = "未开始"; // cust = new Tender_ModelCustomer1(); // cust.bemp_Gonggao = empGong; // } //} return(View(cust)); } } return(View()); }