Esempio n. 1
0
        private void tsmiNewWorksheet_Click(object sender, EventArgs e)
        {
            EditWorksheetForm form = new EditWorksheetForm();

            form.NewWorksheet();
            form.MdiParent = this;
            form.Show();
        }
Esempio n. 2
0
        private void btnAddWorksheet_Click(object sender, EventArgs e)
        {
            try
            {
                if (tbxWorksheetNumber.Text == string.Empty)
                {
                    throw new SWLHMSException("單號不得為空值");
                }

                if ((int)工作單TableAdapter.Instance.GetCountBy單號(tbxWorksheetNumber.Text) > 0)
                {
                    throw new SWLHMSException("已存在工作單號 " + tbxWorksheetNumber.Text + ",請指定其他工作單號");
                }

                //if (tbxCustomerName.Text == string.Empty)
                //    throw new Exception("客戶名稱不得為空值");

                CheckField();

                if (MessageBox.Show("工作單號欄位送出後即不可修改,請確認", "新增確認", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation) == DialogResult.OK)
                {
                    FillWorksheetNumber();
                    DateTime?end = ckbEnd.Checked ? (DateTime?)dtpEnd.Value : (DateTime?)null;

                    // For 1.02
                    //int count = 工作單TableAdapter.Instance.Insert(tbxWorksheetNumber.Text, tbxCustomerName.Text, dtpBegin.Value, end, dtpEstimate.Value, dtpCustomerNeed.Value);
                    int count     = 工作單TableAdapter.Instance.Insert(tbxWorksheetNumber.Text, dtpBegin.Value, end);
                    int partCount = 工作單品號TableAdapter.Instance.UpdateEx(bsWorksheetPart.DataSource as DatabaseSet.工作單品號DataTable);

                    if (count > 0)
                    {
                        MessageBox.Show("新增 " + count + " 筆工作單\n" + partCount + " 筆品號");

                        EditWorksheetForm form = new EditWorksheetForm();
                        form.NewWorksheet();
                        form.MdiParent = this.MdiParent;
                        form.Show();

                        this.Close();
                    }
                    else
                    {
                        throw new SWLHMSException("新增工作單失敗");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Esempio n. 3
0
 private void btnAddWorksheet_Click(object sender, EventArgs e)
 {
     try
     {
         EditWorksheetForm form = new EditWorksheetForm();
         form.NewWorksheet();
         form.MdiParent = this.MdiParent;
         form.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 4
0
 private void btnAddWorksheet_Click(object sender, EventArgs e)
 {
     try
     {
         EditWorksheetForm form = new EditWorksheetForm();
         form.NewWorksheet();
         form.MdiParent = this.MdiParent;
         form.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 5
0
 private void btnEditWorksheet_Click(object sender, EventArgs e)
 {
     try
     {
         if (tbxWorksheetNumber.Text != string.Empty)
         {
             EditWorksheetForm form = new EditWorksheetForm();
             form.EditWorksheet(tbxWorksheetNumber.Text);
             form.MdiParent = this.MdiParent;
             form.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 6
0
 private void btnEditWorksheet_Click(object sender, EventArgs e)
 {
     try
     {
         if (tbxWorksheetNumber.Text != string.Empty)
         {
             EditWorksheetForm form = new EditWorksheetForm();
             form.EditWorksheet(tbxWorksheetNumber.Text);
             form.MdiParent = this.MdiParent;
             form.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Esempio n. 7
0
 private void tsmiNewWorksheet_Click(object sender, EventArgs e)
 {
     EditWorksheetForm form = new EditWorksheetForm();
     form.NewWorksheet();
     form.MdiParent = this;
     form.Show();
 }