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;
        }
        // コンボボックスでは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);
        }
 private void txtID_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (ExCast.zCInt(txtID.Text.Trim()) == 0)
     {
         txtID.Text = "";
     }
 }
        private void utlSummingUp_LostFocus(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(utlSummingUp.txtID.Text.Trim()))
            {
                return;
            }

            string yyyymm       = "";
            string now_yyyymmdd = DateTime.Now.ToString("yyyy/MM/dd");

            if (this.datPaymentYmd.SelectedDate == null)
            {
                this.datPaymentYmd.SelectedDate = ExCast.zConvertToDate(now_yyyymmdd);
            }
            yyyymm = ExCast.zConvertToDate(this.datPaymentYmd.SelectedDate).ToString("yyyy/MM");

            int _id = ExCast.zCInt(utlSummingUp.txtID.Text.Trim());

            switch (_id)
            {
            case 5:
                _entityPrm._payment_yyyymmdd    = "";
                this.datPaymentYmd.SelectedDate = null;
                _entityPrm._payment_yyyymmdd    = yyyymm + "/05";
                this.datPaymentYmd.DisplayDate  = ExCast.zConvertToDate(yyyymm + "/05");
                break;

            case 15:
                _entityPrm._payment_yyyymmdd    = "";
                this.datPaymentYmd.SelectedDate = null;
                _entityPrm._payment_yyyymmdd    = yyyymm + "/15";
                this.datPaymentYmd.DisplayDate  = ExCast.zConvertToDate(yyyymm + "/15");
                break;

            case 20:
                _entityPrm._payment_yyyymmdd    = "";
                this.datPaymentYmd.SelectedDate = null;
                _entityPrm._payment_yyyymmdd    = yyyymm + "/20";
                this.datPaymentYmd.DisplayDate  = ExCast.zConvertToDate(yyyymm + "/20");
                break;

            case 25:
                _entityPrm._payment_yyyymmdd    = "";
                this.datPaymentYmd.SelectedDate = null;
                _entityPrm._payment_yyyymmdd    = yyyymm + "/25";
                this.datPaymentYmd.DisplayDate  = ExCast.zConvertToDate(yyyymm + "/25");
                break;

            case 31:
                _entityPrm._payment_yyyymmdd    = "";
                this.datPaymentYmd.SelectedDate = null;
                DateTime dt = ExCast.zConvertToDate(yyyymm + "/01");
                this.datPaymentYmd.SelectedDate = dt.AddMonths(1).AddDays(-1);
                this.datPaymentYmd.DisplayDate  = (DateTime)this.datPaymentYmd.SelectedDate;
                break;

            default:
                break;
            }
        }
