示例#1
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            try
            {
                ResultStatus myCheckResult = CheckShield();
                if (myCheckResult != ResultStatus.Success)
                {
                    return(myCheckResult);
                }
                if (myCheckResult == ResultStatus.Success)
                {
                    base.Save(gcMain);

                    DataTable dt = (DataTable)gcMain.DataSource;
                    dtForAdd = dt.GetChanges(DataRowState.Added);
                    DataTable dtForModified = dt.GetChanges(DataRowState.Modified);
                    DataTable dtForDeleted  = dt.GetChanges(DataRowState.Deleted);


                    ResultData myResultData = daoUPF.Update(dt);

                    DataTable dtTemp = new DataTable();
                    //若刪除user ,一併刪除相關權限
                    if (dtForDeleted != null)
                    {
                        dtTemp = dtForDeleted.Clone();

                        int rowIndex = 0;
                        foreach (DataRow dr in dtForDeleted.Rows)
                        {
                            DataRow drNewDelete = dtTemp.NewRow();
                            for (int colIndex = 0; colIndex < dtForDeleted.Columns.Count; colIndex++)
                            {
                                drNewDelete[colIndex] = dr[colIndex, DataRowVersion.Original];
                            }
                            dtTemp.Rows.Add(drNewDelete);
                            rowIndex++;
                        }

                        foreach (DataRow row in dtTemp.Rows)
                        {
                            string userId = row["UPF_USER_ID"].AsString();
                            bool   result = daoUTP.DeleteUTPByUserId(userId);
                        }
                    }

                    //列印
                    PrintOrExport(gcMain, dtForAdd, dtTemp, dtForModified);

                    _IsPreventFlowPrint  = true;
                    _IsPreventFlowExport = true;
                }
            }
            catch (Exception ex)
            {
                MessageDisplay.Error(ex.Message);
                throw;
            }
            return(ResultStatus.Success);
        }
示例#2
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            base.Save(gcMain);
            _IsPreventFlowPrint  = true;
            _IsPreventFlowExport = true;

            string fileName = "使用者權限查詢_{0}.txt";

            fileName = string.Format(fileName, DateTime.Now.ToString("yyyyMMdd"));

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "txt files (*.txt)|*.txt";
            saveFileDialog.FileName         = fileName;
            saveFileDialog.InitialDirectory = GlobalInfo.DEFAULT_REPORT_DIRECTORY_PATH;

            Stream stream;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                if ((stream = saveFileDialog.OpenFile()) != null)
                {
                    DataTable     dtMain        = (DataTable)gcMain.DataSource;
                    ExportOptions exportOptions = new ExportOptions();
                    exportOptions.HasHeader = true;
                    ExportHelper.ToText(dtMain, stream, exportOptions);
                    MessageDisplay.Info("存檔完成!");
                }
            }

            return(ResultStatus.Success);
        }
示例#3
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            try {
                base.Save(gcMain);

                DataTable dt       = (DataTable)gcMain.DataSource;
                DataTable dtChange = dt.GetChanges();

                if (dtChange == null)
                {
                    MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(ResultStatus.Fail);
                }
                if (dtChange.Rows.Count == 0)
                {
                    MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(ResultStatus.Fail);
                }
                //更新主要Table
                else
                {
                    ResultData myResultData = daoAA1.updateAA1(dt);
                }
                //不要自動列印
                _IsPreventFlowPrint = true;
            }
            catch (Exception ex) {
                MessageDisplay.Error("儲存錯誤");
                throw ex;
            }
            return(ResultStatus.Success);
        }
