コード例 #1
0
        public ActionResult LoadData(int id = 0)
        {
            Tender_CustomerData data = new Tender_CustomerData();

            data.StrServ = "";
            //Bemp_GongGao empGong = db.Bemp_GongGaos.Include(m => m.Tender_GongGaos).Single(m => m.BGid == id);
            try
            {
                Tender_ModelManage2 modelM = db.Tender_ModelManage2.Single(m => m.Tid == id);

                if ((TimeSpan.Parse(modelM.BeginTime) <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= TimeSpan.Parse(modelM.EndTime)))
                {
                    data.EndTime = Convert.ToDateTime((TimeSpan.Parse(modelM.EndTime) - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss");
                    //data.PriceShangLow = db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceLost > 0).Min(m => m.PriceLost);

                    //if (db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceLost == data.PriceShangLow).Count() > 1)
                    //{
                    //    data.StrServ = "请注意,此刻有多家供应商报出了相同的最低价。";
                    //}
                    //data.TimeXia = modelM.BeginTime;
                }
            }catch (Exception ex)
            {
            }


            return(Json(data, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        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_ModelManage1.FirstOrDefault(m => m.Tid == TaskID) != null)
                        {
                            return(Content("您已选择三轮报价模式并已操作,不能再选择竞价模式"));
                        }
                    }



                    tgonggao.TenderModel     = "竞价模式";
                    db.Entry(tgonggao).State = EntityState.Modified;
                    db.SaveChanges();

                    int mcount = db.Tender_ModelManage2.Where(m => m.Tid == TaskID).Count();
                    if (mcount > 0)
                    {
                        ViewBag.ggM = tg;
                        Tender_ModelManage2 mod2 = db.Tender_ModelManage2.Single(m => m.Tid == TaskID);
                        mod2.Tid = TaskID;
                        return(View(mod2));
                        //return Content("已经投标 请不要重复投标");
                    }
                    ViewBag.ggM = tg;
                    Tender_ModelManage2 mod1 = new Tender_ModelManage2();
                    mod1.Tid       = TaskID;
                    mod1.PriceUnit = "元/标";
                    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();
        }
コード例 #3
0
        public ActionResult Create(Tender_ModelCustomer2 tender_modelcustomer21)
        {
            if (ModelState.IsValid)
            {
                int ttid = db.Bemp_GongGaos.Single(n => n.BGid == tender_modelcustomer21.EmpGonggaoID).GongGaoId;
                isSmall = isSmallByid(ttid);

                Tender_ModelManage2   modelM = db.Tender_ModelManage2.Single(m => m.Tid == ttid);
                Tender_ModelCustomer2 tender_modelcustomer2 = db.Tender_ModelCustomer2.Single(m => m.EmpGonggaoID == tender_modelcustomer21.EmpGonggaoID);

                if (TimeSpan.Parse(modelM.BeginTime) <= System.DateTime.Now.TimeOfDay && TimeSpan.Parse(modelM.EndTime) >= System.DateTime.Now.TimeOfDay)
                {
                    if (isSmall)
                    {
                        if (tender_modelcustomer2.PriceLost != 0 && tender_modelcustomer2.PriceLost <= tender_modelcustomer21.PriceLost)
                        {
                            return(Content("价格必须小于上次报价~!"));
                        }
                    }
                    else
                    {
                        if (tender_modelcustomer2.PriceLost != 0 && tender_modelcustomer2.PriceLost >= tender_modelcustomer21.PriceLost)
                        {
                            return(Content("价格必须大于上次报价~!"));
                        }
                    }

                    tender_modelcustomer2.PriceLost             = tender_modelcustomer21.PriceLost;
                    tender_modelcustomer2.bemp_Gonggao.PayType  = tender_modelcustomer21.bemp_Gonggao.PayType;
                    tender_modelcustomer2.bemp_Gonggao.HandDate = tender_modelcustomer21.bemp_Gonggao.HandDate;
                    Bemp_GongGao bemp = tender_modelcustomer2.bemp_Gonggao;

                    db.Entry(tender_modelcustomer2).State  = EntityState.Modified;
                    db.Configuration.ValidateOnSaveEnabled = false;
                    db.SaveChanges();
                    db.Configuration.ValidateOnSaveEnabled = true;
                    return(Content("投标完成!"));
                }
                else if (TimeSpan.Parse(modelM.BeginTime) > System.DateTime.Now.TimeOfDay)
                {
                    return(Content("投标未开始"));
                }
                else
                {
                    return(Content("投标已结束"));
                }
            }


            return(Content("投标未开始"));
        }
コード例 #4
0
        public ActionResult Create(Tender_ModelManage2 tender_modelmanage1, string btnAction = "")
        {
            Tender_ModelManage2 tender_modelmanage2;

            switch (btnAction)
            {
            case "btn1":
                if (db.Tender_ModelManage2.Where(m => m.Tid == tender_modelmanage1.Tid).Count() > 0)
                {
                    tender_modelmanage2                 = db.Tender_ModelManage2.Single(m => m.Tid == tender_modelmanage1.Tid);
                    tender_modelmanage2.BeginTime       = tender_modelmanage1.BeginTime;
                    tender_modelmanage2.EndTime         = tender_modelmanage1.EndTime;
                    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;
                        //db.SaveChanges();
                    }
                }

                tender_modelmanage1.DateToday = System.DateTime.Now.Date;
                db.Tender_ModelManage2.Add(tender_modelmanage1);
                db.Configuration.ValidateOnSaveEnabled = false;
                db.SaveChanges();
                db.Configuration.ValidateOnSaveEnabled = true;
                return(Content("时间确认成功"));

                break;

            case "btn2":
                break;

            default:
                break;
            }

            return(Content("有问题 ,请联系管理!"));
        }
コード例 #5
0
        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_ModelManage2 modelM = null;
                if (db.Tender_ModelManage2.Where(m => m.Tid == empGong.GongGaoId).Count() > 0)
                {
                    modelM = db.Tender_ModelManage2.Single(m => m.Tid == empGong.GongGaoId);
                }


                if (modelM == null)
                {
                    return(Content("投标未开始"));
                }



                if (modelM.DateToday.Date < System.DateTime.Now.Date)
                {
                    return(Content("投标已结束~!"));
                }
                if (modelM.DateToday.Date > System.DateTime.Now.Date)
                {
                    return(Content("投标未开始~!"));
                }

                TimeSpan tsEnd;
                if (TimeSpan.TryParse(modelM.EndTime, out tsEnd))
                {
                    if (tsEnd <= System.DateTime.Now.TimeOfDay)
                    {
                        return(Content("投标已结束"));
                    }
                }
                else
                {
                    return(Content("投标未开始"));
                }

                TimeSpan tsBegin;
                if (TimeSpan.TryParse(modelM.BeginTime, out tsBegin))
                {
                }
                else
                {
                    return(Content("投标未开始"));
                }
                if (empGong != null)
                {
                    Tender_ModelCustomer2 cust;
                    cust = db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Single(m => m.EmpGonggaoID == empGong.BGid);
                    if (cust == null)
                    {
                        return(Content("请联系管理"));
                    }

                    cust.PriceUnit       = modelM.PriceUnit;
                    db.Entry(cust).State = EntityState.Modified;
                    db.Configuration.ValidateOnSaveEnabled = false;
                    db.SaveChanges();
                    db.Configuration.ValidateOnSaveEnabled = true;

                    ViewBag.TimeXia = modelM.BeginTime;
                    if (tsBegin <= System.DateTime.Now.TimeOfDay && System.DateTime.Now.TimeOfDay <= tsEnd)
                    {
                        ViewBag.Jieshu = Convert.ToDateTime((tsEnd - System.DateTime.Now.TimeOfDay).ToString()).ToString("HH:mm:ss");

                        if (db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceLost > 0).Count() > 0)
                        {
                            if (isSmall)
                            {
                                ViewBag.ShangDi = db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceLost > 0).Min(m => m.PriceLost);
                            }
                            else
                            {
                                ViewBag.ShangDi = db.Tender_ModelCustomer2.Include(m => m.bemp_Gonggao.Tender_GongGaos).Where(m => m.bemp_Gonggao.GongGaoId == empGong.GongGaoId && m.PriceLost > 0).Max(m => m.PriceLost);
                            }
                        }
                    }

                    return(View(cust));
                }
            }
            return(View());
        }