コード例 #1
0
        private void Form_Load(object sender, EventArgs e)
        {
            try
            {
                base.InProgramID = ProID;
                base.InProgramNM = ProNm;

                this.SetFunctionLabel(EProMode.PRINT);
                this.InitialControlArray();
                base.Btn_F10.Text = "";

                //起動時共通処理
                base.StartProgram();

                //検索用のパラメータ設定
                string stores = GetAllAvailableStores();
                ScHacchuuNO.Value1 = InOperatorCD;
                ScHacchuuNO.Value2 = stores;

                hsbl = new Hacchuusho_BL();
                string ymd = bbl.GetDate();
                CboStoreCD.Bind(ymd, "2");

                SetFuncKeyAll(this, "100001000011");
                Scr_Clr(0);
            }
            catch (Exception ex)
            {
                //エラー時共通処理
                MessageBox.Show(ex.Message);
                EndSec();
            }
        }
コード例 #2
0
        /// <summary>
        /// HEAD部のコードチェック
        /// </summary>
        /// <param name="index"></param>
        /// <param name="set">画面展開なしの場合:falesに設定する</param>
        /// <returns></returns>
        private bool CheckDetail(int index, bool set = true)
        {
            bool ret;

            switch (index)
            {
            case (int)EIndex.HacchuuDateFrom:
                detailControls[index].Text = hsbl.FormatDate(detailControls[index].Text);

                if (string.IsNullOrWhiteSpace(detailControls[index].Text))
                {
                    return(true);
                }

                //日付として正しいこと(Be on the correct date)E103
                if (!hsbl.CheckDate(detailControls[index].Text))
                {
                    //E103
                    hsbl.ShowMessage("E103");
                    return(false);
                }
                break;

            case (int)EIndex.HacchuuDateTo:
                detailControls[index].Text = hsbl.FormatDate(detailControls[index].Text);

                if (string.IsNullOrWhiteSpace(detailControls[index].Text))
                {
                    return(true);
                }

                //日付として正しいこと(Be on the correct date)E103
                if (!hsbl.CheckDate(detailControls[index].Text))
                {
                    //E103
                    hsbl.ShowMessage("E103");
                    return(false);
                }

                DateTime hacchuuDateFrom;
                DateTime hacchuuDateTo;
                DateTime.TryParse(hsbl.FormatDate(detailControls[(int)EIndex.HacchuuDateFrom].Text), out hacchuuDateFrom);
                DateTime.TryParse(hsbl.FormatDate(detailControls[index].Text), out hacchuuDateTo);
                if (hacchuuDateFrom > hacchuuDateTo)
                {
                    hsbl.ShowMessage("E104");
                    return(false);
                }
                break;

            case (int)EIndex.Staff:
                //入力無くても良い(It is not necessary to input)
                if (string.IsNullOrWhiteSpace(detailControls[index].Text))
                {
                    ScStaff.LabelText = "";
                    return(true);
                }

                //スタッフマスター(M_Staff)に存在すること
                //[M_Staff]
                M_Staff_Entity mse = new M_Staff_Entity
                {
                    StaffCD = detailControls[index].Text,
                };
                if (string.IsNullOrWhiteSpace(mse.ChangeDate))
                {
                    mse.ChangeDate = bbl.GetDate();
                }

                Staff_BL bl = new Staff_BL();
                ret = bl.M_Staff_Select(mse);
                if (ret)
                {
                    ScStaff.LabelText = mse.StaffName;
                }
                else
                {
                    bbl.ShowMessage("E101");
                    ScStaff.LabelText = "";
                    return(false);
                }
                break;


            case (int)EIndex.Vendor:
                //入力無くても良い(It is not necessary to input)
                if (string.IsNullOrWhiteSpace(detailControls[index].Text))
                {
                    ClearVendorInfo();
                    return(true);
                }

                //[M_Vendor_Select]
                M_Vendor_Entity mce = new M_Vendor_Entity
                {
                    VendorCD = detailControls[index].Text,
                };
                if (string.IsNullOrWhiteSpace(mce.ChangeDate))
                {
                    mce.ChangeDate = bbl.GetDate();
                }

                Vendor_BL sbl = new Vendor_BL();
                ret = sbl.M_Vendor_SelectTop1(mce);
                if (ret)
                {
                    if (mOldVendorCD != detailControls[index].Text)
                    {
                        ScVendor.LabelText = mce.VendorName;
                    }
                }
                else
                {
                    bbl.ShowMessage("E101");
                    ClearVendorInfo();
                    return(false);
                }

                mOldVendorCD = detailControls[index].Text;        //位置確認
                break;

            case (int)EIndex.HacchuuNO:
                //入力必須(Entry required)
                if (string.IsNullOrWhiteSpace(detailControls[index].Text))
                {
                    return(true);
                }

                Hacchuusho_BL hbl = new Hacchuusho_BL();
                var           dt  = hbl.PRC_Hacchuusho_D_Order_SelectByKey(detailControls[index].Text);
                if (dt.Rows.Count == 0)
                {
                    bbl.ShowMessage("E138", "発注番号");
                    return(false);
                }

                if (dt.Rows[0]["DeleteDateTime"] == null)
                {
                    bbl.ShowMessage("E140");
                    return(false);
                }

                //dt = hbl.PRC_Hacchuusho_M_AutorisationCheck();
                //if (dt.Rows.Count == 0)
                //{
                //    bbl.ShowMessage("E139");
                //    return false;
                //}

                mOldVendorCD = detailControls[index].Text;        //位置確認

                break;

            case (int)EIndex.StoreCD:
                if (CboStoreCD.SelectedValue.Equals("-1"))
                {
                    bbl.ShowMessage("E102");
                    CboStoreCD.Focus();
                    return(false);
                }
                else
                {
                    if (!base.CheckAvailableStores(CboStoreCD.SelectedValue.ToString()))
                    {
                        bbl.ShowMessage("E141");
                        CboStoreCD.Focus();
                        return(false);
                    }
                }

                break;
            }

            return(true);
        }