コード例 #1
0
ファイル: formMDI.cs プロジェクト: jsoques/openmiracle
 /// <summary>
 /// Callls frmProductMultipleUnit form
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void productMultipleUnitToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         frmProductMultipleUnit frm = new frmProductMultipleUnit();
         frmProductMultipleUnit open = Application.OpenForms["frmProductMultipleUnit"] as frmProductMultipleUnit;
         if (open == null)
         {
             frm.MdiParent = this;
             frm.Show();
         }
         else
         {
             open.Activate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("MDI 94 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #2
0
        /// <summary>
        /// To woek on cmbMultipleUnit cell leave
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cmbMultipleUnit_Leave(object sender, EventArgs e)
        {
            try
            {
                //if (k.KeyCode != Keys.Escape)
                if (cmbMultipleUnit.SelectedIndex == 1)
                {
                    UnitSP spUnit = new UnitSP();
                    strProductName = txtName.Text.Trim();
                    decimal decUnitId = Convert.ToDecimal(cmbUnit.SelectedValue);
                    string strUnit = spUnit.UnitName(Convert.ToDecimal(cmbUnit.SelectedValue));
                    frmProductMultipleUnit frmMultipleUnitObj = new frmProductMultipleUnit();
                    frmMultipleUnitObj.MdiParent = formMDI.MDIObj;
                    frmProductMultipleUnit open = Application.OpenForms["frmProductMultipleUnit"] as frmProductMultipleUnit;
                    if (open == null)
                    {
                        if (isMulUnitFromRgister && btnSave.Text == "Update")
                        {
                            if (!isCheck)
                            {
                                MultipleUnitTableForUpdate();
                                frmMultipleUnitObj.CallFromProdutCreationForUpadte(this, strProductName, decProductIdForEdit, dtblMulUnitForEdit, strUnitNameForGrid, decUnitIdForUpdate);
                                isGridHasToClear = true;
                            }
                            else
                            {
                                if (strProductName != string.Empty)
                                {
                                    if (cmbUnit.SelectedIndex != -1)
                                    {
                                        if (isSaveMulUnitCheck && (decUnitId == decUnitIdSelectedWhenMulUntCalled))
                                        {
                                            frmMultipleUnitObj.CallFromProdutCreationAgain(this, strProductName, decUnitId, strUnit, dtblMulUnit);
                                            //txtPartNo.Focus();
                                        }
                                        else
                                        {
                                            frmMultipleUnitObj.CallFromProdutCreation(this, strProductName, decUnitId, strUnit);
                                            //txtPartNo.Focus();
                                        }
                                    }
                                    else
                                    {
                                        Messages.InformationMessage("Select default unit");
                                        cmbMultipleUnit.SelectedIndex = 0;
                                        cmbUnit.Focus();
                                    }
                                }
                                else
                                {
                                    Messages.InformationMessage("Enter product name");
                                    cmbMultipleUnit.SelectedIndex = 0;
                                    txtName.Focus();
                                }
                            }
                        }
                        else
                        {
                            if (strProductName != string.Empty)
                            {
                                if (cmbUnit.SelectedIndex != -1)
                                {
                                    if (isSaveMulUnitCheck && (decUnitId == decUnitIdSelectedWhenMulUntCalled))
                                    {
                                        frmMultipleUnitObj.CallFromProdutCreationAgain(this, strProductName, decUnitId, strUnit, dtblMulUnit);
                                        //txtPartNo.Focus();
                                    }
                                    else
                                    {
                                        frmMultipleUnitObj.CallFromProdutCreation(this, strProductName, decUnitId, strUnit);
                                        //txtPartNo.Focus();
                                    }
                                }
                                else
                                {
                                    Messages.InformationMessage("Select default unit");
                                    cmbMultipleUnit.SelectedIndex = 0;
                                    cmbUnit.Focus();
                                }
                            }
                            else
                            {
                                Messages.InformationMessage("Enter product name");
                                cmbMultipleUnit.SelectedIndex = 0;
                                txtName.Focus();
                            }
                        }
                    }
                    else if (open != null)
                    {
                        if (open.WindowState == FormWindowState.Minimized)
                        {
                            open.WindowState = FormWindowState.Normal;
                        }
                    }

                    if (dtblForUnitIdInOpeNingStock != null && dtblForUnitIdInOpeNingStock.Rows.Count > 0)
                    {
                        dgvcmbUnit.DataSource = dtblForUnitIdInOpeNingStock;
                        dgvcmbUnit.DisplayMember = "unitName";
                        dgvcmbUnit.ValueMember = "dgvtxtunitId";
                    }

                }
            }

            catch (Exception ex)
            {
                MessageBox.Show("PC:103" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }