コード例 #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 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);
        }
コード例 #3
0
        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);
        }