public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            ErrorMsg = "";
            CustomerTransactionBo customerTransactionBo = new CustomerTransactionBo();

            try
            {
                customerTransactionBo.RunMFTRansactionsCancellationJob();
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "DailyValuation.ascx.cs:CreateAdviserEODLog()");
                object[] objects = new object[1];

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }

            return(JobStatus.SuccessFull);
        }
Exemple #2
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            ErrorMsg = "";
            logger.Info("-------------Starting NAV Download-------------");

            DownloadLogVo downloadLogVo = new DownloadLogVo();

            downloadLogVo.ID = DownloadLog.Add();

            if (downloadLogVo.ID > 0)
            {
                HttpDownLoad dn = new HttpDownLoad();
                DownloadTask dt = new DownloadTask(TaskType.MutualFund);
                if (dn.ExecuteDownLoadTask(dt, downloadLogVo))
                {
                    NAVUpload navUpload = new NAVUpload();
                    navUpload.CopyDataToWERPTempTable();
                    navUpload.UpdateWERPSchemeCode();
                    downloadLogVo.RejectedSchemesCount = navUpload.MoveRejectedRecords(downloadLogVo.ID);
                    DownloadLog.Update(downloadLogVo);
                    downloadLogVo.UpdatedSchemesCount      = navUpload.UpdateSnapshot();
                    downloadLogVo.Is_WERP_Snapshot_Updated = true;
                    DownloadLog.Update(downloadLogVo);
                    //navUpload.UpdateHistoryTable();
                }
            }
            logger.Info("-------------NAV Update Ends-------------");

            return(JobStatus.SuccessFull);
        }
Exemple #3
0
        private static void StartJob(object Data)
        {
            object[] DataArray = (object[])Data;

            string   DaemonCode    = (string)DataArray[0];
            int      JobInstanceId = (int)DataArray[1];
            int      JobId         = (int)DataArray[2];
            int      JobTypeId     = (int)DataArray[3];
            int      JobPriority   = (int)DataArray[4];
            DateTime RunTime       = (DateTime)DataArray[5];
            string   JobParams     = (string)DataArray[6];

            JobParams JP = new JobParams();

            JP.Init(JobParams);

            Utils.Trace(DaemonCode + ": " + "Processing job " + JobInstanceId.ToString());

            try
            {
                Job J = JobMgr.GetJobByType(JobTypeId);

                J.Init(JobId, JobInstanceId, JobPriority, RunTime);

                string    ErrorMsg;
                JobStatus JS = J.Start(JP, out ErrorMsg);

                Utils.Trace(DaemonCode + ": " + "Updating job status " + JobInstanceId.ToString());

                SqlParameter[] Params = new SqlParameter[3];
                Params[0] = new SqlParameter("Id", JobInstanceId);
                Params[1] = new SqlParameter("Status", JS);
                Params[2] = new SqlParameter("ErrorMsg", ErrorMsg);

                Utils.ExecuteNonQuery("sproc_UpdateJobStatus", Params);
            }
            catch (Exception Ex)
            {
                string Msg = "Unable to process job. " + Ex.ToString();
                Utils.LogError(Msg);

                SqlParameter[] Params = new SqlParameter[3];
                Params[0] = new SqlParameter("Id", JobInstanceId);
                Params[1] = new SqlParameter("Status", JobStatus.Failed);
                Params[2] = new SqlParameter("ErrorMsg", Msg);

                Utils.ExecuteNonQuery("sproc_UpdateJobStatus", Params);
            }
        }
Exemple #4
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            AlertsBo alertBo = new AlertsBo();

            alertBo.ExecuteReminderAlert();

            alertBo.ExecuteConfirmationAlert();

            //alertBo.ExecuteOccurrenceAlert();

            //alertBo.ExecuteProcessAlertstoEmailQueue();

            ErrorMsg = "";
            return(JobStatus.SuccessFull);
        }
Exemple #5
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            ErrorMsg = "";

            string   AccordImportDate = ConfigurationManager.AppSettings["AccordImportDate"];
            DateTime ImportDate       = DateTime.Now.AddDays(-1);

            if (AccordImportDate != "#RUNDATE#")
            {
                ImportDate = DateTime.Parse(AccordImportDate);
            }

            ProcessAccordProductMasterData(ImportDate);

            return(JobStatus.SuccessFull);
        }
Exemple #6
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            DateTime tradeDate = new DateTime();
            List <EQSpeculativeVo> eqSpeculativeVoList  = new List <EQSpeculativeVo>();
            EQSpeculativeTradeBo   eqSpeculativeTradeBo = new EQSpeculativeTradeBo();

            if (DateTime.Now.TimeOfDay.Hours < 1)
            {
                tradeDate = DateTime.Today.AddDays(-1);
            }
            else
            {
                tradeDate = DateTime.Today;
            }
            eqSpeculativeVoList = eqSpeculativeTradeBo.GetEquitySpeculativeTradeGroups(tradeDate);
            eqSpeculativeTradeBo.PerformSpeculativeFlagging(eqSpeculativeVoList);
            ErrorMsg = "";
            return(JobStatus.SuccessFull);
        }
