コード例 #1
0
        // GET: Employee/Edit/5
        public ActionResult EditCardWaste(int id)
        {
            var       cookie = HttpContext.Request.Cookies["jwt"];
            CardWaste cw     = CallApi.Get(cookie, "CardWastes", id.ToString()).Content.ReadAsAsync <CardWaste>().Result;

            return(View(cw));
        }
コード例 #2
0
        // GET: Payment
        public ActionResult Index()
        {
            CallApi asd  = new CallApi("https://localhost:44353", new System.Net.Http.HttpClient());
            var     asd2 = asd.Make3DKuveytPaymentAsync().Result;

            return(View());
        }
コード例 #3
0
        static async Task RunAsync()
        {
            //Generate and return Token
            User objUser = new User();

            objUser.username = ConfigurationManager.AppSettings["login_api"];
            objUser.password = ConfigurationManager.AppSettings["password_api"];
            CallApi callApi = new CallApi();
            Token   token   = await callApi.CreateTokenAuth(objUser);

            //List mail by query
            var strGetListMail = callApi.GetListMail("marcus");

            Console.WriteLine(strGetListMail);

            Console.WriteLine();

            //Get by mail
            var strGetMail = callApi.GetEmail("*****@*****.**");

            Console.WriteLine(strGetMail);

            //Create mail
            Mail objMail = new Mail();

            objMail.data.mail = "";

            Console.ReadLine();
        }
コード例 #4
0
        // GET: Employee
        public ActionResult Index()
        {
            var response = CallApi.Get(Request.Cookies["jwt"], "Cards");
            IEnumerable <Card> result = response.Content.ReadAsAsync <IEnumerable <Card> >().Result;

            return(View(result));
        }
コード例 #5
0
        private async void CarregarCombos()
        {
            try
            {
                var IntegrationJsonStringTipoCliente = await CallApi.GetInfo(ApiEndPoint.ApiTipoCliente + ApiEndPoint.Listar);

                DataTable dtTipoCliente = (DataTable)JsonConvert.DeserializeObject(IntegrationJsonStringTipoCliente, (typeof(DataTable)));

                lstTipoCliente.DataSource     = dtTipoCliente;
                lstTipoCliente.DataTextField  = dtTipoCliente.Columns["Descricao"].ToString();
                lstTipoCliente.DataValueField = dtTipoCliente.Columns["TipoClienteId"].ToString();
                lstTipoCliente.DataBind();
                lstTipoCliente.Items.Insert(0, "Selecione");

                var IntegrationJsonStringSituacao = await CallApi.GetInfo(ApiEndPoint.ApiSituacao + ApiEndPoint.Listar);

                DataTable dtSituacao = (DataTable)JsonConvert.DeserializeObject(IntegrationJsonStringSituacao, (typeof(DataTable)));

                lstSituacao.DataSource     = dtSituacao;
                lstSituacao.DataTextField  = dtSituacao.Columns["Descricao"].ToString();
                lstSituacao.DataValueField = dtSituacao.Columns["SituacaoId"].ToString();
                lstSituacao.DataBind();
                lstSituacao.Items.Insert(0, "Selecione");
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.Page, "Erro ao carregar combos: " + ex.Message);
            }
        }
コード例 #6
0
        private async Task CarregaInfos(int id)
        {
            try
            {
                var IntegrationJsonString = await CallApi.GetInfo(ApiEndPoint.ApiCliente + ApiEndPoint.Buscar + id);

                Cliente cliente = JsonConvert.DeserializeObject <Cliente>(IntegrationJsonString);

                Session["ClienteIdAlterar"] = cliente.ClienteId;

                txtNome.Text = cliente.Nome;
                txtCPF.Text  = cliente.CPF;
                lstTipoCliente.SelectedIndex = 0;
                lstSituacao.SelectedIndex    = 0;
                lstTipoCliente.SelectedIndex = cliente.mTipoCliente;
                lstSituacao.SelectedIndex    = cliente.mSituacao;

                if (cliente.Sexo == "F")
                {
                    rdbFeminino.Checked = true;
                }
                else
                {
                    rdbMasculino.Checked = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.Page, "Erro ao carregar informações do cliente: " + ex.Message);
            }
        }
