示例#1
0
        static void Main(string[] args)
        {
            DataTable       dtNSE       = new DataTable();
            DataTable       dtBSE       = new DataTable();
            GetDownloadData objDownload = new GetDownloadData();
            DateTime        priceDate   = new DateTime();
            UploadBo        uploadBo    = new UploadBo();
            string          xmlPath     = ConfigurationManager.AppSettings["xmlFilePath"].ToString();

            priceDate = DateTime.Today;
            if (DateTime.Now.Hour < 23)
            {
                priceDate = priceDate.AddDays(-1);
            }
            dtNSE = objDownload.downloadNSEEquityData(100, priceDate, priceDate);
            Console.WriteLine("NSE Download Date:" + dtNSE.Rows[0][0].ToString() + " Result: " + dtNSE.Rows[0][1].ToString() + " No Of Records: " + dtNSE.Rows[0][2].ToString());
            dtBSE = objDownload.downloadBSEEquityData(100, priceDate, priceDate);
            Console.WriteLine("BSE Download Date:" + dtBSE.Rows[0][0].ToString() + " Result: " + dtBSE.Rows[0][1].ToString() + " No Of Records: " + dtBSE.Rows[0][2].ToString());


            UploadType     uploadType;
            AssetGroupType assetGroupType;

            uploadType     = (UploadType)(1);
            assetGroupType = (AssetGroupType)(1);

            uploadBo.Upload_Xml_Folder = xmlPath;
            uploadBo.currentUserId     = 100;
            uploadBo.Upload(uploadType, assetGroupType);
            Console.WriteLine("Completed Equity Price Uploads");
        }
        protected void OnClick_Download(object sender, EventArgs e)
        {
            DataTable dt = new DataTable();

            userVo = (UserVo)Session["userVo"];

            if (txtFromDate.Text == "" || txtToDate.Text == "")
            {
                errDateNull.Visible = true;
                errDateNull.Text    = "'From Date' or 'To Date' cannot be null";
            }
            else
            {
                if (ddlAssetGroup.SelectedValue == Contants.Source.Equity.ToString() && ddlSource.SelectedValue == Contants.NSE)
                {
                    dt = objDownload.downloadNSEEquityData(userVo.UserId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                }
                if (ddlAssetGroup.SelectedValue == Contants.Source.Equity.ToString() && ddlSource.SelectedValue == Contants.BSE)
                {
                    dt = objDownload.downloadBSEEquityData(userVo.UserId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                }
                if (ddlAssetGroup.SelectedValue == Contants.Source.MF.ToString() && ddlSource.SelectedValue == Contants.AMFI)
                {
                    dt = objDownload.downloadAmfiHistoricalData(userVo.UserId, Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text));
                }
                gvResult.DataSource = dt;
                gvResult.DataBind();
            }
        }