Beispiel #1
0
        public bool Add_EODDeployed(int EODDepositID, string workplaceId, string Report_Date)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                sb.Append("INSERT INTO dbo.tbl_DCS_EODDeployed (EODDepositID, DaysGracePeriod, Posted_Date, LastUpdated_Date) ");
                sb.Append(" VALUES ");
                sb.Append("(@EODDepositID, @DaysGracePeriod, GETDATE(), GETDATE()) ");


                OpenConnection();
                cmd = new SqlCommand(sb.ToString(), con);
                cmd.Parameters.AddWithValue("EODDepositID", EODDepositID);
                //if(workplaceId=="1")
                //    cmd.Parameters.AddWithValue("DaysGracePeriod", 1);
                //else
                //    cmd.Parameters.AddWithValue("DaysGracePeriod", 2);

                cmd.Parameters.AddWithValue("DaysGracePeriod", EOD.GetGracePeriod((Program.workplaceId)Convert.ToInt32(workplaceId), Convert.ToDateTime(Report_Date)));

                ExecuteNonQuery(CommandType.Text);

                return(true);
            }
            catch (Exception ex)
            {
                strErrorMessage = ex.Message;
                return(false);
            }
        }
Beispiel #2
0
        private static bool ProcessEODData()
        {
            EOD eod = null;

            //string reportDate = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
            //string reportDate = "";
            //string dateToday = DateTime.Now.ToString("yyyy-MM-dd");


            ////tempo
            //reportDate = "2020-09-0";
            //dateToday = Convert.ToDateTime(reportDate).AddDays(1).ToString("yyyy-MM-dd");
            //eod = new EOD(reportDate, dateToday);
            //if (!eod.GenerateEndOfDay()) logger.Error("Failed to generate end of day report for " + reportDate);
            //return false;
            ////tempo

            if (File.Exists(reportDateFile))
            {
                reportDate = System.IO.File.ReadAllText(reportDateFile);
                dateToday  = Convert.ToDateTime(reportDate).Date.AddDays(1).ToString("yyyy-MM-dd");

                eod = new EOD(reportDate, dateToday);
                if (!eod.GenerateEndOfDay())
                {
                    logger.Error("Failed to generated end of day report for " + reportDate);
                }
                else
                {
                    eod = null;
                    eod = new EOD(dateToday, dateToday);
                    if (!eod.GenerateEndOfDay())
                    {
                        logger.Error("Failed to generated end of day report for " + dateToday);
                    }
                }
            }
            else
            {
                DataTable dtLastTwoEntryDates = null;

                if (!dalLocal.SelectLastTwoEntryDates())
                {
                    logger.Error("Failed to get last 2 dates of member table");
                    return(false);
                }
                else
                {
                    dtLastTwoEntryDates = dalLocal.TableResult;
                }

                if (Convert.ToDateTime(dtLastTwoEntryDates.Rows[0][0].ToString()).Date != DateTime.Now.Date)
                {
                    reportDate = Convert.ToDateTime(dtLastTwoEntryDates.Rows[0][0]).ToString("yyyy-MM-dd");
                    eod        = new EOD(reportDate, dateToday);
                    if (!eod.GenerateEndOfDay())
                    {
                        logger.Error("Failed to generate end of day report for " + reportDate);
                    }
                }
                else
                {
                    reportDate = Convert.ToDateTime(dtLastTwoEntryDates.Rows[1][0]).ToString("yyyy-MM-dd");
                    eod        = new EOD(reportDate, dateToday);
                    if (!eod.GenerateEndOfDay())
                    {
                        logger.Error("Failed to generated end of day report for " + reportDate);
                    }
                    else
                    {
                        eod = null;
                        eod = new EOD(dateToday, dateToday);
                        if (!eod.GenerateEndOfDay())
                        {
                            logger.Error("Failed to generated end of day report for " + dateToday);
                        }
                    }
                }
            }

            if (!dalSys.GenerateConsumbalesDailyEnv(config.BankID.ToString(), dateToday))
            {
                logger.Error("GenerateConsumbalesDailyEnv() failed. Error " + dalSys.ErrorMessage);
                return(false);
            }

            return(true);
        }