Пример #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);
         }
     }
 }
Пример #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);
                    }
                }
            }
        }
Пример #3
0
        private void btnModify_Click(object sender, EventArgs e)
        {
            if (dgvMaster.CurrentRow != null)
            {
                DataRow masterRow = ((DataRowView)dgvMaster.CurrentRow.DataBoundItem).Row;
                bool canSave = new THOK.PFK.Dal.ScheduleDal().GetFormula(masterRow["FORMULACODE"].ToString()) == 0;

                FormulaDialog formulaDialog = new FormulaDialog(masterRow["FORMULACODE"].ToString(),
                                                            masterRow["FORMULANAME"].ToString(),
                                                            masterRow["FORMULADATE"].ToString(),
                                                            masterRow["CIGARETTENAME"].ToString(),
                                                            masterRow["USECOUNT"].ToString(),
                                                            masterRow["FORMULANO"].ToString(),
                                                            detailTable,
                                                            canSave);
                formulaDialog.FormulaCode = masterRow[0].ToString();
                if (formulaDialog.ShowDialog() == DialogResult.OK)
                {
                    try
                    {
                        FormulaDal formulaDal = new FormulaDal();
                        formulaDal.SaveFormula(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);
                    }
                }
            }
        }