public PriceRange() { InitializeComponent(); connectionString = @"Server=DESKTOP-GPO65HT; Database=MobileDB; Integrated Security=True"; sqlConnection = new SqlConnection(connectionString); MobileInformation mobileInformation = new MobileInformation(); }
public async Task <IActionResult> UpdatePhoneNumber(MobileInformation request) { if (request.isConsent != true) { dc = new Dictionary <string, string>(); dc.Add("refCode", ""); dc.Add("result", "กรุณายืนยันความถูกต้องของข้อมูล"); return(BadRequest(dc)); } string msg = ""; result = new ResultUpdate(); acc.REST_KeepLogRequest("request", func.JsonSerialize(request)); if (string.IsNullOrEmpty(request.NewPhoneNumber) || string.IsNullOrEmpty(request.LineUserID)) { result.phoneNumber = ""; result.result = "Data is Empty"; acc.REST_KeepLogRequest("Data is Empty", func.JsonSerialize(request)); return(NotFound(result)); } msg = management.REST_UpdateMobileNumber(request.NewPhoneNumber, request.LineUserID, request.isConsent); result.phoneNumber = request.NewPhoneNumber; result.result = msg; return(Ok(result)); }
private void Insert(MobileInformation mobileInformation) { try { // sqlConnection.Open(); commandString = @"INSERT INTO MobileInformation ( ModelName,IMEI,Price) VALUES ('" + mobileInformation.Model + "', '" + mobileInformation.IMEI + "', '" + mobileInformation.Price + "')"; sqlCommand = new SqlCommand(commandString, sqlConnection); int isExecuted; isExecuted = sqlCommand.ExecuteNonQuery(); if (isExecuted > 0) { MessageBox.Show("Saved!!"); } else { MessageBox.Show("Not Saved!!"); } // sqlConnection.Close(); } catch (Exception exception) { MessageBox.Show(exception.Message); } }
private void HubConnectionStateChanged(StateChange stateChange) { if (stateChange.NewState == ConnectionState.Connected && this.mobileInformation != null) { Debug.WriteLine("Hub conectado - Enviando mensagem salva!"); this.chatHubProxy.Invoke(EXCHANGE_INFORMATION, this.mobileInformation.DeviceId, this.mobileInformation.Message, this.mobileInformation.Token); this.mobileInformation = null; } }
public HttpResponseMessage Post([FromBody] MobileInformationRequest request) { MobileInformation MobileInformation = new MobileInformation(); try { if (request.Userid != "" && request.Userid != null) { var birthdaylist = GInfraEntities.sp_mobiledetails(request.Userid, request.IMEI, request.Battery, request.LastActivity, request.LastLocation, request.AppVersion).ToList(); if (birthdaylist.Count > 0) { foreach (var item in birthdaylist) { if (item.returncode == "True") { MobileInformation.Status = true; MobileInformation.Message = "" + item.returnmessage + ""; } else if (item.returncode == "False") { MobileInformation.Status = true; MobileInformation.Message = "" + item.returnmessage + ""; } else { MobileInformation.Status = true; MobileInformation.Message = "" + item.returnmessage + ""; } } return(Request.CreateResponse(HttpStatusCode.OK, MobileInformation)); } else { MobileInformation.Status = false; MobileInformation.Message = "Pass all values"; return(Request.CreateResponse(HttpStatusCode.OK, MobileInformation)); } } else { MobileInformation.Status = false; MobileInformation.Message = "Bad request"; return(Request.CreateResponse(HttpStatusCode.OK, MobileInformation)); } //return Request.CreateResponse(HttpStatusCode.OK, BirthdayList); } catch (Exception ex) { MobileInformation.Status = false; MobileInformation.Message = "" + ex.Message + ""; return(Request.CreateResponse(HttpStatusCode.InternalServerError, MobileInformation)); } }
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { UITableViewCell cell = tableView.DequeueReusableCell(MobileCellIdentifier) ?? new UITableViewCell(UITableViewCellStyle.Subtitle, MobileCellIdentifier); MobileInformation MobileOfInterest = MobileInformation[indexPath.Row]; cell.TextLabel.Text = MobileOfInterest.CommonName; cell.DetailTextLabel.Text = MobileOfInterest.ScientificName; return(cell); }
private void SaveButton_Click(object sender, EventArgs e) { if (modelTextBox.Text == "") { label4.Text = ""; label4.Text = "Field Can not be Empty!"; return; } else { label4.Text = ""; } if (imeiTextBox.Text == "") { label5.Text = ""; label5.Text = "Field Can not be Empty!"; return; } else { label5.Text = ""; } if (priceTextBox.Text == "") { label6.Text = ""; label6.Text = "Field Can not be Empty!"; return; } else { label6.Text = ""; } MobileInformation mobileInformation = new MobileInformation(); mobileInformation.Model = modelTextBox.Text; mobileInformation.IMEI = imeiTextBox.Text; mobileInformation.Price = Convert.ToInt32(priceTextBox.Text); modelTextBox.Text = ""; imeiTextBox.Text = ""; priceTextBox.Text = ""; Insert(mobileInformation); }
private void Show(MobileInformation mobileInformation) { sqlConnection.Open(); // commandString = @"SELECT * FROM MobileInformation"; sqlCommand = new SqlCommand(commandString, sqlConnection); // SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand); DataTable dataTable = new DataTable(); sqlDataAdapter.Fill(dataTable); if (dataTable.Rows.Count > 0) { DisplayDataGridView.DataSource = dataTable; } // sqlConnection.Close(); }
public void SendMessage(string deviceId, string message, string token) { try { if (IsConnected) { Debug.WriteLine("Enviando Mensagem"); Debug.WriteLine($"{deviceId}\n{message}\n{token}"); this.chatHubProxy.Invoke(EXCHANGE_INFORMATION, deviceId, message, token); } else { this.mobileInformation = new MobileInformation(null, deviceId, message, token); Debug.WriteLine("O Client Hub ainda não está conectado. Guardando mensagem para enviar no futuro"); } } catch (Exception e) { Debug.WriteLine(e); throw e; } }
public void ExchangeInformation(string deviceId, string message, string token) { try { Clients.All.Log($"Mensagem recebida de {deviceId} com token {token}:\n{message}"); Guid guid = Guid.NewGuid(); StoredData.TryAdd(guid, new MobileInformation(Context.ConnectionId, deviceId, message, token)); Clients.All.Log($"Salvando item {guid}"); var toDelete = new List <Guid>(); foreach (var data in GetMatchingData(deviceId, token)) { MobileInformation info = data.Value; // Envia informação dos outros devices para o atual Clients.All.Log($"Enviando mensagem de {info.DeviceId} para {deviceId} com token {token}"); Clients.Caller.OnInformationReceived(info.DeviceId, info.Message); // Envia informação atual para os outros devices Clients.All.Log($"Enviando mensagem de {deviceId} para {info.DeviceId}"); Clients.Client(info.ConnectionId).OnInformationReceived(deviceId, message); toDelete.Add(data.Key); toDelete.Add(guid); } foreach (Guid key in toDelete) { MobileInformation info; StoredData.TryRemove(key, out info); Clients.All.Log($"Removendo item: Chave {key} - {info?.DeviceId}"); Clients.All.Log($"Sucesso {info != null}"); } } catch (Exception ex) { Clients.All.Log($"Ocorreu um erro {ex}"); } }
private void PriceRange_Load(object sender, EventArgs e) { MobileInformation mobileInformation = new MobileInformation(); Show(mobileInformation); }