コード例 #7
0
        private async void CarregaRepeater()
        {
            try
            {
                var IntegrationJsonString = await CallApi.GetInfo(ApiEndPoint.ApiCliente + ApiEndPoint.Listar);

                DataTable dt = (DataTable)JsonConvert.DeserializeObject(IntegrationJsonString, (typeof(DataTable)));

                foreach (DataRow item in dt.Rows)
                {
                    string cpf = item["CPF"].ToString();
                    cpf         = cpf.Insert(3, ".");
                    cpf         = cpf.Insert(7, ".");
                    cpf         = cpf.Insert(11, "-");
                    item["CPF"] = cpf;
                }

                gridClientes.DataSource = dt;
                gridClientes.DataBind();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this.Page, "Erro ao carregar listar clientes: " + ex.Message);
            }
        }
コード例 #8
0
        public ActionResult <long> Post([FromBody] Order order)
        {
            string authorization = CallApi.GetRequest(URL_AUTH + "?base64=" + order.authentication);

            if (authorization.Equals("ERROR"))
            {
                return(BadRequest("Não foi possível autenticar o usuário, tente utilizar usuário padrão basicAuthentication: basic Encode64({ login:usuario1, password:teste123})"));
            }

            if (!authorization.Equals("authorized"))
            {
                return(BadRequest("Usuário inválido, tente utilizar usuário padrão: basic {login:usuario1, password:teste123}"));
            }

            string TRANS_DATA    = JsonConvert.SerializeObject(new Transaction(order.cardId, order.totalValue, order.time));
            long   idTransaction = CallApi.PostRequest(TRANS_DATA, URL_TRANS);

            if (idTransaction == -1)
            {
                return(BadRequest("Não foi possível criar transação"));
            }

            long idCreated = _OrderBusiness.createOrder(order);

            string AUDITS_DATA = JsonConvert.SerializeObject(new Record(order.userName, order.store, order.time, order.totalValue, order.location));
            long   idAudit     = CallApi.PostRequest(AUDITS_DATA, URL_AUDIT);

            if (idAudit == -1)
            {
                return(BadRequest("Não foi possível registrar operação"));
            }

            return(idCreated);
        }
コード例 #9
0
        public string RegisterProject(string xml)
        {
            IncomingWebRequestContext request = WebOperationContext.Current.IncomingRequest;
            LogControl    logControl          = new LogControl();
            CallApi       api = new CallApi();
            GenericAddDto dto = new GenericAddDto
            {
                Xml = xml
            };

            string user  = request.Headers["Usuario"];
            string senha = request.Headers["Senha"];

            string access_token = api.Login(user, senha).Result;

            if (String.IsNullOrEmpty(access_token))
            {
                logControl.Write("Usuário e senha não conferem");
                return(api.CAllApiMethod(dto, "/project", access_token));
            }
            else
            {
                logControl.Write("Usuário logado");
                return(api.CAllApiMethod(dto, "/project", access_token));
            }
        }
コード例 #10
0
        public async Task <ActionResult> GetData()
        {
            var     productId = Guid.NewGuid();
            Product products  = await CallApi.Product(_configuration, _freshdeskClient, productId);

            return(Ok("check via debugging"));
        }
コード例 #11
0
        public async Task <JsonResult> PreCreateCustomer()
        {
            CallApi callapii = new CallApi("https://localhost:5001", new System.Net.Http.HttpClient());
            var     asd2     = await callapii.GetPreCustomerAsync();

            return(Json(asd2));
        }
コード例 #12
0
        public ActionResult Edit(int id, Card card)
        {
            var cookie   = HttpContext.Request.Cookies["jwt"];
            var response = CallApi.Put(cookie, "Cards", card, id.ToString());

            return(RedirectToAction(nameof(Index)));
        }
