Ejemplo n.º 1
0
        private void btnStoreNP_Click(object sender, EventArgs e)
        {
            try
            {
                int    newNumber = int.Parse(tbxNumber.Text);
                string newName   = tbxName.Text;

                try
                {
                    if (this.EditState == EditStateType.Edit)
                    {
                        if (bindingSource.Current != null)
                        {
                            DatabaseSet.品質原因Row row = (bindingSource.Current as DataRowView).Row as DatabaseSet.品質原因Row;

                            row.FillRow(newNumber, newName);

                            品質原因TableAdapter.Instance.Update(row);;
                        }
                    }
                    else if (this.EditState == EditStateType.New)
                    {
                        DatabaseSet.品質原因Row newRow = DatabaseSet.品質原因Table.New品質原因Row();

                        newRow.FillRow(newNumber, newName);
                        DatabaseSet.品質原因Table.Rows.Add(newRow);

                        品質原因TableAdapter.Instance.Update(newRow);
                    }

                    this.EditState = EditStateType.None;
                }
                catch (ConstraintException)
                {
                    MessageBox.Show("已存在品質原因 " + newNumber + " (" + newName + "),請指定其他編號");
                }
            }

            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxNumber.DataBindings[0].ReadValue();
                    tbxName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 2
0
        private void btnStoreLabor_Click(object sender, EventArgs e)
        {
            string  newLaborNumber = tbxLaborNumber.Text;
            string  newLaborName   = tbxLaborName.Text;
            decimal newLaborWage   = decimal.Parse(tbxLaborWage.Text);
            string  newLaborLine   = cbxLaborLine.SelectedValue.ToString();

            try
            {
                if (this.EditState == EditStateType.Edit)
                {
                    if (bsLabor.Current != null)
                    {
                        DatabaseSet.員工Row row = (bsLabor.Current as DataRowView).Row as DatabaseSet.員工Row;
                        row.FillRow(newLaborNumber, newLaborName, newLaborWage, newLaborLine);

                        員工TableAdapter.Instance.Update(row);;
                    }
                }
                else if (this.EditState == EditStateType.New)
                {
                    DatabaseSet.員工Row newRow = DatabaseSet.員工Table.New員工Row();
                    newRow.FillRow(newLaborNumber, newLaborName, newLaborWage, newLaborLine);
                    DatabaseSet.員工Table.Rows.Add(newRow);

                    員工TableAdapter.Instance.Update(newRow);
                }

                this.EditState = EditStateType.None;
            }
            catch (ConstraintException)
            {
                MessageBox.Show("已存在員工 (" + newLaborNumber + ")" + newLaborName + ",請指定其他編號");
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxLaborNumber.DataBindings[0].ReadValue();
                    tbxLaborName.DataBindings[0].ReadValue();
                    tbxLaborWage.DataBindings[0].ReadValue();
                    cbxLaborLine.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 3
0
        private void btnStoreLine_Click(object sender, EventArgs e)
        {
            string newLine     = tbxLine.Text;
            string newLineName = tbxLineName.Text;

            try
            {
                if (this.EditState == EditStateType.Edit)
                {
                    if (bsLine.Current != null)
                    {
                        DatabaseSet.產線Row row = (bsLine.Current as DataRowView).Row as DatabaseSet.產線Row;
                        row.FillRow(newLine, newLineName);

                        產線TableAdapter.Instance.Update(row);;
                    }
                }
                else if (this.EditState == EditStateType.New)
                {
                    DatabaseSet.產線Row newRow = DatabaseSet.產線Table.New產線Row();
                    newRow.FillRow(newLine, newLineName);
                    DatabaseSet.產線Table.Rows.Add(newRow);

                    產線TableAdapter.Instance.Update(newRow);
                }

                this.EditState = EditStateType.None;
            }
            catch (ConstraintException)
            {
                MessageBox.Show("已存在產線 " + newLine + ",請指定其他產線");
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxLine.DataBindings[0].ReadValue();
                    tbxLineName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 4
0
 private void LaborForm_Load(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 5
0
 private void btnCancelLabor_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 6
0
        private void btnStoreSeries_Click(object sender, EventArgs e)
        {
            int newSeries = int.Parse(tbxSeries.Text);
            string newSeriesName = tbxSeriesName.Text;

            try
            {
                if (this.SerialState == EditStateType.Edit)
                {
                    if (bsSeries.Current != null)
                    {
                        DatabaseSet.���~�t�CRow row = this.SelectedSerialRow;
                        row.FillRow(newSeries, newSeriesName);

                        ���~�t�CTableAdapter.Instance.Update(row);
                        LoadPart(false);

                    }
                }
                else if (this.SerialState == EditStateType.New)
                {
                    DatabaseSet.���~�t�CRow newRow = DatabaseSet.���~�t�CTable.New���~�t�CRow();
                    newRow.FillRow(newSeries, newSeriesName);
                    DatabaseSet.���~�t�CTable.Rows.Add(newRow);

                    ���~�t�CTableAdapter.Instance.Update(newRow);
                }

                this.SerialState = EditStateType.None;

            }
            catch (ConstraintException)
            {
                MessageBox.Show("�w�s�b�t�C�� " + newSeries + "�A���w��L�t�C��");
                tbxSeries.SelectAll();
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.SerialState == EditStateType.Edit)
                {
                    tbxSeries.DataBindings[0].ReadValue();
                    tbxSeriesName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 7
0
        private void btnStoreNP_Click(object sender, EventArgs e)
        {
            try
            {
                int    newNumber = int.Parse(tbxNPNumber.Text);
                string newName   = tbxNPName.Text;

                try
                {
                    if (this.EditState == EditStateType.Edit)
                    {
                        if (bindingSource.Current != null)
                        {
                            DatabaseSet.非生產Row row = (bindingSource.Current as DataRowView).Row as DatabaseSet.非生產Row;

                            if ((int)row["編號", DataRowVersion.Original] == Global.NonProduct_Other)
                            {
                                if (!newName.Contains("其他"))
                                {
                                    throw new SWLHMSException("更改 其他 項目請至少包含\"其他\"兩字以進行區別");
                                }
                                row.稱 = newName;

                                if (newNumber != 100)
                                {
                                    throw new SWLHMSException("其他 項目不得更改編號");
                                }
                            }
                            else
                            {
                                row.FillRow(newNumber, newName);
                            }

                            非生產TableAdapter.Instance.Update(row);;
                        }
                    }
                    else if (this.EditState == EditStateType.New)
                    {
                        DatabaseSet.非生產Row newRow = DatabaseSet.非生產Table.New非生產Row();

                        newRow.FillRow(newNumber, newName);
                        DatabaseSet.非生產Table.Rows.Add(newRow);

                        非生產TableAdapter.Instance.Update(newRow);
                    }
                }
                catch (ConstraintException)
                {
                    MessageBox.Show("已存在非生產項目 " + newNumber + " (" + newName + "),請指定其他編號");
                }

                this.EditState = EditStateType.None;
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxNPNumber.DataBindings[0].ReadValue();
                    tbxNPName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 8
0
 private void btnEditLine_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.Edit;
 }
Ejemplo n.º 9
0
 private void btnAddLine_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.New;
 }
Ejemplo n.º 10
0
 private void QualityItemForm_Load(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 11
0
 private void btnEditNP_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.Edit;
 }
Ejemplo n.º 12
0
        private void btnStoreNP_Click(object sender, EventArgs e)
        {
            try
            {
                int newNumber = int.Parse(tbxNPNumber.Text);
                string newName = tbxNPName.Text;

                try
                {
                    if (this.EditState == EditStateType.Edit)
                    {
                        if (bindingSource.Current != null)
                        {
                            DatabaseSet.�D�Ͳ�Row row = (bindingSource.Current as DataRowView).Row as DatabaseSet.�D�Ͳ�Row;

                            if ((int)row["�s��", DataRowVersion.Original] == Global.NonProduct_Other)
                            {
                                if (!newName.Contains("��L"))
                                    throw new SWLHMSException("��� ��L ���ؽЦܤ֥]�t\"��L\"��r�H�i��ϧO");
                                row.�W�� = newName;

                                if (newNumber != 100)
                                    throw new SWLHMSException("��L ���ؤ��o���s��");
                            }
                            else
                                row.FillRow(newNumber, newName);

                            �D�Ͳ�TableAdapter.Instance.Update(row); ;
                        }
                    }
                    else if (this.EditState == EditStateType.New)
                    {
                        DatabaseSet.�D�Ͳ�Row newRow = DatabaseSet.�D�Ͳ�Table.New�D�Ͳ�Row();

                        newRow.FillRow(newNumber, newName);
                        DatabaseSet.�D�Ͳ�Table.Rows.Add(newRow);

                        �D�Ͳ�TableAdapter.Instance.Update(newRow);
                    }
                }
                catch (ConstraintException)
                {
                    MessageBox.Show("�w�s�b�D�Ͳ����� " + newNumber + "�@(" + newName + ")�A�Ы��w��L�s��");

                }

                this.EditState = EditStateType.None;
            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxNPNumber.DataBindings[0].ReadValue();
                    tbxNPName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 13
0
        private void btnStoreNP_Click(object sender, EventArgs e)
        {
            try
            {
                int newNumber = int.Parse(tbxNumber.Text);
                string newName = tbxName.Text;

                try
                {
                    if (this.EditState == EditStateType.Edit)
                    {
                        if (bindingSource.Current != null)
                        {
                            DatabaseSet.�~���]Row row = (bindingSource.Current as DataRowView).Row as DatabaseSet.�~���]Row;

                            row.FillRow(newNumber, newName);

                            �~���]TableAdapter.Instance.Update(row); ;
                        }
                    }
                    else if (this.EditState == EditStateType.New)
                    {
                        DatabaseSet.�~���]Row newRow = DatabaseSet.�~���]Table.New�~���]Row();

                        newRow.FillRow(newNumber, newName);
                        DatabaseSet.�~���]Table.Rows.Add(newRow);

                        �~���]TableAdapter.Instance.Update(newRow);
                    }

                    this.EditState = EditStateType.None;
                }
                catch (ConstraintException)
                {
                    MessageBox.Show("�w�s�b�~���] " + newNumber + "�@(" + newName + ")�A���w��L�s��");

                }
            }

            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxNumber.DataBindings[0].ReadValue();
                    tbxName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 14
0
 private void QualityItemForm_Load(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 15
0
 private void btnAddLabor_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.New;
 }
Ejemplo n.º 16
0
        private void btnStoreLabor_Click(object sender, EventArgs e)
        {
            string newLaborNumber = tbxLaborNumber.Text;
            string newLaborName = tbxLaborName.Text;
            decimal newLaborWage = decimal.Parse(tbxLaborWage.Text);
            string newLaborLine = cbxLaborLine.SelectedValue.ToString();

            try
            {
                if (this.EditState == EditStateType.Edit)
                {
                    if (bsLabor.Current != null)
                    {
                        DatabaseSet.���uRow row = (bsLabor.Current as DataRowView).Row as DatabaseSet.���uRow;
                        row.FillRow(newLaborNumber, newLaborName, newLaborWage, newLaborLine);

                        ���uTableAdapter.Instance.Update(row); ;
                    }
                }
                else if (this.EditState == EditStateType.New)
                {
                    DatabaseSet.���uRow newRow = DatabaseSet.���uTable.New���uRow();
                    newRow.FillRow(newLaborNumber, newLaborName, newLaborWage, newLaborLine);
                    DatabaseSet.���uTable.Rows.Add(newRow);

                    ���uTableAdapter.Instance.Update(newRow);
                }

                this.EditState = EditStateType.None;
            }
            catch (ConstraintException)
            {
                MessageBox.Show("�w�s�b���u (" + newLaborNumber + ")" + newLaborName + "�A���w��L�s��");

            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxLaborNumber.DataBindings[0].ReadValue();
                    tbxLaborName.DataBindings[0].ReadValue();
                    tbxLaborWage.DataBindings[0].ReadValue();
                    cbxLaborLine.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 17
0
 private void LineForm_Load(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 18
0
 private void btnCancelSerials_Click(object sender, EventArgs e)
 {
     this.SerialState = EditStateType.None;
 }
Ejemplo n.º 19
0
 private void btnCancelLine_Click(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }
Ejemplo n.º 20
0
 private void btnEditSeries_Click(object sender, EventArgs e)
 {
     this.SerialState = EditStateType.Edit;
 }
Ejemplo n.º 21
0
        private void btnStoreLine_Click(object sender, EventArgs e)
        {
            string newLine = tbxLine.Text;
            string newLineName = tbxLineName.Text;

            try
            {
                if (this.EditState == EditStateType.Edit)
                {
                    if (bsLine.Current != null)
                    {
                        DatabaseSet.���uRow row = (bsLine.Current as DataRowView).Row as DatabaseSet.���uRow;
                        row.FillRow(newLine, newLineName);

                        ���uTableAdapter.Instance.Update(row); ;
                    }
                }
                else if (this.EditState == EditStateType.New)
                {
                    DatabaseSet.���uRow newRow = DatabaseSet.���uTable.New���uRow();
                    newRow.FillRow(newLine, newLineName);
                    DatabaseSet.���uTable.Rows.Add(newRow);

                    ���uTableAdapter.Instance.Update(newRow);
                }

                this.EditState = EditStateType.None;
            }
            catch (ConstraintException)
            {
                MessageBox.Show("�w�s�b���u " + newLine + "�A���w��L���u");

            }
            catch (Exception ex)
            {
                Global.ShowError(ex);
            }
            finally
            {
                if (this.EditState == EditStateType.Edit)
                {
                    tbxLine.DataBindings[0].ReadValue();
                    tbxLineName.DataBindings[0].ReadValue();
                }
            }
        }
Ejemplo n.º 22
0
 private void NonProduceForm_Load(object sender, EventArgs e)
 {
     this.EditState = EditStateType.None;
 }