Exemple #7
0
        public void Start()
        {
            while (1 == 1)
            {
                try
                {
                    Trace("Polling DB for job parts...");

                    SqlParameter[] Params = new SqlParameter[1];
                    Params[0] = new SqlParameter("@DaemonCode", _DaemonCode);

                    DataSet DS = Utils.ExecuteDataSet("sproc_GetJobPartList", Params);

                    bool HasItemsToProcess = false;

                    foreach (DataRow DR in DS.Tables[0].Rows)
                    {
                        HasItemsToProcess = true;

                        int      JobPartId     = int.Parse(DR["Id"].ToString());
                        int      JobInstanceId = int.Parse(DR["JobInstanceId"].ToString());
                        int      JobId         = int.Parse(DR["JobId"].ToString());
                        int      JobTypeId     = int.Parse(DR["JobTypeId"].ToString());
                        int      JobPriority   = int.Parse(DR["Priority"].ToString());
                        DateTime RunTime       = DateTime.Parse(DR["RunTime"].ToString());
                        string   JobParams     = DR["Params"].ToString();

                        JobParams JP = new JobParams();
                        JP.Init(JobParams);

                        Trace("Processing job part " + JobPartId.ToString());

                        try
                        {
                            Trace("Updating job part status " + JobPartId.ToString());

                            Job J = JobMgr.GetJobByType(JobTypeId);

                            J.Init(JobId, JobInstanceId, JobPriority, RunTime, JobPartId);

                            string        ErrorMsg;
                            JobPartStatus JPS = J.StartPart(JP, out ErrorMsg);

                            Params    = new SqlParameter[3];
                            Params[0] = new SqlParameter("Id", JobPartId);
                            Params[1] = new SqlParameter("Status", JPS);
                            Params[2] = new SqlParameter("ErrorMsg", ErrorMsg);

                            Utils.ExecuteNonQuery("sproc_UpdateJobPartStatus", Params);
                        }
                        catch (Exception Ex)
                        {
                            string Msg = "Unable to process job part. " + Ex.ToString();
                            Utils.LogError(Msg);

                            Params    = new SqlParameter[3];
                            Params[0] = new SqlParameter("Id", JobPartId);
                            Params[1] = new SqlParameter("Status", JobPartStatus.Failed);

                            Utils.ExecuteNonQuery("sproc_UpdateJobPartStatus", Params);
                        }
                    }

                    if (!HasItemsToProcess)
                    {
                        Trace("No job part items to process, waiting 5 minutes...");
                        Thread.Sleep(5 * 60 * 1000);
                    }
                }
                catch (Exception Ex)
                {
                    string Msg = "Unable to process job parts queue. " + Ex.ToString();
                    Utils.LogError(Msg);

                    if (Ex.ToString().IndexOf("Login failed") != -1)
                    {
                        break;
                    }
                }
            }
        }
