示例#1
0
        private bool UpdateFields()
        {
            if (this.textBox1.Text.Trim() == string.Empty)
            {
                Webb.Utilities.MessageBoxEx.ShowError("Invalid section name!");

                return(false);
            }

            if (this.C_LBSelFields.Items.Count < 1)
            {
                Webb.Utilities.MessageBoxEx.ShowError("it should have 1 postion field at least!");

                return(false);
            }

            _GradingSection = new GradingSection();

            _GradingSection.SectionName = this.textBox1.Text;

            _GradingSection.Clear();

            foreach (GradingPostion gradingPosition in this.C_LBSelFields.Items)
            {
                _GradingSection.Add(gradingPosition);
            }
            return(true);
        }
        private void BtnAddSections_Click(object sender, EventArgs e)
        {
            GradingSection gradingSection = new GradingSection();

            gradingSection.SectionName = string.Empty;

            GradingPostionsEditForm gradingPostionsEditForm = new GradingPostionsEditForm(gradingSection);

            if (gradingPostionsEditForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            gradingSection = gradingPostionsEditForm._GradingSection;

            if (!this.lstGradingSections.Items.Contains(gradingSection))
            {
                this.lstGradingSections.Items.Add(gradingSection);

                this.lstGradingSections.SelectedIndex = this.lstGradingSections.FindStringExact(gradingSection.SectionName);
            }

            else
            {
                this.lstGradingSections.SelectedIndex = this.lstGradingSections.FindStringExact(gradingSection.SectionName);

                Webb.Utilities.MessageBoxEx.ShowMessage("faild to add a existing name in the list!");
            }
        }
示例#3
0
        public GradingPostionsEditForm(GradingSection gradingSection)
        {
            InitializeComponent();

            this.InitList(gradingSection);

            _GradingSection = gradingSection;
        }
        private void ListSelectSectionsChanged()
        {
            this.lstPostions.Items.Clear();

            object selectItem = this.lstGradingSections.SelectedItem;

            if (selectItem == null)
            {
                this._CurrentSelectSection = null;
            }
            else
            {
                this._CurrentSelectSection = selectItem as GradingSection;

                foreach (GradingPostion gradingposition in this._CurrentSelectSection.InnerList)
                {
                    this.lstPostions.Items.Add(gradingposition);
                }
                if (this.lstPostions.Items.Count > 0)
                {
                    this.lstPostions.SelectedIndex = 0;
                }
            }
        }
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            int selectIndex = this.lstGradingSections.SelectedIndex;

            if (selectIndex < 0)
            {
                return;
            }

            this._CurrentSelectSection = this.lstGradingSections.SelectedItem as GradingSection;

            GradingPostionsEditForm gradingPostionsEditForm = new GradingPostionsEditForm(this._CurrentSelectSection);

            if (gradingPostionsEditForm.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            this._CurrentSelectSection = gradingPostionsEditForm._GradingSection;

            this.lstGradingSections.Items[selectIndex] = this._CurrentSelectSection;

            ListSelectSectionsChanged();
        }
示例#6
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
            }
        }