Пример #1
0
        public void ProcessData()
        {
            try
            {
                string[] _logfilePath          = ConfigurationManager.AppSettings["timeToLoadData"].Split(',');
                string[] _updateDMADataNow     = ConfigurationManager.AppSettings["UpdateDMADataNow"].Split(',');
                string[] _loadDataNow          = ConfigurationManager.AppSettings["LoadDataNow"].Split(',');
                string   _masterDatapathBasic  = ConfigurationManager.AppSettings["MasterDatapathBasic"];
                string   _masterDMAExcelSource = ConfigurationManager.AppSettings["MasterDMAExcelSource"];
                string   _masterDatapathDMA    = ConfigurationManager.AppSettings["MasterDatapathDMA"];

                string _defaultDate = "0";


                TimeSpan now = DateTime.Now.TimeOfDay;
                foreach (string item in _logfilePath)
                {
                    int h = Convert.ToInt32(item.Split('.')[0]);
                    int s = Convert.ToInt32(item.Split('.')[1]);

                    TimeSpan start = new TimeSpan(h, s, 0);
                    TimeSpan end   = new TimeSpan(h, s + 3, 0);

                    if ((now > start) && (now < end))
                    {
                        //Service processing the request in Market time
                        IntermediateClass obj = new IntermediateClass();
                        MessageContext.MessageLog(obj.ProcessRequest("BasicData,OI"));
                        MessageContext.MessageLog(obj.LoadMCData());
                    }



                    if (_loadDataNow.ToString().ToUpper() == "TRUE")
                    {
                        //Service processing the request in Market time
                        IntermediateClass obj = new IntermediateClass();
                        MessageContext.MessageLog(obj.ProcessRequest("BasicData,OI-Using Loaded now option."));
                        MessageContext.MessageLog(obj.LoadMCData());
                    }
                }

                //post market time service updating the Master data excel files
                TimeSpan startPost = new TimeSpan(17, 0, 0);
                TimeSpan endPost   = new TimeSpan(20, 0, 0);
                if ((now > startPost) && (now < endPost))
                {
                    IntermediateClass obj     = new IntermediateClass();
                    string            message = obj.RefreshData(_defaultDate);
                    if (message.Contains("Updated sucussfully"))
                    {
                        try
                        {
                            BasicDataLogic objList  = new BasicDataLogic();
                            Dma            objDma   = new Dma();
                            OBJtoXML       xmltoObj = new OBJtoXML();

                            List <CompanyDetails> basicData    = objList.UpdateDMAMasterSource(_masterDatapathBasic, _defaultDate);
                            List <KeyValue>       objLtpPrices = GeneratePrices(basicData);
                            List <Rank>           dMADataRank  = objDma.GetDmaData(_masterDMAExcelSource, objLtpPrices, "");
                            message = message + " DMA,";
                            xmltoObj.CreateXML(dMADataRank, _masterDatapathDMA, "DMAData", false);
                        }
                        catch (Exception ex)
                        {
                            ErrorContext.ErrorLog("Error in PostRefresh DMA Data" + ex.Message);
                        }
                    }
                    MessageContext.MessageLog(message);
                }
                if (_updateDMADataNow.ToString().ToUpper() == "TRUE")
                {
                    IntermediateClass obj = new IntermediateClass();
                    MessageContext.MessageLog(obj.RefreshData(_defaultDate));
                    MessageContext.MessageLog("DMA data updated using updateDMADataNow option.");
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry(ex.Message, EventLogEntryType.Error);
                ErrorContext.ErrorLog("Problem when Gettign the files   " + ex.Message.ToString());
            }
        }
Пример #2
0
        public void ProcessData()
        {
            try
            {
                string[] _logfilePath          = ConfigurationManager.AppSettings["timeToLoadData"].Split(',');
                string[] _updateDMADataNow     = ConfigurationManager.AppSettings["UpdateDMADataNow"].Split(',');
                string[] _loadDataNow          = ConfigurationManager.AppSettings["LoadDataNow"].Split(',');
                string   _masterDMAExcelSource = ConfigurationManager.AppSettings["MasterDMAExcelSource"];
                string   _masterDatapathDMA    = ConfigurationManager.AppSettings["MasterDatapathDMA"];
                string   _masterDatapathBasic  = ConfigurationManager.AppSettings["bnUrl"];
                string   _bnCurrentExpiryDate  = ConfigurationManager.AppSettings["BnNextExpiryDate"];
                string   _bnBNSeriousValue     = ConfigurationManager.AppSettings["BNSeriousValue"];
                string   _bnCurrentUrlValue    = ConfigurationManager.AppSettings["CurrentUrlValue"];
                int      _count = Convert.ToInt32(ConfigurationManager.AppSettings["IndexNumbers"]);


                string _defaultDate = "0";

                TimeSpan now = DateTime.Now.TimeOfDay;
                foreach (string item in _logfilePath)
                {
                    int h = Convert.ToInt32(item.Split('.')[0]);
                    int s = Convert.ToInt32(item.Split('.')[1]);

                    TimeSpan start = new TimeSpan(h, s, 0);
                    TimeSpan end   = new TimeSpan(h, s + 3, 0);

                    if ((now > start) && (now < end))
                    {
                        try
                        {
                            MessageContext.MessageLog("Started Loading for options");
                            NIndex();
                            BNCurrentIndex();
                            BNNextIndex();
                            MessageContext.MessageLog("Completed Loading for options");
                            try
                            {
                                MessageContext.MessageLog("Started Loading for Stk options");
                                Stk();
                                MessageContext.MessageLog("Completed Loading for Stk options ");
                            }
                            catch (Exception ex)
                            {
                                ErrorContext.ErrorLog("Error in Stk()" + ex.Message.ToString());
                            }
                        }
                        catch (Exception ex)
                        {
                            ErrorContext.ErrorLog("Error Loading for options   " + ex.Message.ToString());
                        }
                    }
                }

                //post market time service updating the Master data excel files
                TimeSpan startPost = new TimeSpan(17, 0, 0);
                TimeSpan endPost   = new TimeSpan(20, 0, 0);
                if ((now > startPost) && (now < endPost))
                {
                }
            }
            catch (Exception ex)
            {
                EventLog.WriteEntry(ex.Message, EventLogEntryType.Error);
                ErrorContext.ErrorLog("Problem when Gettign the files   " + ex.Message.ToString());
            }
        }