Beispiel #1
0
        private void searchDlg_Closed(object sender, EventArgs e)
        {
            try
            {
                Dlg_MstSearch dlg = (Dlg_MstSearch)sender;
                if (dlg.DialogResult == true)
                {
                    string zip = Dlg_MstSearch.this_id;
                    zip = String.Format("{0:0000000}", ExCast.zCDbl(zip));
                    this.txtZipNo1.Text  = zip.Substring(0, 3);
                    this.txtZipNo2.Text  = zip.Substring(3, 4);
                    this.txtAdress1.Text = Dlg_MstSearch.this_attribute1 + Dlg_MstSearch.this_attribute2 + Dlg_MstSearch.this_attribute3;
                    this.txtAdress2.Text = "";
                    this.predecture_Name = Dlg_MstSearch.this_attribute1;
                    this.city_Name       = Dlg_MstSearch.this_attribute2;
                    this.town_Name       = Dlg_MstSearch.this_attribute3;

                    this.UserControlAdress1 = this.txtAdress1.Text;
                    this.UserControlAdress2 = this.txtAdress2.Text;

                    // 次コントロールフォーカスセット
                    ExVisualTreeHelper.FoucsNextControl(this);
                }
                else
                {
                    this.txtZipNo1.Focus();
                }
            }
            finally
            {
                this.IsSearchDlgOpen = false;
            }
        }
        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);
     }
 }
Beispiel #4
0
        /// <summary>
        /// マスタ名称設定(ExWebServiceMstNameから非同期呼出)
        /// </summary>
        /// <param name="intKbn"></param>
        /// <param name="name"></param>
        public override void MstDataSelect(ExWebServiceMst.geWebServiceMstNmCallKbn intKbn, EntityMstData mst)
        {
            Is_Zip_Upd = false;

            if (mst == null)
            {
                this.txtAdress1.Text = "";
                this.txtAdress2.Text = "";
                this.predecture_Name = "";
                this.city_Name       = "";
                this.town_Name       = "";
                this.tbkMessage.Text = "  ※入力郵便番号は存在しません";

                this.UserControlAdress1 = this.txtAdress1.Text;
                this.UserControlAdress2 = this.txtAdress2.Text;
            }
            else
            {
                if (!string.IsNullOrEmpty(mst.attribute1))
                {
                    this.txtZipNo1.Text = String.Format("{0:000}", ExCast.zCDbl(mst.attribute1));
                }
                if (!string.IsNullOrEmpty(mst.attribute2))
                {
                    this.txtZipNo2.Text = String.Format("{0:0000}", ExCast.zCDbl(mst.attribute2));
                }

                if (this.txtAdress1.Text.Trim() == "" || this.txtAdress2.Text.Trim() == "")
                {
                    string adress = mst.attribute3 + mst.attribute4 + mst.attribute5;
                    if (adress.Length > 20)
                    {
                        this.txtAdress1.Text = adress.Substring(0, 20);
                        this.txtAdress2.Text = adress.Substring(20, adress.Length - 20);
                    }
                    else
                    {
                        this.txtAdress1.Text = adress;
                        this.txtAdress2.Text = "";
                    }
                }

                this.predecture_Name = mst.attribute3;
                this.city_Name       = mst.attribute4;
                this.town_Name       = mst.attribute5;
                this.tbkMessage.Text = "";

                this.UserControlAdress1 = this.txtAdress1.Text;
                this.UserControlAdress2 = this.txtAdress2.Text;
            }
        }
        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);
                }
            }
        }
        protected override void OnTextInput(TextCompositionEventArgs e)
        {
            try
            {
                bool flg = InputCheck2(e.Text);

                if (flg == false)
                {
                    e.Handled = true;
                }
                if (e.Handled == false)
                {
                    // 値セット
                    switch (InputMode)
                    {
                    case geInputMode.Number:
                        //if (this.Text.IndexOf(".") != -1)
                        //{
                        //    string format = "0.";
                        //    for (int i = 1; i <= this.DecimalNum; i++)
                        //    {
                        //        format += "0";
                        //    }
                        //    this.Text = ExMath.zFloor(ExCast.zCDbl(this.Text), this.DecimalNum).ToString(format);
                        //}
                        this.Value = ExCast.zCDbl(this.Text).ToString();
                        break;

                    case geInputMode.Alphanumeric:
                        this.Value = this.Text;
                        break;

                    case geInputMode.Date:
                        this.Value = this.Text.Replace("/", "");
                        break;

                    case geInputMode.FullShapeNative:
                        this.Value = this.Text;
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            base.OnTextInput(e);
        }
        // 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();
            }
        }
        protected override void OnGotFocus(RoutedEventArgs e)
        {
            this.UpdataFlg   = false;
            this.BeforeValue = this.Text;

            base.OnGotFocus(e);

            try
            {
                OnFormatString();

                // 値セット
                switch (InputMode)
                {
                case geInputMode.ID:
                    this.SelectAll();
                    break;

                case geInputMode.Number:
                    if (this.Text != "")
                    {
                        this.Text = ExCast.zCDbl(this.Text).ToString();
                    }
                    this.TextAlignment = System.Windows.TextAlignment.Right;
                    this.SelectAll();
                    break;

                case geInputMode.Date:
                    if (this.Text != "")
                    {
                        this.Text = this.Text.Replace("/", "");
                    }
                    break;
                }
                if (this.IsSelectAll)
                {
                    this.SelectAll();
                }

                SetIme();
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #9
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);
        }
Beispiel #10
0
        protected override void OnTextInputUpdate(TextCompositionEventArgs e)
        {
            try
            {
                bool flg = InputCheck(e.Text);

                if (flg == false)
                {
                    e.Handled = true;
                }

                // 値セット
                switch (InputMode)
                {
                case geInputMode.Number:
                    this.Value = ExCast.zCDbl(this.Text).ToString();
                    break;

                case geInputMode.Alphanumeric:
                    this.Value = this.Text;
                    break;

                case geInputMode.Date:
                    this.Value = this.Text.Replace("/", "");
                    break;

                case geInputMode.FullShapeNative:
                    this.Value = this.Text;
                    break;
                }
            }
            catch (Exception ex)
            {
            }
            base.OnTextInputUpdate(e);
        }
Beispiel #11
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
        }
