quarta-feira, 29 de julho de 2015

Hashtable

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Collections;
using System.Xml;



namespace Lapuinka.Util
{
    class LoadingIMG
    {
        private Hashtable hashClient = null;
        private Hashtable hashServer = null;

        public LoadingIMG(Hashtable client, Hashtable server)
        {
            hashClient = client;
            hashServer = server;
        }

    
        public Hashtable createHashURLDownload()
        {
            Hashtable valueReturn = new Hashtable();

            foreach (DictionaryEntry temp in hashServer)
            {
                DataIMG dataImgServer = temp.Value as DataIMG;
                DataIMG dataImgClient = hashClient[temp.Key] as DataIMG;

                if (dataImgClient == null || !(dataImgServer.Version.Equals(dataImgClient.Version)) ) {

                    String nameImg = temp.Key.ToString(); ;

                    String baseDir = nameImg.Substring(0, nameImg.IndexOf("/"));
                    String fileName = nameImg.Substring(nameImg.IndexOf("/") + 1);
                    String url = baseDir + "/" + fileName + "/" + dataImgServer.Dig + "/" + fileName;

                    valueReturn.Add(nameImg,url);
                }
            }

            return valueReturn;
        }
    }

}

...

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using System.Diagnostics;



        [WebMethod]
        public int  SearchSource (string userName, string password)
        {
            try
            {
                Type objTypeDll = Type.GetTypeFromProgID("Linha.ClassUtil", true);
                object objDllUtil = Activator.CreateInstance(objTypeDll);
                object[] objArgsMov = new object[] { userName, password, true };

                object nEntidadeObj = objTypeDll.InvokeMember("GetSearch", System.Reflection.BindingFlags.InvokeMethod, null, objDllUtil, objArgsMov);
                int nEntidade = int.Parse(nEntidadeObj.ToString());
                return nEntidade;
            }
            catch (Exception ex)
            {
                EventLogProp.WriteEntry(ex.Message + " : " + ex.StackTrace);
                return -1;
            }
        }


Postar um comentário