コード例 #1
0
ファイル: InboundData3_SPR.cs プロジェクト: huangss0/GTS0
        private bool PreConnect_check()
        {
            DateTime currTime = DateTime.Now;

            //run Monday to Friday
            if (currTime.DayOfWeek == DayOfWeek.Saturday || currTime.DayOfWeek == DayOfWeek.Sunday)
            {
                return(false);
            }

            //run between 8am to 8pm for Admin
            if (currTime.Hour < 8 || currTime.Hour > 20)
            {
                return(false);
            }


            this.hdj = Hss_DailyJobs_master.GetJob_class_id("Inbound Data", 3);
            if (this.hdj == null)
            {
                return(false);
            }
            else
            {
                this.notes = this.hdj.Notes.Value;
            }

            if (HssDateTime.CompareDateTime_day(currTime, this.hdj.LastRunAt.Value) <= 0)
            {
                Console.WriteLine("---> InboundData3_SPR info 0: Task previous run at " + this.hdj.LastRunAt.Value);
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: Helper_Dividend.cs プロジェクト: huangss0/GTS0
        public static List <Dividend> Get_DividendList_CR(string CUSIP, DateTime recordDate, DividendTable_option table = DividendTable_option.Dividend_Control_Approved)
        {
            List <Dividend> all_List = Helper_Dividend.Get_DividendList_CUSIP(CUSIP, table);
            List <Dividend> res_list = new List <Dividend>();

            foreach (Dividend dvd in all_List)
            {
                int val = HssDateTime.CompareDateTime_day(recordDate, dvd.RecordDate_ADR.Value);
                if (val == 0)
                {
                    res_list.Add(dvd);
                }
            }

            return(res_list);
        }
コード例 #3
0
ファイル: Task20_master.cs プロジェクト: huangss0/GTS0
        private DateTime startDate  = new DateTime(2017, 10, 1);//starting date for

        public void Run()
        {
            Hss_DailyJobs hdj = Hss_DailyJobs_master.GetJob_class_id("Task Manager", 20);

            if (hdj == null)
            {
                return;
            }
            if (HssDateTime.CompareDateTime_day(DateTime.Now, hdj.LastRunAt.Value) <= 0)
            {
                return;
            }
            if (!hdj.UpdateRecordLock(true))
            {
                return;
            }

            Console.WriteLine("Task 20 start running");
            this.PerformTasks();

            hdj.UpdateRecordLock(false, true);
        }
コード例 #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();
            }
        }