Beispiel #12
0
        public EntityCompany GetCompany(string random)
        {
            EntityCompany entity;

            #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 EntityCompany();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCompany(認証処理)", ex);
                entity         = new EntityCompany();
                entity.MESSAGE = CLASS_NM + ".GetCompany : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                return(entity);
            }


            #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

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("      ,SS.ID_FIGURE_SLIP_NO " + Environment.NewLine);
                sb.Append("      ,SS.ID_FIGURE_CUSTOMER " + Environment.NewLine);
                sb.Append("      ,SS.ID_FIGURE_PURCHASE " + Environment.NewLine);
                sb.Append("      ,SS.ID_FIGURE_GOODS " + Environment.NewLine);
                sb.Append("      ,SS.GROUP_DISPLAY_NAME " + Environment.NewLine);
                sb.Append("      ,ES_YMD.YMD AS ES_YMD " + Environment.NewLine);
                sb.Append("      ,JC_YMD.YMD AS JC_YMD " + Environment.NewLine);
                sb.Append("      ,SA_YMD.YMD AS SA_YMD " + Environment.NewLine);
                sb.Append("      ,RP_YMD.YMD AS RP_YMD " + Environment.NewLine);
                sb.Append("      ,ES_CNT.CNT AS ES_CNT " + Environment.NewLine);
                sb.Append("      ,JC_CNT.CNT AS JC_CNT " + Environment.NewLine);
                sb.Append("      ,SA_CNT.CNT AS SA_CNT " + Environment.NewLine);
                sb.Append("      ,RP_CNT.CNT AS RP_CNT " + Environment.NewLine);
                sb.Append("  FROM SYS_M_COMPANY AS MT" + Environment.NewLine);

                #region Join

                // システム設定
                sb.Append("  LEFT JOIN SYS_M_SETTING AS SS" + Environment.NewLine);
                sb.Append("    ON SS.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 見積最終伝票入力日
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , MAX(date_format(ESTIMATE_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine);
                sb.Append("               FROM T_ESTIMATE_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS ES_YMD" + Environment.NewLine);
                sb.Append("    ON ES_YMD.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 受注最終伝票入力日
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , MAX(date_format(ORDER_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine);
                sb.Append("               FROM T_ORDER_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS JC_YMD" + Environment.NewLine);
                sb.Append("    ON JC_YMD.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 売上最終伝票入力日
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , MAX(date_format(SALES_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine);
                sb.Append("               FROM T_SALES_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS SA_YMD" + Environment.NewLine);
                sb.Append("    ON SA_YMD.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 入金最終伝票入力日
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , MAX(date_format(RECEIPT_YMD , " + ExEscape.SQL_YMD + ")) AS YMD " + Environment.NewLine);
                sb.Append("               FROM T_RECEIPT_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS RP_YMD" + Environment.NewLine);
                sb.Append("    ON RP_YMD.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 見積現在伝票件数
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine);
                sb.Append("               FROM T_ESTIMATE_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS ES_CNT" + Environment.NewLine);
                sb.Append("    ON ES_CNT.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 受注現在伝票件数
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine);
                sb.Append("               FROM T_ORDER_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS JC_CNT" + Environment.NewLine);
                sb.Append("    ON JC_CNT.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 売上現在伝票件数
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine);
                sb.Append("               FROM T_SALES_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS SA_CNT" + Environment.NewLine);
                sb.Append("    ON SA_CNT.COMPANY_ID = MT.ID" + Environment.NewLine);

                // 入金現在伝票件数
                sb.Append("  LEFT JOIN (SELECT COMPANY_ID" + Environment.NewLine);
                sb.Append("                  , COUNT(COMPANY_ID) AS CNT " + Environment.NewLine);
                sb.Append("               FROM T_RECEIPT_H " + Environment.NewLine);
                sb.Append("              WHERE DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("                AND COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("              GROUP BY COMPANY_ID) AS RP_CNT" + Environment.NewLine);
                sb.Append("    ON RP_CNT.COMPANY_ID = MT.ID" + Environment.NewLine);

                #endregion

                sb.Append(" WHERE MT.ID = " + companyId + Environment.NewLine);
                sb.Append("   AND MT.DELETE_FLG = 0 " + Environment.NewLine);

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    entity = new EntityCompany();

                    // 排他制御
                    DataPgLock.geLovkFlg lockFlg;
                    string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, companyId.ToString(), ipAdress, db, out lockFlg);
                    if (strErr != "")
                    {
                        entity.MESSAGE = CLASS_NM + ".GetCompany : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    }

                    #region Set Entity

                    entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]);
                    entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]);

                    string _zip = ExCast.zCStr(dt.DefaultView[0]["ZIP_CODE"]);
                    if (!string.IsNullOrEmpty(_zip) && ExCast.zCStr(_zip) != "0")
                    {
                        _zip = string.Format("{0:0000000}", ExCast.zCDbl(_zip));
                        entity.zip_code_from = _zip.Substring(0, 3);
                        entity.zip_code_to   = _zip.Substring(3, 4);
                    }
                    else
                    {
                        entity.zip_code_from = "";
                        entity.zip_code_to   = "";
                    }

                    entity.prefecture_id = ExCast.zCInt(dt.DefaultView[0]["PREFECTURE_ID"]);
                    entity.city_id       = ExCast.zCInt(dt.DefaultView[0]["CITY_ID"]);
                    entity.town_id       = ExCast.zCInt(dt.DefaultView[0]["TOWN_ID"]);
                    entity.adress_city   = ExCast.zCStr(dt.DefaultView[0]["ADRESS_CITY"]);
                    entity.adress_town   = ExCast.zCStr(dt.DefaultView[0]["ADRESS_TOWN"]);
                    entity.adress1       = ExCast.zCStr(dt.DefaultView[0]["ADRESS1"]);
                    entity.adress2       = ExCast.zCStr(dt.DefaultView[0]["ADRESS2"]);
                    entity.tel           = ExCast.zCStr(dt.DefaultView[0]["TEL"]);
                    entity.fax           = ExCast.zCStr(dt.DefaultView[0]["FAX"]);
                    entity.mail_adress   = ExCast.zCStr(dt.DefaultView[0]["MAIL_ADRESS"]);
                    entity.mobile_tel    = ExCast.zCStr(dt.DefaultView[0]["MOBILE_TEL"]);
                    entity.mobile_adress = ExCast.zCStr(dt.DefaultView[0]["MOBILE_ADRESS"]);
                    entity.url           = ExCast.zCStr(dt.DefaultView[0]["URL"]);

                    entity.group_display_name  = ExCast.zCStr(dt.DefaultView[0]["GROUP_DISPLAY_NAME"]);
                    entity.id_figure_slip_no   = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_SLIP_NO"]);
                    entity.id_figure_customer  = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_CUSTOMER"]);
                    entity.id_figure_purchase  = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_PURCHASE"]);
                    entity.id_figure_commodity = ExCast.zCInt(dt.DefaultView[0]["ID_FIGURE_GOODS"]);

                    entity.estimate_ymd       = ExCast.zDateNullToDefault(dt.DefaultView[0]["ES_YMD"]);
                    entity.order_ymd          = ExCast.zDateNullToDefault(dt.DefaultView[0]["JC_YMD"]);
                    entity.sales_ymd          = ExCast.zDateNullToDefault(dt.DefaultView[0]["SA_YMD"]);
                    entity.receipt_ymd        = ExCast.zDateNullToDefault(dt.DefaultView[0]["RP_YMD"]);
                    entity.purchase_order_ymd = "";
                    entity.purchase_ymd       = "";
                    entity.cash_payment_ymd   = "";
                    entity.produce_ymd        = "";
                    entity.ship_ymd           = "";

                    entity.estimate_cnt       = ExCast.zCLng(dt.DefaultView[0]["ES_CNT"]);
                    entity.order_cnt          = ExCast.zCLng(dt.DefaultView[0]["JC_CNT"]);
                    entity.sales_cnt          = ExCast.zCLng(dt.DefaultView[0]["SA_CNT"]);
                    entity.receipt_cnt        = ExCast.zCLng(dt.DefaultView[0]["RP_CNT"]);
                    entity.purchase_order_cnt = 0;
                    entity.purchase_cnt       = 0;
                    entity.cash_payment_cnt   = 0;
                    entity.produce_cnt        = 0;
                    entity.ship_cnt           = 0;

                    entity.lock_flg = (int)lockFlg;
                    entity.memo     = ExCast.zCStr(dt.DefaultView[0]["MEMO"]);

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

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

            return(entity);
        }
        public List <EntityInvoiceBalance> GetInvoiceBalanceList(string random, string strWhereSql, string strOrderBySql)
        {
            List <EntityInvoiceBalance> entityList = new List <EntityInvoiceBalance>();

            #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 != "")
                {
                    EntityInvoiceBalance entity = new EntityInvoiceBalance();
                    entity.MESSAGE = _message;
                    entityList.Add(entity);
                    return(entityList);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList(認証処理)", ex);
                EntityInvoiceBalance entity = new EntityInvoiceBalance();
                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.GetInvoiceBalanceListReportSQL(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

                        EntityInvoiceBalance entity = new EntityInvoiceBalance();
                        entity.no                  = ExCast.zCStr(dt.DefaultView[i]["NO"]);
                        entity.invoice_id          = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]);
                        entity.invoice_nm          = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NM"]);
                        entity.invoice_yyyymmdd    = ExCast.zDateNullToDefault(dt.DefaultView[i]["INVOICE_YYYYMMDD"]);
                        entity.summing_up_group_id = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_ID"]);
                        entity.summing_up_group_nm = ExCast.zCStr(dt.DefaultView[i]["SUMMING_UP_GROUP_NM"]);
                        entity.person_id           = ExCast.zCInt(dt.DefaultView[i]["INPUT_PERSON"]);
                        entity.person_nm           = ExCast.zCStr(dt.DefaultView[i]["INPUT_PERSON_NM"]);

                        entity.collect_plan_day = ExCast.zDateNullToDefault(dt.DefaultView[i]["COLLECT_PLAN_DAY"]);
                        entity.collect_day      = ExCast.zCInt(dt.DefaultView[i]["COLLECT_DAY"]);

                        entity.before_invoice_yyyymmdd = ExCast.zDateNullToDefault(dt.DefaultView[i]["BEFORE_INVOICE_YYYYMMDD"]);

                        entity.before_invoice_price     = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]);
                        entity.before_invoice_price_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_INVOICE_PRICE"]);
                        entity.receipt_price            = ExCast.zCDbl(dt.DefaultView[i]["RECEIPT_PRICE"]);
                        entity.transfer_price           = ExCast.zCDbl(dt.DefaultView[i]["TRANSFER_PRICE"]);
                        entity.sales_price        = ExCast.zCDbl(dt.DefaultView[i]["SALES_PRICE"]);
                        entity.no_tax_sales_price = ExCast.zCDbl(dt.DefaultView[i]["NO_TAX_SALES_PRICE"]);
                        entity.tax = ExCast.zCDbl(dt.DefaultView[i]["TAX"]);

                        entity.invoice_price = ExCast.zCDbl(dt.DefaultView[i]["INVOICE_PRICE"]);

                        entity.invoice_kbn    = ExCast.zCInt(dt.DefaultView[i]["INVOICE_KBN"]);
                        entity.invoice_kbn_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_KBN_NM"]);

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

                        entity.invoice_exists_flg = 0;
                        entity.exec_flg           = false;

                        entity.lock_flg = 0;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetInvoiceBalanceList", ex);
                entityList.Clear();
                EntityInvoiceBalance entity = new EntityInvoiceBalance();
                entity.MESSAGE = CLASS_NM + ".GetInvoiceBalanceList : 予期せぬエラーが発生しました。" + 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.Order.OrderList,
                                       DataPgEvidence.geOperationType.Select,
                                       "Where:" + strWhereSql + ",Orderby:" + strOrderBySql);

            return(entityList);
        }
 // F1ボタン(OK) クリック
 public override void btnF1_Click(object sender, RoutedEventArgs e)
 {
     this.return_unit_price = ExCast.zCDbl(this.txtUnitPrice.Text);
     this.DialogResult      = true;
 }