示例#4
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            base.Save(gcMain);

            DataTable dt = (DataTable)gcMain.DataSource;

            //CI.AM22F在DB沒有PKey,依PB datawindow 設的Key去存檔
            //更新主要Table
            string tableName        = "CI.AM22F";
            string keysColumnList   = "AM2F_KIND_ID, AM2F_YMD, AM2F_MARKET_CODE";
            string insertColumnList = "AM2F_KIND_ID, AM2F_PC_CODE, AM2F_ACC_CODE, AM2F_SETTLE_MONTH1, AM2F_SETTLE_MONTH2, AM2F_SETTLE_MONTH3, " +
                                      "AM2F_SETTLE_MONTH4, AM2F_SETTLE_MONTH5, AM2F_SETTLE_MONTH6, AM2F_SETTLE_MONTH7, AM2F_SETTLE_MONTH8, " +
                                      "AM2F_SETTLE_MONTH9, AM2F_SETTLE_MONTH10, AM2F_SETTLE_MONTH11, AM2F_SETTLE_MONTH12, AM2F_SETTLE_MONTH13, " +
                                      "AM2F_BPOS1, AM2F_SPOS1, AM2F_L_BPOS1, AM2F_L_SPOS1, AM2F_BPOS2, AM2F_SPOS2, AM2F_L_BPOS2, AM2F_L_SPOS2, " +
                                      "AM2F_BPOS3, AM2F_SPOS3, AM2F_L_BPOS3, AM2F_L_SPOS3, AM2F_BPOS4, AM2F_SPOS4, AM2F_L_BPOS4, AM2F_L_SPOS4, " +
                                      "AM2F_BPOS5, AM2F_SPOS5, AM2F_L_BPOS5, AM2F_L_SPOS5, AM2F_BPOS6, AM2F_SPOS6, AM2F_L_BPOS6, AM2F_L_SPOS6, " +
                                      "AM2F_BPOS7, AM2F_SPOS7, AM2F_L_BPOS7, AM2F_L_SPOS7, AM2F_BPOS8, AM2F_SPOS8, AM2F_L_BPOS8, AM2F_L_SPOS8, " +
                                      "AM2F_BPOS9, AM2F_SPOS9, AM2F_L_BPOS9, AM2F_L_SPOS9, AM2F_BPOS10, AM2F_SPOS10, AM2F_L_BPOS10, AM2F_L_SPOS10, " +
                                      "AM2F_BPOS11, AM2F_SPOS11, AM2F_L_BPOS11, AM2F_L_SPOS11, AM2F_BPOS12, AM2F_SPOS12, AM2F_L_BPOS12, AM2F_L_SPOS12, " +
                                      "AM2F_BPOS13, AM2F_SPOS13, AM2F_L_BPOS13, AM2F_L_SPOS13, AM2F_YMD, AM2F_MARKET_CODE ";
            string updateColumnList = insertColumnList;

            try {
                //update to DB
                ServiceCommon serviceCommon = new ServiceCommon();
                ResultData    ResultData    = serviceCommon.SaveForChanged(dt, tableName, insertColumnList, updateColumnList, keysColumnList, pokeBall);

                return(ResultStatus.Success);
            } catch (Exception ex) {
                MessageBox.Show(ex.Message);
                MessageBox.Show("資料庫寫入AM22F錯誤!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(ResultStatus.Fail);
            }
        }
示例#5
0
        protected virtual ResultStatus RunAfterEveryItem(PokeBall args)
        {
            if (args.TXF_TID == "wf_CI_CIOPF")
            {
                DataTable dtTxemail = servicePrefix1.ListTxemail(_ProgramID, 1);

                if (dtTxemail.Rows.Count != 0)
                {
                    string TXEMAIL_SENDER     = dtTxemail.Rows[0]["TXEMAIL_SENDER"].AsString();
                    string TXEMAIL_RECIPIENTS = dtTxemail.Rows[0]["TXEMAIL_RECIPIENTS"].AsString();
                    string TXEMAIL_CC         = dtTxemail.Rows[0]["TXEMAIL_CC"].AsString();
                    string TXEMAIL_TITLE      = dtTxemail.Rows[0]["TXEMAIL_TITLE"].AsString();
                    string TXEMAIL_TEXT       = dtTxemail.Rows[0]["TXEMAIL_TEXT"].AsString();

                    string attachmentFilePath = Path.Combine(GlobalInfo.DEFAULT_REPORT_DIRECTORY_PATH, _ProgramID + ".csv");

                    this.Invoke(new MethodInvoker(() => {
                        // 先把結果產生出csv檔,再用成附件寄出去
                        Retrieve();

                        gvSpLog.OptionsPrint.ShowPrintExportProgress = false;
                        gvSpLog.ExportToCsv(attachmentFilePath);
                    }));
                    MailHelper.SendEmail(TXEMAIL_SENDER, TXEMAIL_RECIPIENTS, TXEMAIL_CC, TXEMAIL_TITLE, TXEMAIL_TEXT, attachmentFilePath);
                }
            }
            return(ResultStatus.Success);
        }
示例#6
0
        private bool isBaby = false; // private members are camelCase. Also, explicit visibility declaration is mandatory.

//^ Add a newline after a declaration. This applies to Properties, Variables, or generally everything present in the class scope.
        // Long method signatures get wrapped. Align with spaces.
        // Constructors can get wrapped too.
        /// <summary>
        /// Initializes a new instance of the <see cref="RealaxoIsAHeavvyPokemon"/> class.
        /// </summary>
        /// <param name="really">Bool that represents if relaxo really is a heavvy pokemon</param>
        /// <param name="isAlreadyWokenWithPokeFlute">Bool that represents if relaxo is already woken with pokeflute</param>
        /// <param name="caughtWith">informations about how relaxo was caught</param>
        /// <param name="favoritePokeBall">This relaxos favorite pokeball</param>
        public RelaxoIsAHeavvyPokemon(bool really, bool isAlreadyWokenWithPokeFlute, CaughtInfo caughtWith,
                                      PokeBall favoritePokeBall)
        {
            if (!isAlreadyWokenWithPokeFlute)
            {
                favoritePokeBall.MakeDescision();
            }
            else // Else deserves it's own line too
            {
                if (CaughtInfo.Pokeball == favoritePokeBall)
                {
                    // Notice the spaces:
                    //                 |  |
                    //                 v  v
                    Pokedex.Awesomeness += 1337;
                }
            }

            this.Weight = new RelaxoWeight() // Use this.<something> when reffering to class members
            {                                // Use the {} initialization wherever possible. Also, {} deserve their own lines.
                Weight            = 9001,
                OverweightLevel   = OverweightLevel.Obese,
                OverweightBadness = 42
            }; // don't forget the semicolon.
        }
