示例#1
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);
        }
示例#2
0
        public static Action ApproveXBRL_action(XBRL_event_info xei, Dividend existing_dvd)
        {
            if (xei == null)
            {
                return(Action.None);
            }
            if (existing_dvd == null)
            {
                return(Action.Create_New_Event);
            }

            bool diffRef_sameDepo_flag = XBRL_event_matrix.DifferentRef_from_sameDepo(xei, existing_dvd);

            if (diffRef_sameDepo_flag)
            {
                return(Action.Create_New_Event);
            }

            if (xei.IsCompleteEvent_flag)
            {
                if (existing_dvd.IsCompleteEvent_flag)
                {
                    if (xei.Sponsored)
                    {
                        return(Action.Update_Existing_event);
                    }
                    else //Unsponsored XBRL
                    {
                        if (xei.IsFirstFiler)
                        {
                            return(Action.Update_Existing_event);
                        }
                        else
                        {
                            return(Action.Add_Ref_to_Current);
                        }
                    }
                }
                else //In-complete Existing Event
                {
                    return(Action.Update_Existing_event);
                }
            }
            else // In-complete XBRL
            {
                if (existing_dvd.IsCompleteEvent_flag)
                {
                    return(Action.Add_Ref_to_Current);
                }
                else //In-complete Existing Event
                {
                    if (xei.Sponsored)
                    {
                        return(Action.Update_Existing_event);
                    }
                    else //Unsponsored XBRL
                    {
                        if (xei.IsFirstFiler)
                        {
                            return(Action.Update_Existing_event);
                        }
                        else
                        {
                            return(Action.Add_Ref_to_Current);
                        }
                    }
                }
            }
        }