コード例 #1
0
ファイル: FormEduDoc.cs プロジェクト: radtek/phamacy2016
        private void initDataGridView2()
        {
            _source2.DataSource    = EduDetails;
            dataGridView2.RowCount = EduDetails.Count;

            for (int i = 0; i < EduDetails.Count; i++)
            {
                if (i == 0)
                {
                    dataGridView2.Rows[i].Cells["colRadioButton"].Value = SelectedStatus.Selected;
                }
                else
                {
                    dataGridView2.Rows[i].Cells["colRadioButton"].Value = SelectedStatus.NoSelected;
                }

                Employee    emp  = Employees.Where(d => d.Id == EduDetails[i].EmployeeId).First();
                EduDocument hDoc = EduDocument.Where(d => d.Id == EduDetails[i].DocumentId).First();
                Department  dpmt = Departments.Where(d => d.Id == emp.DepartmentId).First();

                dataGridView2.Rows[i].Cells["colEmployee"].Value   = emp.Name;
                dataGridView2.Rows[i].Cells["colDepartment"].Value = dpmt.Name;
                dataGridView2.Rows[i].Cells["colDNo"].Value        = hDoc.eduDocumentName;

                dataGridView2.Rows[i].Cells["colDName"].Value   = this.textBox8.Text.Trim();
                dataGridView2.Rows[i].Cells["colDTime"].Value   = this.dateTimePicker1.Value.Date;
                dataGridView2.Rows[i].Cells["colContext"].Value = this.textBox2.Text.Trim();
                dataGridView2.Rows[i].Cells["colPass"].Value    = EduDetails[i].IsEduPass;
                dataGridView2.Rows[i].Cells["colEduOgn"].Value  = this.textBox7.Text.Trim();
                dataGridView2.Rows[i].Cells["colAddress"].Value = this.textBox3.Text.Trim();
            }
        }
コード例 #2
0
ファイル: FormEduDoc.cs プロジェクト: radtek/phamacy2016
 private void comboBox3_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (this.comboBox3.SelectedIndex >= 0)
     {
         EduDocument eduDocument = EduDocument.Where(d => d.Id == (Guid)(this.comboBox3.SelectedValue)).First();
         this.textBox8.Text         = eduDocument.eduDocumentNumber;
         this.dateTimePicker1.Value = eduDocument.eduTimeStart.Date;
         this.textBox7.Text         = eduDocument.eduOrganize;
         this.textBox6.Text         = eduDocument.eduTeacher;
         this.textBox3.Text         = eduDocument.eduAdress;
         this.textBox2.Text         = eduDocument.eduContext;
     }
 }