示例#7
0
        protected override ResultStatus RunBefore(PokeBall args)
        {
            args.GridControlMain = gcMain;
            args.OcfDate         = Convert.ToDateTime(txtOcfDate.Text);

            return(base.RunBefore(args));
        }
示例#8
0
        protected override string RunBeforeEveryItem(PokeBall args)
        {
            string rtn = "";

            switch (args.TXF_TID)
            {
            case "sp_O_gen_T_TPROD_FUT":
                DataTable dtLogSP = servicePrefix1.ListLogsp(txtOcfDate.DateTimeValue, "sp_F_gen_MTF0", "D");
                if (dtLogSP.Rows.Count > 0)
                {
                    if (dtLogSP.Rows[0]["LOGSP_END_TIME"] == null)
                    {
                        rtn = $"{args.TXF_TID} 需待「10012 - sp_F_gen_MTF0」完成才可執行!";
                    }
                }
                break;

            case "wf_CI_1002205":
                //全部
                wf_70010("%");

                //日盤
                wf_70010("0");
                break;
            }
            base.RunBeforeEveryItem(args);

            return(rtn);
        }
示例#9
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            try
            {
                ResultStatus myCheckResult = CheckShield();
                if (myCheckResult != ResultStatus.Success)
                {
                    return(myCheckResult);
                }
                if (myCheckResult == ResultStatus.Success)
                {
                    base.Save(gcMain);
                    DataTable dt = (DataTable)gcMain.DataSource;

                    ResultData result = new RPTF().UpdateData(dt.GetChanges());

                    _IsPreventFlowPrint  = true;
                    _IsPreventFlowExport = true;
                }
            }
            catch (Exception ex)
            {
                MessageDisplay.Error(ex.Message);
                throw;
            }
            return(ResultStatus.Success);
        }
示例#10
0
        protected override ResultStatus Save(PokeBall poke)
        {
            DataTable dtCurrent = (DataTable)gcMain.DataSource;

            gvMain.CloseEditor();
            gvMain.UpdateCurrentRow();

            DataTable dtChange      = dtCurrent.GetChanges();
            DataTable dtForAdd      = dtCurrent.GetChanges(DataRowState.Added);
            DataTable dtForModified = dtCurrent.GetChanges(DataRowState.Modified);
            DataTable dtForDeleted  = dtCurrent.GetChanges(DataRowState.Deleted);

            if (dtChange == null)
            {
                MessageDisplay.Info("沒有變更資料,不需要存檔!");
                return(ResultStatus.Fail);
            }
            if (dtChange.Rows.Count == 0)
            {
                MessageDisplay.Info("沒有變更資料,不需要存檔!");
                return(ResultStatus.Fail);
            }

            dtChange = dtCurrent.GetChanges();
            ResultData result = dao.UpdateData(dtChange);

            if (result.Status == ResultStatus.Fail)
            {
                return(ResultStatus.Fail);
            }

            return(ResultStatus.Success);
        }
示例#11
0
        protected override ResultStatus RunBefore(PokeBall args)
        {
            base.RunBefore(args);


            return(base.RunBefore(args));
        }
示例#12
0
    public static Sprite GetPokeBallSprite(int pokeBallId,
                                           PokeBall.SpriteType spriteType)
    {
        string resourceName = PokeBall.GetPokeBallById(pokeBallId).resourceName + '_' + PokeBall.spriteTypeResourceNames[spriteType];

        return(GetSprite(SpriteType.PokeBall, resourceName));
    }
示例#13
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            base.Save(gcMain);
            _IsPreventFlowPrint  = true;
            _IsPreventFlowExport = true;

            string fileName = "Z9999_{0}.csv";

            fileName = string.Format(fileName, DateTime.Now.ToString("yyyyMMdd"));

            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.Filter           = "CSV|*.csv";
            saveFileDialog.FileName         = fileName;
            saveFileDialog.InitialDirectory = GlobalInfo.DEFAULT_REPORT_DIRECTORY_PATH;

            Stream stream;

            if (saveFileDialog.ShowDialog() == DialogResult.OK)
            {
                if ((stream = saveFileDialog.OpenFile()) != null)
                {
                    DataTable     dtMain        = (DataTable)gcMain.DataSource;
                    ExportOptions exportOptions = new ExportOptions();
                    exportOptions.HasHeader = true;
                    ExportHelper.ToCsv(dtMain, stream, exportOptions);
                    MessageDisplay.Info("存檔完成!");
                    SingletonLogger.Instance.Info(GlobalInfo.USER_ID, _ProgramID, "轉出檔案" + saveFileDialog.FileName, "E");
                }
            }

            return(ResultStatus.Success);
        }