Beispiel #5
0
        // データ追加・更新・削除
        private void UpdateData(Common.geUpdateType upd)
        {
            object[] prm = new object[4];

            prm[0] = (int)upd;

            prm[1] = "";
            for (int i = 0; i <= _entityUserList.Count - 1; i++)
            {
                if (ExCast.zCStr(this.cmbLoginId.SelectedValue) == _entityUserList[i].id)
                {
                    prm[1] = ExCast.zCInt(_entityUserList[i].attribute1);
                }
            }
            if (ExCast.zCStr(prm[1]) == "")
            {
                return;
            }

            prm[2] = _entity;
            webService.objPerent = this;
            webService.CallWebService(_UpdWebServiceCallKbn,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
 public void SetZeroToNullString()
 {
     if (ExCast.zCInt(this.Text.Trim()) == 0)
     {
         this.Text = "";
     }
 }
        private void InOutDeliveryToKbn_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (ExCast.zCInt(this.utlInOutDeliveryKbn.txtID.Text.Trim()) == 0)
            {
                this.lblSupply.Visibility       = System.Windows.Visibility.Collapsed;
                this.utlCompanyGroup.Visibility = System.Windows.Visibility.Collapsed;
                this.utlCustomer.Visibility     = System.Windows.Visibility.Collapsed;
                this.utlPurchase.Visibility     = System.Windows.Visibility.Collapsed;
                return;
            }

            switch (ExCast.zCInt(this.utlInOutDeliveryToKbn.txtID.Text.Trim()))
            {
            case 1:     // グループ
                this.lblSupply.Visibility       = System.Windows.Visibility.Visible;
                this.utlCompanyGroup.Visibility = System.Windows.Visibility.Visible;
                this.utlCustomer.Visibility     = System.Windows.Visibility.Collapsed;
                this.utlPurchase.Visibility     = System.Windows.Visibility.Collapsed;

                if (ExCast.zCInt(this.utlInOutDeliveryKbn.txtID.Text.Trim()) == 1)
                {
                    this.lblSupply.Content = "入庫先" + Common.gstrGroupDisplayNm;
                }
                else
                {
                    this.lblSupply.Content = "出庫先" + Common.gstrGroupDisplayNm;
                }
                break;

            case 2:     // 得意先/仕入先
                this.lblSupply.Visibility = System.Windows.Visibility.Visible;
                if (ExCast.zCInt(this.utlInOutDeliveryKbn.txtID.Text.Trim()) == 1)
                {
                    // 入庫
                    this.lblSupply.Content          = "入庫先(仕入先)";
                    this.utlCompanyGroup.Visibility = System.Windows.Visibility.Collapsed;
                    this.utlCustomer.Visibility     = System.Windows.Visibility.Collapsed;
                    this.utlPurchase.Visibility     = System.Windows.Visibility.Visible;
                }
                else
                {
                    // 出庫
                    this.lblSupply.Content          = "出庫先(得意先)";
                    this.utlCompanyGroup.Visibility = System.Windows.Visibility.Collapsed;
                    this.utlCustomer.Visibility     = System.Windows.Visibility.Visible;
                    this.utlPurchase.Visibility     = System.Windows.Visibility.Collapsed;
                }
                break;

            default:
                this.lblSupply.Visibility       = System.Windows.Visibility.Collapsed;
                this.utlCompanyGroup.Visibility = System.Windows.Visibility.Collapsed;
                this.utlCustomer.Visibility     = System.Windows.Visibility.Collapsed;
                this.utlPurchase.Visibility     = System.Windows.Visibility.Collapsed;
                break;
            }
        }
Beispiel #8
0
        public override void DataSelect(int intKbn, object objList)
        {
            switch ((ExWebService.geWebServiceCallKbn)intKbn)
            {
            case _GetWebServiceCallKbn:
                if (objList != null)
                {
                    _entity = (ObservableCollection <EntityCondition>)objList;

                    EntityCondition entity = new EntityCondition();

                    // 明細初期設定
                    InitDetail(ref entity);

                    _entity.Add(entity);
                    SetDetailRecNo();

                    this.dg.ItemsSource = _entity;

                    if (ExCast.zCInt(_entity[0]._lock_flg) == 0)
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                        ExBackgroundWorker.DoWork_Focus(this.dg, 100);
                        ExBackgroundWorker.DoWork_SelectedIndex(this.dg, 400, 0);
                        ExBackgroundWorker.DoWork_DataGridColum(this.dg, 500, dg.Columns[0]);
                    }
                    else
                    {
                        this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Sel;
                    }
                }
                else
                {
                    _entity = new ObservableCollection <EntityCondition>();

                    EntityCondition entity = new EntityCondition();

                    // 明細初期設定
                    InitDetail(ref entity);

                    _entity.Add(entity);
                    SetDetailRecNo();

                    this.dg.ItemsSource = _entity;

                    this.utlFunctionKey.gFunctionKeyEnable = Utl_FunctionKey.geFunctionKeyEnable.Upd;
                    ExBackgroundWorker.DoWork_Focus(this.dg, 100);
                    ExBackgroundWorker.DoWork_SelectedIndex(this.dg, 400, 0);
                    ExBackgroundWorker.DoWork_DataGridColum(this.dg, 500, dg.Columns[0]);
                }

                break;

            default:
                break;
            }
        }
        void Application_Start(object sender, EventArgs e)
        {
            // アプリケーションのスタートアップで実行するコードです
            //log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(@HttpContext.Current.Server.MapPath(@"\\EW20121725\Sales.system-innovation.net\wwwroot\log4net.xml")));
            //log4net.Config.XmlConfigurator.Configure();

            CommonUtl.gSysDbKbn = ExCast.zCInt(System.Configuration.ConfigurationManager.AppSettings["SysDbKbn"]);
            CommonUtl.gDemoKbn  = ExCast.zCInt(System.Configuration.ConfigurationManager.AppSettings["DemoKbn"]);

            CommonUtl.gConnectionString1 = System.Configuration.ConfigurationManager.ConnectionStrings["ConCmTestDt"].ConnectionString;

            CommonUtl.gMySqlDt = new ExMySQLData();
        }
        public void LockPg(string random, string pgId, string lockId, int type)
        {
            #region 認証処理

            string companyId     = "";
            string groupId       = "";
            string userId        = "";
            string ipAdress      = "";
            string sessionString = "";
            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]);

                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;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UnLockPg(認証処理)", ex);
                return;
            }

            #endregion

            try
            {
                ExMySQLData          db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString);
                DataPgLock.geLovkFlg lockFlg;

                if (type == 0)
                {
                    DataPgLock.DelLockPg(companyId, userId, pgId, lockId, ipAdress, true, db);
                }
                else
                {
                    DataPgLock.SetLockPg(companyId, userId, pgId, lockId, ipAdress, db, out lockFlg);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UnLockPg", ex);
                return;
            }
        }
        private void txtBindID_TextChanged(object sender, TextChangedEventArgs e)
        {
            switch (this.NameKbn)
            {
            // ID:0 データ有りケース
            case MeiNameList.geNameKbn.DISPLAY_DIVISION_ID:
                this.txtID.Text = this.txtBindID.Text;
                if (this.txtBindID.Text == "")
                {
                    this.txtNm.Text = "";
                }
                else
                {
                    this.txtNm.Text = MeiNameList.GetName(this.NameKbn, ExCast.zCInt(this.txtBindID.Text));
                }
                break;

            case MeiNameList.geNameKbn.TITLE_ID:
                this.txtID.Text = ExCast.zCInt(this.txtBindID.Text).ToString();
                if (ExCast.zCInt(this.txtBindID.Text) == 0)
                {
                    this.txtBindID.Text = "";
                }
                else
                {
                    this.txtNm.Text = MeiNameList.GetName(this.NameKbn, ExCast.zCInt(this.txtBindID.Text));
                }
                break;

            // ID:0 データ無しケース
            default:
                this.txtID.Text = ExCast.zCInt(this.txtBindID.Text).ToString();
                if (ExCast.zCInt(this.txtBindID.Text) == 0)
                {
                    this.txtBindID.Text = "";
                    this.txtNm.Text     = "";
                }
                else
                {
                    this.txtNm.Text = MeiNameList.GetName(this.NameKbn, ExCast.zCInt(this.txtBindID.Text));
                }
                break;
            }

            SetTxtNmEnabled();

            if (this.ID_TextChanged != null)
            {
                this.ID_TextChanged(sender, e);
            }
        }
        // データ追加・更新・削除
        private void UpdateData(Common.geUpdateType upd)
        {
            object[] prm = new object[4];

            prm[0] = (int)upd;
            prm[1] = ExCast.zCInt(this.utlID.txtID.Text.Trim());
            prm[2] = _entity;

            webService.objPerent = this;
            webService.CallWebService(_UpdWebServiceCallKbn,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
 private void utlID_LostFocus(object sender, RoutedEventArgs e)
 {
     if (this.utlID.txtID.Text.Trim() != "")
     {
         if (ExCast.zCInt(this.utlID.txtID.Text.Trim()) == 0)
         {
             ExMessageBox.Show("グループIDには0以外を指定して下さい。");
             this.utlID.txtID.Text = "";
             this.utlID.txtID.Focus();
             return;
         }
         GetMstData(ExCast.zCInt(this.utlID.txtID.Text.Trim()));
     }
 }
        private void ExChildWindow_Loaded(object sender, RoutedEventArgs e)
        {
            // 画面初期化
            ExVisualTreeHelper.initDisplay(this.LayoutRoot);

            EntityUnitPriceSetting _entity = null;

            switch (this.kbn)
            {
            case eKbn.Sales:
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "上代";
                _entity.unit_price   = this.retail_price;
                _lstUnit.Add(_entity);
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "売上単価";
                _entity.unit_price   = this.sales_unit_price;
                _lstUnit.Add(_entity);
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "売上原価";
                _entity.unit_price   = this.sales_cost_price;
                _lstUnit.Add(_entity);
                break;

            case eKbn.Purchase:
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "上代";
                _entity.unit_price   = this.retail_price;
                _lstUnit.Add(_entity);
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "仕入単価";
                _entity.unit_price   = this.sales_unit_price;
                _lstUnit.Add(_entity);
                _entity = new EntityUnitPriceSetting();
                _entity.unit_kind_nm = "売上原価";
                _entity.unit_price   = this.sales_cost_price;
                _lstUnit.Add(_entity);
                break;
            }
            this.dg.ItemsSource   = _lstUnit;
            this.dg.SelectedIndex = 0;

            this.numUpCreditRate.SetValue(this.credit_rate);
            //this.numUpCreditRate.Value = this.credit_rate;

            this.txtUnitPrice.Text = ExCast.zCStr(ExMath.zFloor(this.retail_price * ExCast.zCInt(this.numUpCreditRate.Value) / 100, this.unit_decimal_digit));
            this.txtUnitPrice.OnFormatString();
        }
Beispiel #15
0
        private void searchDlg_Closed(object sender, EventArgs e)
        {
            Dlg_Copying dlg = (Dlg_Copying)sender;

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

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

                    this.utlID.txtID_IsReadOnly = true;
                    ExBackgroundWorker.DoWork_Focus(this.txtName, 10);
                }
            }
        }
