Beispiel #1
0
        /// <summary>
        /// Create New Dividend
        /// </summary>
        /// <returns>Approved Dividend in [Dividend_Control_Approved]</returns>
        private static Dividend ApproveXBRL2_CreateNewDividend(XBRL_event_info xei, Security sec)
        {
            Dividend XBRL_dvd = new Dividend();

            XBRL_dvd.Init_from_XBRL(xei, sec);
            XBRL_dvd.LastModifiedBy.Value = "StevenXBRL-" + Utility.CurrentUser;

            //insert temp dividend into [Dividend_Control]
            if (!XBRL_dvd.Insert_to_DB(DividendTable_option.Dividend_Control))
            {
                MessageBox.Show("Helper_XBRL error 0: can't save into [Dividend_Control]");
                return(null);
            }

            //Get DividendIndex from saved dividend in [Dividend_Control]
            Dividend appr_dvd = Helper_Dividend.GetDividend_dvdID(XBRL_dvd.DividendID.Value, DividendTable_option.Dividend_Control);

            if (appr_dvd != null)
            {
                Helper_XBRL_approval.ApproveXBRL3_AddFees(appr_dvd);
                appr_dvd.Insert_to_DB(DividendTable_option.Dividend_Control_Approved);
            }
            else
            {
                MessageBox.Show("Helper_XBRL error 1: can't save into [Dividend_Control_Approved]");
                return(null);
            }

            return(appr_dvd);
        }
Beispiel #2
0
        public static Dividend ApproveXBRL(int xbrl_id)
        {
            XBRL_SavedFile  xsf = Helper_XBRL_approval.ApproveXBRL0_get_xsFile(xbrl_id);
            XBRL_event_info xei = new XBRL_event_info(xsf.XBRLobj);

            Security sec = SecurityMaster.XBRL_Create_or_Get_Security(xei, true);

            if (sec == null)
            {
                MessageBox.Show("Helper_XBRL error 0: no Security info in either XBRL or Security Master");
                return(null);
            }

            Dividend existing_dvd = Helper_XBRL_approval.ApproveXBRL0_find_existingDividend(xei);

            if (xei.IsCancellation_flag)
            {
                return(Helper_XBRL_approval.ApproveXBRL1_cancellation_XBRL(existing_dvd, xsf));
            }

            Action next_step = XBRL_event_matrix.ApproveXBRL_action(xei, existing_dvd);

            Dividend approved_dvd = null;

            if (next_step == Action.Create_New_Event)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL2_CreateNewDividend(xei, sec);
                Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd);

                if (approved_dvd != null)
                {
                    if (existing_dvd == null)
                    {
                        MessageBox.Show("New Dividend " + approved_dvd.DividendIndex + " created");
                    }
                    else
                    {
                        MessageBox.Show("Another Dividend " + approved_dvd.DividendIndex + " created with existing Dividend " + existing_dvd.DividendIndex);
                    }
                }
            }
            else if (next_step == Action.Update_Existing_event)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL2_UpdateDividend(xei, existing_dvd, sec);
                Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, approved_dvd);

                if (approved_dvd != null)
                {
                    MessageBox.Show("Existing Dividend " + approved_dvd.DividendIndex + " is updated");
                }
            }
            else if (next_step == Action.Add_Ref_to_Current)
            {
                approved_dvd = Helper_XBRL_approval.ApproveXBRL4_InsertDvdXBRL(xei, existing_dvd);

                if (approved_dvd != null)
                {
                    MessageBox.Show("XBRL ref# is added to existing Dividend " + approved_dvd.DividendIndex);
                }
            }

            if (approved_dvd != null)//Mark [XBRL_SavedFile] as approved
            {
                xsf.processState.Value  = 1;
                xsf.DividendIndex.Value = approved_dvd.DividendIndex;
                xsf.Update_to_DB();/*Commented out for testing by Steven if needed*/
            }

            return(approved_dvd);
        }