示例#14
0
        protected virtual ResultData ExecuteForm(PokeBall args)
        {
            ResultData resultData    = new ResultData();
            var        dllIndividual = Assembly.LoadFile(Application.ExecutablePath);
            string     typeFormat    = "{0}.FormUI.Prefix{1}.W{2}";
            string     txnId         = args.TXF_TID.Substring(2, 5);
            Type       myType        = dllIndividual.GetType(string.Format(typeFormat, Path.GetFileNameWithoutExtension(Application.ExecutablePath), txnId.Substring(0, 1), txnId));

            if (myType == null)
            {
                MessageDisplay.Error("無此程式");
            }

            object myObj = Activator.CreateInstance(myType, txnId, args.TXF_TID_NAME);

            FormParent formInstance = (FormParent)myObj;


            if (formInstance.BeforeOpen() == ResultStatus.Success)
            {
                formInstance.MdiParent     = this.MdiParent;
                formInstance.StartPosition = FormStartPosition.Manual;
                formInstance.WindowState   = FormWindowState.Maximized;
                formInstance.Show();
            }
            formInstance.IsPreventFlowExportAfter = true;
            ExecuteFormBefore(formInstance, args);
            resultData.Status = formInstance.ProcessExport();
            formInstance.Close();

            return(resultData);
        }
示例#15
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            try {
                DataTable dt       = (DataTable)gcMain.DataSource;
                DataTable dtChange = dt.GetChanges();

                if (dtChange == null)
                {
                    MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(ResultStatus.Fail);
                }
                if (dtChange.Rows.Count == 0)
                {
                    MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(ResultStatus.Fail);
                }

                DataTable dtForAdd = dt.GetChanges(DataRowState.Added);
                if (dtForAdd != null)
                {
                    //檢查重複key值
                    if (!checkDuplicate(dt.GetChanges(DataRowState.Added)))
                    {
                        return(ResultStatus.FailButNext);
                    }
                }

                //更新主要Table
                foreach (DataRow dr in dtChange.Rows)
                {
                    if (dr.RowState == DataRowState.Added || dr.RowState == DataRowState.Modified)
                    {
                        if (string.IsNullOrEmpty(dr["PLT1_QNTY_MIN"].AsString()) || string.IsNullOrEmpty(dr["PLT1_QNTY_MAX"].AsString()) ||
                            string.IsNullOrEmpty(dr["PLT1_MULTIPLE"].AsString()))
                        {
                            MessageDisplay.Info("資料尚未填寫完成!");
                            return(ResultStatus.FailButNext);
                        }
                        else
                        {
                            ResultData myResultData = dao20220.updatePLT1(dt);
                            if (myResultData.Status == ResultStatus.Fail)
                            {
                                return(ResultStatus.Fail);
                            }
                            else
                            {
                                _IsPreventFlowPrint = false; //若有update成功才會跳列印PDF視窗
                            }
                        }
                    }
                }
            } catch (Exception ex) {
                MessageDisplay.Error("存檔失敗");
                WriteLog(ex);
                return(ResultStatus.FailButNext);
            }
            return(ResultStatus.Success);
        }
示例#16
0
        protected override ResultStatus RunAfter(PokeBall args)
        {
            base.RunAfter(args);

            Retrieve();

            return(ResultStatus.Success);
        }
        public PlayerTrainerOutPhase(List <TrainerSprite> trainerSprites, List <TrainerPokemonStatus> trainerPokemonStatuses, IPokemonBattleSprite opponentPokemonBattleSprite) : base(trainerSprites, trainerPokemonStatuses)
        {
            this.opponentPokemonBattleSprite = opponentPokemonBattleSprite;
            PokemonBattleSprite pokemonBattleSpriteTest = new PokemonBattleSprite(new PokemonBattleSpriteData(0, 0, new Vector2(50, 160), Color.White, "Pokemons/charmander", PokemonBattleSpriteData.PokemonFacings.Back));

            pokeBall = new PokeBall(new PokeBallData(new Vector2(0, 70), "Battle/Pokeballs/pokeball_regular"), new PlayerCastingPokeBallEnterAnimation(), new GrowPokemonEnterBattleAnimation(pokemonBattleSpriteTest.GetPokemonBattleSpriteData()));
            this.pokemonBattleSpriteTest = pokemonBattleSpriteTest;
        }
