示例#1
0
    // Use this for initialization
    void Start()
    {
        TimeSta  = GameObject.Find("TimeStage").GetComponent <TimeStage>();
        bebar    = GameObject.Find("Bebar").GetComponent <BebarBoss>();
        player   = GameObject.Find("Player");
        P_Sta    = player.GetComponent <PlayerStatus>();
        A_screen = GameObject.Find("DataCenter").GetComponent <CheckActiveScreen>();

        nav = GetComponent <NavMeshAgent>();


        if (BossStage.ToString() == "Stage_1")
        {
            bossExp = 80;
        }
        else if (BossStage.ToString() == "Stage_2")
        {
            bossExp = 200;
        }
        else if (BossStage.ToString() == "Stage_3")
        {
            bossExp = 400;
        }

        itemAd  = new int[] { 4, 10, 16 };
        itemAd2 = new int[] { 4, 10, 16, 22, 28, 34 };
        itemAd3 = new int[] { 22, 28, 34 };
    }
        public IActionResult TimeStage(int pipelineId, string StartDate, string EndDate, string[] Status)
        {
            bool HasFilter = (pipelineId > 0 || Status.Count() > 0 || !string.IsNullOrEmpty(StartDate) || !string.IsNullOrEmpty(EndDate));


            ViewData["PipelineId"] = new SelectList(_pipelineServices.GetAll(p => p.Active == true), "PipelineId", "Name");

            List <TimeStage> groups = new List <TimeStage>();

            if (HasFilter)
            {
                var conn = _context.Database.GetDbConnection();
                try
                {
                    conn.Open();
                    using (var command = conn.CreateCommand())
                    {
                        var query = " Select a.stageid, b.Name,  convert(varchar(8), dateadd(second, sum(DATEDIFF(SECOND, Isnull(a.exitDate, GETUTCDATE()), a.CreateDate)), 0), 108) tempo " +
                                    " From DealStage a " +
                                    "  Inner join Stage b on a.stageid = b.stageid " +
                                    "  Inner join Deal c on a.dealid = a.dealid " +
                                    " Where c.Deleted = 0 ";

                        if (pipelineId > 0)
                        {
                            query += string.Format(" and c.PipelineId = {0} ", pipelineId);
                        }

                        if (!string.IsNullOrEmpty(StartDate))
                        {
                            query += string.Format(" and convert(char(10),a.CreateDate,120) >= \'{0}\' ", Convert.ToDateTime(StartDate).ToString("yyyy-MM-dd"));
                        }

                        if (!string.IsNullOrEmpty(EndDate))
                        {
                            query += string.Format(" and convert(char(10),a.CreateDate,12) <= \'{0}\' ", Convert.ToDateTime(EndDate).ToString("yyyy-MM-dd"));
                        }

                        if (Status.Contains("Done"))
                        {
                            query += " and c.Win = 1 ";
                        }

                        if (Status.Contains("Deleted"))
                        {
                            query += " and c.Lost = 1 ";
                        }

                        if (Status.Contains("Active"))
                        {
                            query += " and c.Win = 0 and c.Lost = 0 ";
                        }

                        query += " group by a.stageid, b.Name Order by 3 desc, a.stageid, b.Name ";


                        command.CommandText = query;

                        DbDataReader reader = command.ExecuteReader();

                        if (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                var row = new TimeStage {
                                    StageId = reader.GetInt32(0), Name = reader.GetString(1), Time = reader.GetString(2)
                                };
                                groups.Add(row);
                            }
                        }
                        reader.Dispose();
                    }
                }
                finally
                {
                    conn.Close();
                }
            }

            return(View(groups.ToList()));
        }
 public SimpleCondition(Season season, TimeStage timeStage, Terrain terrain)
 {
     Season    = season;
     TimeStage = timeStage;
     Terrain   = terrain;
 }