Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
        private static Dividend ApproveXBRL0_find_existingDividend(XBRL_event_info xei)
        {
            if (xei == null)
            {
                return(null);
            }

            Dividend existingDVD = Helper_Dividend.GetDividend_XBRL_refNum(xei.XBRL_ReferenceNumber);

            if (existingDVD == null)
            {
                List <Dividend> list = Helper_Dividend.Get_DividendList_CR(xei.CUSIP, xei.RecordDate_ADR);
                foreach (Dividend dvd in list)
                {
                    if (dvd.GetStatus() == HssUtility.General.HssStatus.Cancel)
                    {
                        continue;
                    }
                    else
                    {
                        existingDVD = dvd; break;
                    }
                }
            }

            return(existingDVD);
        }
Exemplo n.º 4
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();
            }
        }