Beispiel #15
0
        private bool InputCheck2(string _text)
        {
            string _strText        = "";
            string _chktext        = "";
            int    _selectionStart = 0;

            switch (InputMode)
            {
            case geInputMode.Number:
                // 最大・最小入力値チェック
                _strText = this.Text;
                if (this.SelectedText != "")
                {
                    _strText = this.Text.Replace(this.SelectedText, "");
                }
                if (ExCast.zCDbl(_strText + _text) < this.MinNumber || ExCast.zCDbl(_strText + _text) > this.MaxNumber)
                {
                    return(false);
                }

                double _dbl = ExCast.zCDbl(_strText + _text);
                string strText;
                string str;
                if (this.DecimalNum > 0)
                {
                    if (this.DecimalNum == 1)
                    {
                        strText = _dbl.ToString("#,##0.00");
                        str     = strText.Substring(strText.Length - 1, 1);
                        if (str != "0")
                        {
                            return(false);
                        }
                    }
                    else if (this.DecimalNum == 2)
                    {
                        strText = _dbl.ToString("#,##0.000");
                        str     = strText.Substring(strText.Length - 1, 1);
                        if (str != "0")
                        {
                            return(false);
                        }
                    }
                    else
                    {
                        return(false);
                    }
                }
                break;

            case geInputMode.ID:
            case geInputMode.Alphanumeric:
            case geInputMode.FullKana:
            case geInputMode.HalfKana:
            case geInputMode.FullShapeNative:
                if (ExCast.zCInt(this.MaxLengthB) != 0)
                {
                    if (ExString.IsFullString(_text) || ExString.LenB(_text) >= 2)
                    {
                        // 最大入力バイト数チェック
                        if (ExString.LenB(this.Text) - ExString.LenB(this.SelectedText) > ExCast.zCInt(this.MaxLengthB))
                        {
                            _chktext = this.Text + this.SelectedText;
                            for (int i = 1; i <= _chktext.Length; i++)
                            {
                                _chktext = _chktext.Substring(0, _chktext.Length - 1);
                                if (ExString.LenB(_chktext) <= ExCast.zCInt(this.MaxLengthB))
                                {
                                    _selectionStart     = this.SelectionStart + _text.Length;
                                    this.Text           = _chktext;
                                    this.SelectionStart = _selectionStart;
                                    break;
                                }
                            }
                            return(false);
                        }
                    }
                    else
                    {
                        // 最大入力バイト数チェック

                        if (ExString.LenB(this.Text + _text) - ExString.LenB(this.SelectedText) > ExCast.zCInt(this.MaxLengthB))
                        {
                            _chktext = this.Text + _text + this.SelectedText;
                            for (int i = 1; i <= _chktext.Length; i++)
                            {
                                _chktext = _chktext.Substring(0, _chktext.Length - 1);
                                if (ExString.LenB(_chktext) <= ExCast.zCInt(this.MaxLengthB))
                                {
                                    this.Text = _chktext;
                                    break;
                                }
                            }
                            return(false);
                        }
                    }
                }
                break;
            }

            // 全角チェック
            switch (InputMode)
            {
            case geInputMode.Number:
            case geInputMode.ID:
            case geInputMode.Alphanumeric:
                //case geInputMode.HalfKana:
                string strText = "";
                for (int i = 1; i <= this.Text.Length; i++)
                {
                    string str   = this.Text.Substring(i - 1, 1);
                    byte[] bytes = ExSjisEncoding.ucstojms(str);

                    // 全角は除く
                    if (bytes.Length == 1)
                    {
                        strText += str;
                    }
                }
                if (strText != this.Text)
                {
                    return(false);
                    //this.Text = strText;
                }
                break;
            }

            // 0入力チェック
            switch (InputMode)
            {
            case geInputMode.ID:
                if (this.Text + _text == "0")
                {
                    return(false);
                }
                break;
            }

            return(true);
        }
