Esempio n. 1
0
        public static void WriteDataConfig(string DataConfigFile, string filename)
        {
            Webb.Reports.DataProvider.WebbDataProvider PublicDataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider;

            string[] configs = PublicDataProvider.DBSourceConfig.CreateConfigStrings(filename);

            DataSet ds = VideoPlayBackManager.DataSource.Copy();

            DataTable dt = ConfigFileManager.AddColumn(null);

            DataRow dr = dt.NewRow();

            for (int i = 0; i < dt.Columns.Count; i++)
            {
                dr[i] = configs[i];
            }

            dt.Rows.Add(dr);

            dt.TableName = "ConfigTable";

            ds.Tables.Add(dt);

            try
            {
                ds.WriteXml(DataConfigFile, XmlWriteMode.WriteSchema);

                ds.Dispose();
            }
            catch (Exception ex)
            {
                ds.Dispose();
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 2
0
        public static void WriteInwFile(string filename)
        {
            try
            {
                string InwFile = filename.Replace(".repx", ".inw");

                if (filename.EndsWith(".repw"))
                {
                    InwFile = filename.Replace(".repw", ".inw");
                }

                Webb.Reports.DataProvider.WebbDataProvider PublicDataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider;

                string[] configs = PublicDataProvider.DBSourceConfig.CreateConfigStrings(filename);

                StreamWriter sw = new StreamWriter(InwFile, false);

                foreach (string config in configs)
                {
                    sw.WriteLine(config);
                }
                sw.Flush();

                sw.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
        private void InitList(GradingSection gradingSection)
        {
            this.textBox1.Text = gradingSection.SectionName;

            this.C_LBFields.Items.Clear();

            this.C_LBSelFields.Items.Clear();

            foreach (GradingPostion gradingPostion in gradingSection)
            {
                this.C_LBSelFields.Items.Add(gradingPostion);
            }

            HashCategories.Clear();

            this.cmbCategory.Visible = true;

            this.cmbCategory.Items.Clear();

            this.cmbCategory.Text = string.Empty;

            ArrayList fieldsInAllcategories = new ArrayList();

            DataSet backDataSource = Webb.Reports.DataProvider.VideoPlayBackManager.DataSource;

            Webb.Reports.DataProvider.WebbDataProvider PublicDataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider;

            if (backDataSource != null && PublicDataProvider != null && PublicDataProvider.DBSourceConfig != null && PublicDataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.CoachCRM && backDataSource.Tables.Count > 1)
            {
                #region add categoryies from Table

                ArrayList categories = new ArrayList();

                string strCategoriesName = backDataSource.Tables[0].TableName;

                categories.Add(strCategoriesName);

                HashCategories.Add(strCategoriesName, fieldsInAllcategories);

                foreach (DataRow dr in backDataSource.Tables[1].Rows)
                {
                    if (dr["CurrentField"] == null || (dr["CurrentField"] is System.DBNull))
                    {
                        continue;
                    }

                    string strTableName = dr["Category"].ToString();

                    string strField = dr["CurrentField"].ToString();

                    GradingPostion newGradingPostion = new GradingPostion();

                    newGradingPostion.Field = strField;

                    ArrayList fieldList;

                    if (HashCategories.Contains(strTableName))
                    {
                        fieldList = (ArrayList)HashCategories[strTableName];

                        if (!fieldList.Contains(newGradingPostion))
                        {
                            fieldList.Add(newGradingPostion);
                        }
                    }
                    else
                    {
                        fieldList = new ArrayList();

                        fieldList.Add(newGradingPostion);

                        categories.Add(strTableName);

                        HashCategories.Add(strTableName, fieldList);
                    }

                    if (!fieldsInAllcategories.Contains(newGradingPostion))
                    {
                        fieldsInAllcategories.Add(newGradingPostion);
                    }
                }
                #endregion

                foreach (string strKey in categories)
                {
                    this.cmbCategory.Items.Add(strKey);
                }

                this.cmbCategory.SelectedIndex = 0;
            }
            else
            {
                #region Advantage/Victory Data

                foreach (string strField in Webb.Data.PublicDBFieldConverter.AvialableFields)
                {
                    GradingPostion newGradingPostion = new GradingPostion();

                    newGradingPostion.Field = strField;

                    fieldsInAllcategories.Add(newGradingPostion);
                }

                strCategory = "[All Avaliable Fields]";

                HashCategories.Add(strCategory, fieldsInAllcategories);

                this.cmbCategory.Items.Add(strCategory);

                this.cmbCategory.SelectedIndex = 0;

                #endregion
            }
        }
        private void InitList(string initField)
        {
            this.LstFields.Items.Clear();

            HashCategories.Clear();

            this.cmbCategory.Visible = true;

            this.cmbCategory.Items.Clear();

            DataSet backDataSource = Webb.Reports.DataProvider.VideoPlayBackManager.DataSource;

            Webb.Reports.DataProvider.WebbDataProvider PublicDataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider;

            if (PublicDataProvider != null && PublicDataProvider.DBSourceConfig != null && PublicDataProvider.DBSourceConfig.WebbDBType == WebbDBTypes.CoachCRM && backDataSource != null && backDataSource.Tables.Count > 1)
            {
                #region add categoryies from Table

                List <string> categories = new List <string>();

                string strCategoriesName = backDataSource.Tables[0].TableName;

                categories.Add(strCategoriesName);

                GroupDescriptionCollection fieldsInAllcategories = new GroupDescriptionCollection();

                HashCategories.Add(strCategoriesName, fieldsInAllcategories);

                foreach (DataRow dr in backDataSource.Tables[1].Rows)
                {
                    if (dr["CurrentField"] == null || (dr["CurrentField"] is System.DBNull))
                    {
                        continue;
                    }

                    string strTableName = dr["Category"].ToString();

                    string strField = dr["CurrentField"].ToString();

                    string strHeader = dr["DefaultHeader"].ToString();

                    string TableNameId = strTableName + "ID";

                    GroupDescriptionCollection fieldList;

                    if (HashCategories.Contains(strTableName))
                    {
                        fieldList = (GroupDescriptionCollection)HashCategories[strTableName];

                        if (!fieldList.Contains(strField))
                        {
                            fieldList.Add(strField, strHeader);
                        }
                    }
                    else
                    {
                        fieldList = new GroupDescriptionCollection();

                        fieldList.Add(strField, strHeader);

                        categories.Add(strTableName);

                        HashCategories.Add(strTableName, fieldList);
                    }

                    if (!fieldList.Contains(TableNameId))
                    {
                        fieldList.Add(TableNameId, TableNameId);
                    }

                    if (!fieldsInAllcategories.Contains(strField))
                    {
                        fieldsInAllcategories.Add(strField, strHeader);
                    }

                    if (!fieldsInAllcategories.Contains(TableNameId))
                    {
                        fieldsInAllcategories.Add(TableNameId, TableNameId);
                    }
                }
                #endregion

                this.cmbCategory.Text = string.Empty;

                foreach (string strKey in categories)
                {
                    this.cmbCategory.Items.Add(strKey);
                }

                this.cmbCategory.SelectedIndex = 0;
            }
            else
            {
                #region Advantage /Victory Data

                GroupDescriptionCollection allGroupDescription = new GroupDescriptionCollection();

                foreach (string strfield in Webb.Data.PublicDBFieldConverter.AvialableFields)
                {
                    //this.LstFields.Items.Add(new GroupDescription(strfield, strfield));

                    allGroupDescription.Add(new GroupDescription(strfield, strfield));
                }

                strCategory = "[All Avaliable Fields]";

                HashCategories.Add(strCategory, allGroupDescription);

                this.cmbCategory.Items.Add(strCategory);

                this.cmbCategory.SelectedIndex = 0;

                #endregion
            }

            this.LstFields.SelectedIndex = this.LstFields.FindString(initField);
        }
Esempio n. 5
0
        public static void WriteDataConfig(WebbDBTypes webbType, string TargetPath)
        {
            Webb.Reports.DataProvider.WebbDataProvider PublicDataProvider = Webb.Reports.DataProvider.VideoPlayBackManager.PublicDBProvider;

            string[] configs = PublicDataProvider.DBSourceConfig.CreateConfigStrings(string.Empty);

            DataSet ds = new DataSet("ConfigDataSet");

            DataTable configTable;

            DataRow productRow;

            bool isNewRow = true;

            #region Get the row which contains the product

            if (File.Exists(TargetPath))
            {
                try
                {
                    ds.ReadXml(TargetPath);

                    configTable = ds.Tables[0];

                    DataRow[] dataRows = configTable.Select("Product='Product:" + webbType.ToString() + "'");

                    if (dataRows.Length == 0)
                    {
                        productRow = configTable.NewRow();

                        isNewRow = true;
                    }
                    else
                    {
                        productRow = dataRows[0];

                        isNewRow = false;
                    }
                }
                catch
                {
                    ds = new DataSet();

                    configTable = AddColumn(null);

                    ds.Tables.Add(configTable);

                    productRow = configTable.NewRow();

                    isNewRow = true;
                }
            }
            else
            {
                configTable = AddColumn(null);

                ds.Tables.Add(configTable);

                productRow = configTable.NewRow();

                isNewRow = true;
            }

            #endregion

            try
            {
                for (int i = 0; i < configTable.Columns.Count; i++)
                {
                    productRow[i] = configs[i];
                }

                if (isNewRow)
                {
                    configTable.Rows.Add(productRow);
                }

                ds.AcceptChanges();

                ds.WriteXml(TargetPath);

                ds.Dispose();
            }
            catch (Exception ex)
            {
                ds.Dispose();

                MessageBox.Show(ex.Message);
            }
        }