Beispiel #16
0
        public override void MstDataSelect(ExWebServiceMst.geWebServiceMstNmCallKbn intKbn, svcMstData.EntityMstData mst)
        {
            try
            {
                svcMstData.EntityMstData _mst = null;
                _mst = mst;

                switch (intKbn)
                {
                case ExWebServiceMst.geWebServiceMstNmCallKbn.GetCommodity:
                    if (DataForm.CurrentIndex == -1)
                    {
                        return;
                    }

                    if (_mst == null)
                    {
                        return;
                    }

                    // attribute20に選択された行が設定されてくる
                    if (string.IsNullOrEmpty(_mst.attribute20))
                    {
                        // 商品から明細へ
                        DataDetail.SetCommodityToDetail(DataForm.CurrentIndex, this._entityH, this._entityListD, _mst);
                        OnFormatAll();
                    }
                    else
                    {
                        if (_entityListD.Count >= ExCast.zCInt(_mst.attribute20) + 1)
                        {
                            // 商品から明細へ
                            DataDetail.SetCommodityToDetail(ExCast.zCInt(_mst.attribute20), _entityH, _entityListD, _mst);
                            OnFormatAll();
                        }
                    }
                    break;
                }
            }
            catch
            {
            }
        }
        // F11ボタン(印刷) クリック
        public override void btnF11_Click(object sender, RoutedEventArgs e)
        {
            if (ExCast.zCInt(this.utlClass.txtID.Text.Trim()) == 0)
            {
                ExMessageBox.Show("分類区分を選択して下さい。");
                return;
            }

            if (ExCast.zCInt(this.utlClass.txtID.Text.Trim()) > 3)
            {
                ExMessageBox.Show("分類区分を適切に入力(選択)して下さい。");
                return;
            }

            switch (ExCast.zCInt(this.utlClass.txtID.Text.Trim()))
            {
            case 1:
                Common.report.utlReport.MstGroupKbn = Class.Data.MstData.geMGroupKbn.CustomerGrouop1;
                break;

            case 2:
                Common.report.utlReport.MstGroupKbn = Class.Data.MstData.geMGroupKbn.CommodityGrouop1;
                break;

            case 3:
                Common.report.utlReport.MstGroupKbn = Class.Data.MstData.geMGroupKbn.PurchaseGrouop1;
                break;

            default:
                ExMessageBox.Show("分類区分を適切に選択して下さい。");
                return;
            }

            Common.report.utlReport.gPageType     = Common.gePageType.None;
            Common.report.utlReport.gWinMsterType = _WinMsterType;
            beforeWinGroupType   = Common.gWinGroupType;
            Common.gWinGroupType = Common.geWinGroupType.Report;

            Common.report.Closed -= reportDlg_Closed;
            Common.report.Closed += reportDlg_Closed;
            Common.report.Show();
        }
        public static string GetAccountPeriod(string accountBeginPeriod, string ymd)
        {
            if (accountBeginPeriod.Length != 4 || ymd.Length != 10)
            {
                return("");
            }

            string _ymd  = ymd.Replace("/", "");
            string _YYYY = _ymd.Substring(0, 4);
            string _MMDD = _ymd.Substring(4, 4);

            if (ExCast.zCInt(accountBeginPeriod) > ExCast.zCInt(_MMDD))
            {
                return((ExCast.zCInt(_YYYY) - 1).ToString());
            }
            else
            {
                return(_YYYY);
            }
        }
