Beispiel #1
0
        private static DB_reader Get_DB_reader(HssStatus status, SQL_condition extraCond)
        {
            DB_select selt = new DB_select(XBRL_SavedFile.Get_cmdTP());

            selt.IgnoreColumn("savedfile");
            SQL_relation rela = null;

            if (status == HssStatus.Pending || status == HssStatus.Approved)
            {
                rela = new SQL_relation("processState", RelationalOperator.Equals, (int)status);
            }
            else
            {
                HashSet <int> hs = new HashSet <int>();
                hs.Add(0); hs.Add(1);
                rela = new SQL_relation("processState", false, hs);
            }

            SQL_condition cond = new SQL_condition(rela, ConditionalOperator.And, extraCond);

            selt.SetCondition(cond);

            DB_reader reader = new DB_reader(selt, Utility.Get_XBRL_hDB());

            return(reader);
        }
Beispiel #2
0
        private void Get_XBRLlist_threadRun()
        {
            if (this.curr_reader == null)
            {
                return;
            }

            while (this.curr_reader.Read())
            {
                if (this.threadStop_flag)
                {
                    break;
                }

                XBRL_SavedFile sf = new XBRL_SavedFile();
                sf.Init_from_reader(this.curr_reader);
                this.XBRL_list.Add(sf);
            }

            Thread th = new Thread(this.curr_reader.Close);

            th.Name = "Reader close thread";
            th.Start();

            this.dataFinishedLoading_flag = true;
        }
Beispiel #3
0
        /// <summary>
        /// Add some rows from list to DT
        /// </summary>
        /// <param name="limit">max number of rows to be added</param>
        /// <returns>how many rows added</returns>
        public int Add_XBRLrows_to_DT(int limit = UltraGrid_helper.RowsLoaded_per_scroll)
        {
            int count = 0;

            if (limit < 1)
            {
                limit = UltraGrid_helper.RowsLoaded_per_scroll;
            }

            while (this.currList_id < this.XBRL_list.Count)
            {
                XBRL_SavedFile sf  = this.XBRL_list[this.currList_id];
                DataRow        row = sourceDT.Rows.Add();
                row["id_SavedfilesRcvd"] = sf.id_SavedfilesRcvd;
                row["UniqueUniversalEventIdentifier"] = sf.UniqueUniversalEventIdentifier.Value;
                row["CUSIP"]          = sf.cusip.Value;
                row["DepositaryName"] = sf.DepositaryName.Value;
                //row["UnderlyingSecurityIssuerCountryofIncorporation"] = sf.UnderlyingSecurityIssuerCountryofIncorporation.Value;
                //row["CountryOfIssue"] = sf.CountryOfIssue.Value;
                row["AnnouncementType"] = sf.AnnouncementType.Value;
                if (!sf.AnnouncementDate.IsNull_flag)
                {
                    row["AnnouncementDate"] = sf.AnnouncementDate.Value;
                }
                row["EventCompleteness"] = sf.EventCompleteness.Value;
                row["originalFileName"]  = sf.originalFileName.Value;
                if (!sf.DividendIndex.IsNull_flag)
                {
                    row["DividendIndex"] = sf.DividendIndex.Value;
                }

                row["Createdby"] = sf.createdby.Value;
                if (!sf.createddate.IsNull_flag)
                {
                    row["CreatedDate"] = sf.createddate.Value;
                }
                row["processState"] = sf.processState.Value;
                row["Processedby"]  = sf.Processedby.Value;
                if (!sf.WhenProcessed.IsNull_flag)
                {
                    row["WhenProcessed"] = sf.WhenProcessed.Value;
                }

                List <Security> sec_list = SecurityMaster.Get_secList_cusip(sf.cusip.Value);
                if (sec_list.Count > 0)
                {
                    row["$Country$"] = sec_list[0].Country.Value;
                }

                ++this.currList_id;
                if (++count > limit)
                {
                    break;
                }
            }

            return(count);
        }
Beispiel #4
0
        /*-----------------------------------Functions for Approval--------------------------------------------------*/
        /// <summary>
        /// Get XBRL_SavedFile based on file ID
        /// </summary>
        private static XBRL_SavedFile ApproveXBRL0_get_xsFile(int xbrl_id)
        {
            XBRL_SavedFile xsf = new XBRL_SavedFile(xbrl_id);

            if (!xsf.Init_from_DB(false))
            {
                MessageBox.Show("Helper_XBRL error 2: Error in reading XBRL file");
                return(null);
            }
            return(xsf);
        }