Exemple #8
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            List <AdvisorVo>           adviserVoList         = new List <AdvisorVo>();
            AdviserMaintenanceBo       adviserMaintenanceBo  = new AdviserMaintenanceBo();
            CustomerPortfolioBo        customerPortfolioBo   = new CustomerPortfolioBo();
            PortfolioBo                portfolioBo           = new PortfolioBo();
            List <CustomerPortfolioVo> customerPortfolioList = new List <CustomerPortfolioVo>();
            List <MFPortfolioVo>       mfPortfolioList       = new List <MFPortfolioVo>();
            List <EQPortfolioVo>       eqPortfolioList       = new List <EQPortfolioVo>();
            List <int> customerList_MF   = new List <int>();
            List <int> customerList_EQ   = new List <int>();
            DataSet    dsMFValuationDate = new DataSet();
            DataSet    dsEQValuationDate = new DataSet();
            DateTime   tradeDate         = new DateTime();
            int        LogId             = 0;

            // if (DateTime.Now.TimeOfDay.Hours < 1)
            tradeDate = DateTime.Today;
            // else
            //  tradeDate = DateTime.Today;

            DateTime MFValuationDate;
            DateTime EQValuationDate;

            adviserVoList = adviserMaintenanceBo.GetAdviserList();

            for (int i = 0; i < adviserVoList.Count; i++)
            {
                dsMFValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "MF", tradeDate.Month, tradeDate.Year);
                dsEQValuationDate = customerPortfolioBo.GetAdviserValuationDate(adviserVoList[i].advisorId, "EQ", tradeDate.Month, tradeDate.Year);
                customerList_MF   = customerPortfolioBo.GetAdviserCustomerList_MF(adviserVoList[i].advisorId);
                customerList_EQ   = customerPortfolioBo.GetAdviserCustomerList_EQ(adviserVoList[i].advisorId);
                foreach (DataRow drMF in dsMFValuationDate.Tables[0].Rows)
                {
                    MFValuationDate = DateTime.Parse(drMF["WTD_Date"].ToString());
                    if (MFValuationDate != DateTime.Today || DateTime.Today.Hour > 23)
                    {
                        if (drMF["STAT"].ToString() == "Pending. Changes Found")
                        {
                            customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "MF", MFValuationDate, 0);
                        }
                        if (drMF["STAT"].ToString() != "Completed")
                        {
                            if (DateTime.Compare(MFValuationDate, DateTime.Today) <= 0)
                            {
                                if (customerList_MF != null && customerList_MF.Count != 0)
                                {
                                    LogId = CreateAdviserEODLog("MF", MFValuationDate, adviserVoList[i].advisorId);
                                    for (int j = 0; j < customerList_MF.Count; j++)
                                    {
                                        customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_MF[j]);
                                        customerPortfolioBo.DeleteMutualFundNetPosition(customerList_MF[j], MFValuationDate);
                                        if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                        {
                                            for (int k = 0; k < customerPortfolioList.Count; k++)
                                            {
                                                try
                                                {
                                                    mfPortfolioList = customerPortfolioBo.GetCustomerMFPortfolio(customerList_MF[j], customerPortfolioList[k].PortfolioId, MFValuationDate, "", "", "");
                                                }
                                                catch (Exception ex)
                                                {
                                                    Console.WriteLine("Exception: " + ex.ToString());
                                                }
                                                if (mfPortfolioList != null && mfPortfolioList.Count != 0)
                                                {
                                                    try
                                                    {
                                                        customerPortfolioBo.AddMutualFundNetPosition(mfPortfolioList, adviserVoList[i].UserId);
                                                    }
                                                    catch (Exception Ex)
                                                    {
                                                        Console.WriteLine("Exception: " + Ex.ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    UpdateAdviserEODLog("MF", 1, LogId);
                                }
                            }
                        }
                    }
                }

                foreach (DataRow drEQ in dsEQValuationDate.Tables[0].Rows)
                {
                    EQValuationDate = DateTime.Parse(drEQ["WTD_Date"].ToString());
                    if (EQValuationDate != DateTime.Today || DateTime.Today.Hour > 23)
                    {
                        if (drEQ["STAT"].ToString() == "Pending. Changes Found")
                        {
                            customerPortfolioBo.DeleteAdviserEODLog(adviserVoList[i].advisorId, "EQ", EQValuationDate, 0);
                        }
                        if (drEQ["STAT"].ToString() != "Completed")
                        {
                            if (DateTime.Compare(EQValuationDate, DateTime.Today) <= 0)
                            {
                                if (customerList_EQ != null && customerList_EQ.Count != 0)
                                {
                                    LogId = CreateAdviserEODLog("EQ", EQValuationDate, adviserVoList[i].advisorId);
                                    for (int j = 0; j < customerList_EQ.Count; j++)
                                    {
                                        customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerList_EQ[j]);
                                        customerPortfolioBo.DeleteEquityNetPosition(customerList_EQ[j], EQValuationDate);
                                        if (customerPortfolioList != null && customerPortfolioList.Count != 0)
                                        {
                                            for (int k = 0; k < customerPortfolioList.Count; k++)
                                            {
                                                try
                                                {
                                                    eqPortfolioList = customerPortfolioBo.GetCustomerEquityPortfolio(customerList_EQ[j], customerPortfolioList[k].PortfolioId, EQValuationDate, string.Empty, string.Empty);
                                                }
                                                catch (Exception Ex)
                                                {
                                                    Console.WriteLine("Exception: " + Ex.ToString());
                                                }
                                                if (eqPortfolioList != null && eqPortfolioList.Count != 0)
                                                {
                                                    try
                                                    {
                                                        customerPortfolioBo.AddEquityNetPosition(eqPortfolioList, adviserVoList[i].UserId);
                                                    }
                                                    catch (Exception Ex)
                                                    {
                                                        Console.WriteLine("Exception: " + Ex.ToString());
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    UpdateAdviserEODLog("EQ", 1, LogId);
                                }
                            }
                        }
                    }
                }
            }

            ErrorMsg = "";
            return(JobStatus.SuccessFull);
        }
Exemple #9
0
        public virtual JobPartStatus StartPart(JobParams JP, out string ErrorMsg)
        {
            ErrorMsg = "";

            return(JobPartStatus.Success);
        }
Exemple #10
0
        public override JobStatus Start(JobParams JP, out string ErrorMsg)
        {
            ErrorMsg = "";

            return(JobStatus.SuccessFull);
        }