コード例 #3
0
ファイル: FormEduDoc.cs プロジェクト: radtek/phamacy2016
        private void DeleteBtn_Click(object sender, EventArgs e)
        {
            try
            {
                if (MessageBox.Show("确定要删除吗?", "信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (this.tabControl1.SelectedIndex == 0)
                    {
                        if (dataGridView1.CurrentRow != null)
                        {
                            //执行删除操作
                            int currRowIndex = dataGridView1.CurrentRow.Cells[0].RowIndex;
                            _eduDocument = EduDocument[currRowIndex];

                            string msg = string.Empty;
                            PharmacyDatabaseService.DeleteEduDocument(_eduDocument.Id, out msg);

                            refreshBtn_Click(this, null);
                        }
                        else
                        {
                            MessageBox.Show("没有选择要删除的记录!");
                        }
                    }
                    if (this.tabControl1.SelectedIndex == 1)
                    {
                        if (dataGridView2.CurrentRow != null)
                        {
                            //执行删除操作
                            int currRowIndex = dataGridView2.CurrentRow.Cells[0].RowIndex;
                            _eduDetails = EduDetails[currRowIndex];

                            string msg = string.Empty;
                            PharmacyDatabaseService.DeleteEduDetails(_eduDetails.Id, out msg);

                            refreshBtn_Click(this, null);
                        }
                        else
                        {
                            MessageBox.Show("没有选择要删除的记录!");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Log.Error(ex);
            }
        }
コード例 #4
0
ファイル: FormEduDoc.cs プロジェクト: radtek/phamacy2016
        private void BindingDataToControls()
        {
            try
            {
                if (tabControl1.SelectedIndex == 0)
                {
                    int currRowIndex = dataGridView1.CurrentRow.Cells[0].RowIndex;
                    _eduDocument = EduDocument[currRowIndex];
                    if (_eduDocument != null)
                    {
                        this.textBoxDocNumber.Text = _eduDocument.eduDocumentNumber;
                        this.textBoxDocName.Text   = _eduDocument.eduDocumentName;
                        this.dateTimePicker2.Value = _eduDocument.eduTimeStart;
                        this.dateTimePicker3.Value = _eduDocument.eduTimeEnd;

                        this.textBoxEduOrganize.Text = _eduDocument.eduOrganize;
                        this.textBox10.Text          = _eduDocument.eduTeacher;
                        this.textBoxEduContext.Text  = _eduDocument.eduContext;
                        this.textBoxEduAdress.Text   = _eduDocument.eduAdress;

                        this.textBoxPersonNumber.Text = this._eduDocument.eduEployeesSum.ToString("0");
                        this.textBoxPersonNumber.Text = this._eduDocument.eduEployeesPassNumber.ToString("0");
                    }
                }
                if (tabControl1.SelectedIndex == 1)
                {
                    if (_eduDetails != null)
                    {
                        Employee listitem = Employees.Where(d => d.Id == _eduDetails.EmployeeId).First();
                        this.cmbEployeeName.SelectedItem = listitem;
                        EduDocument listitem1 = EduDocument.Where(d => d.Id == _eduDetails.DocumentId).First();
                        this.comboBox3.SelectedItem = listitem1;
                        Department listitem2 = Departments.Where(d => d.Id == listitem.DepartmentId).First();
                        this.cmbDepartment.SelectedItem = listitem2;
                        this.checkBox1.Checked          = _eduDetails.IsEduPass;
                        //this.textBox8.Text = listitem1.eduDocumentName;
                        //this.textBox7.Text = listitem1.eduOrganize;
                        //this.textBox6.Text = listitem1.eduTeacher;
                        //this.textBox3.Text = listitem1.eduAdress;
                        //this.textBox2.Text = listitem1.eduContext;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("控件绑定数据出错!");
            }
        }
コード例 #5
0
ファイル: FormEduDoc.cs プロジェクト: radtek/phamacy2016
        private void AddBtn_Click(object sender, EventArgs e)
        {
            this.refreshBtn.Enabled    = false;
            this.searchBtn.Enabled     = false;
            this.SaveBtn.Enabled       = true;
            this.CancelBtn.Enabled     = true;
            this.pagerControl1.Visible = false;
            this.pagerControl2.Visible = false;
            AddorEditFlag = 1;
            search();

            if (this.tabControl1.SelectedIndex == 0)
            {
                foreach (var c in this.EditGroup.Controls)
                {
                    if (c.GetType().Name == "TextBox")
                    {
                        ((TextBox)c).Text = "";
                    }
                }
                this.textBoxPersonNumber.Text         = "0";
                this.textBoxPassNumber.Text           = "0";
                this.EditGroup.Visible                = true;
                this.SearchGroup.Visible              = false;
                this.splitContainer1.SplitterDistance = 132;
                _eduDocument = new EduDocument();
            }
            if (this.tabControl1.SelectedIndex == 1)
            {
                foreach (var c in this.groupBox1.Controls)
                {
                    if (c.GetType().Name == "TextBox")
                    {
                        ((TextBox)c).Text = "";
                    }
                }

                this.groupBox1.Visible = true;
                this.groupBox2.Visible = false;
                this.splitContainer2.SplitterDistance = 145;

                this.comboBox3.DataSource = EduDocument;
                comboBox3.DisplayMember   = "eduDocumentName";
                comboBox3.ValueMember     = "ID";
                if (comboBox3.Items.Count > 0)
                {
                    comboBox3.SelectedIndex = 0;
                }
                //this.cmbEployeeName.DataSource = Employees;
                //cmbEployeeName.DisplayMember = "Name";
                //cmbEployeeName.ValueMember = "ID";
                //if ( this.cmbEployeeName.Items.Count > 0)
                //{
                //    cmbEployeeName.SelectedIndex = 0;

                //}
                this.cmbDepartment.DataSource = Departments;
                cmbDepartment.DisplayMember   = "Name";
                cmbDepartment.ValueMember     = "ID";
                if (this.cmbDepartment.Items.Count > 0)
                {
                    cmbDepartment.SelectedIndex = 0;
                }

                _eduDocument = new EduDocument();
            }
        }