Exemplo n.º 1
0
        public void ConstructorToExcel(string request)
        {
            string req = Server.UrlDecode(request);
            //req = "&start=(&start=(&Entity=Счётчик&Collection=Показания&Sign=Количество <&input=5&Or=ИЛИ&Entity=Счётчик&Entity=Пользователь&Bool=Администратор?&Sign===&input=False";

            IEnumerable <IConstructor> collection = null;

            System.Type type = typeof(object);
            string      msg  = "";

            try
            {
                collection = new RequestConstructor(_DataManager).GiveCollection(req, out type);
            }
            catch (Exception e)
            {
                Debug.Write(e);
                return;
            }

            if (msg != "")
            {
                return;
            }

            string filename = "search.xlsx";

            DataManager.ExportToExcel(filename, new [] { DataManager.GetDataTable(collection) });
            ExportResponce(filename);
        }
Exemplo n.º 2
0
        public void generateResponseApiBuyer()
        {
            //Use SignedRequesthelper class to generate signed request.

            RequestConstructor  RequestConstructor  = new RequestConstructor();
            ResponseConstructor ResponseConstructor = new ResponseConstructor();

            BasicAmazonOperation opertion = new CartCreation(ConfigurationManager.AppSettings["productASIN"], "1");

            //Get signed URL in a variable
            string requestUrl = RequestConstructor.buildRequest(opertion);

            ResponseConstructor.buildResponse(requestUrl);
        }
 public void Prepare(InjectionInfos injectInfos)
 {
     _userStop           = false;
     _requestList        = new List <Request>();
     _extractingInfos    = new ExtractorInfos();
     _lastQueryOutput    = string.Empty;
     _injector           = new InjectingClass();
     _injectInfos        = injectInfos;
     _requestConstructor = new RequestConstructor(injectInfos)
     {
         EncodeCharacters = _encodeCharacter,
         EncodeWhiteSpace = _encodeWhiteSpace
     };
     _internalData.Prepared      = true;
     _internalData.UseConditions = true;
 }
 public void Prepare(InjectionInfos injectInfos)
 {
     _userStop = false;
      _requestList = new List<Request>();
      _extractingInfos = new ExtractorInfos();
      _lastQueryOutput = string.Empty;
      _injector = new InjectingClass();
      _injectInfos = injectInfos;
      _requestConstructor = new RequestConstructor(injectInfos)
                           {
                              EncodeCharacters = _encodeCharacter,
                              EncodeWhiteSpace = _encodeWhiteSpace
                           };
      _internalData.Prepared = true;
      _internalData.UseConditions = true;
 }
Exemplo n.º 5
0
        public ActionResult ConstructorGetData(string request)
        {
            string req = Server.UrlDecode(request);
            //req = "&start=(&start=(&Entity=Счётчик&Collection=Показания&Sign=Количество <&input=5&Or=ИЛИ&Entity=Счётчик&Entity=Пользователь&Bool=Администратор?&Sign===&input=False";

            IEnumerable <IConstructor> collection = null;

            System.Type type = typeof(object);
            string      msg  = "";

            try
            {
                collection = new RequestConstructor(_DataManager).GiveCollection(req, out type).ToList();
            }
            catch (NullReferenceException e)
            {
                msg = "Ничего не найдено";
            }
            catch (ArgumentNullException e)
            {
                msg = "Ничего не найдено";
            }
            catch (Exception e)
            {
                msg = "Ошибка в запросе, проверьте все типы введённых данных";
                Debug.Write(e);
            }

            if (msg != "")
            {
                return(PartialView("Error", msg));
            }

            if (collection == null || !collection.Any())
            {
                return(PartialView("Error", "Ничего не найдено"));
            }

            if (type == typeof(Meter))
            {
                ViewData["Meters"] = collection?.Cast <Meter>();
                return(PartialView("MetersList"));
            }

            if (type == typeof(InstalledMeter))
            {
                ViewData["Meters"] = collection?.Cast <InstalledMeter>();
                return(PartialView("MetersList"));
            }

            if (type == typeof(User))
            {
                ViewData["Users"] = collection?.Cast <User>();
                return(PartialView("UserList"));
            }

            if (type == typeof(Tariff))
            {
                ViewData["Tariffes"] = collection?.Cast <Tariff>();
                return(PartialView("TariffList"));
            }

            if (type == typeof(MRS_web.Models.EDM.TimeSpan))
            {
                ViewData["TimeSpans"] = collection?.Cast <MRS_web.Models.EDM.TimeSpan>();
                return(PartialView("TimeSpans"));
            }

            if (type == typeof(MRS_web.Models.EDM.Type))
            {
                ViewData["Types"] = collection?.Cast <MRS_web.Models.EDM.Type>();
                return(PartialView("TypeList"));
            }

            if (type == typeof(Parametr))
            {
                ViewData["Parameters"] = collection?.Cast <Parametr>();
                return(PartialView("ParameterList"));
            }

            if (type == typeof(Reading))
            {
                ViewData["Readings"] = collection?.Cast <Reading>();
                return(PartialView("Readings"));
            }

            if (type == typeof(Document))
            {
                ViewData["Documents"] = collection?.Cast <Document>();
                return(PartialView("DocumentList"));
            }

            return(PartialView("Error", "очень непонятно, предоставьте программисту скриншот данных при которых это произошло"));
        }