示例#1
0
        public static string LoadBasicData(string id)
        {
            string message               = "Sucussfully loaded data for ";
            string _nseUrlIo             = ConfigurationManager.AppSettings["NseUrlIO"].Replace("&", "&");
            string _nseUrlBasic          = ConfigurationManager.AppSettings["NseUrlBasic"].Replace("&", "&");
            string _nifty50              = ConfigurationManager.AppSettings["nifty50"].Replace("&", "&");
            string _allFO                = ConfigurationManager.AppSettings["AllFO"].Replace("&", "&");
            string _indexOnly            = ConfigurationManager.AppSettings["IndexOnly"].Replace("&", "&");
            string _banknifty            = ConfigurationManager.AppSettings["Banknifty"].Replace("&", "&");
            string _expiryDate           = ConfigurationManager.AppSettings["ExpiryDate"];
            string _masterDMAExcelSource = ConfigurationManager.AppSettings["MasterDMAExcelSource"];
            string _TodayCSVFile         = ConfigurationManager.AppSettings["TodayCSVFile"];
            string _masterDatapathOI     = ConfigurationManager.AppSettings["MasterDatapathOI"];
            string _masterDatapathBasic  = ConfigurationManager.AppSettings["MasterDatapathBasic"];
            string _masterDatapathDMA    = ConfigurationManager.AppSettings["MasterDatapathDMA"];



            BulkEntity objData  = new BulkEntity();
            Dma        objDma   = new Dma();
            OBJtoXML   xmltoObj = new OBJtoXML();

            try
            {
                string _list = "";

                if (id.Contains("IndexOnly"))
                {
                    _list   = _indexOnly;
                    message = message + " IndexOnly,";
                }
                else if (id.Contains("Banknifty"))
                {
                    _list   = _banknifty;
                    message = message + " Banknifty,";
                }
                else if (id.Contains("nifty50"))
                {
                    _list   = _nifty50;
                    message = message + " nifty50,";
                }
                else
                {
                    _list   = _allFO;
                    message = message + " All listed items.,";
                }

                foreach (string item in id.Split(','))
                {
                    if (item == "BasicData")
                    {
                        objData.BasicData = BasicData.ColletData(_nseUrlBasic, _list);
                        message           = message + " BasicData,";
                        xmltoObj.CreateXML(objData.BasicData, _masterDatapathBasic, "basicdata", true);

                        //Need to implement this one when master data been ready
                        //List<KeyValue> objLtpPrices = GenerateLastPrices(objData.BasicData);
                        //objData.DMAData = objDma.GetDmaData(_masterDMAExcelSource, objLtpPrices, "");
                        //message = message + " DMA,";
                        //xmltoObj.CreateXML(objData.DMAData, _masterDatapathDMA, "dmadata", true);
                    }
                    if (item == "OI")
                    {
                        IOData objOI = new IOData();
                        objData.OIData = objOI.LoadOIData(_nseUrlIo, _expiryDate, _list);
                        message        = message + " OI,";
                        xmltoObj.CreateXML(objData.OIData, _masterDatapathOI, "openinterest", true);
                    }
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }
            return(message);
        }