示例#18
0
        protected override ResultStatus Save(PokeBall poke)
        {
            gvMain.CloseEditor();
            gvMain.UpdateCurrentRow();
            ResultStatus resultStatus = ResultStatus.Fail;

            try {
                DataTable dt = (DataTable)gcMain.DataSource;

                if (!checkComplete(dt))
                {
                    return(ResultStatus.Fail);
                }

                DataTable dtChange      = dt.GetChanges();
                DataTable dtForAdd      = dt.GetChanges(DataRowState.Added);
                DataTable dtForModified = dt.GetChanges(DataRowState.Modified);

                ResultData resultData = new ResultData();
                resultData.ChangedDataViewForAdded    = dtForAdd == null ? new DataView() : dtForAdd.DefaultView;
                resultData.ChangedDataViewForModified = dtForModified == null ? new DataView() : dtForModified.DefaultView;

                if (dtChange == null)
                {
                    MessageDisplay.Info("沒有變更資料, 不需要存檔!");
                    return(ResultStatus.FailButNext);
                }
                string result = dao51060.ExecuteStoredProcedure(txtYM.DateTimeValue.ToString("yyyyMMdd"));
                if (result == "0")
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        if (r.RowState != DataRowState.Deleted)
                        {
                            r["MMIQ_W_TIME"]    = DateTime.Now;
                            r["MMIQ_W_USER_ID"] = GlobalInfo.USER_ID;
                        }
                        if (Equals(0, r["MMIQ_INVALID_QNTY"]))
                        {
                            r.Delete();
                        }
                    }
                    resultStatus = dao51060.updateData(dt).Status;
                    if (resultStatus == ResultStatus.Fail)
                    {
                        MessageDisplay.Error("儲存失敗");
                        return(ResultStatus.Fail);
                    }
                }

                //列印新增 刪除 修改的資料
                PrintOrExportChangedByKen(gcMain, dtForAdd, null, dtForModified);
            } catch (Exception ex) {
                throw ex;
            }
            return(resultStatus);
        }
示例#19
0
        public OpponentTrainerFirstPokemonPhase(List <TrainerSprite> trainerSprites, List <TrainerPokemonStatus> trainerPokemonStatuses)
        {
            this.trainerSprites         = trainerSprites;
            this.trainerPokemonStatuses = trainerPokemonStatuses;
            PokemonBattleSprite pokemonBattleSpriteTest = new PokemonBattleSprite(new PokemonBattleSpriteData(0, 0, new Vector2(165, 55), Color.White, "Pokemons/weedle_front", PokemonBattleSpriteData.PokemonFacings.Front));

            pokeBall = new PokeBall(new PokeBallData(new Vector2(165, 55), "Battle/Pokeballs/pokeball_regular"), new NoPokeBallEnterAnimation(), new TransparentPokemonEnterBattleAnimation(pokemonBattleSpriteTest.GetPokemonBattleSpriteData()));
            this.pokemonBattleSpriteTest = pokemonBattleSpriteTest;
        }
示例#20
0
        protected override void ExecuteFormBefore(FormParent formInstance, PokeBall args)
        {
            ((CheckBox)formInstance.Controls.Find("cbxNews", true)[0]).Checked            = true;
            ((TextDateEdit)formInstance.Controls.Find("txtSDate", true)[0]).DateTimeValue = txtOcfDate.DateTimeValue;

            if (args.TXF_TID == "w_30055")
            {
                ((CheckBox)formInstance.Controls.Find("cbxTJF", true)[0]).Checked = true;
            }
        }
示例#21
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            //base.Save(gcMain);

            DataTable dt       = (DataTable)gcMain.DataSource;
            DataTable dtChange = dt.GetChanges();

            if (dtChange == null)
            {
                MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(ResultStatus.Fail);
            }
            if (dtChange.Rows.Count == 0)
            {
                MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(ResultStatus.Fail);
            }

            //取得idfg_table_id
            //string idfgTableId = "";
            //if () {
            //   idfgTableId = dt.Rows[0]["IDFG_TABLE_ID"].AsString();
            //}
            //賦值
            foreach (DataRow dr in dt.Rows)
            {
                if (dr.RowState == DataRowState.Added)
                {
                    dr["IDFG_W_TIME"]    = DateTime.Now;
                    dr["IDFG_W_USER_ID"] = GlobalInfo.USER_ID;
                    dr["IDFG_TABLE_ID"]  = dt.Rows[0]["IDFG_TABLE_ID"].AsString();
                }
            }

            //寫入DB
            try {
                ResultData myResultData = dao20420.UpdateIDFG(dt);
                if (myResultData.Status == ResultStatus.Fail)
                {
                    MessageDisplay.Error("更新資料庫IDFG錯誤! ");
                    return(ResultStatus.Fail);
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return(ResultStatus.Fail);
            }

            //重新Retrieve
            gcMain.RefreshDataSource();

            //不要自動列印
            _IsPreventFlowPrint = true;
            return(ResultStatus.Success);
        }