Beispiel #16
0
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            base.OnMouseLeftButtonDown(e);

            bool _flg = false;

            try
            {
                DateTime dtNow = DateTime.Now;

                // 前回ミリ秒設定有り時
                if (intBeforeHour != 0 || intBeforeMinute != 0 || intBeforeSecond != 0 || intBeforeMilliSecond != 0)
                {
                    // 今回ミリ秒取得
                    int intHour        = dtNow.Hour;
                    int intMinute      = dtNow.Minute;
                    int intSecond      = dtNow.Second;
                    int intMilliSecond = dtNow.Millisecond;

                    // 時間間隔取得
                    TimeSpan ts       = new TimeSpan(0, intHour, intMinute, intSecond, intMilliSecond);
                    TimeSpan tsBefore = new TimeSpan(0, intBeforeHour, intBeforeMinute, intBeforeSecond, intBeforeMilliSecond);
                    TimeSpan diff     = tsBefore - ts;
                    double   dbl      = ExCast.zCDbl(diff.Duration().ToString().Replace(":", ""));

                    // 初期化
                    intBeforeHour        = 0;
                    intBeforeMinute      = 0;
                    intBeforeSecond      = 0;
                    intBeforeMilliSecond = 0;

                    // マウスダウンの時間間隔が0.5秒以内
                    if (dbl <= 0.5)
                    {
                        OnMouseDoubleClick(this, e);
                        _flg = true;
                    }
                }
                else
                {
                    // 前回時刻設定
                    intBeforeHour        = dtNow.Hour;
                    intBeforeMinute      = dtNow.Minute;
                    intBeforeSecond      = dtNow.Second;
                    intBeforeMilliSecond = dtNow.Millisecond;
                }

                if (this._IsDataGridSelectCell && _flg == false)
                {
                    ExDataGrid dg = (ExDataGrid)ExVisualTreeHelper.FindPerentDataGrid(this);
                    if (dg != null)
                    {
                        dg.SelectedCell(ExCast.zCInt(this.DataGridRecNo), this.DataGridSelectedColumnIndex);
                        //ExBackgroundWorker.DoWork_DataGridSelectCell(dg, ExCast.zCInt(this.DataGridRecNo) - 1, this.DataGridSelectedColumnIndex);
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Beispiel #17
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;
            }
        }
Beispiel #18
0
        private void txt_LostFocus(object sender, RoutedEventArgs e)
        {
            Control   ctl = (Control)sender;
            ExTextBox txt = null;
            ComboBox  cmb = null;
            int       i   = beforeSelectedIndex;

            switch (ctl.Name)
            {
            case "cmbBreakdown":
                cmb = (ComboBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    // コンボボックスID連携
                    _entityListD[i]._breakdown_id = MeiNameList.GetID(MeiNameList.geNameKbn.BREAKDOWN_ID, ExCast.zCStr(cmb.SelectedValue));
                    // 消費税
                    if (_entityListD[i]._breakdown_id == 5)
                    {
                        _entityListD[i]._tax_division_nm = "非課税";
                        _entityListD[i]._tax_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.TAX_DIVISION_ID, ExCast.zCStr(_entityListD[i]._tax_division_nm));
                    }
                }
                break;

            case "txtGoodsId":
                txt = (ExTextBox)sender;
                if (beforeValue == ExCast.zCStr(txt.Text))
                {
                    return;
                }
                MstData _mstData = new MstData();
                _mstData.GetMData(MstData.geMDataKbn.Commodity, new string[] { ExCast.zCStr(txt.Text), ExCast.zCStr(i) }, this);
                break;

            case "cboUnit":
                cmb = (ComboBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    // コンボボックスID連携
                    _entityListD[i]._unit_id = MeiNameList.GetID(MeiNameList.geNameKbn.UNIT_ID, ExCast.zCStr(cmb.SelectedValue));
                }
                break;

            case "txtEnterNum":
                // 明細入数計算
                txt = (ExTextBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    if (beforeValue == ExCast.zCStr(txt.Text))
                    {
                        return;
                    }
                    _entityListD[i]._enter_number = ExCast.zCDbl(txt.Text);
                    DataDetail.CalcDetailNumber(i, _entityH, _entityListD);
                }
                break;

            case "txtCaseNum":
                // 明細ケース数計算
                txt = (ExTextBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    if (beforeValue == ExCast.zCStr(txt.Text))
                    {
                        return;
                    }
                    _entityListD[i]._case_number = ExCast.zCDbl(txt.Text);
                    DataDetail.CalcDetailNumber(i, _entityH, _entityListD);
                }
                break;

            case "txtNumber":
                // 明細数量計算
                txt = (ExTextBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    if (beforeValue == ExCast.zCStr(txt.Text))
                    {
                        return;
                    }
                    //OrderDetailData.CalcDetailNumber(i, _entityH, _entityListD);
                    _entityListD[i]._number = ExCast.zCDbl(txt.Text);
                    DataDetail.CalcDetail(i, _entityH, _entityListD);
                }
                break;

            case "txtUnitPrice":
                // 明細計算
                txt = (ExTextBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    if (beforeValue == ExCast.zCStr(txt.Text))
                    {
                        return;
                    }
                    _entityListD[i]._unit_price = ExCast.zCDbl(txt.Text);
                    DataDetail.CalcDetail(i, _entityH, _entityListD);
                }
                break;

            case "txtPrice":
                // 明細計算
                txt = (ExTextBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    if (beforeValue == ExCast.zCStr(txt.Text))
                    {
                        return;
                    }
                    _entityListD[i]._price = ExCast.zCDbl(txt.Text);
                    DataDetail.IsCalcPrice = false;
                    DataDetail.CalcDetail(i, _entityH, _entityListD);
                    DataDetail.IsCalcPrice = true;
                }
                break;

            case "cboTaxDivision":
                cmb = (ComboBox)sender;
                if (_entityListD.Count > i && i != -1)
                {
                    // コンボボックスID連携
                    _entityListD[i]._tax_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.TAX_DIVISION_ID, ExCast.zCStr(cmb.SelectedValue));

                    // 課税区分が課税で内訳が消費税の場合
                    if (_entityListD[i]._tax_division_id == 1 && _entityListD[i]._breakdown_id == 5)
                    {
                        ExMessageBox.Show("内訳が消費税の場合、課税区分に課税を選択できません。");
                        _entityListD[i]._tax_division_nm = "非課税";
                        _entityListD[i]._tax_division_id = MeiNameList.GetID(MeiNameList.geNameKbn.TAX_DIVISION_ID, ExCast.zCStr(_entityListD[i]._tax_division_nm));
                    }

                    // 明細計算
                    DataDetail.CalcDetail(i, _entityH, _entityListD);
                }
                break;

            case "txtGoodsNm":
            case "txtDetailMemo":
                break;
            }
        }
        public EntityReportSetting GetReportSetting(string random, string Id)
        {
            EntityReportSetting entity;

            #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 EntityReportSetting();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetReportSetting(認証処理)", ex);
                entity         = new EntityReportSetting();
                entity.MESSAGE = CLASS_NM + ".GetReportSetting : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                return(entity);
            }


            #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

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("      ,SG1.NAME AS GROUP_NAME_FROM " + Environment.NewLine);
                sb.Append("      ,SG2.NAME AS GROUP_NAME_TO " + Environment.NewLine);
                sb.Append("  FROM M_REPORT_SETTING AS MT" + Environment.NewLine);

                #region Join

                // ユーザ
                sb.Append("  LEFT JOIN SYS_M_USER AS UR" + Environment.NewLine);
                sb.Append("    ON UR.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND UR.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND UR.ID = MT.USER_ID" + Environment.NewLine);

                // グループFrom
                sb.Append("  LEFT JOIN SYS_M_COMPANY_GROUP AS SG1" + Environment.NewLine);
                sb.Append("    ON SG1.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND SG1.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND SG1.COMPANY_ID = UR.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND SG1.ID = MT.GROUP_ID_FROM" + Environment.NewLine);

                // グループTo
                sb.Append("  LEFT JOIN SYS_M_COMPANY_GROUP AS SG2" + Environment.NewLine);
                sb.Append("    ON SG2.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND SG2.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND SG2.COMPANY_ID = UR.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND SG2.ID = MT.GROUP_ID_TO" + Environment.NewLine);

                #endregion

                sb.Append(" WHERE MT.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND MT.USER_ID = " + userId + Environment.NewLine);
                sb.Append("   AND MT.PG_ID = " + ExEscape.zRepStr(Id) + Environment.NewLine);

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    entity = new EntityReportSetting();

                    // 排他制御
                    //DataPgLock.geLovkFlg lockFlg;
                    //string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, Id.ToString(), ipAdress, db, out lockFlg);
                    //if (strErr != "")
                    //{
                    //    entity.MESSAGE = CLASS_NM + ".GetReportSetting : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    //}

                    #region Set Entity

                    entity.user_id     = ExCast.zCInt(dt.DefaultView[0]["USER_ID"]);
                    entity.pg_id       = Id;
                    entity.size        = ExCast.zCInt(dt.DefaultView[0]["SIZE"]);
                    entity.orientation = ExCast.zCInt(dt.DefaultView[0]["ORIENTATION"]);

                    entity.left_margin   = ExCast.zCDbl(dt.DefaultView[0]["LEFT_MARGIN"]);
                    entity.right_margin  = ExCast.zCDbl(dt.DefaultView[0]["RIGHT_MARGIN"]);
                    entity.top_margin    = ExCast.zCDbl(dt.DefaultView[0]["TOP_MARGIN"]);
                    entity.bottom_margin = ExCast.zCDbl(dt.DefaultView[0]["BOTTOM_MARGIN"]);

                    if (ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_FROM"]) != 0)
                    {
                        entity.group_id_from = string.Format("{0:000}", ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_FROM"]));
                    }
                    entity.group_nm_from = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME_FROM"]);

                    if (ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_TO"]) != 0)
                    {
                        entity.group_id_to = string.Format("{0:000}", ExCast.zCInt(dt.DefaultView[0]["GROUP_ID_TO"]));
                    }
                    entity.group_nm_to = ExCast.zCStr(dt.DefaultView[0]["GROUP_NAME_TO"]);

                    entity.group_total = ExCast.zCInt(dt.DefaultView[0]["GROUP_TOTAL"]);
                    entity.total_kbn   = ExCast.zCInt(dt.DefaultView[0]["TOTAL_KBN"]);

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

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

            return(entity);
        }
        // 名称マスタリストから個別名称リストへセット
        private void SetIndividualList(object objList)
        {
            objNameList = (ObservableCollection <EntityName>)objList;
            for (int i = 0; i <= objNameList.Count - 1; i++)
            {
                switch ((geNameKbn)objNameList[i].division_id)
                {
                case geNameKbn.TAX_CHANGE_ID:                   // 税転換ID
                    glstTaxChange.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.BUSINESS_DIVISION_ID:            // 取引区分ID
                    glstBusinessDivison.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.BREAKDOWN_ID:                    // 内訳ID
                    glstBreakdown.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.DELIVER_DIVISION_ID:             // 納品区分ID
                    glstDeliverDivision.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.UNIT_ID:                         // 単位ID
                    glstUnit.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.TAX_DIVISION_ID:                 // 課税区分ID
                    glstTaxDivision.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.INVENTORY_DIVISION_ID:           // 在庫管理区分ID
                    glstInventoryDivison.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.UNIT_PRICE_DIVISION_ID:          // 単価区分ID
                    glstUnitPriceDivision.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.DISPLAY_DIVISION_ID:             // 表示区分ID
                    glstDisplayDivision.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.TITLE_ID:                        // 敬称ID
                    glstTitle.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.FRACTION_PROC_ID:                // 端数処理ID
                    glstFractionProc.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.COLLECT_CYCLE_ID:                // 回収サイクルID
                    glstCollectCycle.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.CLASS:                           // 分類区分ID
                    int _id = 0;
                    try
                    {
                        _id = ExCast.zCInt(ExMath.zCeiling(ExCast.zCDbl(ExCast.zCDbl(objNameList[i].id) / 3), 0));
                    }
                    catch
                    {
                    }
                    glstClass.Add(new ListData(_id, objNameList[i].description));
                    break;

                case geNameKbn.DIVIDE_PERMISSION_ID:            // 分納許可ID
                    glstDividePermission.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.INQUIRY_DIVISION_ID:             // 問い合わせ区分ID
                    glstInquiryDivision.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.LEVEL_ID:                // 問い合わせ緊急度ID
                    glstLevel.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.INQUIRY_STATE_ID:                // 問い合わせ状態ID
                    glstInquiryState.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.APPROVAL_STATE_ID:               // 承認状態ID
                    glstApprovalState.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.ACCOUNT_KBN:                     // 預金種別
                    glstAccountKbn.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.OPEN_CLOSE_STATE_ID:             // 状態ID
                    glstOpenCloseState.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.BUSINESS_DIVISION_PU_ID:         // 取引区分ID(仕入)
                    glstBusinessDivisonPu.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.SEND_KBN:                        // 発送区分
                    glstSendkbn.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.TAX_CHANGE_PU_ID:                // 税転換ID(仕入)
                    glstTaxChangePu.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.UNIT_PRICE_DIVISION_PU_ID:       // 単価区分ID(仕入)
                    glstUnitPriceDivisionPu.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.IN_OUT_DELIVERY_KBN:             // 入出庫区分
                    glstInOutDeliveryKbn.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.IN_OUT_DELIVERY_PROC_KBN:        // 入出庫処理区分
                    glstInOutDeliveryProcKbn.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                case geNameKbn.IN_OUT_DELIVERY_TO_KBN:          // 入出庫先区分
                    glstInOutDeliveryToKbn.Add(new ListData(objNameList[i].id, objNameList[i].description));
                    break;

                default:
                    break;
                }
            }
        }
Beispiel #21
0
        public EntityCommodity GetCommodity(string random, string Id)
        {
            EntityCommodity entity;

            #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 EntityCommodity();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetCommodity(認証処理)", ex);
                entity         = new EntityCommodity();
                entity.MESSAGE = CLASS_NM + ".GetCommodity : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                return(entity);
            }


            #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

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("      ,PU.NAME AS MAIN_PURCHASE_NAME " + Environment.NewLine);
                sb.Append("      ,NM1.DESCRIPTION AS UNIT_NAME " + Environment.NewLine);
                sb.Append("      ,NM2.DESCRIPTION AS TAXATION_DIVISION_NAME " + Environment.NewLine);
                sb.Append("      ,NM3.DESCRIPTION AS INVENTORY_MANAGEMENT_DIVISION_NAME " + Environment.NewLine);
                sb.Append("      ,NM4.DESCRIPTION AS INVENTORY_EVALUATION_NAME " + Environment.NewLine);
                sb.Append("      ,CL1.NAME AS GROUP1_NAME " + Environment.NewLine);
                sb.Append("      ,CL2.NAME AS GROUP2_NAME " + Environment.NewLine);
                sb.Append("      ,CL3.NAME AS GROUP3_NAME " + Environment.NewLine);
                sb.Append("      ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine);
                sb.Append("  FROM M_COMMODITY AS MT" + Environment.NewLine);

                #region Join

                // 仕入先
                sb.Append("  LEFT JOIN M_PURCHASE AS PU" + Environment.NewLine);
                sb.Append("    ON PU.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND PU.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND PU.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND PU.ID = MT.MAIN_PURCHASE_ID" + Environment.NewLine);

                // 単位
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine);
                sb.Append("    ON NM1.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.UNIT_ID + Environment.NewLine);
                sb.Append("   AND NM1.ID = MT.UNIT_ID" + Environment.NewLine);

                // 課税区分
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM2" + Environment.NewLine);
                sb.Append("    ON NM2.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM2.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM2.DIVISION_ID = " + (int)CommonUtl.geNameKbn.TAX_DIVISION_ID + Environment.NewLine);
                sb.Append("   AND NM2.ID = MT.TAXATION_DIVISION_ID" + Environment.NewLine);

                // 在庫管理区分
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM3" + Environment.NewLine);
                sb.Append("    ON NM3.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM3.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM3.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INVENTORY_DIVISION_ID + Environment.NewLine);
                sb.Append("   AND NM3.ID = MT.INVENTORY_MANAGEMENT_DIVISION_ID" + Environment.NewLine);

                // 在庫評価
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM4" + Environment.NewLine);
                sb.Append("    ON NM4.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM4.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM4.DIVISION_ID = " + (int)CommonUtl.geNameKbn.INVENTORY_DIVISION_ID + Environment.NewLine);
                sb.Append("   AND NM4.ID = MT.INVENTORY_EVALUATION_ID" + Environment.NewLine);

                // 商品分類1
                sb.Append("  LEFT JOIN M_CLASS AS CL1" + Environment.NewLine);
                sb.Append("    ON CL1.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CL1.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CL1.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND CL1.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop1 + Environment.NewLine);
                sb.Append("   AND CL1.ID = MT.GROUP1_ID" + Environment.NewLine);

                // 商品分類2
                sb.Append("  LEFT JOIN M_CLASS AS CL2" + Environment.NewLine);
                sb.Append("    ON CL2.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CL2.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CL2.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND CL2.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop2 + Environment.NewLine);
                sb.Append("   AND CL2.ID = MT.GROUP2_ID" + Environment.NewLine);

                // 商品分類3
                sb.Append("  LEFT JOIN M_CLASS AS CL3" + Environment.NewLine);
                sb.Append("    ON CL3.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CL3.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CL3.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND CL3.CLASS_DIVISION_ID = " + (int)CommonUtl.geMGroupKbn.CommodityGrouop3 + Environment.NewLine);
                sb.Append("   AND CL3.ID = MT.GROUP3_ID" + Environment.NewLine);

                // 表示区分
                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.SET_COMMODITY_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine);

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

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    entity = new EntityCommodity();

                    // 排他制御
                    DataPgLock.geLovkFlg lockFlg;
                    string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, ExCast.zNumZeroNothingFormat(Id), ipAdress, db, out lockFlg);
                    if (strErr != "")
                    {
                        entity.MESSAGE = CLASS_NM + ".GetCommodity : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    }

                    #region Set Entity

                    entity.id   = ExCast.zCStr(dt.DefaultView[0]["ID"]);
                    entity.name = ExCast.zCStr(dt.DefaultView[0]["NAME"]);
                    entity.kana = ExCast.zCStr(dt.DefaultView[0]["KANA"]);

                    entity.unit_id = ExCast.zCInt(dt.DefaultView[0]["UNIT_ID"]);
                    entity.unit_nm = ExCast.zCStr(dt.DefaultView[0]["UNIT_NAME"]);

                    entity.enter_number         = ExCast.zCDbl(dt.DefaultView[0]["ENTER_NUMBER"]);
                    entity.number_decimal_digit = ExCast.zCInt(dt.DefaultView[0]["NUMBER_DECIMAL_DIGIT"]);
                    entity.unit_decimal_digit   = ExCast.zCInt(dt.DefaultView[0]["UNIT_DECIMAL_DIGIT"]);

                    entity.taxation_divition_id = ExCast.zCInt(dt.DefaultView[0]["TAXATION_DIVISION_ID"]);
                    entity.taxation_divition_nm = ExCast.zCStr(dt.DefaultView[0]["TAXATION_DIVISION_NAME"]);

                    entity.inventory_management_division_id = ExCast.zCInt(dt.DefaultView[0]["INVENTORY_MANAGEMENT_DIVISION_ID"]);
                    entity.inventory_management_division_nm = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_MANAGEMENT_DIVISION_NAME"]);

                    entity.purchase_lot          = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_LOT"]);
                    entity.lead_time             = ExCast.zCInt(dt.DefaultView[0]["LEAD_TIME"]);
                    entity.just_inventory_number = ExCast.zCDbl(dt.DefaultView[0]["JUST_INVENTORY_NUMBER"]);
                    entity.inventory_number      = ExCast.zCDbl(dt.DefaultView[0]["INVENTORY_NUMBER"]);

                    entity.inventory_evaluation_id = ExCast.zCInt(dt.DefaultView[0]["INVENTORY_EVALUATION_ID"]);
                    entity.inventory_evaluation_nm = ExCast.zCStr(dt.DefaultView[0]["INVENTORY_EVALUATION_NAME"]);

                    entity.main_purchase_id = ExCast.zCStr(dt.DefaultView[0]["MAIN_PURCHASE_ID"]);
                    entity.main_purchase_nm = ExCast.zCStr(dt.DefaultView[0]["MAIN_PURCHASE_NAME"]);

                    entity.retail_price_skip_tax          = ExCast.zCDbl(dt.DefaultView[0]["RETAIL_PRICE_SKIP_TAX"]);
                    entity.retail_price_before_tax        = ExCast.zCDbl(dt.DefaultView[0]["RETAIL_PRICE_BEFORE_TAX"]);
                    entity.sales_unit_price_skip_tax      = ExCast.zCDbl(dt.DefaultView[0]["SALES_UNIT_PRICE_SKIP_TAX"]);
                    entity.sales_unit_price_before_tax    = ExCast.zCDbl(dt.DefaultView[0]["SALES_UNIT_PRICE_BEFORE_TAX"]);
                    entity.sales_cost_price_skip_tax      = ExCast.zCDbl(dt.DefaultView[0]["SALES_COST_PRICE_SKIP_TAX"]);
                    entity.sales_cost_price_before_tax    = ExCast.zCDbl(dt.DefaultView[0]["SALES_COST_PRICE_BEFORE_TAX"]);
                    entity.purchase_unit_price_skip_tax   = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_SKIP_TAX"]);
                    entity.purchase_unit_price_before_tax = ExCast.zCDbl(dt.DefaultView[0]["PURCHASE_UNIT_PRICE_BEFORE_TAX"]);

                    entity.group1_id = ExCast.zCStr(dt.DefaultView[0]["GROUP1_ID"]);
                    entity.group1_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP1_NAME"]);

                    entity.group2_id = ExCast.zCStr(dt.DefaultView[0]["GROUP2_ID"]);
                    entity.group2_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP2_NAME"]);

                    entity.group3_id = ExCast.zCStr(dt.DefaultView[0]["GROUP3_ID"]);
                    entity.group3_nm = ExCast.zCStr(dt.DefaultView[0]["GROUP3_NAME"]);

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

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

                    entity.lock_flg = (int)lockFlg;

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

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

            return(entity);
        }
Beispiel #22
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;
            }
        }
Beispiel #23
0
        public static bool IsExistData(ExMySQLData db,
                                       string companyId,
                                       string groupId,
                                       string tblName,
                                       string col1Name,
                                       string col1Value,
                                       string col2Name,
                                       string col2Value,
                                       CommonUtl.geStrOrNumKbn col1Type)
        {
            StringBuilder sb;
            DataTable     dt;

            try
            {
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT TBL.* " + Environment.NewLine);
                sb.Append("  FROM " + tblName + " AS TBL" + Environment.NewLine);

                sb.Append(" WHERE TBL.DELETE_FLG = 0 " + Environment.NewLine);
                if (companyId != "")
                {
                    sb.Append("   AND TBL.COMPANY_ID = " + companyId + Environment.NewLine);
                }
                if (groupId != "")
                {
                    sb.Append("   AND TBL.GROUP_ID = " + groupId + Environment.NewLine);
                }
                if (col1Type == CommonUtl.geStrOrNumKbn.String)
                {
                    sb.Append("   AND TBL." + col1Name + " = " + ExEscape.zRepStr(col1Value) + Environment.NewLine);
                    sb.Append("   AND TBL." + col2Name + " <> " + ExEscape.zRepStr(col2Value) + Environment.NewLine);
                }
                else
                {
                    sb.Append("   AND TBL." + col1Name + " = " + ExCast.zCDbl(col1Value) + Environment.NewLine);
                    sb.Append("   AND TBL." + col2Name + " <> " + ExCast.zCDbl(col2Value) + Environment.NewLine);
                }
                sb.Append(" LIMIT 0, 1" + Environment.NewLine);

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".IsExistData", ex);
                throw;
            }
            finally
            {
            }
        }
Beispiel #24
0
        public static void GetData(ExMySQLData db,
                                   string companyId,
                                   string groupId,
                                   string tblName,
                                   string col1Name,
                                   string col1Value,
                                   CommonUtl.geStrOrNumKbn col1Type,
                                   string get_col1Name,
                                   string get_col2Name,
                                   string get_col3Name,
                                   string get_col4Name,
                                   string get_col5Name,
                                   string get_another_col1Name,
                                   string get_another_col2Name,
                                   string get_another_col3Name,
                                   string get_another_col4Name,
                                   string get_another_col5Name,
                                   ref string get_col1Value,
                                   ref string get_col2Value,
                                   ref string get_col3Value,
                                   ref string get_col4Value,
                                   ref string get_col5Value)
        {
            StringBuilder sb;
            DataTable     dt;

            try
            {
                sb = new StringBuilder();

                #region SQL

                sb.Append("SELECT " + get_col1Name + Environment.NewLine);
                if (!string.IsNullOrEmpty(get_col2Name))
                {
                    sb.Append("      ," + get_col2Name + Environment.NewLine);
                }
                if (!string.IsNullOrEmpty(get_col3Name))
                {
                    sb.Append("      ," + get_col3Name + Environment.NewLine);
                }
                if (!string.IsNullOrEmpty(get_col4Name))
                {
                    sb.Append("      ," + get_col4Name + Environment.NewLine);
                }
                if (!string.IsNullOrEmpty(get_col5Name))
                {
                    sb.Append("      ," + get_col5Name + Environment.NewLine);
                }
                sb.Append("  FROM " + tblName + " AS TBL" + Environment.NewLine);

                sb.Append(" WHERE TBL.DELETE_FLG = 0 " + Environment.NewLine);
                if (companyId != "")
                {
                    sb.Append("   AND TBL.COMPANY_ID = " + companyId + Environment.NewLine);
                }
                if (groupId != "")
                {
                    sb.Append("   AND TBL.GROUP_ID = " + groupId + Environment.NewLine);
                }
                if (col1Type == CommonUtl.geStrOrNumKbn.String)
                {
                    sb.Append("   AND TBL." + col1Name + " = " + ExEscape.zRepStr(col1Value) + Environment.NewLine);
                }
                else
                {
                    sb.Append("   AND TBL." + col1Name + " = " + ExCast.zCDbl(col1Value) + Environment.NewLine);
                }
                sb.Append(" LIMIT 0, 1" + Environment.NewLine);

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    get_col1Value = ExCast.zCStr(dt.DefaultView[0][get_another_col1Name]);
                    if (!string.IsNullOrEmpty(get_col2Name))
                    {
                        get_col2Value = ExCast.zCStr(dt.DefaultView[0][get_another_col2Name]);
                    }
                    if (!string.IsNullOrEmpty(get_col3Name))
                    {
                        get_col3Value = ExCast.zCStr(dt.DefaultView[0][get_another_col3Name]);
                    }
                    if (!string.IsNullOrEmpty(get_col4Name))
                    {
                        get_col4Value = ExCast.zCStr(dt.DefaultView[0][get_another_col4Name]);
                    }
                    if (!string.IsNullOrEmpty(get_col5Name))
                    {
                        get_col5Value = ExCast.zCStr(dt.DefaultView[0][get_another_col5Name]);
                    }
                }
                else
                {
                    get_col1Value = "";
                    get_col2Value = "";
                    get_col3Value = "";
                    get_col4Value = "";
                    get_col5Value = "";
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetData", ex);
                throw;
            }
            finally
            {
            }
        }
        public EntitySupplier GetSupplier(string random, string CustomerId, string Id)
        {
            EntitySupplier entity;

            #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 EntitySupplier();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSupplier(認証処理)", ex);
                entity         = new EntitySupplier();
                entity.MESSAGE = CLASS_NM + ".GetSupplier : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                return(entity);
            }


            #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

                sb.Append("SELECT MT.* " + Environment.NewLine);
                sb.Append("      ,CM.NAME AS CUSTOMER_NAME " + Environment.NewLine);
                sb.Append("      ,NM1.DESCRIPTION AS DIVIDE_PERMISSION_NAME " + Environment.NewLine);
                sb.Append("      ,NM.DESCRIPTION AS DISPLAY_DIVISION_NAME " + Environment.NewLine);
                sb.Append("  FROM M_SUPPLIER AS MT" + Environment.NewLine);

                #region Join

                // 得意先
                sb.Append("  LEFT JOIN M_CUSTOMER AS CM" + Environment.NewLine);
                sb.Append("    ON CM.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND CM.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND CM.COMPANY_ID = MT.COMPANY_ID" + Environment.NewLine);
                sb.Append("   AND CM.ID = MT.CUSTOMER_ID" + Environment.NewLine);

                // 分納許可
                sb.Append("  LEFT JOIN SYS_M_NAME AS NM1" + Environment.NewLine);
                sb.Append("    ON NM1.DELETE_FLG = 0 " + Environment.NewLine);
                sb.Append("   AND NM1.DISPLAY_FLG = 1 " + Environment.NewLine);
                sb.Append("   AND NM1.DIVISION_ID = " + (int)CommonUtl.geNameKbn.DIVIDE_PERMISSION_ID + Environment.NewLine);
                sb.Append("   AND NM1.ID = MT.DIVIDE_PERMISSION_ID" + Environment.NewLine);

                // 表示区分
                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.CUSTOMER_ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(CustomerId)) + Environment.NewLine);
                sb.Append("   AND MT.ID = " + ExEscape.zRepStr(ExCast.zNumZeroNothingFormat(Id)) + Environment.NewLine);

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

                #endregion

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

                if (dt.DefaultView.Count > 0)
                {
                    entity = new EntitySupplier();

                    // 排他制御
                    DataPgLock.geLovkFlg lockFlg;
                    string strErr = DataPgLock.SetLockPg(companyId, userId, PG_NM, ExCast.zNumZeroNothingFormat(CustomerId) + "-" + ExCast.zNumZeroNothingFormat(Id), ipAdress, db, out lockFlg);
                    if (strErr != "")
                    {
                        entity.MESSAGE = CLASS_NM + ".GetSupplier : 排他制御(ロック情報取得)に失敗しました。" + Environment.NewLine + strErr;
                    }

                    #region Set Entity

                    entity.id         = ExCast.zCStr(dt.DefaultView[0]["ID"]);
                    entity.name       = ExCast.zCStr(dt.DefaultView[0]["NAME"]);
                    entity.kana       = ExCast.zCStr(dt.DefaultView[0]["KANA"]);
                    entity.about_name = ExCast.zCStr(dt.DefaultView[0]["ABOUT_NAME"]);

                    string _zip = ExCast.zCStr(dt.DefaultView[0]["ZIP_CODE"]);
                    if (!string.IsNullOrEmpty(_zip) && ExCast.zCStr(_zip) != "0")
                    {
                        _zip = string.Format("{0:0000000}", ExCast.zCDbl(_zip));
                        entity.zip_code_from = _zip.Substring(0, 3);
                        entity.zip_code_to   = _zip.Substring(3, 4);
                    }
                    else
                    {
                        entity.zip_code_from = "";
                        entity.zip_code_to   = "";
                    }

                    entity.prefecture_id = ExCast.zCInt(dt.DefaultView[0]["PREFECTURE_ID"]);
                    entity.city_id       = ExCast.zCInt(dt.DefaultView[0]["CITY_ID"]);
                    entity.town_id       = ExCast.zCInt(dt.DefaultView[0]["TOWN_ID"]);
                    entity.adress_city   = ExCast.zCStr(dt.DefaultView[0]["ADRESS_CITY"]);
                    entity.adress_town   = ExCast.zCStr(dt.DefaultView[0]["ADRESS_TOWN"]);
                    entity.adress1       = ExCast.zCStr(dt.DefaultView[0]["ADRESS1"]);
                    entity.adress2       = ExCast.zCStr(dt.DefaultView[0]["ADRESS2"]);
                    entity.station_name  = ExCast.zCStr(dt.DefaultView[0]["STATION_NAME"]);
                    entity.post_name     = ExCast.zCStr(dt.DefaultView[0]["POST_NAME"]);
                    entity.person_name   = ExCast.zCStr(dt.DefaultView[0]["PERSON_NAME"]);
                    entity.title_id      = ExCast.zCInt(dt.DefaultView[0]["TITLE_ID"]);
                    entity.title_name    = ExCast.zCStr(dt.DefaultView[0]["TITLE_NAME"]);
                    entity.tel           = ExCast.zCStr(dt.DefaultView[0]["TEL"]);
                    entity.fax           = ExCast.zCStr(dt.DefaultView[0]["FAX"]);
                    entity.mail_adress   = ExCast.zCStr(dt.DefaultView[0]["MAIL_ADRESS"]);
                    entity.mobile_tel    = ExCast.zCStr(dt.DefaultView[0]["MOBILE_TEL"]);
                    entity.mobile_adress = ExCast.zCStr(dt.DefaultView[0]["MOBILE_ADRESS"]);
                    entity.url           = ExCast.zCStr(dt.DefaultView[0]["URL"]);

                    entity.customer_id = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_ID"]);
                    entity.customer_nm = ExCast.zCStr(dt.DefaultView[0]["CUSTOMER_NAME"]);

                    entity.divide_permission_id = ExCast.zCInt(dt.DefaultView[0]["DISPLAY_FLG"]);
                    entity.divide_permission_nm = ExCast.zCStr(dt.DefaultView[0]["DISPLAY_DIVISION_NAME"]);

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

                    entity.lock_flg = (int)lockFlg;
                    entity.memo     = ExCast.zCStr(dt.DefaultView[0]["MEMO"]);

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

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

            return(entity);
        }
