private void ScBranchCD_CodeKeyDownEvent(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (!string.IsNullOrWhiteSpace(ScBranchCD.TxtCode.Text))
         {
             if (!ScBranchCD.SelectData())
             {
                 mtbbl.ShowMessage("E101");
                 ScBranchCD.SetFocus(1);
             }
         }
         else
         {
             mtbbl.ShowMessage("E101");
             ScBranchCD.SetFocus(1);
         }
     }
 }
        private bool ErrorCheck(int index)
        {
            mtbbl = new MasterTouroku_GinkouKouza_BL();
            if (index == 11)
            {
                //HeaderCheck on F11
                if (OperationMode == EOperationMode.INSERT)
                {
                    if (type == 1)
                    {
                        if (!RequireCheck(new Control[] { ScKouzaCD.TxtCode, ScKouzaCD.TxtChangeDate }))   //,ScCopyKouzaCD.TxtCode,ScCopyKouzaCD.TxtChangeDate
                        {
                            return(false);
                        }
                    }


                    else
                    {
                        if (!RequireCheck(new Control[] { ScKouzaCD.TxtCode, ScKouzaCD.TxtChangeDate }))
                        {
                            return(false);
                        }
                        if (!RequireCheck(new Control[] { ScCopyKouzaCD.TxtCode }, ScCopyKouzaCD.TxtChangeDate))
                        {
                            return(false);
                        }

                        if (!RequireCheck(new Control[] { ScCopyKouzaCD.TxtChangeDate }, ScCopyKouzaCD.TxtCode))
                        {
                            return(false);
                        }

                        if (ScKouzaCD.IsExists(1))
                        {
                            mtbbl.ShowMessage("E132");
                            ScKouzaCD.SetFocus(1);
                            return(false);
                        }

                        if (!string.IsNullOrWhiteSpace(ScCopyKouzaCD.TxtCode.Text) && !string.IsNullOrWhiteSpace(ScCopyKouzaCD.TxtChangeDate.Text))
                        {
                            if (!ScCopyKouzaCD.IsExists(1))
                            {
                                mtbbl.ShowMessage("E133");
                                ScCopyKouzaCD.SetFocus(1);
                                return(false);
                            }
                        }
                    }
                }
                else
                {
                    if (!ScKouzaCD.IsExists(1))
                    {
                        mtbbl.ShowMessage("E133");
                        ScKouzaCD.SetFocus(1);
                        return(false);
                    }
                }
            }
            else if (index == 12)
            {
                if (!RequireCheck(new Control[] { ScKouzaCD.TxtCode, ScKouzaCD.TxtChangeDate }))
                {
                    return(false);
                }
                if (OperationMode == EOperationMode.INSERT)
                {
                    if (ScKouzaCD.IsExists(1))
                    {
                        mtbbl.ShowMessage("E132");
                        ScKouzaCD.SetFocus(1);
                        return(false);
                    }
                }

                if (!RequireCheck(new Control[] { txtKouzaName }))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { ScBankCD.TxtCode }))
                {
                    return(false);
                }
                if (!ScBankCD.IsExists(2))
                {
                    mtbbl.ShowMessage("E101");
                    ScBankCD.SetFocus(1);
                    return(false);
                }

                if (!RequireCheck(new Control[] { ScBranchCD.TxtCode }))
                {
                    return(false);
                }
                if (!ScBranchCD.IsExists(2))
                {
                    mtbbl.ShowMessage("E101");
                    ScBranchCD.SetFocus(1);
                    return(false);
                }

                if (!RequireCheck(new Control[] { txtKouzaKBN }))
                {
                    return(false);
                }

                if (txtKouzaKBN.Text != "1" && txtKouzaKBN.Text != "2")
                {
                    mtbbl.ShowMessage("E101");
                    ScBankCD.SetFocus(1);
                    return(false);
                }

                if (!RequireCheck(new Control[] { txtKouzaNO, txtKouzaMeigi }))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtCompanyName }, txtCompanyCD))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax11 }, txtFee11))
                {
                    return(false);
                }
                if (!ReverseRequireCheck(new Control[] { txtFee12 }, txtAmount1))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax12 }, txtFee12))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax21 }, txtFee21))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtFee22 }, txtAmount2))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax22 }, txtFee22))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax31 }, txtFee31))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtFee32 }, txtAmount3))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { txtTax32 }, txtFee32))
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        private bool ErrorCheck(int index)
        {
            if (index == 11)
            {
                //HeaderCheck on F11
                if (OperationMode == EOperationMode.INSERT)
                {
                    if (type == 1)                                                                                           //New
                    {
                        if (!RequireCheck(new Control[] { ScBankCD.TxtCode, ScBranchCD.TxtCode, ScBranchCD.TxtChangeDate })) //E102
                        {
                            return(false);
                        }

                        if ((Convert.ToDateTime(ScBranchCD.ChangeDate)) < (Convert.ToDateTime(date)))
                        {
                            bbl.ShowMessage("E133");
                            ScBankCD.SetFocus(1);
                            return(false);
                        }


                        if (!ScBankCD.IsExists(2))
                        {
                            mtbstbl.ShowMessage("E133");
                            ScBankCD.SetFocus(1);
                            return(false);
                        }

                        if (ScBranchCD.IsExists(1))
                        {
                            //***show Message mtsbl.ShowMessage("E132");
                            mtbstbl.ShowMessage("E132");
                            ScBranchCD.SetFocus(1);
                            return(false);
                        }
                    }
                    else//Copy
                    {
                        //if (!RequireCheck(new Control[] { ScBankCD.TxtCode,ScBranchCD.TxtCode, ScBranchCD.TxtChangeDate,ScCopyBankCD.TxtCode,ScCopyBranchCD.TxtCode,ScCopyBranchCD.TxtChangeDate }))

                        if (!RequireCheck(new Control[] { ScBankCD.TxtCode, ScBranchCD.TxtCode, ScBranchCD.TxtChangeDate }))
                        {
                            return(false);
                        }

                        if (!RequireCheck(new Control[] { ScCopyBankCD.TxtCode }, ScCopyBranchCD.TxtCode))
                        {
                            return(false);
                        }

                        if (!RequireCheck(new Control[] { ScCopyBranchCD.TxtCode }, ScCopyBranchCD.TxtChangeDate))
                        {
                            return(false);
                        }

                        if (!RequireCheck(new Control[] { ScCopyBranchCD.TxtChangeDate }, ScCopyBranchCD.TxtCode))
                        {
                            return(false);
                        }
                        if ((Convert.ToDateTime(ScBranchCD.ChangeDate)) < (Convert.ToDateTime(date)))
                        {
                            bbl.ShowMessage("E133");
                            ScBankCD.SetFocus(1);
                            return(false);
                        }

                        if (!ScBankCD.IsExists(2))
                        {
                            mtbstbl.ShowMessage("E133");
                            ScBankCD.SetFocus(1);
                            return(false);
                        }
                        if (ScBranchCD.IsExists(1))
                        {
                            //***show Message mtsbl.ShowMessage("E132");
                            mtbstbl.ShowMessage("E132");
                            ScBranchCD.SetFocus(1);
                            return(false);
                        }

                        if (!string.IsNullOrWhiteSpace(ScCopyBranchCD.TxtCode.Text) && !string.IsNullOrWhiteSpace(ScCopyBranchCD.TxtChangeDate.Text))
                        {
                            if (!ScCopyBranchCD.IsExists(1))
                            {
                                //*** show Message mtsbl.ShowMessage("E133");
                                mtbstbl.ShowMessage("E133");
                                ScCopyBranchCD.SetFocus(1);
                                return(false);
                            }
                        }
                    }
                }
                else
                {
                    if (!RequireCheck(new Control[] { ScBankCD.TxtCode, ScBranchCD.TxtCode, ScBranchCD.TxtChangeDate }))
                    {
                        return(false);
                    }

                    //if (!string.IsNullOrWhiteSpace(ScCopyBranchCD.TxtCode.Text) && !string.IsNullOrWhiteSpace(ScCopyBranchCD.TxtChangeDate.Text))
                    //{
                    //    if (!ScBranchCD.IsExists(1))
                    //    {
                    //        //*** Show Message mtsbl.ShowMessage("E133");
                    //        mtbstbl.ShowMessage("E133");
                    //        ScBranchCD.SetFocus(1);
                    //        return false;
                    //    }
                    //}
                }
            }
            else if (index == 12)
            {
                if (!RequireCheck(new Control[] { ScBranchCD.TxtCode, ScBranchCD.TxtChangeDate }))
                {
                    return(false);
                }

                if (OperationMode == EOperationMode.INSERT)
                {
                    if ((Convert.ToDateTime(ScBranchCD.ChangeDate)) < (Convert.ToDateTime(date)))
                    {
                        bbl.ShowMessage("E133");
                        ScBankCD.SetFocus(1);
                        return(false);
                    }

                    //DataTable dtResult = bbl.SimpleSelect1("4", ScBranchCD.ChangeDate, ScBankCD.TxtCode.Text);
                    //if (dtResult.Rows.Count < 1)
                    //{
                    //    bbl.ShowMessage("E133");
                    //    ScBankCD.SetFocus(1);
                    //    return false;
                    //}
                    if (!ScBankCD.IsExists(2))
                    {
                        mtbstbl.ShowMessage("E133");
                        ScBankCD.SetFocus(1);
                        return(false);
                    }
                    if (ScBranchCD.IsExists(1))
                    {
                        //***show Message mtsbl.ShowMessage("E132");
                        mtbstbl.ShowMessage("E132");
                        ScBranchCD.SetFocus(1);
                        return(false);
                    }
                }

                if (!RequireCheck(new Control[] { TxtBankBranchName, TxtKanaName }))
                {
                    return(false);
                }
                if (OperationMode == EOperationMode.DELETE)
                {
                    if (ScBranchCD.IsExistsDeleteCheck())
                    {
                        //Show Message ==>E154
                        mtbstbl.ShowMessage("E154");
                        ScBranchCD.SetFocus(1);
                        return(false);
                    }
                }
                //*** Insert Other Error Check
            }
            return(true);
        }