// 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)); }
// GET: Payment public ActionResult Index() { CallApi asd = new CallApi("https://localhost:44353", new System.Net.Http.HttpClient()); var asd2 = asd.Make3DKuveytPaymentAsync().Result; return(View()); }
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(); }
// 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)); }
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); } }
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); } }
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); } }
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); }
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)); } }
public async Task <ActionResult> GetData() { var productId = Guid.NewGuid(); Product products = await CallApi.Product(_configuration, _freshdeskClient, productId); return(Ok("check via debugging")); }
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)); }
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))); }
// 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)); }
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 })); }
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 })); }
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)); }
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)); }
// 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)); }
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")); }
public ActionResult NewScrape() { if (ModelState.IsValid) { var apiCall = new ApiCall(); CallApi.GetStockData(apiCall); } return(Redirect("Index")); }
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)); }
// 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)); }
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()); }
// 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)); }
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); }
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; }
//获取用户信息 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; }
/// <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); }
{ //创建数据层对象 #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); }
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 } }; }
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")); }
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); } } }
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; }