コード例 #1
0
        protected void SendMessage_Click(object sender, EventArgs e)
        {
            try
            {
                AdviserMaintenanceBo advisermaintanencebo = new AdviserMaintenanceBo();
                DateTime             dtExpiry             = new DateTime();
                bool   result       = false;
                string gvAdviserIds = "";

                foreach (GridViewRow gvRow in gvAdviserList.Rows)
                {
                    CheckBox ChkBxItem = (CheckBox)gvRow.FindControl("chkBx");
                    if (ChkBxItem.Checked)
                    {
                        gvAdviserIds += Convert.ToString(gvAdviserList.DataKeys[gvRow.RowIndex].Value) + "~";
                    }
                }
                result = DateTime.TryParse(txtExpiryDate.Text.ToString(), out dtExpiry);
                advisermaintanencebo.MessageBroadcastSendMessage(MessageBox.Text, DateTime.Now, dtExpiry, gvAdviserIds);
                SuccessMessage.Visible = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //    [WebMethod]
        //    [ScriptMethod(UseHttpGet = false,
        //XmlSerializeString = true, ResponseFormat = ResponseFormat.Xml)]
        //    public XmlDocument XmlData()
        //    {
        //        int page = 1;
        //        int total = 4;
        //        XDocument xmlDoc = new XDocument(
        //            new XDeclaration("1.0", "utf-8", "yes"),
        //            new XElement("rows",
        //            new XElement("page", page.ToString()),
        //            new XElement("total", total.ToString(),
        //                new XElement("row", new XAttribute("id", "111"),
        //                    new XElement("cell", "111"),
        //                    new XElement("cell", "row1"),
        //                    new XElement("cell", "rowDescription1"),
        //                    new XElement("cell", "rowUnit1"),
        //                    new XElement("cell", "rowUnitPrice1"),
        //                    new XElement("cell", DateTime.Now.ToShortDateString())
        //    ),
        //    new XElement("row", new XAttribute("id", "222"),
        //                    new XElement("cell", "222"),
        //                    new XElement("cell", "row2"),
        //                    new XElement("cell", "rowDescription2"),
        //                    new XElement("cell", "rowUnit2"),
        //                    new XElement("cell", "rowUnitPrice2"),
        //                    new XElement("cell", DateTime.Now.ToShortDateString())
        //    ),
        //     new XElement("row", new XAttribute("id", "333"),
        //                    new XElement("cell", "333"),
        //                    new XElement("cell", "row3"),
        //                    new XElement("cell", "rowDescription3"),
        //                    new XElement("cell", "rowUnit3"),
        //                    new XElement("cell", "rowUnitPrice3"),
        //                    new XElement("cell", DateTime.Now.ToShortDateString())
        //    ),
        //       new XElement("row", new XAttribute("id", "444"),
        //                    new XElement("cell", "444"),
        //                    new XElement("cell", "row4"),
        //                    new XElement("cell", "rowDescription4"),
        //                    new XElement("cell", "rowUnit4"),
        //                    new XElement("cell", "rowUnitPrice4"),
        //                    new XElement("cell", DateTime.Now.ToShortDateString())
        //    )
        //                                       )
        //                            )
        //    );

        //        XmlDocument newDoc = new XmlDocument();
        //        newDoc.LoadXml(xmlDoc.ToString());
        //        return newDoc;
        //    }
        protected void SendMessage_Click(object sender, EventArgs e)
        {
            try
            {
                AdviserMaintenanceBo advisermaintanencebo = new AdviserMaintenanceBo();
                DateTime             dtExpiry             = new DateTime();
                bool result = false;
                result = DateTime.TryParse(txtExpiryDate.Text.ToString(), out dtExpiry);
                advisermaintanencebo.MessageBroadcastSendMessage(MessageBox.Text, DateTime.Now, dtExpiry);
                SuccessMessage.Visible = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            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;
            int        year  = int.Parse(ConfigurationSettings.AppSettings["YEAR"].ToString());
            int        month = int.Parse(ConfigurationSettings.AppSettings["MONTH"].ToString());
            int        day   = int.Parse(ConfigurationSettings.AppSettings["FROMDAY"].ToString());

            tradeDate = new DateTime(year, month, 01);
            while (tradeDate.Year == year && tradeDate.Month == month)
            {
                //if (DateTime.Now.TimeOfDay.Hours < 1)
                //    tradeDate = DateTime.Today.AddDays(-1);
                //else

                Console.WriteLine("Starting for the Year:" + tradeDate.Year.ToString() + "Month:" + tradeDate.Month.ToString());
                DateTime MFValuationDate;
                DateTime EQValuationDate;
                try
                {
                    adviserVoList = adviserMaintenanceBo.GetAdviserList();
                    Console.WriteLine("Starting Valuation Process for " + adviserVoList.Count.ToString() + " Advisers");
                    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);
                        Console.WriteLine("Starting MF Valuation Process for Adviser: " + adviserVoList[i].OrganizationName.ToString());

                        foreach (DataRow drMF in dsMFValuationDate.Tables[0].Rows)
                        {
                            if (DateTime.Parse(drMF["WTD_Date"].ToString()).Day != DateTime.Now.Day && DateTime.Parse(drMF["WTD_Date"].ToString()).Day > day)
                            {
                                MFValuationDate = DateTime.Parse(drMF["WTD_Date"].ToString());
                                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++)
                                                    {
                                                        Console.WriteLine("Starting MF Valuation Process for Customer:" + j.ToString() + " Portfolio:" + k.ToString() + " Date:" + MFValuationDate.ToShortDateString());
                                                        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);
                                        }
                                    }
                                }
                            }
                        }
                        #region Equity Valuation
                        Console.WriteLine("Starting EQ Valuation Process for Adviser " + i.ToString());

                        foreach (DataRow drEQ in dsEQValuationDate.Tables[0].Rows)
                        {
                            EQValuationDate = DateTime.Parse(drEQ["WTD_Date"].ToString());
                            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++)
                                                {
                                                    Console.WriteLine("Starting EQ Valuation Process for Customer:" + j.ToString() + " Portfolio:" + k.ToString() + " Date:" + EQValuationDate.ToShortDateString());
                                                    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);
                                    }
                                }
                            }
                        }
                        #endregion Equity Valuation
                    }
                }
                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[2];
                    objects[0]   = 0;
                    objects[1]   = tradeDate;
                    FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                    exBase.AdditionalInformation = FunctionInfo;
                    ExceptionManager.Publish(exBase);
                    throw exBase;
                }
                tradeDate = tradeDate.AddMonths(1);
            }
        }
コード例 #4
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);
        }