コード例 #13
0
ファイル: BillsController.cs プロジェクト: m4ccim/wasteApiMvc
        // GET: Invoices/Details/5
        public ActionResult Details(int id)
        {
            List <DataPoint> dataPoints = new List <DataPoint>();
            BillDetails      res        = CallApi.Get(Request.Cookies["jwt"], "bills/details", id.ToString()).Content.ReadAsAsync <BillDetails>().Result;

            Dictionary <string, double> keyValuePairs = new Dictionary <string, double>();

            foreach (ProductDetails productDetails in res.ProductDetails)
            {
                foreach (WasteDiscount productWaste in productDetails.WasteDiscounts)
                {
                    if (!keyValuePairs.ContainsKey(productWaste.Waste.Name))
                    {
                        keyValuePairs.Add(productWaste.Waste.Name, productWaste.DiscountedAmount * productWaste.Waste.RecyclingPrice);
                    }
                    else
                    {
                        keyValuePairs[productWaste.Waste.Name] += productWaste.DiscountedAmount * productWaste.Waste.RecyclingPrice;
                    }
                }
            }
            foreach (var x in keyValuePairs)
            {
                dataPoints.Add(new DataPoint(x.Key, x.Value));
            }

            ViewBag.DataPoints = JsonConvert.SerializeObject(dataPoints);

            return(View(res));
        }
コード例 #14
0
        public ActionResult EditCardWaste(int id, CardWaste cardWaste)
        {
            var cookie   = HttpContext.Request.Cookies["jwt"];
            var response = CallApi.Put(cookie, "CardWastes", cardWaste, id.ToString());

            return(RedirectToAction("Edit", new { id = cardWaste.CardId }));
        }
コード例 #15
0
        public async Task <ActionResult> ResetBalance(int id)
        {
            var cookie   = HttpContext.Request.Cookies["jwt"];
            var response = await CallApi.PostAsync(cookie, "Cards/resetbalance/" + id, new object());

            return(RedirectToAction("Edit", new { id }));
        }
コード例 #16
0
        public async Task <JsonResult> GetCustomerAccounts()
        {
            var asd      = new CallApi("https://localhost:5001", new System.Net.Http.HttpClient());
            var response = await asd.GetCustomersAsync();

            return(Json(response));
        }
コード例 #17
0
        public async Task <JsonResult> Index2()
        {
            var asd  = new CallApi("https://localhost:5001", new System.Net.Http.HttpClient());
            var asdd = await asd.Make3DKuveytPaymentAsync();

            return(Json(asdd));
        }
コード例 #18
0
        // GET: Wastes/Delete/5
        public ActionResult Delete(int id)
        {
            var cookie = HttpContext.Request.Cookies["jwt"];

            Waste waste = CallApi.Get(cookie, "Wastes", id.ToString()).Content.ReadAsAsync <Waste>().Result;

            return(View(waste));
        }
コード例 #19
0
        public ActionResult Profile(Card card)
        {
            var cookie   = HttpContext.Request.Cookies["jwt"];
            var response = CallApi.Put(cookie, "Cards", card, card.CardId.ToString());



            return(RedirectToAction("Index", "Home"));
        }
コード例 #20
0
 public ActionResult NewScrape()
 {
     if (ModelState.IsValid)
     {
         var apiCall = new ApiCall();
         CallApi.GetStockData(apiCall);
     }
     return(Redirect("Index"));
 }
コード例 #21
0
        public JsonResult VerifyIdentity(KisiVeCuzdanDogrulaRequest req)
        {
            var asd      = new CallApi("", new System.Net.Http.HttpClient());
            var response = asd.KisiVeCuzdanDogrulaAsync(req.TCKimlikNo, req.Ad, req.Soyad, req.SoyadYok, req.DogumGun, req.DogumGunYok, req.DogumAy, req.DogumAyYok, req.DogumYil, req.TCKKSeriNo);



            return(Json(response));
        }