Beispiel #5
0
        /***********************************************Static Methods******************************************************************/

        public static List <XBRL_SavedFile> Get_XBRL_fileList(HssStatus status)
        {
            List <XBRL_SavedFile> list = new List <XBRL_SavedFile>();

            DB_reader reader = XBRL_SavedFile_master.Get_DB_reader(status, null);

            while (reader.Read())
            {
                XBRL_SavedFile sf = new XBRL_SavedFile();
                sf.Init_from_reader(reader);
                list.Add(sf);
            }
            reader.Close();

            return(list);
        }
Beispiel #6
0
        public XBRL_SavedFile GetCopy()
        {
            XBRL_SavedFile newEntity = new XBRL_SavedFile();

            //if (!this.savedfile.IsNull_flag) newEntity.savedfile.Value = this.savedfile.Value;
            if (!this.EventType.IsNull_flag)
            {
                newEntity.EventType.Value = this.EventType.Value;
            }
            if (!this.DRWINIncomeEventID.IsNull_flag)
            {
                newEntity.DRWINIncomeEventID.Value = this.DRWINIncomeEventID.Value;
            }
            if (!this.cusip.IsNull_flag)
            {
                newEntity.cusip.Value = this.cusip.Value;
            }
            if (!this.ISIN.IsNull_flag)
            {
                newEntity.ISIN.Value = this.ISIN.Value;
            }
            if (!this.originalFileName.IsNull_flag)
            {
                newEntity.originalFileName.Value = this.originalFileName.Value;
            }
            if (!this.DepositaryName.IsNull_flag)
            {
                newEntity.DepositaryName.Value = this.DepositaryName.Value;
            }
            if (!this.AnnouncementDate.IsNull_flag)
            {
                newEntity.AnnouncementDate.Value = this.AnnouncementDate.Value;
            }
            if (!this.EventCompleteness.IsNull_flag)
            {
                newEntity.EventCompleteness.Value = this.EventCompleteness.Value;
            }
            if (!this.UniqueUniversalEventIdentifier.IsNull_flag)
            {
                newEntity.UniqueUniversalEventIdentifier.Value = this.UniqueUniversalEventIdentifier.Value;
            }
            if (!this.DepositoryReceiptSponsorIndicator.IsNull_flag)
            {
                newEntity.DepositoryReceiptSponsorIndicator.Value = this.DepositoryReceiptSponsorIndicator.Value;
            }
            if (!this.PaymentDate.IsNull_flag)
            {
                newEntity.PaymentDate.Value = this.PaymentDate.Value;
            }
            if (!this.RecordDate.IsNull_flag)
            {
                newEntity.RecordDate.Value = this.RecordDate.Value;
            }
            if (!this.CountryOfIssue.IsNull_flag)
            {
                newEntity.CountryOfIssue.Value = this.CountryOfIssue.Value;
            }
            if (!this.ContextRefBase.IsNull_flag)
            {
                newEntity.ContextRefBase.Value = this.ContextRefBase.Value;
            }
            if (!this.Source.IsNull_flag)
            {
                newEntity.Source.Value = this.Source.Value;
            }
            if (!this.processState.IsNull_flag)
            {
                newEntity.processState.Value = this.processState.Value;
            }
            if (!this.WhenProcessed.IsNull_flag)
            {
                newEntity.WhenProcessed.Value = this.WhenProcessed.Value;
            }
            if (!this.Processedby.IsNull_flag)
            {
                newEntity.Processedby.Value = this.Processedby.Value;
            }
            if (!this.flgLock.IsNull_flag)
            {
                newEntity.flgLock.Value = this.flgLock.Value;
            }
            if (!this.WhenLocked_date.IsNull_flag)
            {
                newEntity.WhenLocked_date.Value = this.WhenLocked_date.Value;
            }
            if (!this.LockedBy_userid.IsNull_flag)
            {
                newEntity.LockedBy_userid.Value = this.LockedBy_userid.Value;
            }
            if (!this.createdby.IsNull_flag)
            {
                newEntity.createdby.Value = this.createdby.Value;
            }
            if (!this.createddate.IsNull_flag)
            {
                newEntity.createddate.Value = this.createddate.Value;
            }
            if (!this.AnnouncementIdentifier.IsNull_flag)
            {
                newEntity.AnnouncementIdentifier.Value = this.AnnouncementIdentifier.Value;
            }
            if (!this.FirstFilerFlag.IsNull_flag)
            {
                newEntity.FirstFilerFlag.Value = this.FirstFilerFlag.Value;
            }
            if (!this.UnderlyingSecurityIssuerCountryofIncorporation.IsNull_flag)
            {
                newEntity.UnderlyingSecurityIssuerCountryofIncorporation.Value = this.UnderlyingSecurityIssuerCountryofIncorporation.Value;
            }
            if (!this.id_SavedFiles_CSV.IsNull_flag)
            {
                newEntity.id_SavedFiles_CSV.Value = this.id_SavedFiles_CSV.Value;
            }
            if (!this.DividendIndex.IsNull_flag)
            {
                newEntity.DividendIndex.Value = this.DividendIndex.Value;
            }
            if (!this.AnnouncementType.IsNull_flag)
            {
                newEntity.AnnouncementType.Value = this.AnnouncementType.Value;
            }
            if (!this.ID_GTS_SFTP_InputSITEs.IsNull_flag)
            {
                newEntity.ID_GTS_SFTP_InputSITEs.Value = this.ID_GTS_SFTP_InputSITEs.Value;
            }
            if (!this.recNum.IsNull_flag)
            {
                newEntity.recNum.Value = this.recNum.Value;
            }
            if (!this.flgEmailSent.IsNull_flag)
            {
                newEntity.flgEmailSent.Value = this.flgEmailSent.Value;
            }
            if (!this.EmailSentDate.IsNull_flag)
            {
                newEntity.EmailSentDate.Value = this.EmailSentDate.Value;
            }
            return(newEntity);
        }
