Ejemplo n.º 1
0
        /// <summary>
        /// Creates the dataset in Power BI when user clicks save. Dataset will be created based on destination connection string and source tables
        /// </summary>
        /// <returns>bool, true if dataset does not exists while creating job</returns>
        private bool CreateDatasetPowerBI(out string[] NewDataset)
        {
            NewDataset = null;

            //Check the datasets exists or not...
            UserCredential uc           = new UserCredential(txtUserID.Text, txtPwd.Text);
            PollPush       objPollPush  = new PollPush(uc, txtClientID.Text);
            bool           bIsValidated = false;
            var            datasets     = objPollPush.GetAllDatasets().Datasets(txtDatasetName.Text);

            if (datasets.Count() != 0)
            {
                MessageBox.Show("'" + txtDatasetName.Text.ToUpper() + "' dataset already exists! Delete it before attempting to re-create.", "Job Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txtDatasetName.Text = "";
                txtDatasetName.Focus();
                bIsValidated = false;
            }
            else
            {
                //Create new dataset
                objPollPush.ConnectionString   = ConnectionString;
                objPollPush.PowerBIDatasetName = txtDatasetName.Text;
                objPollPush.IsInitialLoad      = chkIsFullLoad.Checked;
                string sTableName = "";
                foreach (ListViewItem lviChecked in listView1.CheckedItems)
                {
                    if (sTableName == "")
                    {
                        sTableName = lviChecked.Text;
                    }
                    else
                    {
                        sTableName += "," + lviChecked.Text;
                    }
                }

                bIsValidated = objPollPush.CreateDatasets(sTableName, xdData.SelectSingleNode("/Jobs/Job[@Name='" + txtJobName.Text + "']"), out NewDataset);
            }

            return(bIsValidated);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates the dataset in Power BI when user clicks save. Dataset will be created based on destination connection string and source tables
        /// </summary>
        /// <returns>bool, true if dataset does not exists while creating job</returns>
        private bool CreateDatasetPowerBI(out string[] NewDataset)
        {
            NewDataset = null;

                //Check the datasets exists or not...
                UserCredential uc = new UserCredential(txtUserID.Text, txtPwd.Text);
                PollPush objPollPush = new PollPush(uc,txtClientID.Text);
                bool bIsValidated = false;
                var datasets = objPollPush.GetAllDatasets().Datasets(txtDatasetName.Text);

                if (datasets.Count() != 0)
                {
                    MessageBox.Show("'" + txtDatasetName.Text.ToUpper() + "' dataset already exists! Delete it before attempting to re-create.", "Job Settings", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    txtDatasetName.Text = "";
                    txtDatasetName.Focus();
                    bIsValidated = false;
                }
                else
                {
                    //Create new dataset
                    objPollPush.ConnectionString = ConnectionString;
                    objPollPush.PowerBIDatasetName = txtDatasetName.Text;
                    objPollPush.IsInitialLoad = chkIsFullLoad.Checked;
                    string sTableName = "";
                    foreach (ListViewItem lviChecked in listView1.CheckedItems)
                    {
                        if (sTableName == "")
                            sTableName = lviChecked.Text;
                        else
                            sTableName += "," + lviChecked.Text;
                    }

                   bIsValidated = objPollPush.CreateDatasets(sTableName,xdData.SelectSingleNode("/Jobs/Job[@Name='" + txtJobName.Text + "']"),out NewDataset);

                }

                return bIsValidated;
        }