Beispiel #26
0
        public List <EntitySalesCreditBalance> GetSalesCreditBalanaceList(string random, string strWhereSql, string strOrderBySql)
        {
            List <EntitySalesCreditBalance> entityList = new List <EntitySalesCreditBalance>();

            #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 != "")
                {
                    EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                    entity.MESSAGE = _message;
                    entityList.Add(entity);
                    return(entityList);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList(認証処理)", ex);
                EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                entity.MESSAGE = "認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();;
                entityList.Add(entity);
                return(entityList);
            }
            #endregion

            StringBuilder sb;
            DataTable     dt;
            ExMySQLData   db;
            long          rec_no = 0;

            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.GetSalesCreditBalanaceListReportSQL(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

                        rec_no += 1;

                        EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                        entity.rec_no     = rec_no;
                        entity.ym         = ExCast.zCStr(dt.DefaultView[i]["YM"]);
                        entity.invoice_id = ExCast.zCStr(dt.DefaultView[i]["INVOICE_ID"]);
                        entity.invoice_nm = ExCast.zCStr(dt.DefaultView[i]["INVOICE_NAME"]);
                        entity.before_sales_credit_balacne     = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]);
                        entity.before_sales_credit_balacne_upd = ExCast.zCDbl(dt.DefaultView[i]["BEFORE_SALES_CREDIT_BALANCE"]);
                        entity.this_receipt_price      = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PRICE"]);
                        entity.this_receipt_percent    = ExCast.zCDbl(dt.DefaultView[i]["THIS_RECEIPT_PERCENT"]);
                        entity.this_sales_credit_price = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_PRICE"]);
                        entity.this_tax = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_TAX"]);
                        entity.this_sales_credit_balance = ExCast.zCDbl(dt.DefaultView[i]["THIS_SALES_CREDIT_BALANCE"]);

                        entity.exec_flg = false;

                        entity.lock_flg = 0;

                        entityList.Add(entity);

                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".GetSalesCreditBalanaceList", ex);
                entityList.Clear();
                EntitySalesCreditBalance entity = new EntitySalesCreditBalance();
                entity.MESSAGE = CLASS_NM + ".GetSalesCreditBalanaceList : 予期せぬエラーが発生しました。" + 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.Order.OrderList,
                                       DataPgEvidence.geOperationType.Select,
                                       "Where:" + strWhereSql + ",Orderby:" + strOrderBySql);

            return(entityList);
        }
