コード例 #1
0
        /// <summary>
        /// ErrorCheck
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        private bool ErrorCheck(int index)
        {
            if (index == 11)
            {
                //HeaderCheck on F11
                mbe = GetBrandEntity();
                if (OperationMode == EOperationMode.INSERT)
                {
                    if (type == 1)//New
                    {
                        if (!RequireCheck(new Control[] { ScBrandCD.TxtCode }))
                        {
                            return(false);
                        }

                        DataTable dtbrand = new DataTable();
                        mbe.BrandCD = ScBrandCD.Code;
                        dtbrand     = mtkbl.Brand_Select(mbe);
                        if (dtbrand.Rows.Count > 0)
                        {
                            mtkbl.ShowMessage("E132");
                            ScBrandCD.SetFocus(1);
                            return(false);
                        }
                    }
                    else//Copy
                    {
                        if (!RequireCheck(new Control[] { ScBrandCD.TxtCode }))
                        {
                            return(false);
                        }
                        DataTable dtbrand = new DataTable();
                        mbe.BrandCD = ScBrandCD.Code;
                        dtbrand     = mtkbl.Brand_Select(mbe);
                        if (dtbrand.Rows.Count > 0)
                        {
                            mtkbl.ShowMessage("E132");
                            ScBrandCD.SetFocus(1);
                            return(false);
                        }
                        else
                        {
                            if (!string.IsNullOrWhiteSpace(ScCopyBrand.TxtCode.Text))
                            {
                                mbe.BrandCD = ScCopyBrand.Code;
                                DataTable dtcopybrand = new DataTable();
                                dtcopybrand = mtkbl.Brand_Select(mbe);
                                if (dtcopybrand.Rows.Count > 0)
                                {
                                    txtBrandName.Text = dtcopybrand.Rows[0]["BrandName"].ToString();
                                }
                                else
                                {
                                    mtkbl.ShowMessage("E133");
                                    ScCopyBrand.SetFocus(1);
                                    return(false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    DataTable dtbrand = new DataTable();
                    mbe.BrandCD = ScBrandCD.Code;
                    dtbrand     = mtkbl.Brand_Select(mbe);
                    if (dtbrand.Rows.Count == 0)
                    {
                        mtkbl.ShowMessage("E133");
                        ScBrandCD.SetFocus(1);
                        return(false);
                    }
                }
            }
            else if (index == 12)
            {
                if (!RequireCheck(new Control[] { ScBrandCD.TxtCode }))
                {
                    return(false);
                }
                if (string.IsNullOrWhiteSpace(txtBrandName.Text))
                {
                    mtkbl.ShowMessage("E102");
                    txtBrandName.Focus();
                    return(false);
                }
                if (string.IsNullOrWhiteSpace(txtKanaName.Text))
                {
                    mtkbl.ShowMessage("E102");
                    txtKanaName.Focus();
                    return(false);
                }

                if (OperationMode == EOperationMode.INSERT)
                {
                    DataTable dtbrand = new DataTable();
                    mbe     = GetBrandEntity();
                    dtbrand = mtkbl.Brand_Select(mbe);
                    if (dtbrand.Rows.Count > 0)
                    {
                        mtkbl.ShowMessage("E132");
                        ScBrandCD.SetFocus(1);
                        return(false);
                    }
                }
                else if (OperationMode == EOperationMode.DELETE)
                {
                    DataTable dtbrand = new DataTable();
                    mbe     = GetBrandEntity();
                    dtbrand = mtkbl.Brand_Select(mbe);
                    if (dtbrand.Rows.Count > 0)
                    {
                        if (dtbrand.Rows[0]["UsedFlg"].ToString() == "1")
                        {
                            mtkbl.ShowMessage("E154");
                            ScBrandCD.SetFocus(1);
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Display event
        /// </summary>
        /// <param name="type"></param>
        ///
        private void F11()
        {
            if (ErrorCheck(11))
            {
                switch (OperationMode)
                {
                case EOperationMode.INSERT:
                    if (type == 1)
                    {
                        //DisablePanel(PanelNormal);
                        //DisablePanel(PanelCopy);
                        btnDisplay.Enabled = true;
                        F11Enable          = true;
                        DisablePanel(PanelDetail);
                        //txtBrandName.Focus();
                        ScCopyBrand.SetFocus(1);
                    }

                    else
                    {
                        DisablePanel(PanelNormal);
                        DisablePanel(PanelCopy);
                        EnablePanel(PanelDetail);
                        btnDisplay.Enabled = false;
                        F11Enable          = false;
                        mbe.BrandCD        = ScCopyBrand.Code;
                        DisplayData();
                        txtBrandName.Focus();
                    }
                    break;

                case EOperationMode.UPDATE:
                    mbe.BrandCD = ScBrandCD.Code;
                    DisplayData();
                    DisablePanel(PanelNormal);
                    DisablePanel(PanelCopy);
                    btnDisplay.Enabled = false;
                    EnablePanel(PanelDetail);
                    F12Enable = true;
                    F11Enable = false;
                    txtBrandName.Focus();
                    break;

                case EOperationMode.DELETE:
                    mbe.BrandCD = ScBrandCD.Code;
                    DisplayData();
                    DisablePanel(PanelNormal);
                    DisablePanel(PanelCopy);
                    btnDisplay.Enabled = false;
                    DisablePanel(PanelDetail);
                    F12Enable = true;
                    F11Enable = false;
                    break;

                case EOperationMode.SHOW:
                    mbe.BrandCD = ScBrandCD.Code;
                    DisplayData();
                    DisablePanel(PanelNormal);
                    DisablePanel(PanelCopy);
                    btnDisplay.Enabled = false;
                    DisablePanel(PanelDetail);
                    F12Enable = false;
                    F11Enable = false;
                    break;
                }
            }
        }