Beispiel #1
0
        /// <summary>
        /// Get the data for a specific date from market DB and create XML file using the data.
        /// </summary>
        private bool GetDataAndCreateXML(DateTime date)
        {
            UploadDao uploadDao = new UploadDao();

            DataSet ds;

            try
            {
                //get the data for a specific date.
                ds = uploadDao.GetDownloadsByDate(date, this.uploadType, this.assetGroupType);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    //Checking if both NSE and BSE data available.
                    if (assetGroupType == AssetGroupType.Equity && !IsNSEandBSEDataExists(ds))
                    {
                        return(false);
                    }

                    //Check if the folder exists. If not , create a folder
                    CreateFolder(Upload_Xml_Folder);
                    //form xml file name.
                    this.xmlFileName = "Uploads-" + "-" + this.uploadType.ToString() + "-" + assetGroupType.ToString() + "-" + date.ToString("d-MMM-yyyy") + "-" + DateTime.Now.ToFileTime() + ".xml";
                    ds.WriteXml(Upload_Xml_Folder + this.xmlFileName);
                    return(true);
                }
                else
                {
                    errorMessage = "Data not available.";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                errorMessage     = "Error occurred while creating XML file.";
                this.xmlFileName = string.Empty;
                return(false);
            }
        }