Beispiel #1
0
        private void RequestUpdate_Load(object sender, EventArgs e)
        {
            //Fill cbCategory ComboBox
            this.caCategories = Category.GetCategories(this.cnConnection);
            foreach (Category ctCategory in this.caCategories)
            {
                this.cbCategory.Items.Add(ctCategory.strName);
            }

            //Fill deDepartments
            this.deDepartments = Department.GetDepartments(this.cnConnection);
            foreach (Department deDepartment in this.deDepartments)
            {
                this.cbDepartment.Items.Add(deDepartment.strName);
            }

            //Fill cbRowBudget
            this.cbRowBudget.Items.Clear();
            this.dsCurrentAffairs = CurrentAffairs.GetCurrentAffairs(this.cnConnection);
            foreach (DataRow drCurrentAffair in this.dsCurrentAffairs.Tables["tabCurrentAffairs"].Rows)
            {
                this.cbRowBudget.Items.Add(drCurrentAffair["nvcName"].ToString());
            }
            Project proSearch = new Project();

            proSearch.intCategory = Category.GetNumberByName(this.cnConnection, this.cbCategory.Text);
            this.dsProjects       = Project.GetProjects(this.cnConnection, proSearch);
            foreach (DataRow drCurrentAffair in this.dsProjects.Tables["tabProjects"].Rows)
            {
                this.cbRowBudget.Items.Add(drCurrentAffair["nvcName"].ToString());
            }

            //Fill Controls with Part Properties
            this.tbNumber.Text     = this.reqUpdate.intNumber.ToString();
            this.cbDepartment.Text = Department.GetNameByNumber(this.cnConnection, this.reqUpdate.intDepartment);
            this.dtpDate.Value     = this.reqUpdate.dtDate;
            if (this.reqUpdate.intRowBudget < 100)
            {
                this.cbRowBudget.Text = CurrentAffairs.GetNameByNumber(this.cnConnection, this.reqUpdate.intRowBudget);
            }
            if (this.reqUpdate.intRowBudget >= 100)
            {
                this.cbCategory.Text =
                    Category.GetNameByNumber(this.cnConnection, Project.GetCategoryByNumber(this.cnConnection, this.reqUpdate.intRowBudget));
                this.cbRowBudget.Text = Project.GetNameByNumber(this.cnConnection, this.reqUpdate.intRowBudget);
            }
            this.labEmployee1.Text = Employee.GetNameByCoID(this.cnConnection, this.reqUpdate.strRequesterCoID);
            this.labEmployee2.Text = Employee.GetNameByCoID(this.cnConnection, this.reqUpdate.strSupervisorCoID);
            this.labEmployee3.Text = Employee.GetNameByCoID(this.cnConnection, this.reqUpdate.strPlantmanagerCoID);
            this.labEmployee4.Text = Employee.GetNameByCoID(this.cnConnection, this.reqUpdate.strCeoCoID);

            SetEnableBtmOk();
        }
Beispiel #2
0
        private void CbCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            this.cbRowBudget.Items.Clear();

            this.dsCurrentAffairs = CurrentAffairs.GetCurrentAffairs(this.cnConnection);
            foreach (DataRow drCurrentAffair in this.dsCurrentAffairs.Tables["tabCurrentAffairs"].Rows)
            {
                this.cbRowBudget.Items.Add(drCurrentAffair["nvcName"].ToString());
            }

            Project proSearch = new Project();

            proSearch.intCategory = Category.GetNumberByName(this.cnConnection, this.cbCategory.Text);
            this.dsProjects       = Project.GetProjects(this.cnConnection, proSearch);
            foreach (DataRow drCurrentAffair in this.dsProjects.Tables["tabProjects"].Rows)
            {
                this.cbRowBudget.Items.Add(drCurrentAffair["nvcName"].ToString());
            }
        }