Exemple #1
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);
        }
Exemple #2
0
        /// <summary>
        /// Определить Id владельца (если id нет в системе RailCars создать из данных КИС)
        /// </summary>
        /// <param name="id_sob_kis"></param>
        /// <param name="id_owner_country"></param>
        /// <returns></returns>
        public int?DefinitionIDOwner(int id_sob_kis, int?id_owner_country)
        {
            int?id_own = rs_own.GetIDOwnersOfKis(id_sob_kis);

            if (id_own == null)
            {
                KometaSobstvForNakl sfn = kc.GetSobstvForNakl(id_sob_kis);
                if (sfn != null)
                {
                    int res = rs_own.SaveOwners(new OWNERS()
                    {
                        id_owner    = 0,
                        name        = sfn.NPLAT,
                        abr         = sfn.ABR,
                        id_country  = id_owner_country,
                        id_ora      = id_sob_kis,
                        id_ora_temp = null,
                    });
                    if (res > 0)
                    {
                        id_own = res;
                    }
                }
            }
            return(id_own);
        }