Exemplo n.º 1
0
        // コンボボックスではKeyDown,Upは規定の動作
        private bool IsComboBoxColumnIndex(int _index)
        {
            if (string.IsNullOrEmpty(this._ComboBoxColumnIndex))
            {
                return(false);
            }

            string[] colIndex = this._ComboBoxColumnIndex.Split(',');
            if (colIndex.Length == 0)
            {
                return(false);
            }

            // 数値項目のみ制御を行う(ひらがなや半角英数項目はなぜかいく)
            for (int i = 0; i <= colIndex.Length - 1; i++)
            {
                if (ExCast.IsNumeric(colIndex[i]))
                {
                    if (_index == ExCast.zCInt(colIndex[i]))
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
Exemplo n.º 2
0
        public void FormatToID()
        {
            if (InputMode != geInputMode.ID)
            {
                return;
            }
            if (this.Text == "")
            {
                return;
            }
            if (ExCast.zCInt(this.MaxLengthB) == 0)
            {
                return;
            }
            if (ExCast.IsNumeric(this.Text) == false)
            {
                return;
            }

            string str0 = "";

            for (int i = 1; i <= ExCast.zCInt(this.MaxLengthB); i++)
            {
                str0 += "0";
            }
            string str = ExCast.zCDbl(this.Text).ToString(str0);

            this.Text = str;
            this.Text = str;
        }
 private void utlID_LostFocus(object sender, RoutedEventArgs e)
 {
     if (this.utlID.txtID.Text.Trim() != "")
     {
         string _id = this.utlID.txtID.Text.Trim();
         if (ExCast.IsNumeric(_id))
         {
             _id = ExCast.zCDbl(_id).ToString();
         }
         GetMstData(_id);
     }
 }
        private void copyDlg_Closed(object sender, EventArgs e)
        {
            Dlg_Copying dlg = (Dlg_Copying)sender;

            if (dlg.utlCopying.DialogResult == true)
            {
                // ロック解除
                DataPgLock.gLockPg(PG_NM, _entity._id, (int)DataPgLock.geLockType.UnLock);

                if (dlg.utlCopying.copy_id == "")
                {
                    this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Init;
                    this.btnSalesBalance.IsEnabled         = false;
                    this.utlID.txtID_IsReadOnly            = false;
                    this.utlID.txtID.Text = "";
                }
                else
                {
                    if (dlg.utlCopying.ExistsData == true)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                        this.btnSalesBalance.IsEnabled         = true;
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.New;
                        this.btnSalesBalance.IsEnabled         = false;
                    }
                    string _id = dlg.utlCopying.copy_id;
                    if (ExCast.IsNumeric(dlg.utlCopying.copy_id))
                    {
                        _id                   = ExCast.zCDbl(_id).ToString();
                        _entity._id           = _id;
                        this.utlID.txtID.Text = _id;
                        this.utlID.txtID.FormatToID();
                    }
                    else
                    {
                        _entity._id           = _id;
                        this.utlID.txtID.Text = _id;
                    }

                    this.utlID.txtID_IsReadOnly = true;
                    ExBackgroundWorker.DoWork_Focus(this.txtName, 10);
                }
            }
        }
        // F1ボタン(OK) クリック
        public override void btnF1_Click(object sender, RoutedEventArgs e)
        {
            if (this.btnF1.IsEnabled == false)
            {
                return;
            }

            if (this.rdoAri.IsChecked == true && this_txtID.Text.Trim() == "")
            {
                ExMessageBox.Show("IDが指定されていません。");
                return;
            }

            if (ExCast.IsNumeric(this_txtID.Text.Trim()))
            {
                if (ExCast.zCDbl(this.before_id) == ExCast.zCDbl(this_txtID.Text.Trim()))
                {
                    ExMessageBox.Show("複写元と複写先IDが同じです。");
                    return;
                }
            }
            else
            {
                if (this.before_id == this_txtID.Text.Trim())
                {
                    ExMessageBox.Show("複写元と複写先IDが同じです。");
                    return;
                }
            }

            if (this.rdoAri.IsChecked == true)
            {
                this.copy_id = this_txtID.Text.Trim();
                if (ExCast.IsNumeric(this.copy_id))
                {
                    this.copy_id = ExCast.zCDbl(this.copy_id).ToString();
                }
                OnCopyCheck();
            }
            else
            {
                this.copy_id      = "";
                this.DialogResult = true;
                Dlg_Copying win = (Dlg_Copying)ExVisualTreeHelper.FindPerentChildWindow(this);
                win.Close();
            }
        }
Exemplo n.º 6
0
        private void txtZipNo2_LostFocus(object sender, RoutedEventArgs e)
        {
            if (this.txtZipNo1.Text.Trim() == "")
            {
                this.UserControlAdress1 = "";
                this.UserControlAdress2 = "";
                return;
            }

            if (this.txtZipNo2.Text.Trim() == "")
            {
                this.UserControlAdress1 = "";
                this.UserControlAdress2 = "";
                return;
            }

            if (Is_Zip_Upd == false)
            {
                return;
            }

            string zip1 = this.txtZipNo1.Text.Trim();

            if (zip1 != "" && ExCast.IsNumeric(zip1))
            {
                zip1 = string.Format("{0:000}", ExCast.zCDbl(zip1));
            }

            string zip2 = this.txtZipNo2.Text.Trim();

            if (zip2 != "" && ExCast.IsNumeric(zip2))
            {
                zip2 = string.Format("{0:0000}", ExCast.zCDbl(zip2));
            }

            this.txtZipNo1.Text = zip1;
            this.txtZipNo2.Text = zip2;

            MstData _mstData = new MstData();

            _mstData.GetMData(MstData.geMDataKbn.Zip, new string[] { zip1, zip2 }, this);
        }
        // データ追加・更新・削除
        private void UpdateData(Common.geUpdateType upd)
        {
            object[] prm = new object[4];

            prm[0] = (int)upd;
            if (ExCast.IsNumeric(this.utlID.txtID.Text.Trim()))
            {
                prm[1] = ExCast.zCLng(this.utlID.txtID.Text.Trim());
            }
            else
            {
                prm[1] = this.utlID.txtID.Text.Trim();
            }
            prm[2] = _entity;
            webService.objPerent = this;
            webService.CallWebService(_UpdWebServiceCallKbn,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
Exemplo n.º 8
0
        // 入力チェック(更新時)
        public override void InputCheckUpdate()
        {
            #region Field

            string  errMessage  = "";
            string  warnMessage = "";
            Control errCtl      = null;

            #endregion

            try
            {
                for (int i = 0; i <= _entity.Count - 1; i++)
                {
                    // IDまたは名称の入力がある場合(空行は無視)
                    if (!string.IsNullOrEmpty(_entity[i]._id) || !string.IsNullOrEmpty(_entity[i]._name))
                    {
                        #region 入力チェック

                        #region 必須チェック

                        // ID
                        if (string.IsNullOrEmpty(_entity[i]._id))
                        {
                            errMessage += (i + 1) + "行目のIDが入力されていません。" + Environment.NewLine;
                            if (errCtl == null)
                            {
                                errCtl        = this.dg;
                                _selectIndex  = i;
                                _selectColumn = 0;
                            }
                        }

                        // 名称
                        if (string.IsNullOrEmpty(_entity[i]._name))
                        {
                            errMessage += (i + 1) + "行目の名称が入力されていません。" + Environment.NewLine;
                            if (errCtl == null)
                            {
                                errCtl        = this.dg;
                                _selectIndex  = i;
                                _selectColumn = 1;
                            }
                        }

                        #endregion

                        #region 適正値入力チェック

                        if (!string.IsNullOrEmpty(_entity[i]._id))
                        {
                            if (ExCast.zCInt(_entity[i]._id) == 0)
                            {
                                errMessage += (i + 1) + "行目のIDに「0」以外を入力して下さい。" + Environment.NewLine;
                                if (errCtl == null)
                                {
                                    errCtl        = this.dg;
                                    _selectIndex  = i;
                                    _selectColumn = 0;
                                }
                            }
                        }

                        //// 主仕入先
                        //if (ExCast.zCStr(_entity._main_purchase_id) != "" && string.IsNullOrEmpty(_entity._main_purchase_nm))
                        //{
                        //    errMessage += "主仕入先が適切に入力(選択)されていません。" + Environment.NewLine;
                        //    if (errCtl == null) errCtl = this.utlMainPurchaseId.txtID;
                        //}

                        #endregion

                        #region  一IDチェック

                        if (!string.IsNullOrEmpty(_entity[i]._id))
                        {
                            for (int _i = 0; _i <= _entity.Count - 1; _i++)
                            {
                                if (_i != i && ExCast.zCInt(_entity[i]._id) == ExCast.zCInt(_entity[_i]._id) && !string.IsNullOrEmpty(_entity[_i]._id) && ExCast.zCInt(_entity[i]._id) != 0)
                                {
                                    string _msg = "ID : " + ExCast.zCInt(_entity[i]._id) + " が重複して入力されています。" + Environment.NewLine;
                                    if (errMessage.IndexOf(_msg) == -1)
                                    {
                                        errMessage += _msg;
                                        if (errCtl == null)
                                        {
                                            errCtl        = this.dg;
                                            _selectIndex  = i;
                                            _selectColumn = 0;
                                        }
                                    }
                                }
                            }
                        }

                        #endregion

                        #region 日付チェック

                        //// 納入指定日
                        //if (string.IsNullOrEmpty(_entity.supply_ymd) == false)
                        //{
                        //    if (ExCast.IsDate(_entity.supply_ymd) == false)
                        //    {
                        //        errMessage += "納入指定日の形式が不正です。(yyyy/mm/dd形式で入力(選択)して下さい)" + Environment.NewLine;
                        //        if (errCtl == null) errCtl = this.datNokiYmd;
                        //    }
                        //}

                        #endregion

                        #region 日付変換

                        // 受注日
                        //if (string.IsNullOrEmpty(_entity.order_ymd) == false)
                        //{
                        //    _entity.order_ymd = ExCast.zConvertToDate(_entity.order_ymd).ToString("yyyy/MM/dd");

                        //}

                        #endregion

                        #region 数値チェック

                        // ID
                        if (!string.IsNullOrEmpty(_entity[i]._id))
                        {
                            if (!ExCast.IsNumeric(_entity[i]._id))
                            {
                                errMessage += (i + 1) + "行目のIDに数値が入力されていません。" + Environment.NewLine;
                                if (errCtl == null)
                                {
                                    errCtl        = this.dg;
                                    _selectIndex  = i;
                                    _selectColumn = 0;
                                }
                            }
                        }

                        #endregion

                        #region 正数チェック

                        //if (this.utlMode.Mode != Utl_FunctionKey.geFunctionKeyEnable.Init)
                        //{
                        //    if (ExCast.zCLng(this.utlID.txtID.Text.Trim()) < 0)
                        //    {
                        //        errMessage += "IDには正の整数を入力して下さい。" + Environment.NewLine;
                        //    }
                        //}

                        #endregion

                        #region 範囲チェック

                        //if (ExCast.zCLng(this.utlID.txtID.Text.Trim()) > 9999)
                        //{
                        //    errMessage += "IDには4桁の正の整数を入力して下さい。" + Environment.NewLine;
                        //}

                        //if (ExString.LenB(_entity._memo) > 32)
                        //{
                        //    errMessage += "備考には全角16桁文字以内(半角32桁文字以内)を入力して下さい。" + Environment.NewLine;
                        //    if (errCtl == null) errCtl = this.txtMemo;
                        //}

                        #endregion

                        #endregion

                        _entity[i]._display_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.DISPLAY_DIVISION_ID, ExCast.zCStr(_entity[i]._display_division_nm)) - 1;
                    }
                }

                #region エラー or 警告時処理

                bool flg = true;

                if (!string.IsNullOrEmpty(errMessage))
                {
                    ExMessageBox.Show(this, errCtl, errMessage, Dlg.MessageBox.MessageBoxIcon.Error);
                    flg = false;
                }

                if (!string.IsNullOrEmpty(warnMessage))
                {
                    warnMessage += "このまま登録を続行してもよろしいですか?" + Environment.NewLine;
                    ExMessageBox.ResultShow(this, errCtl, warnMessage);
                    flg = false;
                    //if (ExMessageBox.ResultShow(warnMessage) == MessageBoxResult.No)
                    //{
                    //    flg = false;
                    //}
                }

                this.txtDummy.IsTabStop = false;

                if (flg == false)
                {
                    if (errCtl != null)
                    {
                        switch (errCtl.Name)
                        {
                        case "dg":
                            errCtl.Focus();
                            this.dg.SelectedIndex = _selectIndex;
                            dg.CurrentColumn      = dg.Columns[_selectColumn];
                            ExBackgroundWorker.DoWork_Focus(errCtl, 10);
                            break;

                        default:
                            ExBackgroundWorker.DoWork_Focus(errCtl, 10);
                            break;
                        }
                    }
                    return;
                }

                #endregion

                #region 更新処理

                UpdateData();

                #endregion
            }
            finally
            {
                Common.gblnBtnProcLock          = false;
                Common.gblnBtnDesynchronizeLock = false;
            }
        }
Exemplo n.º 9
0
        public string UpdateCommodity(string random, int type, string Id, EntityCommodity entity)
        {
            #region 認証処理

            string companyId     = "";
            string groupId       = "";
            string userId        = "";
            string ipAdress      = "";
            string sessionString = "";
            string personId      = "";

            try
            {
                companyId     = ExCast.zCStr(HttpContext.Current.Session[ExSession.COMPANY_ID]);
                groupId       = ExCast.zCStr(HttpContext.Current.Session[ExSession.GROUP_ID]);
                userId        = ExCast.zCStr(HttpContext.Current.Session[ExSession.USER_ID]);
                ipAdress      = ExCast.zCStr(HttpContext.Current.Session[ExSession.IP_ADRESS]);
                sessionString = ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]);
                personId      = ExCast.zCStr(HttpContext.Current.Session[ExSession.PERSON_ID]);

                string _message = ExSession.SessionUserUniqueCheck(random, ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]), ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]));
                if (_message != "")
                {
                    return(_message);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(認証処理)", ex);
                return(CLASS_NM + ".UpdateCommodity : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString());
            }

            #endregion

            #region Field

            StringBuilder sb = new StringBuilder();
            DataTable     dt;
            ExMySQLData   db  = null;
            string        _Id = "";

            #endregion

            #region Databese Open

            try
            {
                db = new ExMySQLData(ExCast.zCStr(HttpContext.Current.Session[ExSession.DB_CONNECTION_STR]));
                db.DbOpen();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(DbOpen)", ex);
                return(CLASS_NM + ".UpdateCommodity(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region BeginTransaction

            try
            {
                db.ExBeginTransaction();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(BeginTransaction)", ex);
                return(CLASS_NM + ".UpdateCommodity(BeginTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Get Max Master ID

            if (type == 1 && (Id == "" || Id == "0"))
            {
                try
                {
                    DataMasterId.GetMaxMasterId(companyId,
                                                "",
                                                db,
                                                DataMasterId.geMasterMaxIdKbn.Commodity,
                                                out _Id);

                    if (_Id == "")
                    {
                        return("ID取得に失敗しました。");
                    }
                }
                catch (Exception ex)
                {
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(GetMaxMasterId)", ex);
                    return(CLASS_NM + ".UpdateCommodity(GetMaxMasterId) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }
            else
            {
                _Id = Id;
            }

            #endregion

            #region Insert

            if (type == 1)
            {
                try
                {
                    #region Delete SQL

                    sb.Length = 0;
                    sb.Append("DELETE FROM M_COMMODITY " + Environment.NewLine);
                    sb.Append(" WHERE DELETE_FLG = 1 " + Environment.NewLine);
                    sb.Append("   AND COMPANY_ID = " + companyId + Environment.NewLine);
                    sb.Append("   AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine);

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);

                    #region Insert SQL

                    string _main_purchase_id = entity.main_purchase_id;
                    if (ExCast.IsNumeric(_main_purchase_id))
                    {
                        _main_purchase_id = ExCast.zCDbl(_main_purchase_id).ToString();
                    }

                    #region SQL

                    sb.Length = 0;
                    sb.Append("INSERT INTO M_COMMODITY " + Environment.NewLine);
                    sb.Append("       ( COMPANY_ID" + Environment.NewLine);
                    sb.Append("       , ID" + Environment.NewLine);
                    sb.Append("       , ID2" + Environment.NewLine);
                    sb.Append("       , NAME" + Environment.NewLine);
                    sb.Append("       , KANA" + Environment.NewLine);
                    sb.Append("       , UNIT_ID" + Environment.NewLine);
                    sb.Append("       , ENTER_NUMBER" + Environment.NewLine);
                    sb.Append("       , NUMBER_DECIMAL_DIGIT" + Environment.NewLine);
                    sb.Append("       , UNIT_DECIMAL_DIGIT" + Environment.NewLine);
                    sb.Append("       , TAXATION_DIVISION_ID" + Environment.NewLine);
                    sb.Append("       , INVENTORY_MANAGEMENT_DIVISION_ID" + Environment.NewLine);
                    sb.Append("       , PURCHASE_LOT" + Environment.NewLine);
                    sb.Append("       , LEAD_TIME" + Environment.NewLine);
                    sb.Append("       , JUST_INVENTORY_NUMBER" + Environment.NewLine);
                    sb.Append("       , INVENTORY_NUMBER" + Environment.NewLine);
                    sb.Append("       , INVENTORY_EVALUATION_ID" + Environment.NewLine);
                    sb.Append("       , MAIN_PURCHASE_ID" + Environment.NewLine);
                    sb.Append("       , RETAIL_PRICE_SKIP_TAX" + Environment.NewLine);
                    sb.Append("       , RETAIL_PRICE_BEFORE_TAX" + Environment.NewLine);
                    sb.Append("       , SALES_UNIT_PRICE_SKIP_TAX" + Environment.NewLine);
                    sb.Append("       , SALES_UNIT_PRICE_BEFORE_TAX" + Environment.NewLine);
                    sb.Append("       , SALES_COST_PRICE_SKIP_TAX" + Environment.NewLine);
                    sb.Append("       , SALES_COST_PRICE_BEFORE_TAX" + Environment.NewLine);
                    sb.Append("       , PURCHASE_UNIT_PRICE_SKIP_TAX" + Environment.NewLine);
                    sb.Append("       , PURCHASE_UNIT_PRICE_BEFORE_TAX" + Environment.NewLine);
                    sb.Append("       , GROUP1_ID" + Environment.NewLine);
                    sb.Append("       , GROUP2_ID" + Environment.NewLine);
                    sb.Append("       , GROUP3_ID" + Environment.NewLine);
                    sb.Append("       , MEMO" + Environment.NewLine);
                    sb.Append("       , DISPLAY_FLG" + Environment.NewLine);
                    sb.Append("       , UPDATE_FLG" + Environment.NewLine);
                    sb.Append("       , DELETE_FLG" + Environment.NewLine);
                    sb.Append("       , CREATE_PG_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_ADRESS" + Environment.NewLine);
                    sb.Append("       , CREATE_USER_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_PERSON_ID" + Environment.NewLine);
                    sb.Append("       , CREATE_DATE" + Environment.NewLine);
                    sb.Append("       , CREATE_TIME" + Environment.NewLine);
                    sb.Append("       , UPDATE_PG_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_ADRESS" + Environment.NewLine);
                    sb.Append("       , UPDATE_USER_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_PERSON_ID" + Environment.NewLine);
                    sb.Append("       , UPDATE_DATE" + Environment.NewLine);
                    sb.Append("       , UPDATE_TIME" + Environment.NewLine);
                    sb.Append(")" + Environment.NewLine);
                    sb.Append("SELECT  " + companyId + Environment.NewLine);                                                // COMPANY_ID
                    sb.Append("       ," + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine);      // ID
                    sb.Append("       ," + ExCast.zIdForNumIndex(_Id) + Environment.NewLine);                               // ID2
                    sb.Append("       ," + ExEscape.zRepStr(entity.name) + Environment.NewLine);                            // NAME
                    sb.Append("       ," + ExEscape.zRepStr(entity.kana) + Environment.NewLine);                            // KANA
                    sb.Append("       ," + entity.unit_id + Environment.NewLine);                                           // UNIT_ID
                    sb.Append("       ," + entity.enter_number + Environment.NewLine);                                      // ENTER_NUMBER
                    sb.Append("       ," + entity.number_decimal_digit + Environment.NewLine);                              // NUMBER_DECIMAL_DIGIT
                    sb.Append("       ," + entity.unit_decimal_digit + Environment.NewLine);                                // UNIT_DECIMAL_DIGIT
                    sb.Append("       ," + entity.taxation_divition_id + Environment.NewLine);                              // TAXATION_DIVISION_ID
                    sb.Append("       ," + entity.inventory_management_division_id + Environment.NewLine);                  // INVENTORY_MANAGEMENT_DIVISION_ID
                    sb.Append("       ," + entity.purchase_lot + Environment.NewLine);                                      // PURCHASE_LOT
                    sb.Append("       ," + entity.lead_time + Environment.NewLine);                                         // LEAD_TIME
                    sb.Append("       ," + entity.just_inventory_number + Environment.NewLine);                             // JUST_INVENTORY_NUMBER
                    sb.Append("       ," + entity.inventory_number + Environment.NewLine);                                  // INVENTORY_NUMBER
                    sb.Append("       ," + entity.inventory_evaluation_id + Environment.NewLine);                           // INVENTORY_EVALUATION_ID
                    sb.Append("       ," + ExEscape.zRepStr(_main_purchase_id) + Environment.NewLine);                      // MAIN_PURCHASE_ID
                    sb.Append("       ," + entity.retail_price_skip_tax + Environment.NewLine);                             // RETAIL_PRICE_SKIP_TAX
                    sb.Append("       ," + entity.retail_price_before_tax + Environment.NewLine);                           // RETAIL_PRICE_BEFORE_TAX
                    sb.Append("       ," + entity.sales_unit_price_skip_tax + Environment.NewLine);                         // SALES_UNIT_PRICE_SKIP_TAX
                    sb.Append("       ," + entity.sales_unit_price_before_tax + Environment.NewLine);                       // SALES_UNIT_PRICE_BEFORE_TAX
                    sb.Append("       ," + entity.sales_cost_price_skip_tax + Environment.NewLine);                         // SALES_COST_PRICE_SKIP_TAX
                    sb.Append("       ," + entity.sales_cost_price_before_tax + Environment.NewLine);                       // SALES_COST_PRICE_BEFORE_TAX
                    sb.Append("       ," + entity.purchase_unit_price_skip_tax + Environment.NewLine);                      // PURCHASE_UNIT_PRICE_SKIP_TAX
                    sb.Append("       ," + entity.purchase_unit_price_before_tax + Environment.NewLine);                    // PURCHASE_UNIT_PRICE_BEFORE_TAX
                    sb.Append("       ," + ExEscape.zRepStr(entity.group1_id) + Environment.NewLine);                       // GROUP1_ID
                    sb.Append("       ," + ExEscape.zRepStr(entity.group2_id) + Environment.NewLine);                       // GROUP2_ID
                    sb.Append("       ," + ExEscape.zRepStr(entity.group3_id) + Environment.NewLine);                       // GROUP3_ID
                    sb.Append("       ," + ExEscape.zRepStr(entity.memo) + Environment.NewLine);                            // MEMO
                    sb.Append("       ," + entity.display_division_id + Environment.NewLine);                               // DISPLAY_FLG
                    sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins,
                                                              PG_NM,
                                                              "M_COMMODITY",
                                                              ExCast.zCInt(personId),
                                                              _Id,
                                                              ipAdress,
                                                              userId));

                    #endregion

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);

                    #region Commodity Inventory Insert

                    try
                    {
                        #region Delete SQL

                        sb.Length = 0;
                        sb.Append("DELETE FROM M_COMMODITY_INVENTORY " + Environment.NewLine);
                        sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);                                   // COMPANY_ID
                        sb.Append("   AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine); // ID

                        #endregion

                        db.ExecuteSQL(sb.ToString(), false);

                        #region SQL

                        sb.Length = 0;
                        sb.Append("SELECT MT.* " + Environment.NewLine);
                        sb.Append("  FROM SYS_M_COMPANY_GROUP AS MT" + Environment.NewLine);
                        sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine);
                        sb.Append("   AND MT.DELETE_FLG = 0 " + Environment.NewLine);
                        sb.Append(" ORDER BY MT.ID " + Environment.NewLine);

                        #endregion

                        dt = db.GetDataTable(sb.ToString());

                        if (dt.DefaultView.Count > 0)
                        {
                            for (int i = 0; i <= dt.DefaultView.Count - 1; i++)
                            {
                                #region Insert SQL

                                sb.Length = 0;
                                sb.Append("INSERT INTO M_COMMODITY_INVENTORY " + Environment.NewLine);
                                sb.Append("       ( COMPANY_ID" + Environment.NewLine);
                                sb.Append("       , GROUP_ID" + Environment.NewLine);
                                sb.Append("       , ID" + Environment.NewLine);
                                sb.Append("       , INVENTORY_NUMBER" + Environment.NewLine);
                                sb.Append("       , UPDATE_FLG" + Environment.NewLine);
                                sb.Append("       , DELETE_FLG" + Environment.NewLine);
                                sb.Append("       , CREATE_PG_ID" + Environment.NewLine);
                                sb.Append("       , CREATE_ADRESS" + Environment.NewLine);
                                sb.Append("       , CREATE_USER_ID" + Environment.NewLine);
                                sb.Append("       , CREATE_PERSON_ID" + Environment.NewLine);
                                sb.Append("       , CREATE_DATE" + Environment.NewLine);
                                sb.Append("       , CREATE_TIME" + Environment.NewLine);
                                sb.Append("       , UPDATE_PG_ID" + Environment.NewLine);
                                sb.Append("       , UPDATE_ADRESS" + Environment.NewLine);
                                sb.Append("       , UPDATE_USER_ID" + Environment.NewLine);
                                sb.Append("       , UPDATE_PERSON_ID" + Environment.NewLine);
                                sb.Append("       , UPDATE_DATE" + Environment.NewLine);
                                sb.Append("       , UPDATE_TIME" + Environment.NewLine);
                                sb.Append(")" + Environment.NewLine);
                                sb.Append("SELECT  " + companyId + Environment.NewLine);                                                        // COMPANY_ID
                                sb.Append("       ," + ExCast.zCStr(dt.DefaultView[i]["ID"]) + Environment.NewLine);                            // GROUP_ID
                                sb.Append("       ," + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(_Id)) + Environment.NewLine);              // ID
                                sb.Append("       ,0" + Environment.NewLine);                                                                   // INVENTORY_NUMBER
                                sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins,
                                                                          PG_NM,
                                                                          "M_COMMODITY_INVENTORY",
                                                                          ExCast.zCInt(personId),
                                                                          _Id,
                                                                          ipAdress,
                                                                          userId));

                                #endregion

                                db.ExecuteSQL(sb.ToString(), false);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        db.ExRollbackTransaction();
                        CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Commodity Inventory Insert)", ex);
                        return(CLASS_NM + ".UpdateCommodity(Commodity Inventory Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                    }

                    #endregion
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Insert)", ex);
                    return(CLASS_NM + ".UpdateCommodity(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region Update

            if (type == 0)
            {
                try
                {
                    #region SQL

                    string _main_purchase_id = entity.main_purchase_id;
                    if (ExCast.IsNumeric(_main_purchase_id))
                    {
                        _main_purchase_id = ExCast.zCDbl(_main_purchase_id).ToString();
                    }

                    sb.Length = 0;
                    sb.Append("UPDATE M_COMMODITY " + Environment.NewLine);
                    sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM,
                                                              ExCast.zCInt(personId),
                                                              ipAdress,
                                                              userId,
                                                              0));
                    sb.Append("      ,NAME = " + ExEscape.zRepStr(entity.name) + Environment.NewLine);
                    sb.Append("      ,KANA = " + ExEscape.zRepStr(entity.kana) + Environment.NewLine);
                    sb.Append("      ,UNIT_ID = " + entity.unit_id + Environment.NewLine);
                    sb.Append("      ,ENTER_NUMBER = " + entity.enter_number + Environment.NewLine);
                    sb.Append("      ,NUMBER_DECIMAL_DIGIT = " + entity.number_decimal_digit + Environment.NewLine);
                    sb.Append("      ,UNIT_DECIMAL_DIGIT = " + entity.unit_decimal_digit + Environment.NewLine);
                    sb.Append("      ,TAXATION_DIVISION_ID = " + entity.taxation_divition_id + Environment.NewLine);
                    sb.Append("      ,INVENTORY_MANAGEMENT_DIVISION_ID = " + entity.inventory_management_division_id + Environment.NewLine);
                    sb.Append("      ,PURCHASE_LOT = " + entity.purchase_lot + Environment.NewLine);
                    sb.Append("      ,LEAD_TIME = " + entity.lead_time + Environment.NewLine);
                    sb.Append("      ,JUST_INVENTORY_NUMBER = " + entity.just_inventory_number + Environment.NewLine);
                    sb.Append("      ,INVENTORY_NUMBER = " + entity.inventory_number + Environment.NewLine);
                    sb.Append("      ,INVENTORY_EVALUATION_ID = " + entity.inventory_evaluation_id + Environment.NewLine);
                    sb.Append("      ,MAIN_PURCHASE_ID = " + ExEscape.zRepStr(_main_purchase_id) + Environment.NewLine);
                    sb.Append("      ,RETAIL_PRICE_SKIP_TAX = " + entity.retail_price_skip_tax + Environment.NewLine);
                    sb.Append("      ,RETAIL_PRICE_BEFORE_TAX = " + entity.retail_price_before_tax + Environment.NewLine);
                    sb.Append("      ,SALES_UNIT_PRICE_SKIP_TAX = " + entity.sales_unit_price_skip_tax + Environment.NewLine);
                    sb.Append("      ,SALES_UNIT_PRICE_BEFORE_TAX = " + entity.sales_unit_price_before_tax + Environment.NewLine);
                    sb.Append("      ,SALES_COST_PRICE_SKIP_TAX = " + entity.sales_cost_price_skip_tax + Environment.NewLine);
                    sb.Append("      ,SALES_COST_PRICE_BEFORE_TAX = " + entity.sales_cost_price_before_tax + Environment.NewLine);
                    sb.Append("      ,PURCHASE_UNIT_PRICE_SKIP_TAX = " + entity.purchase_unit_price_skip_tax + Environment.NewLine);
                    sb.Append("      ,PURCHASE_UNIT_PRICE_BEFORE_TAX = " + entity.purchase_unit_price_before_tax + Environment.NewLine);
                    sb.Append("      ,GROUP1_ID = " + ExEscape.zRepStr(entity.group1_id) + Environment.NewLine);
                    sb.Append("      ,GROUP2_ID = " + ExEscape.zRepStr(entity.group2_id) + Environment.NewLine);
                    sb.Append("      ,GROUP3_ID = " + ExEscape.zRepStr(entity.group3_id) + Environment.NewLine);
                    sb.Append("      ,MEMO = " + ExEscape.zRepStr(entity.memo) + Environment.NewLine);
                    sb.Append("      ,DISPLAY_FLG = " + entity.display_division_id + Environment.NewLine);
                    sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);                                  // COMPANY_ID
                    sb.Append("   AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); // ID

                    #endregion

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Update)", ex);
                    return(CLASS_NM + ".UpdateCommodity(Insert) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region Delete

            if (type == 2)
            {
                #region Exist Data

                try
                {
                    bool _ret = false;

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_ESTIMATE_D", "COMMODITY_ID", ExCast.zNumZeroNothingFormat(Id), CommonUtl.geStrOrNumKbn.String);
                    if (_ret == true)
                    {
                        return("商品ID : " + Id + " は見積データに使用されている為、削除できません。");
                    }

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_ORDER_D", "COMMODITY_ID", ExCast.zNumZeroNothingFormat(Id), CommonUtl.geStrOrNumKbn.String);
                    if (_ret == true)
                    {
                        return("商品ID : " + Id + " は受注データに使用されている為、削除できません。");
                    }

                    _ret = DataExists.IsExistData(db, companyId, groupId, "T_SALES_D", "COMMODITY_ID", ExCast.zNumZeroNothingFormat(Id), CommonUtl.geStrOrNumKbn.String);
                    if (_ret == true)
                    {
                        return("商品ID : " + Id + " は売上データに使用されている為、削除できません。");
                    }
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Exist Data)", ex);
                    return(CLASS_NM + ".UpdateCommodity(Exist Data) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }

                #endregion

                #region Delete Commodity Inventory

                try
                {
                    sb.Length = 0;
                    sb.Append("UPDATE M_COMMODITY_INVENTORY " + Environment.NewLine);
                    sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM,
                                                              ExCast.zCInt(personId),
                                                              ipAdress,
                                                              userId,
                                                              1));
                    sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);                                  // COMPANY_ID
                    sb.Append("   AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); // ID

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Delete Commodity Inventory)", ex);
                    return(CLASS_NM + ".UpdateCommodity(Commodity Inventory) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }

                #endregion

                #region Update

                try
                {
                    sb.Length = 0;
                    sb.Append("UPDATE M_COMMODITY " + Environment.NewLine);
                    sb.Append(CommonUtl.GetUpdSQLCommonColums(PG_NM,
                                                              ExCast.zCInt(personId),
                                                              ipAdress,
                                                              userId,
                                                              1));
                    sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);                                  // COMPANY_ID
                    sb.Append("   AND ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine); // ID

                    db.ExecuteSQL(sb.ToString(), false);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Delete)", ex);
                    return(CLASS_NM + ".UpdateCommodity(Delete) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }

                #endregion
            }

            #endregion

            #region PG排他制御

            if (type == 0 || type == 2)
            {
                try
                {
                    DataPgLock.DelLockPg(companyId, userId, PG_NM, "", ipAdress, false, db);
                }
                catch (Exception ex)
                {
                    db.ExRollbackTransaction();
                    CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(DelLockPg)", ex);
                    return(CLASS_NM + ".UpdateCommodity(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                }
            }

            #endregion

            #region CommitTransaction

            try
            {
                db.ExCommitTransaction();
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(CommitTransaction)", ex);
                return(CLASS_NM + ".UpdateCommodity(CommitTransaction) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Database Close

            try
            {
                db.DbClose();
            }
            catch (Exception ex)
            {
                db.ExRollbackTransaction();
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(DbClose)", ex);
                return(CLASS_NM + ".UpdateCommodity(DbClose) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }
            finally
            {
                db = null;
            }

            #endregion

            #region Add Evidence

            try
            {
                switch (type)
                {
                case 0:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Update,
                                               "ID:" + Id.ToString());
                    break;

                case 1:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Insert,
                                               "ID:" + _Id.ToString());
                    break;

                case 2:
                    svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                               companyId,
                                               userId,
                                               ipAdress,
                                               sessionString,
                                               PG_NM,
                                               DataPgEvidence.geOperationType.Delete,
                                               "ID:" + Id.ToString());
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateCommodity(Add Evidence)", ex);
                return(CLASS_NM + ".UpdateCommodity(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region Return

            if (type == 1 && (Id == "0" || Id == ""))
            {
                return("Auto Insert success : " + "ID : " + _Id.ToString() + "で登録しました。");
            }
            else
            {
                return("");
            }

            #endregion
        }
Exemplo n.º 10
0
        public void OnFormatString()
        {
            switch (InputMode)
            {
            case geInputMode.Date:
                if (this.Text == "")
                {
                    break;
                }
                if (this.Text.Length != 8)
                {
                    break;
                }
                this.Text = this.Text.Substring(0, 4) + "/" + this.Text.Substring(4, 2) + "/" + this.Text.Substring(6, 2);
                break;

            case geInputMode.Number:
                if (this.Text == "")
                {
                    break;
                }
                if (this.FormatString.IndexOf(".") == -1 && this.DecimalNum > 0)
                {
                    this.FormatString = "#,##0.00";
                    //string format = "";
                    //if (this.FormatString == "")
                    //{
                    //    format = "0.";
                    //}
                    //else
                    //{
                    //    format = FormatString + ".";
                    //}
                    //for (int i = 1; i <= this.DecimalNum; i++)
                    //{
                    //    format += "0";
                    //}
                    this.Text = ExCast.zCDbl(this.Text).ToString(this.FormatString);
                    if (this.DecimalNum > 0)
                    {
                        int _length = this.Text.Length;
                        if (this.DecimalNum == 1)
                        {
                            this.Text = this.Text.Substring(0, this.Text.Length - 1) + "0";
                        }
                    }
                }
                else
                {
                    this.Text = ExCast.zCDbl(this.Text).ToString(this.FormatString);
                    // 上記だけではなぜか設定されない
                    string str = ExCast.zCDbl(this.Text).ToString(this.FormatString);
                    this.Text = str;
                }
                break;

            case geInputMode.ID:
                if (this.Text == "")
                {
                    break;
                }
                if (ExCast.zCInt(this.MaxLengthB) == 0)
                {
                    break;
                }
                if (ExCast.IsNumeric(this.Text) == false)
                {
                    break;
                }

                FormatToID();
                break;

            default:
                break;
            }
        }
Exemplo n.º 11
0
        // ログイン
        //public void Login()
        //{
        //    try
        //    {
        //        ExWebService.geDialogDisplayFlg DialogDisplayFlg = ExWebService.geDialogDisplayFlg.Yes;
        //        if (this.blClose == true || this.rptKbn == DataReport.geReportKbn.OutPut)
        //        {
        //            DialogDisplayFlg = ExWebService.geDialogDisplayFlg.No;
        //        }

        //        switch (this.rptKbn)
        //        {
        //            case DataReport.geReportKbn.Download:
        //                Common.gstrProgressDialogTitle = "PDFファイル作成中";
        //                break;
        //            case DataReport.geReportKbn.Csv:
        //                Common.gstrProgressDialogTitle = "CSVファイル作成中";
        //                break;
        //        }

        //        object[] prm = new object[3];
        //        prm[0] = Common.gstrLoginUserID;
        //        prm[1] = Common.gstrLoginPassword;
        //        prm[2] = 0;
        //        webService.objPerent = this;
        //        webService.CallWebService(ExWebService.geWebServiceCallKbn.Login,
        //                                  DialogDisplayFlg,
        //                                  ExWebService.geDialogCloseFlg.No,
        //                                  prm);
        //    }
        //    catch
        //    {
        //        if (this.utlParentFKey != null) this.utlParentFKey.IsEnabled = true;
        //    }
        //}

        //public override void DataSelect(int intKbn, object objList)
        //{
        //    try
        //    {
        //        switch ((ExWebService.geWebServiceCallKbn)intKbn)
        //        {
        //            case ExWebService.geWebServiceCallKbn.Login:
        //                EntitySysLogin entity = (EntitySysLogin)objList;
        //                switch (entity._login_flg)
        //                {
        //                    case 0:     // 正常ログイン
        //                        // システム情報設定
        //                        Common.gintCompanyId = entity._company_id;
        //                        Common.gstrCompanyNm = entity._company_nm;
        //                        Common.gintGroupId = entity._group_id;
        //                        Common.gstrGroupNm = entity._group_nm;
        //                        Common.gintDefaultPersonId = entity._defult_person_id;
        //                        Common.gstrDefaultPersonNm = entity._defult_person_nm;
        //                        Common.gstrGroupDisplayNm = entity._group_display_name;
        //                        Common.gintEvidenceFlg = entity._evidence_flg;
        //                        Common.gintidFigureSlipNo = entity._idFigureSlipNo;
        //                        Common.gintidFigureCustomer = entity._idFigureCustomer;
        //                        Common.gintidFigurePurchase = entity._idFigurePurchase;
        //                        Common.gintidFigureCommodity = entity._idFigureGoods;
        //                        Common.gstrSessionString = entity._session_string;
        //                        Common.gblnLogin = true;
        //                        break;
        //                    case 1:     // 同一ユーザーログイン
        //                        break;
        //                    default:    // ログイン失敗
        //                        if (this.utlParentFKey != null) this.utlParentFKey.IsEnabled = true;
        //                        return;
        //                }
        //                break;
        //        }

        //        if (this.blClose == true)
        //        {
        //            if (this.parentUtl != null)
        //            {
        //                this.blClose = false;
        //                if (this.utlParentFKey != null) this.utlParentFKey.IsEnabled = true;
        //                return;
        //            }
        //            Dlg_Report win = (Dlg_Report)ExVisualTreeHelper.FindPerentChildWindow(this);
        //            if (this.utlParentFKey != null) this.utlParentFKey.IsEnabled = true;
        //            win.Close();
        //        }
        //        else
        //        {
        //            Report();
        //        }
        //    }
        //    catch
        //    {
        //        if (this.utlParentFKey != null) this.utlParentFKey.IsEnabled = true;
        //    }
        //}

        #endregion

        #region InputCheck

        public override void InputCheckUpdate()
        {
            #region Field

            string  errMessage     = "";
            string  warnMessage    = "";
            int     _selectIndex   = 0;
            int     _selectColumn  = 0;
            bool    IsDetailExists = false;
            Control errCtl         = null;

            #endregion

            try
            {
                #region 入力チェック

                #region 必須チェック

                #endregion

                #region 入力チェック

                if (!string.IsNullOrEmpty(utlID_F.txtID.Text.Trim()) && string.IsNullOrEmpty(utlID_F.txtNm.Text.Trim()))
                {
                    errMessage += this.lblID.Content + "が適切に入力(選択)されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.utlID_F.txtID;
                    }
                }

                if (!string.IsNullOrEmpty(utlID_T.txtID.Text.Trim()) && string.IsNullOrEmpty(utlID_T.txtNm.Text.Trim()))
                {
                    errMessage += this.lblID.Content + "が適切に入力(選択)されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.utlID_T.txtID;
                    }
                }

                #endregion

                #region 日付チェック

                //// 受注日
                //if (string.IsNullOrEmpty(_entityH._order_ymd) == false)
                //{
                //    if (ExCast.IsDate(_entityH._order_ymd) == false)
                //    {
                //        errMessage += "受注日の形式が不正です。(yyyy/mm/dd形式で入力(選択)して下さい)" + Environment.NewLine;
                //        if (errCtl == null) errCtl = this.datOrderYmd;
                //    }
                //}

                //// 納入指定日
                //if (string.IsNullOrEmpty(_entityH._supply_ymd) == false)
                //{
                //    if (ExCast.IsDate(_entityH._supply_ymd) == false)
                //    {
                //        errMessage += "納入指定日の形式が不正です。(yyyy/mm/dd形式で入力(選択)して下さい)" + Environment.NewLine;
                //        if (errCtl == null) errCtl = this.datNokiYmd;
                //    }
                //}

                #endregion

                #region 日付変換

                //// 受注日
                //if (string.IsNullOrEmpty(_entityH._order_ymd) == false)
                //{
                //    _entityH._order_ymd = ExCast.zConvertToDate(_entityH._order_ymd).ToString("yyyy/MM/dd");

                //}

                //// 納入指定日
                //if (string.IsNullOrEmpty(_entityH._supply_ymd) == false)
                //{
                //    _entityH._supply_ymd = ExCast.zConvertToDate(_entityH._supply_ymd).ToString("yyyy/MM/dd");
                //}

                #endregion

                #region 正数チェック

                //if (ExCast.zCLng(_entityH._no) < 0)
                //{
                //    errMessage += "受注番号には正の整数を入力して下さい。" + Environment.NewLine;
                //}

                //if (ExCast.zCLng(_entityH._estimateno) < 0)
                //{
                //    errMessage += "見積番号には正の整数を入力して下さい。" + Environment.NewLine;
                //    if (errCtl == null) errCtl = this.utlEstimateNo.txtID;
                //}

                #endregion

                #region 範囲チェック

                if (!string.IsNullOrEmpty(this.utlID_F.txtID.Text.Trim()) && !string.IsNullOrEmpty(this.utlID_T.txtID.Text.Trim()) &&
                    ExCast.IsNumeric(this.utlID_F.txtID.Text.Trim()) && ExCast.IsNumeric(this.utlID_F.txtID.Text.Trim()))
                {
                    if (ExCast.zCDbl(this.utlID_F.txtID.Text.Trim()) > ExCast.zCLng(this.utlID_T.txtID.Text.Trim()))
                    {
                        errMessage += this.lblID.Content + "の範囲指定が不正です。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.utlID_F.txtID;
                        }
                    }
                }

                //if (ExCast.zCLng(_entityH._no) > 999999999999999)
                //{
                //    errMessage += "受注番号には15桁以内の正の整数を入力して下さい。" + Environment.NewLine;
                //}

                //if (ExCast.zCLng(_entityH._estimateno) > 999999999999999)
                //{
                //    errMessage += "見積番号には15桁以内の正の整数を入力して下さい。" + Environment.NewLine;
                //    if (errCtl == null) errCtl = this.utlEstimateNo.txtID;
                //}

                //if (ExString.LenB(_entityH._memo) > 32)
                //{
                //    errMessage += "摘要には全角16桁文字以内(半角32桁文字以内)を入力して下さい。" + Environment.NewLine;
                //    if (errCtl == null) errCtl = this.txtMemo;
                //}

                #endregion

                #endregion

                #region エラー or 警告時処理

                bool flg = true;

                if (!string.IsNullOrEmpty(errMessage))
                {
                    ExMessageBox.Show(errMessage, Dlg.MessageBox.MessageBoxIcon.Error);
                    flg = false;
                }

                this.txtDummy.IsTabStop = false;

                if (flg == false)
                {
                    if (errCtl != null)
                    {
                        ExBackgroundWorker.DoWork_Focus(errCtl, 10);
                    }
                    if (this.utlParentFKey != null)
                    {
                        this.utlParentFKey.IsEnabled = true;
                    }
                    return;
                }

                #endregion

                ReportStart();
            }
            catch
            {
                if (this.utlParentFKey != null)
                {
                    this.utlParentFKey.IsEnabled = true;
                }
            }
            finally
            {
                Common.gblnBtnProcLock          = false;
                Common.gblnBtnDesynchronizeLock = false;
            }
        }
        // 入力チェック
        public override void InputCheckUpdate()
        {
            string  errMessage = "";
            Control errCtl     = null;

            try
            {
                switch (this.ProcKbn)
                {
                case eProcKbn.Search:
                case eProcKbn.Report:

                    #region 検索時チェック

                    #region 必須チェック

                    #endregion

                    #region 入力チェック

                    // 商品
                    if (this.utlCommodity_F.txtID.Text.Trim() != "" && string.IsNullOrEmpty(this.utlCommodity_F.txtNm.Text.Trim()))
                    {
                        errMessage += "商品が適切に入力(選択)されていません。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.utlCommodity_F.txtID;
                        }
                    }
                    if (this.utlCommodity_T.txtID.Text.Trim() != "" && string.IsNullOrEmpty(this.utlCommodity_T.txtNm.Text.Trim()))
                    {
                        errMessage += "商品が適切に入力(選択)されていません。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.utlCommodity_T.txtID;
                        }
                    }

                    #endregion

                    #region 範囲チェック

                    // 商品
                    if ((ExCast.IsNumeric(this.utlCommodity_F.txtID.Text.Trim()) && ExCast.IsNumeric(this.utlCommodity_T.txtID.Text.Trim())) &&
                        (!string.IsNullOrEmpty(this.utlCommodity_F.txtID.Text.Trim()) && !string.IsNullOrEmpty(this.utlCommodity_T.txtID.Text.Trim())))
                    {
                        if (ExCast.zCLng(this.utlCommodity_F.txtID.Text.Trim()) > ExCast.zCLng(this.utlCommodity_T.txtID.Text.Trim()))
                        {
                            errMessage += "商品の範囲指定が不正です。" + Environment.NewLine;
                            if (errCtl == null)
                            {
                                errCtl = this.utlCommodity_F.txtID;
                            }
                        }
                    }

                    #endregion

                    #region 日付チェック

                    #endregion

                    #endregion

                    break;

                case eProcKbn.Update:

                    #region 更新チェック

                    #region 必須チェック

                    //if (this.datIssueYmd.SelectedDate == null)
                    //{
                    //    errMessage += "出力発行日が入力されていません。" + Environment.NewLine;
                    //    if (errCtl == null) errCtl = this.datIssueYmd;
                    //}

                    // 棚卸日
                    if (string.IsNullOrEmpty(this.datYmd.Text.Trim()))
                    {
                        errMessage += "棚卸日を入力(選択)して下さい" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.datYmd;
                        }
                    }

                    #endregion

                    #region 日付チェック

                    // 棚卸日
                    if (string.IsNullOrEmpty(this.datYmd.Text.Trim()) == false)
                    {
                        if (ExCast.IsDate(this.datYmd.Text.Trim()) == false)
                        {
                            errMessage += "棚卸日の形式が不正です。(yyyy/mm/dd形式で入力(選択)して下さい)" + Environment.NewLine;
                            if (errCtl == null)
                            {
                                errCtl = this.datYmd;
                            }
                        }
                    }

                    #endregion

                    #region 選択チェック

                    if (this.entityList == null)
                    {
                        errMessage += "表示データがありません。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.datYmd;
                        }
                    }
                    if (this.entityList.Count == 0)
                    {
                        errMessage += "表示データがありません。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.datYmd;
                        }
                    }

                    bool _exec_flg = false;
                    for (int i = 0; i <= this.entityList.Count - 1; i++)
                    {
                        if (this.entityList[i]._exec_flg == true)
                        {
                            _exec_flg = true;
                        }
                    }
                    if (_exec_flg == false)
                    {
                        errMessage += "登録対象データを選択して下さい。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.datYmd;
                        }
                    }

                    if (_exec_flg == true)
                    {
                        _exec_flg = false;
                        for (int i = 0; i <= this.entityList.Count - 1; i++)
                        {
                            if (this.entityList[i]._exec_flg == true && this.entityList[i]._diff_number != 0)
                            {
                                _exec_flg = true;
                            }
                        }
                        if (_exec_flg == false)
                        {
                            errMessage += "差異0以外のデータがありません。" + Environment.NewLine;
                            if (errCtl == null)
                            {
                                errCtl = this.datYmd;
                            }
                        }
                    }

                    #endregion

                    #endregion

                    break;
                }

                #region エラー or 警告時処理

                bool flg = true;

                if (!string.IsNullOrEmpty(errMessage))
                {
                    ExMessageBox.Show(errMessage, Dlg.MessageBox.MessageBoxIcon.Error);
                    flg = false;
                }
                this.txtDummy.IsTabStop = false;

                if (flg == false)
                {
                    if (errCtl != null)
                    {
                        ExBackgroundWorker.DoWork_Focus(errCtl, 10);
                    }
                    return;
                }

                #endregion

                if (this.ProcKbn == eProcKbn.Search)
                {
                    GetListData();
                }
                else
                {
                    if (this.ProcKbn == eProcKbn.Update)
                    {
                        //ExMessageBox.ResultShow(this, null, "処理対象となる仕入先のすべての請求データの残高が更新されます。" + Environment.NewLine + "このまま登録を続行してもよろしいですか?");

                        #region 更新処理

                        UpdateData(Common.geUpdateType.Update);

                        #endregion

                        return;
                    }

                    this.utlReport.utlParentFKey = this.utlFKey;

                    //switch (Common.gWinGroupType)
                    //{
                    //    case Common.geWinGroupType.InpListReport:
                    //        this.utlReport.pgId = DataPgEvidence.PGName.SalesManagement.InvoiceBalancePrint;
                    //        break;
                    //    default:
                    //        break;
                    //}

                    //this.utlReport.sqlWhere = GetSQLWhere();
                    //this.utlReport.sqlOrderBy = GetSQLOrderBy();
                    //this.utlReport.ReportStart();
                }
            }
            finally
            {
                Common.gblnBtnProcLock          = false;
                Common.gblnBtnDesynchronizeLock = false;
            }
        }
Exemplo n.º 13
0
        // 入力チェック(更新時)
        public override void InputCheckUpdate()
        {
            #region Field

            string  errMessage    = "";
            string  warnMessage   = "";
            int     _selectIndex  = 0;
            int     _selectColumn = 0;
            Control errCtl        = null;

            #endregion

            try
            {
                #region 必須チェック

                if (this.utlMode.Mode != Utl_FunctionKey.geFunctionKeyEnable.Init)
                {
                    // ID
                    if (string.IsNullOrEmpty(this.utlID.txtID.Text.Trim()))
                    {
                        errMessage += "IDが入力されていません。" + Environment.NewLine;
                        if (errCtl == null)
                        {
                            errCtl = this.utlID.txtID;
                        }
                    }
                }

                // 名称
                if (string.IsNullOrEmpty(_entity._name))
                {
                    errMessage += "名称が入力されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.txtName;
                    }
                }

                //// 会社グループ
                //if (string.IsNullOrEmpty(ExCast.zCStr(_entity._group_id)))
                //{
                //    errMessage += "会社グループが入力(選択)されていません。" + Environment.NewLine;
                //    if (errCtl == null) errCtl = this.utlCompanyGroup.txtID;
                //}

                // 表示区分
                if (string.IsNullOrEmpty(ExCast.zCStr(_entity._display_division_id)))
                {
                    errMessage += "表示区分が入力(選択)されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.utlDisplay.txtID;
                    }
                }

                #endregion

                #region 適正値入力チェック

                // 会社グループ
                if (string.IsNullOrEmpty(_entity._group_id) == false && string.IsNullOrEmpty(_entity._group_nm))
                {
                    errMessage += "会社グループが適切に入力(選択)されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.utlCompanyGroup.txtID;
                    }
                }

                // 表示区分
                if (ExCast.zCInt(_entity._display_division_id) != 0 && string.IsNullOrEmpty(_entity._display_division_nm))
                {
                    errMessage += "表示区分が適切に入力(選択)されていません。" + Environment.NewLine;
                    if (errCtl == null)
                    {
                        errCtl = this.utlDisplay.txtID;
                    }
                }

                #endregion

                #region 日付チェック

                //// 納入指定日
                //if (string.IsNullOrEmpty(_entity.supply_ymd) == false)
                //{
                //    if (ExCast.IsDate(_entity.supply_ymd) == false)
                //    {
                //        errMessage += "納入指定日の形式が不正です。(yyyy/mm/dd形式で入力(選択)して下さい)" + Environment.NewLine;
                //        if (errCtl == null) errCtl = this.datNokiYmd;
                //    }
                //}

                #endregion

                #region 日付変換

                // 受注日
                //if (string.IsNullOrEmpty(_entity.order_ymd) == false)
                //{
                //    _entity.order_ymd = ExCast.zConvertToDate(_entity.order_ymd).ToString("yyyy/MM/dd");

                //}

                #endregion

                #region 数値チェック

                if (this.utlMode.Mode != Utl_FunctionKey.geFunctionKeyEnable.Init)
                {
                    if (ExCast.IsNumeric(this.utlID.txtID.Text.Trim()) == false)
                    {
                        errMessage += "IDには数値を入力して下さい。" + Environment.NewLine;
                    }
                }

                #endregion

                #region 正数チェック

                if (this.utlMode.Mode != Utl_FunctionKey.geFunctionKeyEnable.Init)
                {
                    if (ExCast.zCLng(this.utlID.txtID.Text.Trim()) < 0)
                    {
                        errMessage += "IDには正の整数を入力して下さい。" + Environment.NewLine;
                    }
                }

                #endregion

                #region 範囲チェック

                if (ExCast.zCLng(this.utlID.txtID.Text.Trim()) > 9999)
                {
                    errMessage += "IDには4桁の正の整数を入力して下さい。" + Environment.NewLine;
                }

                #endregion

                #region エラー or 警告時処理

                bool flg = true;

                if (!string.IsNullOrEmpty(errMessage))
                {
                    ExMessageBox.Show(errMessage, Dlg.MessageBox.MessageBoxIcon.Error);
                    flg = false;
                }

                if (!string.IsNullOrEmpty(warnMessage))
                {
                    warnMessage += "このまま登録を続行してもよろしいですか?" + Environment.NewLine;
                    ExMessageBox.ResultShow(this, errCtl, warnMessage);
                    flg = false;
                    //if (ExMessageBox.ResultShow(warnMessage) == MessageBoxResult.No)
                    //{
                    //    flg = false;
                    //}
                }

                this.txtDummy.IsTabStop = false;

                if (flg == false)
                {
                    if (errCtl != null)
                    {
                        ExBackgroundWorker.DoWork_Focus(errCtl, 10);
                    }
                    return;
                }

                #endregion

                #region 更新処理

                switch (this.utlFunctionKey.gFunctionKeyEnable)
                {
                case Utl_FunctionKey.geFunctionKeyEnable.New:
                case Utl_FunctionKey.geFunctionKeyEnable.Init:
                    UpdateData(Common.geUpdateType.Insert);
                    break;

                case Utl_FunctionKey.geFunctionKeyEnable.Upd:
                    UpdateData(Common.geUpdateType.Update);
                    break;

                default:
                    break;
                }

                #endregion
            }
            finally
            {
                Common.gblnBtnProcLock          = false;
                Common.gblnBtnDesynchronizeLock = false;
            }
        }
