ASP NET JQuery Table with refreshing content

http://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP

https://evolpin.wordpress.com/2011/04/12/asp-net-mvc-partialview-with-ajax/
simple example of jquery ajax mvc

c# timer without timer

public void OnStart()
{
    _stop.Reset();
    _registeredWait = ThreadPool.RegisterWaitForSingleObject(_stop, 
        new WaitOrTimerCallback(PeriodicProcess), null, 5000, false);
}

public void OnStop()
{
    _stop.Set();
}

private void PeriodicProcess(object state, bool timeout)
{
    if (timeout)
    {
        // Periodic processing here
    }
    else
        // Stop any more events coming along
        _registeredWait.Unregister(null);
}

private ManualResetEvent _stop = new ManualResetEvent(false);
private RegisteredWaitHandle _registeredWait;


//It's the method for periodically calling some methothds without using Timers. I think it is more elegant solution for this.

//Waiting process works in separate thread pool. Calling method works in main thread. Be carefull with that.


c# send get responce/request

using System.Net;
using System.Collections.Specialized;
POST
using (var client = new WebClient())
{
    var values = new NameValueCollection();
    values["thing1"] = "hello";
    values["thing2"] = "world";

    var response = client.UploadValues("http://www.mydomain.com/recepticle.aspx", values);

    var responseString = Encoding.Default.GetString(response);
}
GET
using (var client = new WebClient())
{
    var responseString = client.DownloadString("http://www.mydomain.com/recepticle.aspx");
}
WebProxy wproxy = new WebProxy("10.10.0.2:8080", true);
wproxy.Credentials = new NetworkCredential("int", "FSinet1234", "fsrar");
webclient.Proxy=wpproxy;


http://stackoverflow.com/questions/4015324/http-request-with-post

c# XML Creating class for serialization

What do we want

How to do

    public class wo_ids
    {
        [System.Xml.Serialization.XmlElementAttribute("id")]
        public string[] id {get;set;}
    }

c# RunProcedure with logging

    string RunProc(string s,Func<string,string> _a)
        {
            try
            {
                return _a.Invoke(s);
            }
            catch (Exception e)
            {
                var msg = e.Message;
                if (e.InnerException != null)
                    msg = msg + e.InnerException.Message + e.StackTrace;
                msg = msg + "||InString:" + s;
                Common.WriteLog(DateTime.Now.ToString() + ":" + msg);
                return msg;
            }
        }
            return RunProc(s,(x) =>
            {
                return "success";
            });

c# - Xml serialization - Hide tags with null values

You can create a function with the pattern ShouldSerialize{PropertyName} which tells the XmlSerializer if it should serialize the member or not.
For example, if your class property is called MyNullableInt you could have
public bool ShouldSerializeMyNullableInt() 
{
  return MyNullableInt.HasValue;
}
Here is a full sample
public class Person
{
  public string Name {get;set;}
  public int? Age {get;set;}
  public bool ShouldSerializeAge()
  {
    return Age.HasValue;
  }
}
Serialized with the following code
Person thePerson = new Person(){Name="Chris"};
XmlSerializer xs = new XmlSerializer(typeof(Person));
StringWriter sw = new StringWriter();
xs.Serialize(sw, thePerson);
Results in the followng XML - Notice there is no Age
<Person xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <Name>Chris</Name>
</Person>

Пишем СМЭВ сервис c#

Для проверки валидности вашего xml
http://smev.gosuslugi.ru/portal/services-tools.jsp

Будем делать чтобы сервис соответствовал методическим рекомендациям по разработке веб-сервисов версии 2.5.6

Подпись по формату ЭП-ОВ

Отправляем тем способом который без доп обертки в Envelope
http://msnet-developer.blogspot.ru/2013/03/wcf.html