Beispiel #7
0
        internal HssUtility.SQLserver.DB_update Get_DBupdate()
        {
            if (!this.CheckValueChanges())
            {
                return(null);
            }

            this.Processedby.Value   = Utility.CurrentUser;
            this.WhenProcessed.Value = DateTime.Now;

            HssUtility.SQLserver.DB_update upd = new HssUtility.SQLserver.DB_update(XBRL_SavedFile.Get_cmdTP());
            //if (this.savedfile.ValueChanged) upd.AddValue("savedfile", this.savedfile); //no update for binary for now
            if (this.EventType.ValueChanged)
            {
                upd.AddValue("EventType", this.EventType);
            }
            if (this.DRWINIncomeEventID.ValueChanged)
            {
                upd.AddValue("DRWINIncomeEventID", this.DRWINIncomeEventID);
            }
            if (this.cusip.ValueChanged)
            {
                upd.AddValue("cusip", this.cusip);
            }
            if (this.ISIN.ValueChanged)
            {
                upd.AddValue("ISIN", this.ISIN);
            }
            if (this.originalFileName.ValueChanged)
            {
                upd.AddValue("originalFileName", this.originalFileName);
            }
            if (this.DepositaryName.ValueChanged)
            {
                upd.AddValue("DepositaryName", this.DepositaryName);
            }
            if (this.AnnouncementDate.ValueChanged)
            {
                upd.AddValue("AnnouncementDate", this.AnnouncementDate);
            }
            if (this.EventCompleteness.ValueChanged)
            {
                upd.AddValue("EventCompleteness", this.EventCompleteness);
            }
            if (this.UniqueUniversalEventIdentifier.ValueChanged)
            {
                upd.AddValue("UniqueUniversalEventIdentifier", this.UniqueUniversalEventIdentifier);
            }
            if (this.DepositoryReceiptSponsorIndicator.ValueChanged)
            {
                upd.AddValue("DepositoryReceiptSponsorIndicator", this.DepositoryReceiptSponsorIndicator);
            }
            if (this.PaymentDate.ValueChanged)
            {
                upd.AddValue("PaymentDate", this.PaymentDate);
            }
            if (this.RecordDate.ValueChanged)
            {
                upd.AddValue("RecordDate", this.RecordDate);
            }
            if (this.CountryOfIssue.ValueChanged)
            {
                upd.AddValue("CountryOfIssue", this.CountryOfIssue);
            }
            if (this.ContextRefBase.ValueChanged)
            {
                upd.AddValue("ContextRefBase", this.ContextRefBase);
            }
            if (this.Source.ValueChanged)
            {
                upd.AddValue("Source", this.Source);
            }
            if (this.processState.ValueChanged)
            {
                upd.AddValue("processState", this.processState);
            }
            if (this.WhenProcessed.ValueChanged)
            {
                upd.AddValue("WhenProcessed", this.WhenProcessed);
            }
            if (this.Processedby.ValueChanged)
            {
                upd.AddValue("Processedby", this.Processedby);
            }
            if (this.flgLock.ValueChanged)
            {
                upd.AddValue("flgLock", this.flgLock);
            }
            if (this.WhenLocked_date.ValueChanged)
            {
                upd.AddValue("WhenLocked_date", this.WhenLocked_date);
            }
            if (this.LockedBy_userid.ValueChanged)
            {
                upd.AddValue("LockedBy_userid", this.LockedBy_userid);
            }
            if (this.createdby.ValueChanged)
            {
                upd.AddValue("createdby", this.createdby);
            }
            if (this.createddate.ValueChanged)
            {
                upd.AddValue("createddate", this.createddate);
            }
            if (this.AnnouncementIdentifier.ValueChanged)
            {
                upd.AddValue("AnnouncementIdentifier", this.AnnouncementIdentifier);
            }
            if (this.FirstFilerFlag.ValueChanged)
            {
                upd.AddValue("FirstFilerFlag", this.FirstFilerFlag);
            }
            if (this.UnderlyingSecurityIssuerCountryofIncorporation.ValueChanged)
            {
                upd.AddValue("UnderlyingSecurityIssuerCountryofIncorporation", this.UnderlyingSecurityIssuerCountryofIncorporation);
            }
            if (this.id_SavedFiles_CSV.ValueChanged)
            {
                upd.AddValue("id_SavedFiles_CSV", this.id_SavedFiles_CSV);
            }
            if (this.DividendIndex.ValueChanged)
            {
                upd.AddValue("DividendIndex", this.DividendIndex);
            }
            if (this.AnnouncementType.ValueChanged)
            {
                upd.AddValue("AnnouncementType", this.AnnouncementType);
            }
            if (this.ID_GTS_SFTP_InputSITEs.ValueChanged)
            {
                upd.AddValue("ID_GTS_SFTP_InputSITEs", this.ID_GTS_SFTP_InputSITEs);
            }
            if (this.recNum.ValueChanged)
            {
                upd.AddValue("recNum", this.recNum);
            }
            if (this.flgEmailSent.ValueChanged)
            {
                upd.AddValue("flgEmailSent", this.flgEmailSent);
            }
            if (this.EmailSentDate.ValueChanged)
            {
                upd.AddValue("EmailSentDate", this.EmailSentDate);
            }

            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id_SavedfilesRcvd", HssUtility.General.RelationalOperator.Equals, this.pk_ID);
            upd.SetCondition(rela);

            return(upd);
        }