Exemplo n.º 14
0
        private void SetBinding()
        {
            bool is_null = false;

            if (_entity == null)
            {
                _entity = new EntitySupplier();
                is_null = true;
            }

            // マスタコントロールPropertyChanged
            _entity.PropertyChanged += this.utlCustomer.MstID_Changed;
            _entity.PropertyChanged += this.utlZip.MstID_Changed;

            NumberConverter nmConvDecm0 = new NumberConverter();

            #region Bind

            string _customerId = ExCast.zNumZeroNothingFormat(this.utlCustomer.txtID.Text.Trim());
            string _customerNm = this.utlCustomer.txtNm.Text.Trim();

            // バインド
            Binding BindingCustomerId = new Binding("_customer_id");
            BindingCustomerId.Mode   = BindingMode.TwoWay;
            BindingCustomerId.Source = _entity;
            this.utlCustomer.txtID.SetBinding(TextBox.TextProperty, BindingCustomerId);
            this.utlID.txtID2.SetBinding(TextBox.TextProperty, BindingCustomerId);

            Binding BindingCustomerName = new Binding("_customer_nm");
            BindingCustomerName.Mode   = BindingMode.TwoWay;
            BindingCustomerName.Source = _entity;
            this.utlCustomer.txtNm.SetBinding(TextBox.TextProperty, BindingCustomerName);

            if (is_null == false)
            {
                this.utlCustomer.txtID.Text = _customerId;
                this.utlCustomer.txtNm.Text = _customerNm;
            }

            Binding BindingName = new Binding("_name");
            BindingName.Mode   = BindingMode.TwoWay;
            BindingName.Source = _entity;
            this.txtName.SetBinding(TextBox.TextProperty, BindingName);

            Binding BindingKana = new Binding("_kana");
            BindingKana.Mode   = BindingMode.TwoWay;
            BindingKana.Source = _entity;
            this.txtKana.SetBinding(TextBox.TextProperty, BindingKana);

            Binding BindingAboutName = new Binding("_about_name");
            BindingAboutName.Mode   = BindingMode.TwoWay;
            BindingAboutName.Source = _entity;
            this.txtAdoutName.SetBinding(TextBox.TextProperty, BindingAboutName);

            Binding BindingZipCodeFrom = new Binding("_zip_code_from");
            BindingZipCodeFrom.Mode   = BindingMode.TwoWay;
            BindingZipCodeFrom.Source = _entity;
            this.utlZip.txtZipNo1.SetBinding(TextBox.TextProperty, BindingZipCodeFrom);

            Binding BindingZipCodeTo = new Binding("_zip_code_to");
            BindingZipCodeTo.Mode   = BindingMode.TwoWay;
            BindingZipCodeTo.Source = _entity;
            this.utlZip.txtZipNo2.SetBinding(TextBox.TextProperty, BindingZipCodeTo);

            this.utlZip.is_zip_from_first_flg = true;
            this.utlZip.is_zip_to_first_flg   = true;

            Binding BindingAdress1 = new Binding("_adress1");
            BindingAdress1.Mode   = BindingMode.TwoWay;
            BindingAdress1.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress1Property, BindingAdress1);

            Binding BindingAdress2 = new Binding("_adress2");
            BindingAdress2.Mode   = BindingMode.TwoWay;
            BindingAdress2.Source = _entity;
            this.utlZip.SetBinding(Utl_Zip.UserControlAdress2Property, BindingAdress2);

            Binding BindingStationName = new Binding("_station_name");
            BindingStationName.Mode   = BindingMode.TwoWay;
            BindingStationName.Source = _entity;
            this.txtStationName.SetBinding(TextBox.TextProperty, BindingStationName);

            Binding BindingPostName = new Binding("_post_name");
            BindingPostName.Mode   = BindingMode.TwoWay;
            BindingPostName.Source = _entity;
            this.txtPostName.SetBinding(TextBox.TextProperty, BindingPostName);

            Binding BindingPersonName = new Binding("_person_name");
            BindingPersonName.Mode   = BindingMode.TwoWay;
            BindingPersonName.Source = _entity;
            this.txtPersonName.SetBinding(TextBox.TextProperty, BindingPersonName);

            Binding BindingTitleId = new Binding("_title_id");
            BindingTitleId.Mode   = BindingMode.TwoWay;
            BindingTitleId.Source = _entity;
            this.utlTitle.txtID.SetBinding(TextBox.TextProperty, BindingTitleId);

            Binding BindingTitleName = new Binding("_title_name");
            BindingTitleName.Mode   = BindingMode.TwoWay;
            BindingTitleName.Source = _entity;
            this.utlTitle.txtNm.SetBinding(TextBox.TextProperty, BindingTitleName);

            Binding BindingTel = new Binding("_tel");
            BindingTel.Mode   = BindingMode.TwoWay;
            BindingTel.Source = _entity;
            this.txtTel.SetBinding(TextBox.TextProperty, BindingTel);

            Binding BindingFax = new Binding("_fax");
            BindingFax.Mode   = BindingMode.TwoWay;
            BindingFax.Source = _entity;
            this.txtFax.SetBinding(TextBox.TextProperty, BindingFax);

            Binding BindingMailAdress = new Binding("_mail_adress");
            BindingMailAdress.Mode   = BindingMode.TwoWay;
            BindingMailAdress.Source = _entity;
            this.txtMail.SetBinding(TextBox.TextProperty, BindingMailAdress);

            Binding BindigDiaplayDivisionId = new Binding("_display_division_id");
            BindigDiaplayDivisionId.Mode   = BindingMode.TwoWay;
            BindigDiaplayDivisionId.Source = _entity;
            this.utlDisplay.txtID.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionId);

            Binding BindigDiaplayDivisionNm = new Binding("_display_division_nm");
            BindigDiaplayDivisionNm.Mode   = BindingMode.TwoWay;
            BindigDiaplayDivisionNm.Source = _entity;
            this.utlDisplay.txtNm.SetBinding(TextBox.TextProperty, BindigDiaplayDivisionNm);

            Binding BindigMemo = new Binding("_memo");
            BindigMemo.Mode   = BindingMode.TwoWay;
            BindigMemo.Source = _entity;
            this.txtMemo.SetBinding(TextBox.TextProperty, BindigMemo);

            #endregion

            if (ExCast.IsNumeric(this.utlID.txtID.Text.Trim()))
            {
                this.utlID.txtID.SetZeroToNullString();
            }
            this.utlID.txtID.FormatToID();
            this.utlTitle.txtID.SetZeroToNullString();
            this.utlCustomer.txtID.SetZeroToNullString();

            this.utlCustomer.txtID.FormatToID();

            if (ExCast.zCInt(_entity._id) == 0)
            {
                _entity._divide_permission_id = 2;
                _entity._display_division_id  = 1;
            }
        }