示例#1
0
        public void Test_SUD_RC_Shops()
        {
            SHOPS s1 = new SHOPS()
            {
                id_shop   = 0,
                name      = "Тест",
                name_full = "Тест_name_full",
                id_stat   = null,
                id_ora    = 0,
            };
            int id_new = shops.SaveShop(s1);

            Test_RC_Shops(id_new);
            SHOPS s2 = new SHOPS()
            {
                id_shop   = id_new,
                name      = "Тест1",
                name_full = "Тест_name_full1",
                id_stat   = null,
                id_ora    = 0,
            };
            int id_ch = shops.SaveShop(s2);

            Test_RC_Shops(id_ch);
            SHOPS del = shops.DeleteShops(id_ch);

            WL(del);
        }
示例#2
0
 public void WL(SHOPS t)
 {
     if (t != null)
     {
         Console.WriteLine("id_shop: {0}, name: {1}, name_full: {2}, id_stat: {3}, id_ora: {4}",
                           t.id_shop, t.name, t.name_full, t.id_stat, t.id_ora);
     }
     else
     {
         Console.WriteLine("= NULL");
     }
 }
示例#3
0
        /// <summary>
        /// Удалить
        /// </summary>
        /// <param name="id_shop"></param>
        /// <returns></returns>
        public SHOPS DeleteSHOPS(int id_shop)
        {
            SHOPS dbEntry = context.SHOPS.Find(id_shop);

            if (dbEntry != null)
            {
                context.SHOPS.Remove(dbEntry);
                try
                {
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    LogRW.LogError(e, "SaveSHOPS", eventID);
                    return(null);
                }
            }
            return(dbEntry);
        }
示例#4
0
        /// <summary>
        /// Добавить или править
        /// </summary>
        /// <param name="SHOPS"></param>
        /// <returns></returns>
        public int SaveSHOPS(SHOPS SHOPS)
        {
            SHOPS dbEntry;

            if (SHOPS.id_shop == 0)
            {
                dbEntry = new SHOPS()
                {
                    id_shop   = SHOPS.id_shop,
                    name      = SHOPS.name,
                    name_full = SHOPS.name_full,
                    id_stat   = SHOPS.id_stat,
                    id_ora    = SHOPS.id_ora
                };
                context.SHOPS.Add(dbEntry);
            }
            else
            {
                dbEntry = context.SHOPS.Find(SHOPS.id_shop);
                if (dbEntry != null)
                {
                    dbEntry.name      = SHOPS.name;
                    dbEntry.name_full = SHOPS.name_full;
                    dbEntry.id_stat   = SHOPS.id_stat;
                    dbEntry.id_ora    = SHOPS.id_ora;
                }
            }
            try
            {
                context.SaveChanges();
            }
            catch (Exception e)
            {
                LogRW.LogError(e, "SaveSHOPS", eventID);
                return(-1);
            }
            return(dbEntry.id_shop);
        }
示例#5
0
 /// <summary>
 /// Добавить или удалить
 /// </summary>
 /// <param name="gruzs"></param>
 /// <returns></returns>
 public int SaveShop(SHOPS shop)
 {
     return rep_sh.SaveSHOPS(shop);
 }
示例#6
0
 /// <summary>
 /// Получить ID цеха системы RailCars по id системы КИС
 /// </summary>
 /// <param name="id_shop_kis"></param>
 /// <returns></returns>
 public int? GetIDShopsOfKis(int id_shop_kis) 
 {
     SHOPS shop = GetShopsOfKis(id_shop_kis);
     if (shop != null) return shop.id_shop;
     return null;
 }