Beispiel #8
0
        internal HssUtility.SQLserver.DB_insert Get_DBinsert()
        {
            HssUtility.SQLserver.DB_insert dbIns = new HssUtility.SQLserver.DB_insert(XBRL_SavedFile.Get_cmdTP());

            dbIns.AddValue("savedfile", this.savedfile);
            dbIns.AddValue("EventType", this.EventType.Value);
            dbIns.AddValue("DRWINIncomeEventID", this.DRWINIncomeEventID);                               /*Optional 4*/
            dbIns.AddValue("cusip", this.cusip);                                                         /*Optional 5*/
            dbIns.AddValue("ISIN", this.ISIN);                                                           /*Optional 6*/
            dbIns.AddValue("originalFileName", this.originalFileName);                                   /*Optional 7*/
            dbIns.AddValue("DepositaryName", this.DepositaryName);                                       /*Optional 8*/
            dbIns.AddValue("AnnouncementDate", this.AnnouncementDate);                                   /*Optional 9*/
            dbIns.AddValue("EventCompleteness", this.EventCompleteness);                                 /*Optional 10*/
            dbIns.AddValue("UniqueUniversalEventIdentifier", this.UniqueUniversalEventIdentifier);       /*Optional 11*/
            dbIns.AddValue("DepositoryReceiptSponsorIndicator", this.DepositoryReceiptSponsorIndicator); /*Optional 12*/
            dbIns.AddValue("PaymentDate", this.PaymentDate);                                             /*Optional 13*/
            dbIns.AddValue("RecordDate", this.RecordDate);                                               /*Optional 14*/
            dbIns.AddValue("CountryOfIssue", this.CountryOfIssue);                                       /*Optional 15*/
            dbIns.AddValue("ContextRefBase", this.ContextRefBase);                                       /*Optional 16*/
            dbIns.AddValue("Source", this.Source);                                                       /*Optional 17*/
            dbIns.AddValue("processState", this.processState.Value);
            dbIns.AddValue("WhenProcessed", this.WhenProcessed);                                         /*Optional 19*/
            dbIns.AddValue("Processedby", this.Processedby);                                             /*Optional 20*/
            dbIns.AddValue("flgLock", this.flgLock);                                                     /*Optional 21*/
            dbIns.AddValue("WhenLocked_date", this.WhenLocked_date);                                     /*Optional 22*/
            dbIns.AddValue("LockedBy_userid", this.LockedBy_userid);                                     /*Optional 23*/
            dbIns.AddValue("createdby", this.createdby.Value);
            dbIns.AddValue("createddate", this.createddate.Value);
            dbIns.AddValue("AnnouncementIdentifier", this.AnnouncementIdentifier);                                                 /*Optional 26*/
            dbIns.AddValue("FirstFilerFlag", this.FirstFilerFlag);                                                                 /*Optional 27*/
            dbIns.AddValue("UnderlyingSecurityIssuerCountryofIncorporation", this.UnderlyingSecurityIssuerCountryofIncorporation); /*Optional 28*/
            dbIns.AddValue("id_SavedFiles_CSV", this.id_SavedFiles_CSV);                                                           /*Optional 29*/
            dbIns.AddValue("DividendIndex", this.DividendIndex);                                                                   /*Optional 30*/
            dbIns.AddValue("AnnouncementType", this.AnnouncementType);                                                             /*Optional 31*/
            dbIns.AddValue("ID_GTS_SFTP_InputSITEs", this.ID_GTS_SFTP_InputSITEs);                                                 /*Optional 32*/
            dbIns.AddValue("recNum", this.recNum);                                                                                 /*Optional 33*/
            dbIns.AddValue("flgEmailSent", this.flgEmailSent);                                                                     /*Optional 34*/
            dbIns.AddValue("EmailSentDate", this.EmailSentDate);                                                                   /*Optional 35*/

            return(dbIns);
        }