コード例 #22
0
        // GET: Employee/Edit/5
        public ActionResult Edit(int id)
        {
            var            cookie         = HttpContext.Request.Cookies["jwt"];
            CardCardWastes cardCardWastes = new CardCardWastes();

            cardCardWastes.Card       = CallApi.Get(cookie, "Cards", id.ToString()).Content.ReadAsAsync <Card>().Result;
            cardCardWastes.CardWastes = CallApi.Get(cookie, "CardWastes/CardId", id.ToString()).Content.ReadAsAsync <List <CardWaste> >().Result;
            return(View(cardCardWastes));
        }
コード例 #23
0
ファイル: ContentController.cs プロジェクト: Rifat172/CoinApp
        public ActionResult CryptocurrencyQuotes(string value)
        {
            var data = CallApi.GetObj(CallApi.MakeAPICall(50));

            ViewBag.Data = data;
            if (value != null)
            {
                int valueb = 0;
                if (!int.TryParse(value, out valueb))
                {
                    valueb = -1;
                }

                switch (valueb)
                {
                case 0:
                    ViewBag.Data = data.OrderBy(o => o.Name);
                    return(View());

                case 1:
                    ViewBag.Data = data.OrderBy(o => o.Symbol);
                    return(View());

                case 2:
                    ViewBag.Data = data.OrderBy(o => o.Slug);
                    return(View());

                case 3:
                    ViewBag.Data = data.OrderBy(o => o.Quote.Usd.Price);
                    return(View());

                case 4:
                    ViewBag.Data = data.OrderBy(o => o.Quote.Usd.Percent_change_1h);
                    return(View());

                case 5:
                    ViewBag.Data = data.OrderBy(o => o.Quote.Usd.Percent_change_24h);
                    return(View());

                case 6:
                    ViewBag.Data = data.OrderBy(o => o.Quote.Usd.Market_cap);
                    return(View());

                case 7:
                    ViewBag.Data = data.OrderByDescending(o => o.Quote.Usd.Last_updated);
                    return(View());

                case 8:
                    ViewBag.Data = CallApi.GetObj(CallApi.MakeAPICall(50));
                    return(View());

                default:
                    return(View());
                }//0-название, 1-символ, 2-логотип, 3-цена, 4-изменение1ч, 5-изменение24ч, 6-капита., 7-время.
            }
            return(View());
        }
コード例 #24
0
        // GET: Products
        public ActionResult Index()
        {
            var response = CallApi.Get(Request.Cookies["jwt"], "Products");
            var readTask = response.Content.ReadAsAsync <IList <Product> >();

            readTask.Wait();

            return(View(readTask.Result));
        }
コード例 #25
0
        public long sendBudgetToClient(Budget budget)
        {
            long retornoApi = CallApi.PostRequest(JsonConvert.SerializeObject(budget), Constants.BASE_SHOPKEEP_API + Constants.PATH_POST_BUDGET, false);

            if (retornoApi == -1)
            {
                return(-1);
            }
            return(budget.budgetCode);
        }
コード例 #26
0
ファイル: Token.cs プロジェクト: aj-hc/SZY
 private string Get_Auth_Token()
 {
     Dictionary<string, string> dic = new Dictionary<string, string>();
     dic.Add("username", UserName);
     dic.Add("password", PassWord);
     dic.Add("method", Fp_Common.FpMethod.gen_token.ToString());
     Fp_DAL.CallApi call = new CallApi(dic);
     string result = call.GetData();
     return result;
 }
コード例 #27
0
ファイル: Users.cs プロジェクト: aj-hc/SY
 //获取用户信息
 private static List<User> GetAll(Fp_Common.UnameAndPwd up)
 {
     Dictionary<string, string> dic = new Dictionary<string, string>();
     dic.Add("username", up.UserName);
     dic.Add("password", up.PassWord);
     dic.Add("method", Fp_Common.FpMethod.users.ToString());
     Fp_DAL.CallApi call = new CallApi(dic);
     List<Fp_Model.User> list = call.getdata<Fp_Model.User>("Users");
     return list;
 }
