Skip to content

Instantly share code, notes, and snippets.

View ChrisMoney's full-sized avatar

Chris Weathers ChrisMoney

  • Onevested
  • St. Louis, MO
View GitHub Profile
@ChrisMoney
ChrisMoney / wcf-implementation
Last active February 9, 2017 17:19
WCF - Implementation
// Right click Service Reference in Visual Studio
// Click Configuration
// Add WSDL url
// Make sure the service returns as a list & dictionary
private bool SaveToSettingsWeb(KIOSK_Properties dto)
{
List<string> macIds = CurrentIP.GetLocalMacs().ToList<string>();
// proxy uses settings from the client config file which points to the actual WCF config file
@ChrisMoney
ChrisMoney / wcf-interface
Created February 8, 2017 23:19
WCF Interfaces
using System.Collections.Generic;
using System.Data.Entity.Core.Objects;
using System.ServiceModel;
using Intercard.WS_Kiosk.DataContext;
using System.Runtime.Serialization;
using System.Data;
namespace WS_Kiosk
{
@ChrisMoney
ChrisMoney / wcf-methods
Last active February 9, 2017 17:16
WCF - Methods
public class Kiosk : IKiosk
{
public DataTable GetKiosk(int locId, int corpId)
{
SqlConnection connection = new SqlConnection(SqlManager.FetchConnectionString(SqlManager.DEBITCARD_DATA, corpId));
using (SqlCommand command = new SqlCommand("ST_DC_KIOSK_GetSettings", connection))
{
command.CommandType = CommandType.StoredProcedure;
@ChrisMoney
ChrisMoney / likeFunction.php
Last active January 23, 2017 03:35
Like Function
<script>
$(document).ready(function () {
$("body").delegate(".btnApprove", "click", function () {
var parentDiv = $(this).closest("div[id^=approvals]");
var data = {
postID: $(this).closest('div').find('.postID').val(),
ID: $(this).closest('div').find('.ID').val(),
memberID: $(this).closest('div').find('.memberID').val()
//add other properties similarly
}
@ChrisMoney
ChrisMoney / uploadImage.cs
Last active November 10, 2016 22:59
Upload File/Image in WPF, Win Forms
private void btnBrowse_Click_1(object sender, EventArgs e)
{
OpenFileDialog openFile = new OpenFileDialog();
openFile.Filter = "Images only. | *.jpg; *.jpeg; *.png; *.gif;";
DialogResult dialogResult = openFile.ShowDialog();
Image img = Image.FromFile(openFile.FileName);
@ChrisMoney
ChrisMoney / parentProject-pass-to-RefProject.cs
Last active November 8, 2016 22:04
Referenced project gets and sets data from parent project - C#
namespace ReferencedProject
{
public class ReferencedClass
{
// use public static Properties in a non static class to pass and set in parent project
public static int LocId;
public static int DeviceTag;
}
}
@ChrisMoney
ChrisMoney / doc.xslt
Last active October 26, 2016 19:14
XSLT (eXtensible Stylesheet Language Transformations) styles XML
<?xml version="1.0" encoding="UTF-8"?>
<html xsl:version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<body style="font-family:Arial;font-size:12pt;background-color:#EEEEEE">
<xsl:for-each select="breakfast_menu/food">
<div style="background-color:teal;color:white;padding:4px">
<span style="font-weight:bold"><xsl:value-of select="name"/> - </span>
<xsl:value-of select="price"/>
</div>
<div style="margin-left:20px;margin-bottom:1em;font-size:10pt">
<p>
@ChrisMoney
ChrisMoney / schema.wsdl
Created October 26, 2016 14:27
WSDL that adheres to an XSD
http://192.168.0.134/WS_AuthenticateAndAuthorize/AuthenticateAndAuthorize1.asmx?wsdl
<wsdl:definitions xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://tempuri.org/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:import namespace="http://www.tempuri.org/AuthorizedForLocatiionAndApp.xsd"/>
<s:import namespace="http://www.tempuri.org/EmployeeGameCardPlay_List.xsd"/>
<s:import namespace="http://www.tempuri.org/SecurtyGroupsDataset.xsd"/>
<s:import namespace="http://www.tempuri.org/PDA_RedemptionCounterPassCardList.xsd"/>
<s:import namespace="http://www
@ChrisMoney
ChrisMoney / tcpMethods.cs
Last active September 29, 2016 14:08
TCP (Transmission Control Protocol) Methods
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Net.Sockets;
using System.Runtime.Serialization;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using ClassLibrary_Accounts;
@ChrisMoney
ChrisMoney / tcp.cs
Last active September 29, 2016 14:58
TCP (Transmission Control Protocol) IP + Port = Socket
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net;
using System.Net.Sockets;
namespace SocketSender