Esempio n. 1
0
        private bool ErrorCheck(int index)
        {
            if (index == 11)
            {
                //HeaderCheck on F11
                if (OperationMode == EOperationMode.INSERT)
                {
                    if (type == 1)
                    {
                        if (!RequireCheck(new Control[] { ScID.TxtCode }))
                        {
                            return(false);
                        }
                        if (!RequireCheck(new Control[] { ScKey.TxtCode }))
                        {
                            return(false);
                        }
                    }
                    else // Copy
                    {
                        if (!RequireCheck(new Control[] { ScID.TxtCode }))
                        {
                            return(false);
                        }

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


                        if (!string.IsNullOrWhiteSpace(ScCopyKey.Code))
                        {
                            DataTable dtKey = new DataTable();
                            mhe   = GetHanyouEntity();
                            dtKey = mthbl.Hanyou_KeySelect(mhe);
                            if (dtKey.Rows.Count > 0)
                            {
                                mthbl.ShowMessage("E132");
                                ScKey.SetFocus(1);
                                return(false);
                            }
                            else
                            {
                                mhe.ID  = ScID.Code;
                                mhe.Key = ScCopyKey.Code;
                                ScCopyKey.SearchEnable = true;
                                DataTable dtcopyKey = new DataTable();
                                dtcopyKey = mthbl.Hanyou_KeySelect(mhe);
                                if (dtcopyKey.Rows.Count == 0)
                                {
                                    mthbl.ShowMessage("E133");
                                    ScCopyKey.SetFocus(1);
                                    return(false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    DataTable dtKey = new DataTable();
                    mhe   = GetHanyouEntity();
                    dtKey = mthbl.Hanyou_KeySelect(mhe);
                    if (dtKey.Rows.Count == 0)
                    {
                        mthbl.ShowMessage("E133");
                        ScKey.SetFocus(1);
                        return(false);
                    }
                }
            }
            else if (index == 12)
            {
                if (!RequireCheck(new Control[] { ScID.TxtCode }))
                {
                    return(false);
                }
                if (!RequireCheck(new Control[] { ScKey.TxtCode }))
                {
                    return(false);
                }

                if (OperationMode == EOperationMode.INSERT)
                {
                    DataTable dtKey = new DataTable();
                    mhe   = GetHanyouEntity();
                    dtKey = mthbl.Hanyou_KeySelect(mhe);
                    if (dtKey.Rows.Count > 0)
                    {
                        mthbl.ShowMessage("E132");
                        ScKey.SetFocus(1);
                        return(false);
                    }
                }
            }
            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Display event
        /// </summary>
        /// <param name="type"></param>
        ///
        private void F11()
        {
            if (ErrorCheck(11))
            {
                switch (OperationMode)
                {
                case EOperationMode.INSERT:
                    if (type == 1)
                    {
                        BtnF11Show.Enabled = true;
                        F11Enable          = true;
                        DisablePanel(panelDetail);
                        ScCopyKey.SetFocus(1);
                    }
                    else
                    {
                        mhe.ID  = ScID.Code;
                        mhe.Key = ScCopyKey.Code;
                        DisplayData();
                        DisablePanel(panel3);
                        EnablePanel(panelDetail);
                        BtnF11Show.Enabled = false;
                        F11Enable          = false;
                        txtText1.Focus();

                        //if(string.IsNullOrWhiteSpace(ScKey.ChangeDate) || (DisplayData(ScCopyKey)))
                        //{
                        //    DisablePanel(panel3);
                        //    EnablePanel(panelDetail);
                        //    BtnF11Show.Enabled = F11Enable = false;
                        //    SelectNextControl(PanelDetail, true, true, true, true);
                        //}
                    }
                    break;

                case EOperationMode.UPDATE:
                    mhe.ID  = ScID.Code;
                    mhe.Key = ScKey.Code;
                    DisplayData();
                    DisablePanel(panel3);
                    BtnF11Show.Enabled = false;
                    F11Enable          = false;
                    EnablePanel(panelDetail);
                    F12Enable          = true;
                    ScKey.SearchEnable = true;
                    txtText1.Focus();
                    break;

                case EOperationMode.DELETE:
                    mhe.ID  = ScID.Code;
                    mhe.Key = ScKey.Code;
                    DisplayData();
                    DisablePanel(panel3);
                    BtnF11Show.Enabled = false;
                    F11Enable          = false;
                    DisablePanel(panelDetail);
                    txtText1.Focus();
                    F12Enable = true;
                    break;

                case EOperationMode.SHOW:
                    mhe.ID  = ScID.Code;
                    mhe.Key = ScKey.Code;
                    DisplayData();
                    DisablePanel(panel3);
                    BtnF11Show.Enabled = false;
                    F11Enable          = false;
                    DisablePanel(panelDetail);
                    txtText1.Focus();
                    F12Enable = false;
                    break;
                }
            }
        }