Beispiel #19
0
        public override void MstDataSelect(ExWebServiceMst.geWebServiceMstNmCallKbn intKbn, svcMstData.EntityMstData mst)
        {
            try
            {
                svcMstData.EntityMstData _mst = null;
                _mst = mst;

                switch (intKbn)
                {
                case ExWebServiceMst.geWebServiceMstNmCallKbn.GetRecieptDivision:
                    if (DataForm.CurrentIndex == -1)
                    {
                        return;
                    }

                    if (_mst == null)
                    {
                        return;
                    }

                    // attribute20に選択された行が設定されてくる
                    if (string.IsNullOrEmpty(_mst.attribute20))
                    {
                        _entityListD[ExCast.zCInt(_mst.attribute20) + 1]._receipt_division_nm = "";
                        OnFormatAll();
                    }
                    else
                    {
                        if (_entityListD.Count >= ExCast.zCInt(_mst.attribute20) + 1)
                        {
                            _entityListD[ExCast.zCInt(_mst.attribute20)]._receipt_division_nm = mst.name;
                            OnFormatAll();
                        }
                    }
                    break;
                }
            }
            catch
            {
            }
        }
        private void GetMstData()
        {
            object[] prm = new object[2];

            int id = 0;

            for (int i = 0; i <= this._entityUserList.Count - 1; i++)
            {
                if (ExCast.zCStr(this.cmbUser.SelectedValue) == _entityUserList[i].name)
                {
                    id = ExCast.zCInt(_entityUserList[i].attribute1);
                }
            }
            prm[0] = id;

            webService.objPerent = this;
            webService.CallWebService(_GetWebServiceCallKbn,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
        // データ追加・更新・削除
        private void UpdateData(Common.geUpdateType upd)
        {
            object[] prm = new object[3];
            prm[0] = (int)upd;
            prm[1] = 0;

            _entityUpdate._title = this.txtTitle.Text;

            for (int i = 0; i <= _entityPersonList.Count - 1; i++)
            {
                if (ExCast.zCStr(this.cmbPerson.SelectedValue) == _entityPersonList[i].name)
                {
                    _entityUpdate._person_id   = ExCast.zCInt(_entityPersonList[i].id);
                    _entityUpdate._d_person_id = ExCast.zCInt(_entityPersonList[i].id);
                }
            }

            if (this.cmbKbn.SelectedValue != null)
            {
                _entityUpdate._inquiry_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.INQUIRY_DIVISION_ID, ExCast.zCStr(this.cmbKbn.SelectedValue));
            }

            if (this.cmbLevel.SelectedValue != null)
            {
                _entityUpdate._inquiry_level_id = MeiNameList.GetID(MeiNameList.geNameKbn.LEVEL_ID, ExCast.zCStr(this.cmbLevel.SelectedValue));
            }

            _entityUpdate._inquiry_level_state_id = 1;    // オープン
            _entityUpdate._title   = this.txtTitle.Text;
            _entityUpdate._content = this.txtContent.Text;
            _entityUpdate._rec_no  = 1;
            _entityUpdate._kbn     = 0;   // ユーザー

            prm[2] = _entityUpdate;
            webService.objWindow = this;
            webService.CallWebService(ExWebService.geWebServiceCallKbn.UpdateInquiry,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
Beispiel #22
0
        private void GetMstData()
        {
            object[] prm = new object[1];

            prm[0] = "";
            for (int i = 0; i <= _entityUserList.Count - 1; i++)
            {
                if (ExCast.zCStr(this.cmbLoginId.SelectedValue) == _entityUserList[i].id)
                {
                    prm[0] = ExCast.zCInt(_entityUserList[i].attribute1);
                }
            }
            if (ExCast.zCStr(prm[0]) == "")
            {
                return;
            }

            webService.objPerent = this;
            webService.CallWebService(_GetWebServiceCallKbn,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
        public static void UpdateSlipNo(string companyId,
                                        string groupId,
                                        ExMySQLData db,
                                        geSlipKbn kbn,
                                        string accountPeriod,
                                        long no,
                                        long id)
        {
            StringBuilder sb;

            try
            {
                sb = new StringBuilder();

                sb.Append("UPDATE M_SLIP_MANAGEMENT " + Environment.NewLine);
                sb.Append("   SET ID = " + id.ToString() + Environment.NewLine);
                // 追加時
                if (no != 0)
                {
                    sb.Append("      ,NO = " + no.ToString() + Environment.NewLine);
                }
                sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND GROUP_ID = " + groupId + Environment.NewLine);
                sb.Append("   AND SLIP_DIVISION = " + ((int)kbn).ToString() + Environment.NewLine);
                sb.Append("   AND YEAR = " + ExCast.zCInt(accountPeriod).ToString() + Environment.NewLine);
                sb.Append("   AND DELETE_FLG = 0 " + Environment.NewLine);

                db.ExecuteSQL(sb.ToString(), false);
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSlipNo", ex);
                no = 0;
                id = 0;
                throw;
            }
        }
        // データ追加・更新・削除
        private void UpdateData(Common.geUpdateType upd)
        {
            object[] prm = new object[3];
            prm[0] = (int)upd;
            prm[1] = _entityList[0]._no;

            _entityUpdate._no                     = _entityList[0]._no;
            _entityUpdate._company_id             = _entityList[0]._company_id;
            _entityUpdate._gropu_id               = _entityList[0]._gropu_id;
            _entityUpdate._person_id              = _entityList[0]._person_id;
            _entityUpdate._date_time              = _entityList[0]._date_time;
            _entityUpdate._title                  = _entityList[0]._title;
            _entityUpdate._inquiry_division_id    = _entityList[0]._inquiry_division_id;
            _entityUpdate._inquiry_level_id       = _entityList[0]._inquiry_level_id;
            _entityUpdate._inquiry_level_state_id = 2; // 回答待ち
            _entityUpdate._rec_no                 = _entityList[0]._rec_no + 1;
            _entityUpdate._kbn                    = 0; // ユーザー
            _entityUpdate._title                  = this.txtTitle.Text;
            _entityUpdate._content                = this.txtContent.Text;

            for (int i = 0; i <= _entityPersonList.Count - 1; i++)
            {
                if (ExCast.zCStr(this.cmbPerson.SelectedValue) == _entityPersonList[i].name)
                {
                    _entityUpdate._d_person_id = ExCast.zCInt(_entityPersonList[i].id);
                }
            }


            prm[2] = _entityUpdate;
            webService.objWindow = this;
            webService.CallWebService(ExWebService.geWebServiceCallKbn.UpdateInquiry,
                                      ExWebService.geDialogDisplayFlg.Yes,
                                      ExWebService.geDialogCloseFlg.Yes,
                                      prm);
        }
Beispiel #25
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;
            }
        }
        public static void gAddEvidence(int saveFlg, string companyId, string userId, string ipAdress, string sessionString, string pgId, DataPgEvidence.geOperationType type, string memo)
        {
            if (saveFlg != 1)
            {
                return;
            }

            StringBuilder sb = new StringBuilder();
            DataTable     dt;

            ExMySQLData db = ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString);

            // 日時取得
            string   date        = "";
            string   time        = "";
            int      millisecond = 0;
            DateTime now         = DateTime.Now;

            date        = now.ToString("yyyy/MM/dd");
            time        = now.ToString("HH:mm:ss");
            millisecond = now.Millisecond;

            // PG実行履歴登録
            try
            {
                sb.Length = 0;
                sb.Append("INSERT INTO H_PG_EXEC_HISTORY " + Environment.NewLine);
                sb.Append("       (COMPANY_ID" + Environment.NewLine);
                sb.Append("       ,USER_ID" + Environment.NewLine);
                sb.Append("       ,PG_ID" + Environment.NewLine);
                sb.Append("       ,OPERATION_DATE" + Environment.NewLine);
                sb.Append("       ,OPERATION_TIME" + Environment.NewLine);
                sb.Append("       ,OPERATION_MILLISECOND" + Environment.NewLine);
                sb.Append("       ,OPERATION_TYPE" + Environment.NewLine);
                sb.Append("       ,PG_NAME" + Environment.NewLine);
                sb.Append("       ,OPERATION_TYPE_NAME" + Environment.NewLine);
                sb.Append("       ,MEMO" + 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_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_DATE" + Environment.NewLine);
                sb.Append("       ,UPDATE_TIME" + Environment.NewLine);
                sb.Append(")" + Environment.NewLine);
                sb.Append("VALUES (" + companyId + Environment.NewLine);                                                   // COMPANY_ID
                sb.Append("       ," + userId + Environment.NewLine);                                                      // USER_ID
                sb.Append("       ," + ExEscape.zRepStr(pgId) + Environment.NewLine);                                      // PG_ID
                sb.Append("       ," + ExEscape.zRepStr(date) + Environment.NewLine);                                      // OPERATION_DATE
                sb.Append("       ," + ExEscape.zRepStr(time) + Environment.NewLine);                                      // OPERATION_TIME
                sb.Append("       ," + millisecond.ToString() + Environment.NewLine);                                      // OPERATION_MILLISECOND
                sb.Append("       ," + (int)type + Environment.NewLine);                                                   // OPERATION_TYPE
                sb.Append("       ," + ExEscape.zRepStr(DataPgEvidence.GetPgName(pgId)) + Environment.NewLine);            // PG_NAME
                sb.Append("       ," + ExEscape.zRepStr(DataPgEvidence.GetOperationTypeName(type)) + Environment.NewLine); // OPERATION_TYPE_NAME
                sb.Append("       ," + ExEscape.zRepStr(memo) + Environment.NewLine);                                      // MEMO
                sb.Append("       ,0" + Environment.NewLine);                                                              // UPDATE_FLG
                sb.Append("       ,0" + Environment.NewLine);                                                              // DELETE_FLG
                sb.Append("       ,'SYSTEM'" + Environment.NewLine);                                                       // CREATE_PG_ID
                sb.Append("       ," + ExEscape.zRepStr(ipAdress) + Environment.NewLine);                                  // CREATE_ADRESS
                sb.Append("       ," + ExEscape.zRepStr(userId) + Environment.NewLine);                                    // CREATE_USER_ID
                sb.Append("       ," + ExEscape.zRepStr(date) + Environment.NewLine);                                      // CREATE_DATE
                sb.Append("       ," + ExEscape.zRepStr(time) + Environment.NewLine);                                      // CREATE_TIME
                sb.Append("       ,'SYSTEM'" + Environment.NewLine);                                                       // UPDATE_PG_ID
                sb.Append("       ," + ExEscape.zRepStr(ipAdress) + Environment.NewLine);                                  // UPDATE_ADRESS
                sb.Append("       ," + ExEscape.zRepStr(userId) + Environment.NewLine);                                    // UPDATE_USER_ID
                sb.Append("       ," + ExEscape.zRepStr(date) + Environment.NewLine);                                      // UPDATE_DATE
                sb.Append("       ," + ExEscape.zRepStr(time) + Environment.NewLine);                                      // UPDATE_TIME
                sb.Append(")");

                if (db.ExecuteSQL(sb.ToString(), true) == false)
                {
                    CommonUtl.ExLogger.Error(CLASS_NM + ".gAddEvidence(ExecuteSQL) : " + Environment.NewLine + ExSession.GetSessionDb(ExCast.zCInt(userId), sessionString).errMessage);
                    return;
                }

                switch (type)
                {
                case DataPgEvidence.geOperationType.Start:
                case DataPgEvidence.geOperationType.End:
                    if (pgId == DataPgEvidence.PGName.System)
                    {
                        DataPgLock.DelLockPg(companyId, userId, "", "", ipAdress, true, db);
                    }
                    else
                    {
                        DataPgLock.DelLockPg(companyId, userId, pgId, "", ipAdress, true, db);
                    }
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".gAddEvidence(Insert)", ex);
                db.ExRollbackTransaction();
            }
        }
        public void AddEvidence(string random, string pgId, int type, string memo)
        {
            #region 認証処理

            string companyId     = "";
            string groupId       = "";
            string userId        = "";
            string ipAdress      = "";
            string sessionString = "";
            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]);

                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;
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".AddEvidence(認証処理)", ex);
                return;
            }

            #endregion

            gAddEvidence(1, companyId, userId, ipAdress, sessionString, pgId, (DataPgEvidence.geOperationType)type, memo);
        }
        public List <EntityStockInventory> GetStockInventoryList(string random, string strWhereSql, string strOrderBySql)
        {
            List <EntityStockInventory> entityList = new List <EntityStockInventory>();

            #region 認証処理

            string companyId         = "";
            string groupId           = "";
            string userId            = "";
            string ipAdress          = "";
            string sessionString     = "";
            int    idFigureCommodity = 0;
            int    idFigureCustomer  = 0;
            int    idFigurePurchase  = 0;
            int    idFigureSlipNo    = 0;

            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]);
                idFigureCommodity = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_GOODS]);
                idFigureCustomer  = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_CUSTOMER]);
                idFigurePurchase  = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_PURCHASE]);
                idFigureSlipNo    = ExCast.zCInt(HttpContext.Current.Session[ExSession.ID_FIGURE_SLIP_NO]);

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

            StringBuilder sb;
            DataTable     dt;
            ExMySQLData   db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));

                sb = new StringBuilder();

                ExReportManeger rptMgr = new ExReportManeger();
                rptMgr.idFigureCommodity = idFigureCommodity;
                rptMgr.idFigureCustomer  = idFigureCustomer;
                rptMgr.idFigurePurchase  = idFigurePurchase;
                rptMgr.idFigureSlipNo    = idFigureSlipNo;
                sb.Append(rptMgr.GetStockInventoryListReportSQL(companyId, groupId, strWhereSql, strOrderBySql));

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

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

                        EntityStockInventory entity = new EntityStockInventory();
                        entity.commodity_id              = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_ID"]);
                        entity.commodity_name            = ExCast.zCStr(dt.DefaultView[i]["COMMODITY_NAME"]);
                        entity.account_inventory_number  = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]);
                        entity.practice_inventory_number = ExCast.zCDbl(dt.DefaultView[i]["INVENTORY_NUMBER"]);
                        entity.diff_number = 0;

                        entity.exec_flg = false;

                        entity.lock_flg = 0;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetStockInventoryList", ex);
                entityList.Clear();
                EntityStockInventory entity = new EntityStockInventory();
                entity.MESSAGE = CLASS_NM + ".GetStockInventoryList : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();
                entityList.Add(entity);
            }
            finally
            {
                db = null;
            }

            svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                       companyId,
                                       userId,
                                       ipAdress,
                                       sessionString,
                                       DataPgEvidence.PGName.StockInventory.StockInventoryInp,
                                       DataPgEvidence.geOperationType.Select,
                                       "Where:" + strWhereSql + ",Orderby:" + strOrderBySql);

            return(entityList);
        }
        public string UpdateStockInventory(string random, int type, string ymd, List <EntityStockInventory> 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 + ".UpdateStockInventory(認証処理)", ex);
                return(CLASS_NM + ".UpdateStockInventory : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString());
            }

            #endregion

            #region Field

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

            long   rec_cnt     = 0;
            string str_message = "";

            EntityInOutDeliveryH        _entityInOutDeliveryH           = new EntityInOutDeliveryH();
            List <EntityInOutDeliveryD> _entityInOutDeliveryListD_Plus  = new List <EntityInOutDeliveryD>();
            List <EntityInOutDeliveryD> _entityInOutDeliveryListD_Minus = new List <EntityInOutDeliveryD>();

            #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 + ".UpdateStockInventory(DbOpen)", ex);
                return(CLASS_NM + ".UpdateStockInventory(DbOpen) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region BeginTransaction

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

            #endregion

            #region Update

            if (type == 0)
            {
                try
                {
                    for (int i = 0; i <= entity.Count - 1; i++)
                    {
                        if (entity[i].exec_flg == true && entity[i].diff_number != 0)
                        {
                            #region Update Commodity Inventory

                            try
                            {
                                DataCommodityInventory.UpdCommodityInventory(companyId,
                                                                             groupId,
                                                                             db,
                                                                             ExCast.zNumZeroNothingFormat(entity[i].commodity_id),
                                                                             entity[i].diff_number * -1,
                                                                             PG_NM,
                                                                             ExCast.zCInt(personId),
                                                                             ipAdress,
                                                                             userId);
                            }
                            catch (Exception ex)
                            {
                                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateSales(Update Commodity Inventory)", ex);
                                return("UpdateSales(Update Commodity Inventory) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                            }

                            #endregion

                            #region Set Entity InOutDelivery

                            rec_cnt += 1;

                            EntityInOutDeliveryD _entityInOutDeliveryD = new EntityInOutDeliveryD();
                            _entityInOutDeliveryD.rec_no         = rec_cnt;
                            _entityInOutDeliveryD.commodity_id   = entity[i].commodity_id;
                            _entityInOutDeliveryD.commodity_name = entity[i].commodity_name;
                            _entityInOutDeliveryD.unit_id        = 0;
                            _entityInOutDeliveryD.enter_number   = 0;
                            _entityInOutDeliveryD.case_number    = 0;

                            if (entity[i].diff_number > 0)
                            {
                                _entityInOutDeliveryD.number = entity[i].diff_number;
                                _entityInOutDeliveryListD_Minus.Add(_entityInOutDeliveryD);
                            }
                            else
                            {
                                _entityInOutDeliveryD.number = entity[i].diff_number * -1;
                                _entityInOutDeliveryListD_Plus.Add(_entityInOutDeliveryD);
                            }

                            #endregion
                        }
                    }

                    #region Update InOutDelivery

                    try
                    {
                        svcInOutDelivery _svcInOutDelivery = new svcInOutDelivery();

                        if (_entityInOutDeliveryListD_Minus.Count > 0)
                        {
                            _entityInOutDeliveryH.in_out_delivery_ymd      = ymd;
                            _entityInOutDeliveryH.in_out_delivery_kbn      = 2;     // 入出庫区分:出庫
                            _entityInOutDeliveryH.in_out_delivery_proc_kbn = 4;     // 入出庫処理区分:棚卸
                            _entityInOutDeliveryH.in_out_delivery_to_kbn   = 1;     // 入出庫先区分:グループ
                            _entityInOutDeliveryH.update_person_id         = ExCast.zCInt(personId);
                            _entityInOutDeliveryH.group_id_to = groupId;

                            for (int i = 0; i <= _entityInOutDeliveryListD_Minus.Count - 1; i++)
                            {
                                _entityInOutDeliveryH.sum_enter_number += _entityInOutDeliveryListD_Minus[i].enter_number;
                                _entityInOutDeliveryH.sum_case_number  += _entityInOutDeliveryListD_Minus[i].case_number;
                                _entityInOutDeliveryH.sum_number       += _entityInOutDeliveryListD_Minus[i].number;
                            }

                            // random
                            // update type     1:Insert
                            // procKbn         4:棚卸
                            // InOutDeliveryNo 入出庫番号
                            // CauseNo         元伝票番号
                            str_message = _svcInOutDelivery.UpdateInOutDeliveryExcExc(random,
                                                                                      1,
                                                                                      4,
                                                                                      0,
                                                                                      0,
                                                                                      _entityInOutDeliveryH,
                                                                                      _entityInOutDeliveryListD_Minus,
                                                                                      null,
                                                                                      null);
                            if (str_message.IndexOf("Auto Insert success : ") == -1 && !string.IsNullOrEmpty(str_message))
                            {
                                return("UpdateStockInventory(Update InOutDelivery) : " + str_message);
                            }
                        }

                        _svcInOutDelivery = new svcInOutDelivery();

                        _entityInOutDeliveryH = null;
                        _entityInOutDeliveryH = new EntityInOutDeliveryH();
                        if (_entityInOutDeliveryListD_Plus.Count > 0)
                        {
                            _entityInOutDeliveryH.in_out_delivery_ymd      = ymd;
                            _entityInOutDeliveryH.in_out_delivery_kbn      = 1;     // 入出庫区分:入庫
                            _entityInOutDeliveryH.in_out_delivery_proc_kbn = 4;     // 入出庫処理区分:棚卸
                            _entityInOutDeliveryH.in_out_delivery_to_kbn   = 1;     // 入出庫先区分:グループ
                            _entityInOutDeliveryH.update_person_id         = ExCast.zCInt(personId);
                            _entityInOutDeliveryH.group_id_to = groupId;

                            for (int i = 0; i <= _entityInOutDeliveryListD_Plus.Count - 1; i++)
                            {
                                _entityInOutDeliveryH.sum_enter_number += _entityInOutDeliveryListD_Plus[i].enter_number;
                                _entityInOutDeliveryH.sum_case_number  += _entityInOutDeliveryListD_Plus[i].case_number;
                                _entityInOutDeliveryH.sum_number       += _entityInOutDeliveryListD_Plus[i].number;
                            }

                            // random
                            // update type     1:Insert
                            // procKbn         4:棚卸
                            // InOutDeliveryNo 入出庫番号
                            // CauseNo         元伝票番号
                            str_message = _svcInOutDelivery.UpdateInOutDeliveryExcExc(random,
                                                                                      1,
                                                                                      4,
                                                                                      0,
                                                                                      0,
                                                                                      _entityInOutDeliveryH,
                                                                                      _entityInOutDeliveryListD_Plus,
                                                                                      null,
                                                                                      null);
                            if (str_message.IndexOf("Auto Insert success : ") == -1 && !string.IsNullOrEmpty(str_message))
                            {
                                return("UpdateStockInventory(Update InOutDelivery) : " + str_message);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        db.ExRollbackTransaction();
                        CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateStockInventory(Update InOutDelivery)", ex);
                        return("UpdateStockInventory(Update InOutDelivery) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
                    }

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

            #endregion

            #region PG排他制御

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

            #endregion

            #region CommitTransaction

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

            #endregion

            #region Database Close

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

            #endregion

            #region Add Evidence

            try
            {
                svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                           companyId,
                                           userId,
                                           ipAdress,
                                           sessionString,
                                           PG_NM,
                                           DataPgEvidence.geOperationType.DeleteAndInsert,
                                           "");
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateStockInventory(Add Evidence)", ex);
                return(CLASS_NM + ".UpdateStockInventory(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            return("");
        }
Beispiel #30
0
        public List <EntityClass> GetClass(string random, int classKbn)
        {
            EntityClass        entity;
            List <EntityClass> entityList = new List <EntityClass>();

            #region 認証処理

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

            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]);

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

            #endregion

            StringBuilder sb;
            DataTable     dt;
            ExMySQLData   db;

            try
            {
                db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                            ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));

                sb = new StringBuilder();

                #region SQL

                int _classKbn = ((classKbn - 1)) * 3 + 1;

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("      ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine);
                sb.Append("  FROM M_CLASS AS MT" + Environment.NewLine);

                #region Join

                // 表示区分
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM" + Environment.NewLine);
                sb.Append("    ON NM.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DISPLAY_DIVISION_ID + Environment.NewLine);
                sb.Append("   AND NM.ID = MT.DISPLAY_FLG" + Environment.NewLine);

                #endregion

                sb.Append(" WHERE MT.COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND MT.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND MT.CLASS_DIVISION_ID = " + _classKbn.ToString() + Environment.NewLine);

                sb.Append(" ORDER BY MT.COMPANY_ID " + Environment.NewLine);
                sb.Append("         ,MT.ID " + Environment.NewLine);

                #endregion

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

                // 排他制御
                DataPgLock.geLovkFlg lockFlg;
                string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, _classKbn.ToString(), ipAdress, db, out lockFlg);

                if (strErr != "")
                {
                    entity         = new EntityClass();
                    entity.MESSAGE = CLASS_NM + ".GetCommodity : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    entityList.Add(entity);
                    return(entityList);
                }

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

                        entity    = new EntityClass();
                        entity.id = ExCast.zCStr(dt.DefaultView[i]["ID"]);
                        entity.class_divition_id = ExCast.zCInt(dt.DefaultView[i]["CLASS_DIVISION_ID"]);
                        entity.name = ExCast.zCStr(dt.DefaultView[i]["NAME"]);

                        entity.display_division_id = ExCast.zCInt(dt.DefaultView[i]["DISPLAY_FLG"]);
                        entity.display_division_nm = ExCast.zCStr(dt.DefaultView[i]["DISPLAY_DIVISION_NAME"]);

                        entity.memo = ExCast.zCStr(dt.DefaultView[i]["MEMO"]);

                        entity.lock_flg = (int)lockFlg;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetClass", ex);
                entityList.Clear();
                entity         = new EntityClass();
                entity.MESSAGE = CLASS_NM + ".GetClass : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();
                entityList.Add(entity);
            }
            finally
            {
                db = null;
            }

            svcPgEvidence.gAddEvidence(ExCast.zCInt(HttpContext.Current.Session[ExSession.EVIDENCE_SAVE_FLG]),
                                       companyId,
                                       userId,
                                       ipAdress,
                                       sessionString,
                                       PG_NM,
                                       DataPgEvidence.geOperationType.Select,
                                       "");

            return(entityList);
        }