示例#22
0
        protected override ResultStatus Save(PokeBall poke)
        {
            gvMain.CloseEditor();
            gvMain.UpdateCurrentRow();
            ResultStatus resultStatus = ResultStatus.Fail;

            DataTable dt       = (DataTable)gcMain.DataSource;
            DataTable dtChange = dt.GetChanges();

            if (dtChange != null)
            {
                if (dtChange.Rows.Count == 0)
                {
                    MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return(ResultStatus.FailButNext);
                }
                else
                {
                    //先刪除舊資料, 再新增資料
                    if (daoS0012.DeleteSP2S() >= 0)
                    {
                        DataTable insertSP2SData = daoS0012.GetSP2SColumns();
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            insertSP2SData.Rows.Add();
                            insertSP2SData.Rows[i]["SP2S_DATE"]       = dt.Rows[i]["SP1_DATE"];
                            insertSP2SData.Rows[i]["SP2S_TYPE"]       = dt.Rows[i]["SP1_TYPE"];
                            insertSP2SData.Rows[i]["SP2S_KIND_ID1"]   = dt.Rows[i]["SP1_KIND_ID1"];
                            insertSP2SData.Rows[i]["SP2S_KIND_ID2"]   = dt.Rows[i]["SP1_KIND_ID2"];
                            insertSP2SData.Rows[i]["SP2S_VALUE_DATE"] = txtCountDate.DateTimeValue;
                            insertSP2SData.Rows[i]["SP2S_OSW_GRP"]    = dt.Rows[i]["SP1_OSW_GRP"];
                            insertSP2SData.Rows[i]["SP2S_SPAN_CODE"]  = dt.Rows[i]["SP2_SPAN_CODE"];
                            insertSP2SData.Rows[i]["SP2S_ADJ_CODE"]   = "Y";
                            insertSP2SData.Rows[i]["SP2S_W_TIME"]     = DateTime.Now;
                            insertSP2SData.Rows[i]["SP2S_W_USER_ID"]  = GlobalInfo.USER_ID;
                            insertSP2SData.Rows[i]["SP2S_USER_CM"]    = dt.Rows[i]["SP1_USER_RATE"].AsDecimal() == 0 ? DBNull.Value : dt.Rows[i]["SP1_USER_RATE"];
                        }
                        resultStatus = daoS0012.updateData(insertSP2SData).Status;
                        if (resultStatus == ResultStatus.Success)
                        {
                            //儲存備份 pdf
                            ReportHelper            _ReportHelper   = new ReportHelper(gcMain, _ProgramID, this.Text);
                            CommonReportLandscapeA4 reportLandscape = new CommonReportLandscapeA4();//設定為橫向列印
                            reportLandscape.printableComponentContainerMain.PrintableComponent = gcMain;
                            reportLandscape.IsHandlePersonVisible = false;
                            reportLandscape.IsManagerVisible      = false;
                            _ReportHelper.Create(reportLandscape);

                            _ReportHelper.Export(FileType.PDF, _ReportHelper.FilePath);
                        }
                    }
                }
            }
            return(resultStatus);
        }
示例#23
0
        protected override ResultStatus Save(PokeBall pokeBall)
        {
            try
            {
                ResultStatus myCheckResult = CheckShield();
                if (myCheckResult != ResultStatus.Success)
                {
                    return(myCheckResult);
                }
                if (myCheckResult == ResultStatus.Success)
                {
                    base.Save(gcMain);

                    DataTable dt = (DataTable)gcMain.DataSource;

                    DataTable dtChange = dt.GetChanges();

                    foreach (DataRow row in dtChange.Rows)
                    {
                        string flag   = row["UTP_FLAG"].AsString();
                        string userId = row["UTP_USER_ID"] == null ? "" : row["UTP_USER_ID"].AsString();
                        string txnId  = row["TXN_ID"].AsString();
                        string opType = "";
                        if (string.IsNullOrEmpty(userId) && flag == "Y")
                        {
                            //INSERT
                            userId = ddlUserId.EditValue.AsString();
                            opType = "I";
                            bool result    = daoUTP.InsertUTPByTXN(userId, GlobalInfo.USER_ID, txnId);
                            bool logResult = daoLOGUTP.InsertByUTPAndUPF(txnId, GlobalInfo.USER_DPT_ID, GlobalInfo.USER_ID, GlobalInfo.USER_NAME, opType, userId);
                        }
                        else if (!string.IsNullOrEmpty(userId) && string.IsNullOrEmpty(flag))
                        {
                            //DELETE
                            opType = "D";
                            bool logResult = daoLOGUTP.InsertByUTPAndUPF(txnId, GlobalInfo.USER_DPT_ID, GlobalInfo.USER_ID, GlobalInfo.USER_NAME, opType, userId);
                            bool result    = daoUTP.DeleteUTPByUserIdAndTxnId(userId, txnId);
                        }
                    }

                    gcMain.DataSource   = dt.GetChanges();
                    _IsPreventFlowPrint = false;
                }
            }
            catch (Exception ex)
            {
                MessageDisplay.Error(ex.Message);
                throw;
            }


            return(ResultStatus.Success);
        }