コード例 #28
0
ファイル: Token.cs プロジェクト: yandehao1/FP_Extend
        /// <summary>
        /// 检查登陆
        /// </summary>
        /// <returns></returns>
        private string Get_Auth_Token()
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("username", UserName);
            dic.Add("password", PassWord);
            dic.Add("method", Fp_Common.FpMethod.gen_token.ToString());
            Fp_DAL.CallApi call   = new CallApi(dic);
            string         result = call.GetData();

            return(result);
        }
コード例 #29
0
ファイル: UserFields.cs プロジェクト: yandehao1/FP_Extend
    {        //创建数据层对象
        #region 获取自定义字段集合 + public List<UserFields> UserFields()
        /// <summary>
        /// 获取自定义字段的集合
        /// </summary>
        /// <param name="up"></param>
        /// <returns></returns>
        public static List <Fp_Model.UserFields> GetAll(Fp_Common.UnameAndPwd up)
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("username", up.UserName);
            dic.Add("password", up.PassWord);
            dic.Add("method", Fp_Common.FpMethod.gen_token.ToString());
            Fp_DAL.CallApi             call = new CallApi(dic);
            List <Fp_Model.UserFields> list = call.getdata <Fp_Model.UserFields>("UserFields");

            return(list);
        }
コード例 #30
0
 private void SetupApis()
 {
     Error = new ErrorApi {
         Client = this
     };
     Account = new AccountApi {
         Client = this
     };
     Application = new ApplicationApi {
         Client = this
     };
     AvailableNumber = new AvailableNumberApi {
         Client = this
     };
     Bridge = new BridgeApi {
         Client = this
     };
     Domain = new DomainApi {
         Client = this
     };
     Call = new CallApi {
         Client = this
     };
     Conference = new ConferenceApi {
         Client = this
     };
     Message = new MessageApi {
         Client = this
     };
     NumberInfo = new NumberInfoApi {
         Client = this
     };
     PhoneNumber = new PhoneNumberApi {
         Client = this
     };
     Recording = new RecordingApi {
         Client = this
     };
     Transcription = new TranscriptionApi {
         Client = this
     };
     Media = new MediaApi {
         Client = this
     };
     Endpoint = new EndpointApi {
         Client = this
     };
     V2 = new ApiV2 {
         Message = new Bandwidth.Net.ApiV2.MessageApi {
             Client = this
         }
     };
 }
コード例 #31
0
        public async Task <ActionResult> UpdateProduct()
        {
            var product = new Product()
            {
                Id    = Guid.NewGuid(),
                Name  = "zzz",
                Harga = "Rp. 8.000.000",
                Warna = "Merah zzz"
            };
            var result = await CallApi.UpdateProduct(_configuration, _freshdeskClient, product);

            return(Ok("check via debugging"));
        }
コード例 #32
0
ファイル: .cs プロジェクト: Radic4l/MyMetroMobility
    public ConvertToJson()
    {
        List <Station> Stations = JsonConvert.DeserializeObject <List <Station> >(CallApi.ReceiveJson());

        foreach (Station OneStation in Stations)
        {
            Console.WriteLine(OneStation.Name);
            foreach (string Line in OneStation.Lines)
            {
                Console.WriteLine("\t" + Line);
            }
        }
    }
コード例 #33
0
ファイル: Login.cs プロジェクト: aj-hc/ZSSY
 public bool CheckLogin()
 {
     bool result = false;
     Dictionary<string, string> dicData = new Dictionary<string, string>();
     dicData.Add("username", up.UserName);
     dicData.Add("password", up.PassWord);
     dicData.Add("method", "gen_token");
     CallApi api = new CallApi(dicData);
     string strResult = api.PostData();
     if (!string.IsNullOrEmpty(strResult) && strResult.Contains("auth_token"))
     {
         result = true;
         Fp_Common.SessionHelper.SetSession(up.GetType().Name.ToString() + "_" + up.UserName, dicData);
     }
     else
     {
         Fp_Common.SessionHelper.Del(up.GetType().Name.ToString() + "_" + up.UserName);
     }
     return result;
 }