Beispiel #9
0
        /// <summary>
        /// Initialize object from DB
        /// </summary>
        public bool Init_from_DB(bool ignore_savedfile)
        {
            if (this.id_SavedfilesRcvd < 0)
            {
                return(false);
            }

            HssUtility.SQLserver.DB_select db_sel = new HssUtility.SQLserver.DB_select(XBRL_SavedFile.Get_cmdTP());
            if (ignore_savedfile)
            {
                db_sel.IgnoreColumn("savedfile");
            }
            db_sel.tableName = "SavedFiles";
            HssUtility.SQLserver.SQL_relation rela = new HssUtility.SQLserver.SQL_relation("id_SavedfilesRcvd", HssUtility.General.RelationalOperator.Equals, this.id_SavedfilesRcvd);
            db_sel.SetCondition(rela);

            bool res_flag = false;

            HssUtility.SQLserver.DB_reader reader = new HssUtility.SQLserver.DB_reader(db_sel, Utility.Get_XBRL_hDB());
            if (reader.Read())
            {
                this.Init_from_reader(reader);
                res_flag = true;
            }
            reader.Close();
            return(res_flag);
        }
Beispiel #10
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);
        }
Beispiel #11
0
        /// <summary>
        /// Deal with cancellation XBRL
        /// </summary>
        private static Dividend ApproveXBRL1_cancellation_XBRL(Dividend existing_dvd, XBRL_SavedFile xsf)
        {
            if (existing_dvd == null)
            {
                MessageBox.Show("No Dividend created for this cancellation XBRL");
                if (xsf != null)
                {
                    xsf.processState.Value = 2;
                }
            }
            else
            {
                Helper_Dividend.CancelDivdiend(existing_dvd);//cancel existing dividend
                MessageBox.Show("Dividend " + existing_dvd.DividendIndex + " is cancelled");
                if (xsf != null)
                {
                    xsf.processState.Value = 1;
                }
            }

            if (xsf != null)
            {
                xsf.Update_to_DB();
            }
            return(existing_dvd);
        }