Beispiel #27
0
        public string UpdateClass(string random, List <EntityClass> entity, int classKbn)
        {
            #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 + ".UpdateClass(認証処理)", ex);
                return(CLASS_NM + ".UpdateClass : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString());
            }

            #endregion

            #region Field

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

            #endregion

            #region データ存在チェック

            sb = new StringBuilder();

            #region SQL

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

            sb.Length = 0;
            sb.Append("SELECT MT.* " + Environment.NewLine);
            sb.Append("  FROM M_CLASS AS MT" + Environment.NewLine);
            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

            db = ExSession.GetSessionDb(ExCast.zCInt(HttpContext.Current.Session[ExSession.USER_ID]),
                                        ExCast.zCStr(HttpContext.Current.Session[ExSession.SESSION_RANDOM_STR]));
            dt = db.GetDataTable(sb.ToString());

            string ret_msg = "";
            if (dt.DefaultView.Count > 0)
            {
                for (int i = 0; i <= dt.DefaultView.Count - 1; i++)
                {
                    long lngClassId = ExCast.zCLng(dt.DefaultView[i]["ID"]);
                    bool exists_flg = false;
                    for (int i_ = 0; i_ <= entity.Count - 1; i_++)
                    {
                        if (ExCast.zCLng(entity[i_].id) == lngClassId)
                        {
                            exists_flg = true;
                        }
                    }

                    string strClassId = string.Format("{0:000}", ExCast.zCDbl(lngClassId));

                    if (exists_flg == false)
                    {
                        bool _ret = false;

                        switch (classKbn)
                        {
                        case 1:         // 得意先分類
                            _ret = DataExists.IsExistData(db, companyId, "", "M_CUSTOMER", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String);
                            if (_ret == true)
                            {
                                ret_msg += "得意先分類ID : " + strClassId + " は得意先マスタで使用されている為、削除できません。" + Environment.NewLine;
                            }
                            break;

                        case 2:         // 商品分類
                            _ret = DataExists.IsExistData(db, companyId, "", "M_COMMODITY", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String);
                            if (_ret == true)
                            {
                                ret_msg += "商品分類ID : " + strClassId + " は商品マスタで使用されている為、削除できません。" + Environment.NewLine;
                            }
                            break;

                        case 3:         // 仕入先分類
                            _ret = DataExists.IsExistData(db, companyId, "", "M_PURCHASE", "GROUP1_ID", strClassId, CommonUtl.geStrOrNumKbn.String);
                            if (_ret == true)
                            {
                                ret_msg += "仕入先分類ID : " + strClassId + " は仕入先マスタで使用されている為、削除できません。" + Environment.NewLine;
                            }
                            break;
                        }
                    }
                }

                if (!string.IsNullOrEmpty(ret_msg))
                {
                    return(ret_msg);
                }
            }


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

            #endregion

            #region BeginTransaction

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

            #endregion

            #region Delete

            try
            {
                #region Delete SQL

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

                sb.Length = 0;
                sb.Append("DELETE FROM M_CLASS " + Environment.NewLine);
                sb.Append(" WHERE COMPANY_ID = " + companyId + Environment.NewLine);
                sb.Append("   AND CLASS_DIVISION_ID = " + _classKbn.ToString() + Environment.NewLine);

                #endregion

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

            #endregion

            #region Insert

            try
            {
                for (int i = 0; i <= entity.Count - 1; i++)
                {
                    // 空行は無視する
                    if (!string.IsNullOrEmpty(entity[i].id))
                    {
                        #region Insert SQL

                        sb.Length = 0;
                        sb.Append("INSERT INTO M_CLASS " + Environment.NewLine);
                        sb.Append("       ( COMPANY_ID" + Environment.NewLine);
                        sb.Append("       , CLASS_DIVISION_ID" + Environment.NewLine);
                        sb.Append("       , ID" + Environment.NewLine);
                        sb.Append("       , NAME" + 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("       ," + _classKbn.ToString() + Environment.NewLine);                                             // Class_DIVISION_ID
                        sb.Append("       ," + ExEscape.zRepStr(ExCast.zNumZeroFormat("{0:000}", entity[i].id)) + Environment.NewLine); // ID
                        sb.Append("       ," + ExEscape.zRepStr(entity[i].name) + Environment.NewLine);                                 // NAME
                        sb.Append("       ," + ExEscape.zRepStr(entity[i].memo) + Environment.NewLine);                                 // MEMO
                        sb.Append("       ," + entity[i].display_division_id + Environment.NewLine);                                    // DISPLAY_FLG
                        sb.Append(CommonUtl.GetInsSQLCommonColums(CommonUtl.UpdKbn.Ins,
                                                                  PG_NM,
                                                                  "M_Class",
                                                                  ExCast.zCInt(personId),
                                                                  _Id,
                                                                  ipAdress,
                                                                  userId));

                        #endregion

                        db.ExecuteSQL(sb.ToString(), false);
                    }
                }
            }
            catch (Exception ex)
            {
                db.ExRollbackTransaction();
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(Insert)", ex);
                return(CLASS_NM + ".UpdateClass(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 + ".UpdateClass(DelLockPg)", ex);
                return(CLASS_NM + ".UpdateClass(DelLockPg) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            #region CommitTransaction

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

            #endregion

            #region Database Close

            try
            {
                db.DbClose();
            }
            catch (Exception ex)
            {
                db.ExRollbackTransaction();
                CommonUtl.ExLogger.Error(CLASS_NM + ".UpdateClass(DbClose)", ex);
                return(CLASS_NM + ".UpdateClass(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 + ".UpdateClass(Add Evidence)", ex);
                return(CLASS_NM + ".UpdateClass(Add Evidence) : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message);
            }

            #endregion

            return("");
        }
Beispiel #28
0
        protected override void OnLostFocus(RoutedEventArgs e)
        {
            try
            {
                if (this.BeforeValue == this.Text)
                {
                    this.UpdataFlg = false;
                }
                else
                {
                    this.UpdataFlg = true;
                }

                // 初期化
                intBeforeHour        = 0;
                intBeforeMinute      = 0;
                intBeforeSecond      = 0;
                intBeforeMilliSecond = 0;

                // 値セット
                switch (InputMode)
                {
                case geInputMode.Number:
                    this.Value = ExCast.zCDbl(this.Text).ToString();
                    break;

                case geInputMode.Alphanumeric:
                    this.Value = this.Text;
                    break;

                case geInputMode.Date:
                    if (this.Text == "")
                    {
                        break;
                    }
                    if (this.Text.Length != 8)
                    {
                        this.Text = ""; break;
                    }
                    this.Value = this.Text;
                    break;

                case geInputMode.FullShapeNative:
                    this.Value = this.Text;
                    break;
                }

                if (this.NullToZero == true)
                {
                    if (string.IsNullOrEmpty(this.Text))
                    {
                        this.Text = "0";
                    }
                }

                // フォーマット
                OnFormatString();
            }
            catch (Exception ex)
            {
            }
            this._IsDoubleFocusFlg = false;
            base.OnLostFocus(e);
        }
        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 EntityReport ReportOut(string random, string rptKbn, string pgId, string parameters)
        {
            EntityReport        entity;
            EntityReportSetting entitySetting;

            #region 認証処理

            string companyId           = "";
            string groupId             = "";
            string userId              = "";
            string ipAdress            = "";
            string sessionString       = "";
            int    reportSizeUser      = 0;
            int    idFigureCommodity   = 0;
            int    idFigureCustomer    = 0;
            int    idFigurePurchase    = 0;
            int    idFigureSlipNo      = 0;
            int    rpTotalAuthorityKbn = 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]);
                reportSizeUser      = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_SAVE_SIZE_USER]);
                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]);
                rpTotalAuthorityKbn = ExCast.zCInt(HttpContext.Current.Session[ExSession.REPORT_TOTAL_AUTHORITY_KBN]);

                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 EntityReport();
                    entity.MESSAGE = _message;
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut(認証処理)", ex);
                entity         = new EntityReport();
                entity.MESSAGE = CLASS_NM + ".ReportOut : 認証処理に失敗しました。" + Environment.NewLine + ex.Message.ToString();
                return(entity);
            }

            #endregion

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

            try
            {
                #region Get Report Setting

                entitySetting = GetReportSetting(random, pgId);

                if (entitySetting == null)
                {
                    entitySetting               = new EntityReportSetting();
                    entitySetting.user_id       = ExCast.zCInt(userId);
                    entitySetting.pg_id         = pgId;
                    entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                    entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                }
                else if (entitySetting != null)
                {
                    if (!string.IsNullOrEmpty(entitySetting.MESSAGE))
                    {
                        entitySetting               = new EntityReportSetting();
                        entitySetting.user_id       = ExCast.zCInt(userId);
                        entitySetting.pg_id         = pgId;
                        entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                        entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                    }
                    else
                    {
                        if (ExCast.zCInt(entitySetting.group_id_from) == 0 && ExCast.zCInt(entitySetting.group_id_to) == 0)
                        {
                            entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                            entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                        }
                    }
                }

                if (rpTotalAuthorityKbn < 2)
                {
                    entitySetting.group_id_from = ExCast.zCInt(groupId).ToString();
                    entitySetting.group_id_to   = ExCast.zCInt(groupId).ToString();
                }

                #endregion

                entity = new EntityReport();

                DataReport.geReportKbn kbn    = (DataReport.geReportKbn)ExCast.zCInt(rptKbn);
                ExReportManeger        rptMgr = new ExReportManeger();
                rptMgr.idFigureCommodity = idFigureCommodity;
                rptMgr.idFigureCustomer  = idFigureCustomer;
                rptMgr.idFigurePurchase  = idFigurePurchase;
                rptMgr.idFigureSlipNo    = idFigureSlipNo;
                rptMgr.entitySetting     = entitySetting;
                rptMgr.rptKbn            = kbn;

                #region Report FilePath Setting

                bool _ret = rptMgr.GetReportFilePath(pgId, companyId, userId);
                if (_ret == false)
                {
                    entity.MESSAGE = CommonUtl.gstrErrMsg;
                    return(entity);
                }
                entity.downLoadFilePath = rptMgr.reportFilePath;
                entity.downLoadFileName = rptMgr.reportFileName;
                entity.downLoadFileSize = rptMgr.reportFileSize.ToString();
                entity.downLoadUrl      = CommonUtl.gstrMainUrl + rptMgr.reportDir;

                #endregion

                DataSet ds = db.GetDataSet(rptMgr.ReportSQL(pgId, companyId, groupId, parameters), rptMgr.GetPGIDXsd(pgId));

                #region Export xsd

                System.IO.StreamWriter xmlSW = null;
                try
                {
                    xmlSW = new System.IO.StreamWriter(CommonUtl.gstrReportTemp + rptMgr.GetPGIDXsd(pgId) + ".xsd");
                    ds.WriteXmlSchema(xmlSW);
                    xmlSW.Close();
                }
                catch (Exception ex)
                {
                    CommonUtl.ExLogger.Error(CLASS_NM + ".WriteXmlSchema", ex);
                }
                finally
                {
                    if (xmlSW != null)
                    {
                        xmlSW.Dispose();
                        xmlSW = null;
                    }
                }

                #endregion

                if (ds.Tables[0].Rows.Count == 0)
                {
                    entity.MESSAGE = "データが存在しません。";
                    entity.ret     = false;
                    return(entity);
                }

                string _fileType     = "";
                string _DownloadType = "";
                switch (kbn)
                {
                case DataReport.geReportKbn.OutPut:
                    _fileType     = "PDF";
                    _DownloadType = "出力";

                    if (rptMgr.ReportToPdf(ds, pgId) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                case DataReport.geReportKbn.Download:
                    _fileType     = "PDF";
                    _DownloadType = "ダウンロード";

                    if (rptMgr.ReportToPdf(ds, pgId) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                case DataReport.geReportKbn.Csv:
                    _fileType     = "CSV";
                    _DownloadType = "ダウンロード";

                    if (rptMgr.DataTableToCsv(ds.Tables[0]) == true)
                    {
                        entity.ret = true;
                    }
                    else
                    {
                        entity.MESSAGE = CommonUtl.gstrErrMsg;
                        entity.ret     = false;
                    }
                    break;

                default:
                    break;
                }

                //entity.downLoadFilePath = @"d:\HostingSpaces\Users\EW20121725\Sales.system-innovation.net\wwwroot\temp\顧客マスタ一覧.csv";
                //System.IO.FileInfo fi = new System.IO.FileInfo(entity.downLoadFilePath);
                //entity.downLoadFileSize = fi.Length.ToString();
                if (reportSizeUser < ExCast.zCDbl(entity.downLoadFileSize) / 1000000)
                {
                    entity.MESSAGE = _fileType + "ファイルのサイズが" + reportSizeUser.ToString() + "Mバイトを超える為、" + _DownloadType + "できません。";
                    return(entity);
                }
            }
            catch (Exception ex)
            {
                CommonUtl.ExLogger.Error(CLASS_NM + ".ReportOut", ex);
                entity         = new EntityReport();
                entity.MESSAGE = CLASS_NM + ".ReportOut : 予期せぬエラーが発生しました。" + Environment.NewLine + ex.Message.ToString();
                return(entity);
            }

            return(entity);
        }