Пример #1
0
        public static void ShowObject <T>(this CropioApi cropio, Int32 objId) where T : ICropioRegularObject
        {
            Response <T> obj = cropio.GetObject <T>(objId);

            if (obj == null || obj.Data == null)
            {
                return;
            }
            Console.WriteLine("\n\n————— {0,6} ({1}) ——————————————————————————————————————", objId, CropioDataModel.Name <T>());
            Console.WriteLine(obj.Data);
        }
Пример #2
0
        public static void Update(this CropioApi cropio)
        {
            Response <CO_Alert> resp_alert = cropio.GetObject <CO_Alert>(433);

            if (resp_alert.CropioResponse.IsSuccess)
            {
                CO_Alert alert = resp_alert.Data;
                //alert.Id_ResponsiblePerson = 9913;
                alert.Id_AlertableObject = 21;
                alert.Description       += "\n[TEST] Тревога изменена программным образом.";

                Console.WriteLine(cropio.UpdateObject(alert));
            }
        }
Пример #3
0
        static void Main(String[] args)
        {
            CropioApi cropio = GetCropioClient();
            CO_Alert  alert  = cropio.GetObject <CO_Alert>(834).Data;

            Console.WriteLine(alert.GetTextView(1));
            //RunMultipleAlertsFromOutside.Main(cropio);

            //var resp = cropio.GetObjectsIds<CO_Alert>();
            //foreach(var ids in resp.Data.Paginate(100))
            //{
            //    var resp2 = cropio.GetObjects<CO_Alert>(ids);
            //    foreach(var obj in resp2.Data)
            //    {
            //        Console.WriteLine(obj.GetTextView(1));
            //    }
            //}
        }
Пример #4
0
        public static void ShowAllObjects_Slowly <T>(this CropioApi cropio, Boolean showNextItemAutomated = false) where T : ICropioRegularObject
        {
            MassResponse <Int32> ids = cropio.GetObjectsIds <T>();

            if (ids.Data == null)
            {
                Console.WriteLine("Identifiers not found"); return;
            }
            foreach (Int32 id in ids.Data)
            {
                Response <T> resp = cropio.GetObject <T>(id);
                Console.WriteLine(resp.Data);
                if (showNextItemAutomated)
                {
                    continue;
                }
                Console.ReadKey();
                Console.Clear();
            }
        }