예제 #1
0
파일: Service.cs 프로젝트: sneJoke/Web-API
        public string SelectData(Table table)
        {
            ReadRequest req = new ReadRequest();

            try
            {
                req.Entity = Connection.RunFetch(table.Name);
            }
            catch (Exception e)
            {
                req.Exception = e.Message;
            }
            Connection.Disconnect();
            return(js.Serialize(req));
        }
예제 #2
0
파일: Service.cs 프로젝트: sneJoke/Web-API
        public string ReadData(Table table)
        {
            ReadRequest req = new ReadRequest();

            try
            {
                /*Перечисляем поля для Fetch запроса*/
                String fields = String.Empty;
                foreach (Field field in table.Fields)
                {
                    fields = fields + "<attribute name='" + field.Caption + "' />";
                }

                /*Формируем ответ на запрос*/
                req.Entity = Connection.RunFetch(table.Name, table.Id.Value, table.Id.Name, fields);
            }
            /*Обработка ошибок*/
            catch (Exception e)
            {
                req.Exception = e.Message;
            }
            Connection.Disconnect();
            return(js.Serialize(req));
        }