public void DownloadImages()
        {
            Int32 year, date, month, pid, eid;

            month = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["month"].ToString());
            year  = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["year"].ToString());
            date  = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["date"].ToString());
            eid   = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["eid"].ToString());
            pid   = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PID"].ToString());

            DataTable dtlServiceResponse = new DataTable();
            int       resultCount;
            Dictionary <double, string> imageDictionary;
            utlSoapClient objSoapProxy = new utlSoapClient();

            try
            {
                dtlServiceResponse = objSoapProxy.geturlandphotoidtable(eid, new DateTime(year, month, date), pid);
            }
            catch (Exception)
            {
                throw;
            }


            resultCount = dtlServiceResponse.Rows.Count;


            if (resultCount > 0)
            {
                imageDictionary = new Dictionary <double, string>();
                for (int i = 0; i < resultCount; i++)
                {
                    imageDictionary.Add(Convert.ToInt64(dtlServiceResponse.Rows[i].ItemArray[0]),
                                        dtlServiceResponse.Rows[i].ItemArray[1].ToString());
                }

                var list = imageDictionary.Keys.ToList();
                list.Sort();
                if (GetLastPID() < list[resultCount - 1])
                {
                    DownloadImages(imageDictionary);
                }
            }
        }
        public void DownloadImages()
        {
            Int32 year, date, month, pid, eid;
            month = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["month"].ToString());
            year = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["year"].ToString());
            date = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["date"].ToString());
            eid = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["eid"].ToString());
            pid = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PID"].ToString());

            DataTable dtlServiceResponse = new DataTable();
            int resultCount;
            Dictionary<double, string> imageDictionary;
            utlSoapClient objSoapProxy = new utlSoapClient();

            try
            {
                dtlServiceResponse = objSoapProxy.geturlandphotoidtable(eid, new DateTime(year, month, date), pid);
            }
            catch (Exception)
            {

                throw;
            }

            resultCount = dtlServiceResponse.Rows.Count;

            if (resultCount > 0)
            {
                imageDictionary = new Dictionary<double, string>();
                for (int i = 0; i < resultCount; i++)
                {
                    imageDictionary.Add(Convert.ToInt64(dtlServiceResponse.Rows[i].ItemArray[0]),
                                        dtlServiceResponse.Rows[i].ItemArray[1].ToString());
                }

                var list = imageDictionary.Keys.ToList();
             list.Sort();
                if (GetLastPID() < list[resultCount - 1])
                {
                    DownloadImages(imageDictionary);
                }

            }
        }