Ejemplo n.º 1
0
        public AtomData DeployFormationFromTree(DeployedFormation deployFormation)
        {
            SessionManager m    = (SessionManager)GlobalHost.DependencyResolver.GetService(typeof(SessionManager));
            AtomData       atom = m.gameManager.m_GameObject.DeployFormationFromTree(deployFormation);

            return(atom);
        }
Ejemplo n.º 2
0
        private static AtomData GetAtomBySql(string sql)
        {
            try
            {
                AtomData atom = new AtomData();

                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                {
                    DataSet dsPol = new DataSet();
                    DataTable dtPol = new DataTable();
                    dsPol.Reset();
                    da.Fill(dsPol);
                    dtPol = dsPol.Tables[0];

                    if (dtPol == null || dtPol.Rows == null || dtPol.Rows.Count == 0)
                    {
                        return null;
                    }

                    foreach (DataRow row in dtPol.Rows)
                    {
                      
                        atom.UnitGuid = row["atom_guid"].ToString();
                        atom.UnitName = row["atom_name"].ToString();
                        atom.Location = new DPoint();
                        atom.Location.x = System.Convert.ToDouble(row["pointX"]);
                        atom.Location.y = System.Convert.ToDouble(row["pointY"]);              

                    }
                }


                return atom;
            }
            catch (Exception ex)
            {

            }
            return null;
        }
Ejemplo n.º 3
0
        public IEnumerable <GeneralActivityDTO> GetActivitesByAtomName(string AtomName)
        {
            IEnumerable <GeneralActivityDTO> Activites = null;
            AtomData atom = TDS.DAL.AtomsDB.GetAtomByName(AtomName);               // GetAtomByName(string Name)

            if (atom != null)
            {
                Activites = TDS.DAL.ActivityDB.GetActivitesByAtom(atom.UnitGuid);

                if (Activites != null)
                {
                    foreach (GeneralActivityDTO ActivityDTO in Activites)
                    {
                        ActivityDTO.Atom = atom;
                    }
                }
            }



            return(Activites);
        }
Ejemplo n.º 4
0
        public AtomData DeployFormationFromTree(DeployedFormation deployFormation)
        {

            if (GroundAtomObjectCollection.ContainsKey(deployFormation.formation.GUID)) return null;



            AtomData atom = new AtomData();
            atom.Location = new DPoint(deployFormation.x, deployFormation.y);
            atom.UnitGuid = deployFormation.formation.GUID;
            atom.UnitName = deployFormation.formation.Identification;

            TDS.DAL.AtomsDB.AddAtom(atom);




            clsGroundAtom GroundAtom = new clsGroundAtom(this);
            GroundAtom.MyName = atom.UnitName;
            GroundAtom.GUID = atom.UnitGuid;
            GroundAtom.curr_X = atom.Location.x;
            GroundAtom.curr_Y = atom.Location.y;
            GroundAtomObjectCollection.TryAdd(GroundAtom.GUID, GroundAtom);
            m_GameManager.QuadTreeGroundAtom.PositionUpdate(GroundAtom);




            NotifyClientsEndCycleArgs args = new NotifyClientsEndCycleArgs();
            args = new NotifyClientsEndCycleArgs();
            args.Transport2Client.Ex_clockDate = Ex_clockDate;
            // args.Transport2Client.ExClockRatioSpeed = m_GameManager.ExClockRatioSpeed;
            args.Transport2Client.AtomObjectType = 2;
            args.Transport2Client.AtomObjectCollection = PrepareGroundCommonProperty();
            args.Transport2Client.ManagerStatus = m_GameManager.ManagerStatus;
            m_GameManager.NotifyClientsEndCycle(args);

            return atom;
        }
Ejemplo n.º 5
0
        public static IEnumerable<AtomData> GetAllAtoms()
        {
            try
            {
                List<AtomData> atoms = new List<AtomData>();
                string sql = "select * from AtomObjects";
                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                using (NpgsqlDataAdapter da = new NpgsqlDataAdapter(sql, connection))
                {
                    DataSet ds = new DataSet();
                    DataTable dt = new DataTable();
                    ds.Reset();
                    da.Fill(ds);
                    dt = ds.Tables[0];

                    if (dt == null || dt.Rows == null || dt.Rows.Count == 0)
                    {
                        return null;
                    }
                    foreach (DataRow row in dt.Rows)
                    {
                        AtomData atom = new AtomData();
                        atom.UnitGuid = row["atom_guid"].ToString();
                        atom.UnitName = row["atom_name"].ToString();
                        atom.Location = new DPoint();
                        atom.Location.x = System.Convert.ToDouble(row["pointX"]);
                        atom.Location.y = System.Convert.ToDouble(row["pointY"]);
                        atoms.Add(atom);
                    }
                }
                return atoms;
            }
            catch (Exception ex)
            {

            }
            return null;
        }
Ejemplo n.º 6
0
        public static void AddAtom(AtomData Atom)
        {
            try
            {
                string sql;
                using (NpgsqlConnection connection = new NpgsqlConnection(strPostGISConnection))
                {
                    connection.Open();

                    sql = "insert into AtomObjects (atom_guid,atom_name,CountryId,pointX,pointY)" +
                                 "values ('" + Atom.UnitGuid + "','" +
                                   Atom.UnitName + "'," +
                                   0 + "," +
                                   Atom.Location.x + "," +
                                   Atom.Location.y +

                                   " )  ";
                    using (NpgsqlCommand command = new NpgsqlCommand(sql, connection))
                    {                     
                        command.ExecuteNonQuery();
                    }
                }

            }
            catch(Exception ex)
            {

            }
        }