Exemplo n.º 1
0
        protected override ResultStatus Retrieve()
        {
            DataTable returnTable = new DataTable();

            _cpYMD      = emDate.Text.Replace("/", "");
            returnTable = dao20231.List20231(_cpYMD);

            if (returnTable.Rows.Count <= 0)
            {
                gcMain.Visible = false;
                MessageDisplay.Info(MessageDisplay.MSG_NO_DATA);
                return(ResultStatus.Success);
            }
            if (!string.IsNullOrEmpty(returnTable.Rows[0]["PLS4_PDK_YMD"].AsString()))
            {
                _IsPdkYMD       = returnTable.Rows[0]["PLS4_PDK_YMD"].AsString();
                emProdDate.Text = _IsPdkYMD.AsDateTime("yyyyMMdd").ToString("yyyy/MM/dd");
            }
            _ToolBtnInsert.Enabled = true;
            _ToolBtnSave.Enabled   = true;
            _ToolBtnDel.Enabled    = true;

            gcMain.Visible = true;

            base.Retrieve(gcMain);
            //流水號欄寬
            gvMain.IndicatorWidth = 60;

            returnTable.Columns.Add("Is_NewRow", typeof(string));
            gcMain.DataSource = returnTable;

            gcMain.Focus();
            this.gvMain.CustomDrawRowIndicator += new DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventHandler(this.gvMain_CustomDrawRowIndicator);
            return(ResultStatus.Success);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 確認日期 有資料時清除PLS4相關日期資料
        /// </summary>
        /// <returns></returns>
        private string WfChkDate()
        {
            string lsYMD;

            //確認:計算日期
            lsYMD = emDate.Text.Replace("/", "");
            DialogResult ChooseResult = MessageDisplay.Choose($"請確認「計算日期 :{emDate.Text}」是否正確?");

            if (ChooseResult == DialogResult.No)
            {
                return("E");
            }

            //刪除舊有資料
            DataTable data = dao20231.List20231(lsYMD);

            if (data.Rows.Count > 0)
            {
                DialogResult ChooseResult1 = MessageDisplay.Choose($"「計算日期 :{emDate.Text}」資料已存在,是否刪除?");
                if (ChooseResult1 == DialogResult.No)
                {
                    return("E");
                }

                DialogResult ChooseResult2 = MessageBox.Show($"「計算日期 :{emDate.Text}」資料確定刪除?", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                if (ChooseResult2 == DialogResult.Cancel)
                {
                    return("E");
                }

                //刪除相關日期條件已存在的資料
                dao20231.DeletePLS4(lsYMD);
            }

            //確認:比對日期
            if (!emProdDate.IsDate(emProdDate.Text, "「比對期貨/選擇權商品基準日期」非正確日期格式"))
            {
                return("E");
            }

            DialogResult ChooseResult3 = MessageBox.Show($"請確認「比對期貨/選擇權商品基準日期 :{emDate.Text}」是否正確?", "注意", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);

            if (ChooseResult3 == DialogResult.Cancel)
            {
                return("E");
            }

            return("");
        }