示例#24
0
        protected override ResultStatus Run(PokeBall args)
        {
            this.BeginInvoke(new MethodInvoker(() => {
                args.GridControlMain   = gcMain;
                args.GridControlSecond = gcLogsp;
                args.OcfDate           = Convert.ToDateTime(txtOcfDate.Text);
            }));

            ResultStatus result = base.RunAsync(args);

            return(result);
        }
示例#25
0
        protected override ResultStatus RunBefore(PokeBall args)
        {
            ResultStatus resultStatus = ResultStatus.Success;

            if (checkChanged())
            {
                MessageDisplay.Info("資料有變更, 請先存檔!");
                resultStatus = ResultStatus.FailButNext;
            } //else {
            //   resultStatus = Run(args);
            //}
            return(resultStatus);
        }
示例#26
0
        public override void SetPokemon(PokemonInstance pokemon)
        {
            if (pokemon != null)
            {
                imagePokeBall.gameObject.SetActive(true);
                imagePokeBall.sprite = SpriteStorage.GetItemSprite(
                    PokeBall.GetPokeBallById(pokemon.pokeBallId)
                    .resourceName
                    );

                textName.text = pokemon.GetDisplayName();
                imageGender.gameObject.SetActive(true);
                imageGender.sprite = SpriteStorage.GetGenderSprite(pokemon.gender);

                imageFront.gameObject.SetActive(true);
                imageFront.sprite = pokemon.LoadSprite(PokemonSpecies.SpriteType.Front1);

                imageType1.gameObject.SetActive(true);
                imageType2.gameObject.SetActive(true);
                imageType1.sprite = SpriteStorage.GetTypeSymbolSprite(pokemon.species.type1);

                Type?pokemonType2 = pokemon.species.type2;
                if (pokemonType2 == null)
                {
                    imageType2.gameObject.SetActive(false);
                }
                else
                {
                    imageType2.gameObject.SetActive(true);
                    imageType2.sprite = SpriteStorage.GetTypeSymbolSprite((Type)pokemonType2);
                }

                imageCheatPokemon.gameObject.SetActive(pokemon.cheatPokemon);
                imageShinyPokemon.gameObject.SetActive(pokemon.IsShiny);
            }
            else
            {
                imageFront.gameObject.SetActive(false);

                imageType1.gameObject.SetActive(false);
                imageType2.gameObject.SetActive(false);

                imagePokeBall.gameObject.SetActive(false);

                textName.text = noPokemonPromptMessage;
                imageGender.gameObject.SetActive(false);

                imageCheatPokemon.gameObject.SetActive(false);
                imageShinyPokemon.gameObject.SetActive(false);
            }
        }
示例#27
0
        protected override ResultStatus RunBefore(PokeBall args)
        {
            string txfServer = gvMain.GetRowCellValue(1, "TXF_SERVER").AsString();

            if (txfServer != GlobalDaoSetting.GetConnectionInfo.ConnectionName)
            {
                MessageDisplay.Warning("作業Server(" + txfServer + ") 不等於連線Server(" + GlobalDaoSetting.GetConnectionInfo.ConnectionName + ")");
                return(ResultStatus.Fail);
            }

            string inputDate = txtOcfDate.Text;
            string nowDate   = DateTime.Now.ToString(txtOcfDate.Properties.EditFormat.FormatString);

            if (OCF_TYPE == "D")
            {
                if (inputDate != nowDate)
                {
                    if (MessageDisplay.Choose("交易日期(" + inputDate + ") 不等於今日(" + nowDate + "),是否要繼續?") == DialogResult.No)
                    {
                        return(ResultStatus.Fail);
                    }
                }
                if (servicePrefix1.HasLogspDone(Convert.ToDateTime(inputDate), _ProgramID))
                {
                    if (MessageDisplay.Choose(_ProgramID + " 作業 " + inputDate + "「曾經」執行過,\n是否要繼續?\n\n★★★建議先執行 [預覽] 確認執行狀態") == DialogResult.No)
                    {
                        return(ResultStatus.Fail);
                    }
                }

                if (!servicePrefix1.setOCF(txtOcfDate.DateTimeValue, _DB_TYPE, GlobalInfo.USER_ID))
                {
                    return(ResultStatus.Fail);
                }
            }
            else if (OCF_TYPE == "M")
            {
                if (inputDate != nowDate)
                {
                    if (MessageDisplay.Choose("月份(" + inputDate + ") 不等於本月(" + nowDate + "),是否要繼續?") == DialogResult.No)
                    {
                        return(ResultStatus.Fail);
                    }
                }
            }


            GridHelper.AcceptText(gcMain);

            return(base.RunBefore(args));
        }
