コード例 #1
0
ファイル: ResearchForm.cs プロジェクト: huangss0/GTS0
        private void HssEntityFramework_button_Click(object sender, EventArgs e)
        {
            HssEntityFramework hef = new HssEntityFramework();

            hssDB  hDB          = null;
            string hDB_funcName = "hDB";
            bool   build_in_DB  = this.hef_BiD_checkBox.Checked;

            if (this.DB_comboBox.Text.Equals("DRWIN", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_DRWIN_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_DRWIN_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("XBRL", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_XBRL_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_XBRL_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("ESP2", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_ESP2_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_ESP2_hDB()";
                }
            }
            else if (this.DB_comboBox.Text.Equals("EDI", StringComparison.OrdinalIgnoreCase))
            {
                hDB = Utility.Get_EDI_hDB();
                if (build_in_DB)
                {
                    hDB_funcName = "Utility.Get_EDI_hDB()";
                }
            }

            hef.SetTable(this.hef_tn_textBox.Text, this.hef_sn_textBox.Text, hDB);
            hef.className      = this.hef_cn_textBox.Text;
            hef.hDB_name       = hDB_funcName;
            hef.builtInDB_flag = build_in_DB;

            ViewDataForm vdf = new ViewDataForm();

            vdf.Set_notePad_dataSource(hef.Run());
            vdf.Show();
        }
コード例 #2
0
        /// <summary>
        /// Action column event handler
        /// </summary>
        private void ActionButtonEvent_textEditor(object sender, EditorButtonEventArgs e)
        {
            if (e.Context is UltraGridCell == false)
            {
                return;
            }

            UltraGridCell cell = (UltraGridCell)e.Context;
            int           ID   = (int)cell.Row.Cells["id_SavedfilesRcvd"].Value;

            XBRL_SavedFile sf = new XBRL_SavedFile(ID);

            string option = e.Button.Key;

            if (option.StartsWith("Approve", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Approve file " + ID + "?", "Happy!", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                Dividend dvd = Helper_XBRL_approval.ApproveXBRL(ID);
                this.RefreshData(null);
                if (dvd != null && MessageBox.Show("Go to Control? " + dvd.DividendIndex, "???", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    this.GoToControl_func(dvd.DividendIndex);
                }
            }
            else if (option.StartsWith("ViewData", StringComparison.OrdinalIgnoreCase))
            {
                sf.Init_from_DB(false);
                ViewDataForm vdf = new ViewDataForm();
                vdf.suggestedFileName_forSave = sf.id_SavedfilesRcvd.ToString();
                vdf.Set_grid_dataSource(sf.Get_XBRLinfo_DS());
                vdf.Set_notePad_dataSource(sf.savedfile);
                vdf.Show();
            }
            else if (option.StartsWith("Reject", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Reject file " + ID + "?", "Sad...", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                sf.Init_from_DB(true);
                sf.processState.Value = (int)HssStatus.Rejected;
                sf.Update_to_DB();

                this.lastRefreshAt = DateTime.MinValue;
                this.RefreshData(null);
            }
            else if (option.StartsWith("Restore", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Restore file " + ID + "?", "Hero is back!", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                sf.Init_from_DB(true);
                sf.processState.Value = (int)HssStatus.Pending;
                sf.Update_to_DB();

                this.lastRefreshAt = DateTime.MinValue;
                this.RefreshData(null);
            }
        }
コード例 #3
0
        /// <summary>
        /// Button events handler in Action column
        /// </summary>
        private void ActionButtonEvent_textEditor(object sender, EditorButtonEventArgs e)
        {
            if (e.Context is UltraGridCell == false)
            {
                return;
            }

            UltraGridCell cell = (UltraGridCell)e.Context;
            int           ID   = (int)cell.Row.Cells["ID"].Value;

            SPR_file sf = new SPR_file(ID);

            sf.Init_from_DB();

            string option = e.Button.Key;

            if (option.StartsWith("Approve", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Approve file " + ID + "?", "Happy!", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                Dividend        curr_dvd = null;
                string          CUSIP    = cell.Row.Cells["CUSIP"].Value.ToString();
                List <Dividend> dvdList  = Helper_Dividend.Get_DividendList_CUSIP(CUSIP);

                foreach (Dividend dvd in dvdList)
                {
                    if (HssDateTime.CompareDateTime_day(sf.RecordDate.Value, dvd.RecordDate_ADR.Value) == 0)
                    {
                        curr_dvd = dvd;//matching Dividend found
                        break;
                    }
                }

                if (curr_dvd == null) //CUSIP and Record Date not found record in [Dividend_Control] table, let user to choose
                {
                    Form_DividendSelector fds = new Form_DividendSelector();
                    int dvd_index             = fds.Init_from_list(dvdList);
                    if (dvd_index > 0)
                    {
                        curr_dvd = new Dividend(dvd_index);
                    }
                }
                else //CUSIP and Record Date match record in [Dividend_Control] table
                {
                    if (MessageBox.Show("Update Dividend " + curr_dvd.DividendIndex + "?", "???", MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return;
                    }
                }

                if (curr_dvd != null)
                {
                    if (!curr_dvd.Insert_DTC_position(sf))
                    {
                        return;
                    }

                    sf.SetStatus(HssStatus.Approved);
                    sf.LastModifyAction.Value = "Approve";
                    sf.Update_to_DB();

                    MessageBox.Show("Dividend #" + curr_dvd.DividendIndex + " DTC position updated!");
                    this.RefreshData();
                }
                else
                {
                    MessageBox.Show("Dividend Event not found...");
                }
            }
            else if (option.StartsWith("ViewData", StringComparison.OrdinalIgnoreCase))
            {
                ViewDataForm vdf = new ViewDataForm();
                vdf.Set_notePad_dataSource(sf.FileBinary, ViewDataOption.RawView_strLine);
                vdf.Show();
            }
            else if (option.StartsWith("Reject", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Reject file " + ID + "?", "Sad...", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                sf.SetStatus(HssStatus.Rejected);
                sf.LastModifyAction.Value = "Reject";
                sf.Update_to_DB();
                this.RefreshData();
            }
            else if (option.StartsWith("Restore", StringComparison.OrdinalIgnoreCase))
            {
                if (MessageBox.Show("Restore file " + ID + "?", "Hero is back!", MessageBoxButtons.YesNo) != DialogResult.Yes)
                {
                    return;
                }

                sf.SetStatus(HssStatus.Pending);
                sf.LastModifyAction.Value = "Restore";
                sf.Update_to_DB();
                this.RefreshData();
            }
        }