Ejemplo n.º 1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     FormulaDialog formulaDialog = new FormulaDialog();
     if (formulaDialog.ShowDialog() == DialogResult.OK)
     {
         try
         {
             FormulaDal formulaDal = new FormulaDal();
             formulaDal.AddFormula(formulaDialog.FormulaCode,
                                 formulaDialog.FormulaName,
                                 formulaDialog.FormulaDate,
                                 formulaDialog.CigaretteName,
                                 formulaDialog.Quantity,
                                 UserID,
                                 formulaDialog.FormulaNo,
                                 formulaDialog.FormulaDetail);
             bsMain.DataSource = formulaDal.GetFormulaMaster();
         }
         catch (Exception exp)
         {
             THOKUtil.ShowInfo("�����䷽������ʧ�ܣ�ԭ��" + exp.Message);
         }
     }
 }
Ejemplo n.º 2
0
        private void btnCopy_Click(object sender, EventArgs e)
        {
            if (dgvMaster.SelectedRows.Count != 0)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                FormulaDialog formulaDialog = new FormulaDialog(masterRow["FORMULACODE"].ToString(),
                                                            masterRow["FORMULANAME"].ToString(),
                                                            masterRow["FORMULADATE"].ToString(),
                                                            masterRow["CIGARETTENAME"].ToString(),
                                                            masterRow["USECOUNT"].ToString(),
                                                            masterRow["FORMULANO"].ToString(),
                                                            detailTable,
                                                            true);

                if (formulaDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        FormulaDal formulaDal = new FormulaDal();
                        formulaDal.AddFormula(formulaDialog.FormulaCode,
                                            formulaDialog.FormulaName,
                                            formulaDialog.FormulaDate,
                                            formulaDialog.CigaretteName,
                                            formulaDialog.Quantity,
                                            UserID,
                                            formulaDialog.FormulaNo,
                                            formulaDialog.FormulaDetail);

                        bsMain.DataSource = formulaDal.GetFormulaMaster();
                    }
                    catch (Exception exp)
                    {
                        detailTable.RejectChanges();
                        THOKUtil.ShowInfo("�����䷽������ʧ�ܣ�ԭ��" + exp.Message);
                    }
                }
            }
        }