public OwnerViewModel(OWNERS owner)
 {
     this.FNAME   = owner.FNAME;
     this.LNAME   = owner.LNAME;
     this.PHONE   = owner.PHONE;
     this.OWNERID = owner.OWNERID;
 }
示例#2
0
        public void Test_SUD_RC_Owners()
        {
            RC_Owners ow  = new RC_Owners();
            OWNERS    ow1 = new OWNERS()
            {
                id_owner    = 0,
                name        = "Тест",
                abr         = "ТСТ",
                id_country  = null,
                id_ora      = null,
                id_ora_temp = null,
            };
            int res_ow1 = ow.SaveOwners(ow1);

            Test_RC_Owners(res_ow1);
            OWNERS ow2 = new OWNERS()
            {
                id_owner    = res_ow1,
                name        = "Тест1111",
                abr         = "ТСТ111",
                id_country  = null,
                id_ora      = null,
                id_ora_temp = null,
            };
            int res_ow2 = ow.SaveOwners(ow2);

            Test_RC_Owners(res_ow2);
            OWNERS ow_del = ow.DeleteOwners(res_ow2);

            WL(ow_del);
        }
示例#3
0
    public void SetDroneOwner(DroneBase drone, OWNERS owner)
    {
        Color droneColor = Color.yellow;

        switch (owner)
        {
        case OWNERS.PLAYER:
            droneColor = Color.green;
            break;

        case OWNERS.RAIDER:
            droneColor = Color.red;
            break;

        case OWNERS.NEUTRAL:
            droneColor = Color.white;
            break;
        }

        foreach (Image image in images)
        {
            image.color = droneColor;
        }

        idText.color = droneColor;

        UserDrone uDrone = drone.GetComponent <UserDrone>();

        if (uDrone != null)
        {
            idText.text = uDrone.GetStringIdentifier();
        }
    }
示例#4
0
        public void Update()
        {
            OWNERS dbOwner = DbContext.OWNERS.Find(SelectedOwner.OWNERID);

            dbOwner.FNAME = SelectedOwner.FNAME;
            dbOwner.LNAME = SelectedOwner.LNAME;
            dbOwner.PHONE = SelectedOwner.PHONE;
            DbContext.SaveChanges();
        }
示例#5
0
        /// <summary>
        /// Получить Id владельца по id системы КИС
        /// </summary>
        /// <param name="id_sob_kis"></param>
        /// <returns></returns>
        public int?GetIDOwnersOfKis(int id_sob_kis)
        {
            OWNERS ow = GetOwnersOfKis(id_sob_kis);

            if (ow != null)
            {
                return(ow.id_owner);
            }
            return(null);
        }
示例#6
0
        /// <summary>
        /// Удалить
        /// </summary>
        /// <param name="id_way"></param>
        /// <returns></returns>
        public OWNERS DeleteOWNERS(int id_owner)
        {
            OWNERS dbEntry = context_edit.OWNERS.Find(id_owner);

            if (dbEntry != null)
            {
                context_edit.OWNERS.Remove(dbEntry);
                context_edit.SaveChanges();
            }
            return(dbEntry);
        }
示例#7
0
        public void Add()
        {
            OWNERS dbOwner = new OWNERS();

            dbOwner.FNAME         = SelectedOwner.FNAME;
            dbOwner.LNAME         = SelectedOwner.LNAME;
            dbOwner.PHONE         = SelectedOwner.PHONE;
            SelectedOwner.FNAME   = "";
            SelectedOwner.LNAME   = "";
            SelectedOwner.PHONE   = "";
            SelectedOwner.OWNERID = 0;
            DbContext.OWNERS.Add(dbOwner);
            DbContext.SaveChanges();
            OwnersList.Add(new OwnerViewModel(dbOwner));
        }
示例#8
0
        public void Test_References_Owner()
        {
            TransferWagons.Railcars.ReferencesKIS refer = new TransferWagons.Railcars.ReferencesKIS();
            //refer.DefinitionIDOwner(53,null);
            Console.WriteLine("Новая перевозочная компания 123 = {0}", refer.DefinitionIDOwner(53, null));
            Console.WriteLine("Null = {0}", refer.DefinitionIDOwner(0, null));
            int?new_ow = refer.DefinitionIDOwner(-1, null);

            Console.WriteLine("Новый (-1) = {0}", new_ow);
            if (new_ow != null)
            {
                RC_Owners ow     = new RC_Owners();
                OWNERS    ow_del = ow.DeleteOwners((int)new_ow);
            }
        }
示例#9
0
        /// <summary>
        /// Добавить или править
        /// </summary>
        /// <param name="WAYS"></param>
        /// <returns></returns>
        public int SaveOWNERS(OWNERS OWNERS)
        {
            OWNERS dbEntry;

            if (OWNERS.id_owner == 0)
            {
                dbEntry = new OWNERS()
                {
                    id_owner    = OWNERS.id_owner,
                    name        = OWNERS.name,
                    abr         = OWNERS.abr,
                    id_country  = OWNERS.id_country,
                    id_ora      = OWNERS.id_ora,
                    id_ora_temp = OWNERS.id_ora_temp,
                };
                context_edit.OWNERS.Add(dbEntry);
            }
            else
            {
                dbEntry = context_edit.OWNERS.Find(OWNERS.id_owner);
                if (dbEntry != null)
                {
                    dbEntry.id_owner    = OWNERS.id_owner;
                    dbEntry.name        = OWNERS.name;
                    dbEntry.abr         = OWNERS.abr;
                    dbEntry.id_country  = OWNERS.id_country;
                    dbEntry.id_ora      = OWNERS.id_ora;
                    dbEntry.id_ora_temp = OWNERS.id_ora_temp;
                }
            }
            try
            {
                context_edit.SaveChanges();
            }
            catch (Exception e)
            {
                return(-1);
            }
            return(dbEntry.id_owner);
        }
示例#10
0
 public void SetOwner(OWNERS newOwner)
 {
     owner = newOwner;
 }
示例#11
0
 /// <summary>
 /// Добавить удалить
 /// </summary>
 /// <param name="vagons"></param>
 /// <returns></returns>
 public int SaveOwners(OWNERS owners)
 {
     return(rep_ow.SaveOWNERS(owners));
 }
示例#12
0
 public void WL(OWNERS t)
 {
     Console.WriteLine("id_owner: {0}, name: {1}, abr: {2}, id_country: {3}, id_ora: {4}, id_ora_temp: {5}",
                       t.id_owner, t.name, t.abr, t.id_country, t.id_ora, t.id_ora_temp);
 }