示例#28
0
        protected override ResultStatus Save(PokeBall args)
        {
            gvExAccount.CloseEditor();
            gvExAccount.UpdateCurrentRow();
            gvPresTest.CloseEditor();
            gvPresTest.UpdateCurrentRow();
            ResultStatus resultStatus = ResultStatus.FailButNext;

            try {
                if (!checkChanged())
                {
                    MessageDisplay.Info("沒有變更資料,不需要存檔!");
                    return(ResultStatus.FailButNext);
                }

                //檢查日期區間
                if (!CheckPeriod())
                {
                    return(ResultStatus.FailButNext);
                }

                //檢查REQ區間(0.1~5)
                if (!CheckREQValue())
                {
                    return(ResultStatus.FailButNext);
                }

                //檢查帳號及壓力測試參數
                DataTable dtExAccount = (DataTable)gcExAccount.DataSource;
                GenWTime(dtExAccount, "SPAN_ACCT_W_TIME", "SPAN_ACCT_USER_ID");
                if (!checkExAccount())
                {
                    return(ResultStatus.FailButNext);
                }
                DataTable dtPresTest = (DataTable)gcPresTest.DataSource;
                GenWTime(dtPresTest, "SPAN_PARAM_W_TIME", "SPAN_PARAM_USER_ID");
                if (!checkPresTest())
                {
                    return(ResultStatus.FailButNext);
                }

                //更新四部份資料
                DataTable dtPeriod = overWritePeriod();
                DataTable dtREQ    = overWriteREQ();
                resultStatus = daoS0070.UpdateAllDB(dtPeriod, dtREQ, dtExAccount, dtPresTest);
            } catch (Exception ex) {
                throw ex;
            }
            return(resultStatus);
        }
示例#29
0
        protected override ResultStatus Save(PokeBall poke)
        {
            gvMain.CloseEditor();
            gvMain.UpdateCurrentRow();

            DataTable dt             = (DataTable)gcMain.DataSource;
            DataTable dtChange       = dt.GetChanges();
            DataTable dtDeleteChange = dt.GetChanges(DataRowState.Deleted);
            DataTable dtForAdd       = dt.GetChanges(DataRowState.Added);
            DataTable dtForModified  = dt.GetChanges(DataRowState.Modified);

            if (dtChange != null)
            {
                if (!SaveBefore(dt))
                {
                    return(ResultStatus.FailButNext);
                }
                // 寫入DB
                foreach (DataRow dr in dt.Rows)
                {
                    //紀錄更動時間
                    if (dr.RowState != DataRowState.Deleted &&
                        (dr.RowState == DataRowState.Added || dr.RowState == DataRowState.Modified)
                        )
                    {
                        dr["MMF_W_TIME"]    = DateTime.Now;
                        dr["MMF_W_USER_ID"] = GlobalInfo.USER_ID;
                    }
                }
                gcMain.DataSource = dt;
                dtChange          = dt.GetChanges();
                try {
                    dao51030.UpdateMMF(dt);
                }
                catch (Exception ex) {
                    WriteLog(ex);
                    return(ResultStatus.Fail);
                }
                //列印新增、刪除、修改
                PrintOrExportChanged(gcMain, dtChange);

                return(ResultStatus.Success);
            }
            else
            {
                MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            return(ResultStatus.Success);
        }
示例#30
0
        protected override ResultStatus Save(PokeBall args)
        {
            ResultStatus resultStatus = ResultStatus.Fail;

            if (!checkChanged())
            {
                MessageBox.Show("沒有變更資料,不需要存檔!", "注意", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return(ResultStatus.FailButNext);
            }

            //1.儲存日期區間
            if (savePeriod() != ResultStatus.Success)
            {
                return(resultStatus);
            }

            //2.儲存VSR PSR InterMonth SOM
            if (!checkComplete())
            {
                return(ResultStatus.FailButNext);
            }

            //存module 1
            for (int i = 0; i < modules1.Length; i++)
            {
                GridView gv = GetGridView(modules1[i]);

                gv.CloseEditor();
                gv.UpdateCurrentRow();

                DataTable dt = (DataTable)gv.GridControl.DataSource;
                resultStatus = daoS0072.udpateSpanContentData(dt).Status;
            }

            //存module 2
            for (int i = 0; i < modules2.Length; i++)
            {
                GridView gv = GetGridView(modules2[i]);

                gv.CloseEditor();
                gv.UpdateCurrentRow();

                DataTable dtZISP = (DataTable)gv.GridControl.DataSource;

                resultStatus = daoS0072.udpateZIPData(dtZISP).Status;
            }

            return(resultStatus);
        }
示例#31
0
	public static byte[] Serialize(PokeBall pokeBall)
	{
		return Serialize((Item)pokeBall);
	}
示例#32
0
	public static void Deserialize(byte[] serialized, out PokeBall pokeBall)
	{
		Item item;
		Deserialize(serialized, out item);
		pokeBall = (PokeBall)item;
	}