Esempio n. 1
0
        private static int CreateAdviserEODLog(string p, DateTime dt, int adviserId)
        {
            int LogId = 0;

            AdviserDailyLOGVo   adviserDaliyLOGVo   = new AdviserDailyLOGVo();
            CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();

            try
            {
                adviserDaliyLOGVo.AdviserId   = adviserId;
                adviserDaliyLOGVo.CreatedBy   = 100;
                adviserDaliyLOGVo.StartTime   = DateTime.Now;
                adviserDaliyLOGVo.ProcessDate = dt;
                adviserDaliyLOGVo.AssetGroup  = p;
                LogId = customerPortfolioBo.CreateAdviserEODLog(adviserDaliyLOGVo);
            }
            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]   = p;
                objects[1]   = dt;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(LogId);
        }
Esempio n. 2
0
        private static void UpdateAdviserEODLog(string group, int IsComplete, int LogId)
        {
            AdviserDailyLOGVo   adviserDaliyLOGVo   = new AdviserDailyLOGVo();
            CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();

            try
            {
                adviserDaliyLOGVo.IsEquityCleanUpComplete = 0;
                adviserDaliyLOGVo.IsValuationComplete     = IsComplete;
                adviserDaliyLOGVo.ModifiedBy = 100;
                adviserDaliyLOGVo.EODLogId   = LogId;
                adviserDaliyLOGVo.AssetGroup = group;
                adviserDaliyLOGVo.EndTime    = DateTime.Now;
                customerPortfolioBo.UpdateAdviserEODLog(adviserDaliyLOGVo);
            }
            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:UpdateAdviserEODLog()");
                object[] objects = new object[3];
                objects[0]   = group;
                objects[1]   = IsComplete;
                objects[2]   = LogId;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
        }
        protected void hiddenassociation_Click(object sender, EventArgs e)
        {
            string val = Convert.ToString(hdnMsgValue.Value);

            if (val == "1")
            {
                bool        DeleteAccount;
                CustomerVo  customervo  = (CustomerVo)Session["customerVo"];
                int         Account     = customervo.CustomerId;
                InsuranceVo insuranceVo = (InsuranceVo)Session["insuranceId"];
                int         InsuranceNo = insuranceVo.AccountId;



                //int Insurance = Session ;
                CustomerPortfolioBo BoCustomerPortfolio = new CustomerPortfolioBo();
                DeleteAccount = BoCustomerPortfolio.DeleteGIAccount(Account, InsuranceNo);


                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('ViewGeneralInsuranceDetails','none');", true);
            }
            if (val == "0")
            {
                Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('ViewGeneralInsuranceDetails','none');", true);
            }
        }
Esempio n. 4
0
        public bool WERPEQInsertTransDetails(int processId, string Packagepath, string configPath)
        {
            bool blResult = false;

            try
            {
                Package werpEQTranPkg1 = App.LoadPackage(Packagepath, null);
                werpEQTranPkg1.Variables["varProcessIdDataFlow"].Value    = processId;
                werpEQTranPkg1.Variables["varProcessIdUpdateTable"].Value = processId;
                werpEQTranPkg1.ImportConfigurationFile(configPath);
                DTSExecResult werpEQTranResult1 = werpEQTranPkg1.Execute();
                if (werpEQTranResult1.ToString() == "Success")
                {
                    //To update the least trans date for the process.
                    DataSet             dsmindateval        = new DataSet();
                    UploadsCommonDao    uploadscommonDao    = new UploadsCommonDao();
                    CustomerPortfolioBo customerportfoliobo = new CustomerPortfolioBo();
                    bool valupdated = true;
                    dsmindateval = uploadscommonDao.GetMinDateofUploadTrans(processId, "EQ");
                    if (dsmindateval.Tables[0].Rows.Count != 0)
                    {
                        DateTime LeastTransDate = DateTime.Parse(dsmindateval.Tables[0].Rows[0]["MinDate"].ToString());
                        int      AdvId          = int.Parse(dsmindateval.Tables[0].Rows[0]["AdviserId"].ToString());
                        valupdated = customerportfoliobo.UpdateAdviserDailyEODLogRevaluateForTransaction(AdvId, "EQ", LeastTransDate);
                    }
                    if (valupdated)
                    {
                        blResult = true;
                    }
                }
            }
            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }
            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();

                FunctionInfo.Add("Method", "WerpMFUploadsBo.cs:WerpMFInsertToInputProfile()");

                object[] objects = new object[2];
                objects[0] = processId;
                objects[1] = Packagepath;

                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(blResult);
        }
        /// <summary>
        /// Creating Data Table For "ELIGIBLE CAPITAL GAIN DETAILS & SUMMARY" Report : "Author:Pramod"
        /// </summary>
        /// <param name="reports">"reports" is a object of "MFReportVo" Contails report parameters </param>
        /// <returns> DataTable</returns>
        public DataTable GetEligibleCapitalGainDetailsReport(MFReportVo reports)
        {
            DataTable dtEligibleCapitalGainDetails = new DataTable();

            dtEligibleCapitalGainDetails.Columns.Add("CustomerName");
            dtEligibleCapitalGainDetails.Columns.Add("CustomerId");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioName");
            dtEligibleCapitalGainDetails.Columns.Add("PortfolioId");
            dtEligibleCapitalGainDetails.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("RedDate");
            dtEligibleCapitalGainDetails.Columns.Add("RedAmount", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("DaysInvestedFor");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseDate");
            dtEligibleCapitalGainDetails.Columns.Add("PurchaseAmount", System.Type.GetType("System.Double"));

            dtEligibleCapitalGainDetails.Columns.Add("FolioNum");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanCode");
            dtEligibleCapitalGainDetails.Columns.Add("SchemePlanName");

            dtEligibleCapitalGainDetails.Columns.Add("STCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("LTCGTax", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("Category");
            dtEligibleCapitalGainDetails.Columns.Add("CurrNAV", System.Type.GetType("System.Double"));
            dtEligibleCapitalGainDetails.Columns.Add("CurrVALUE", System.Type.GetType("System.Double"));

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == false && mFPortfolioTransaction.BuyDate < reports.ToDate)
                                {
                                    DataRow drEligibleCapitalGainDetails = dtEligibleCapitalGainDetails.NewRow();

                                    drEligibleCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drEligibleCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drEligibleCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drEligibleCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drEligibleCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Units"]      = mFPortfolioTransaction.BuyQuantity;
                                    drEligibleCapitalGainDetails["RedDate"]    = mFPortfolioTransaction.SellDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["RedAmount"]  = mFPortfolioTransaction.NetSalesProceed;

                                    drEligibleCapitalGainDetails["DaysInvestedFor"] = mFPortfolioTransaction.AgeOfInvestment;

                                    drEligibleCapitalGainDetails["PurchaseDate"]   = mFPortfolioTransaction.BuyDate.ToShortDateString();
                                    drEligibleCapitalGainDetails["PurchaseAmount"] = mFPortfolioTransaction.CostOfAcquisition;

                                    drEligibleCapitalGainDetails["FolioNum"]       = mFPortfolioVo.Folio;
                                    drEligibleCapitalGainDetails["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drEligibleCapitalGainDetails["SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drEligibleCapitalGainDetails["STCGTax"]  = mFPortfolioTransaction.STCGTax;
                                    drEligibleCapitalGainDetails["LTCGTax"]  = mFPortfolioTransaction.LTCGTax;
                                    drEligibleCapitalGainDetails["Category"] = mFPortfolioVo.Category;

                                    drEligibleCapitalGainDetails["CurrNAV"]   = mFPortfolioTransaction.CurrentNAV;
                                    drEligibleCapitalGainDetails["CurrVALUE"] = mFPortfolioTransaction.CurrentValue;


                                    dtEligibleCapitalGainDetails.Rows.Add(drEligibleCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtEligibleCapitalGainDetails);
        }
        public DataTable GetCapitalGainSummaryReport(MFReportVo reports)
        {
            DataTable dtCapitalGainSummary = new DataTable();

            dtCapitalGainSummary.Columns.Add("CustomerName");
            dtCapitalGainSummary.Columns.Add("CustomerId");
            dtCapitalGainSummary.Columns.Add("PortfolioName");
            dtCapitalGainSummary.Columns.Add("PortfolioId");
            dtCapitalGainSummary.Columns.Add("GainOrLoss", System.Type.GetType("System.Double"));

            dtCapitalGainSummary.Columns.Add("FolioNum");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanCode");
            dtCapitalGainSummary.Columns.Add("PASP_SchemePlanName");


            dtCapitalGainSummary.Columns.Add("STCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("LTCGAmount", System.Type.GetType("System.Double"));
            dtCapitalGainSummary.Columns.Add("Category");


            DataRow dtRow = dtCapitalGainSummary.NewRow();

            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();


            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32   portfoliioId        = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.ToDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                if (mFPortfolioTransaction.Closed == true && mFPortfolioTransaction.SellDate > reports.FromDate && mFPortfolioTransaction.SellDate < reports.ToDate)
                                {
                                    DataRow drCapitalGainDetails = dtCapitalGainSummary.NewRow();

                                    drCapitalGainDetails["CustomerName"] = drPortfolioCustomer["C_FirstName"].ToString();
                                    drCapitalGainDetails["CustomerId"]   = mFPortfolioVo.CustomerId;
                                    if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                    {
                                        drCapitalGainDetails["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                    }
                                    drCapitalGainDetails["PortfolioId"] = portfoliioId;

                                    //drCapitalGainDetails["GainOrLoss"] = mFPortfolioTransaction.RealizedProfitLoss;
                                    drCapitalGainDetails["GainOrLoss"]          = mFPortfolioTransaction.STCGTax + mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["FolioNum"]            = mFPortfolioVo.Folio;
                                    drCapitalGainDetails["PASP_SchemePlanCode"] = mFPortfolioVo.MFCode;
                                    drCapitalGainDetails["PASP_SchemePlanName"] = mFPortfolioVo.SchemePlan;

                                    drCapitalGainDetails["STCGAmount"] = mFPortfolioTransaction.STCGTax;
                                    drCapitalGainDetails["LTCGAmount"] = mFPortfolioTransaction.LTCGTax;
                                    drCapitalGainDetails["Category"]   = mFPortfolioVo.Category;

                                    dtCapitalGainSummary.Rows.Add(drCapitalGainDetails);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtCapitalGainSummary);
        }
        public DataTable GetReturnTransactionSummaryReport(MFReportVo reports)
        {
            DataTable            dtReturnTransaction   = new DataTable();
            PortfolioBo          portfolioBo           = new PortfolioBo();
            CustomerPortfolioBo  customerPortfolioBo   = new CustomerPortfolioBo();
            DataSet              dsReturnsTransactions = new DataSet();
            List <MFPortfolioVo> mfPortfolioVoList     = new List <MFPortfolioVo>();

            dtReturnTransaction.Columns.Add("TransactionType");
            dtReturnTransaction.Columns.Add("Units", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("PurchasePrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("PurchaseCost", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SellDate", System.Type.GetType("System.DateTime"));
            dtReturnTransaction.Columns.Add("SellPrice", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("SaleProceed", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsonDateNAV", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AsOnDateValue", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AgeOfInvestment", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("ActualPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("NotionalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("TotalPL", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AbsoluteReturn", System.Type.GetType("System.Double"));
            dtReturnTransaction.Columns.Add("AnnualReturn", System.Type.GetType("System.Double"));


            dtReturnTransaction.Columns.Add("SchemePlanCode");
            dtReturnTransaction.Columns.Add("SchemePlanName");
            dtReturnTransaction.Columns.Add("FolioNum");
            dtReturnTransaction.Columns.Add("CustomerName");
            dtReturnTransaction.Columns.Add("CustomerId");
            dtReturnTransaction.Columns.Add("PortfolioName");
            dtReturnTransaction.Columns.Add("PortfolioId");

            try
            {
                String[] portfolioIds = reports.PortfolioIds.Split(',');
                foreach (string strPortfoliioId in portfolioIds)
                {
                    mfPortfolioVoList = new List <MFPortfolioVo>();
                    Int32 portfoliioId = 0;
                    portfoliioId = Convert.ToInt32(strPortfoliioId);
                    DataSet dsPortfolioCustomer = portfolioBo.GetCustomerPortfolioDetails(portfoliioId);
                    DataRow drPortfolioCustomer = dsPortfolioCustomer.Tables[0].Rows[0];
                    mfPortfolioVoList = customerPortfolioBo.GetCustomerMFPortfolio(int.Parse(drPortfolioCustomer["C_CustomerId"].ToString()), portfoliioId, reports.FromDate, "", "", "");
                    if (mfPortfolioVoList != null && mfPortfolioVoList.Count > 0)
                    {
                        foreach (MFPortfolioVo mFPortfolioVo in mfPortfolioVoList)
                        {
                            foreach (MFPortfolioTransactionVo mFPortfolioTransaction in mFPortfolioVo.MFPortfolioTransactionVoList)
                            {
                                DataRow drReturnTransaction = dtReturnTransaction.NewRow();
                                drReturnTransaction["TransactionType"] = mFPortfolioTransaction.TransactionType;
                                drReturnTransaction["Units"]           = mFPortfolioTransaction.BuyQuantity; //
                                drReturnTransaction["PurchaseDate"]    = mFPortfolioTransaction.BuyDate;
                                drReturnTransaction["PurchasePrice"]   = mFPortfolioTransaction.BuyPrice;
                                drReturnTransaction["PurchaseCost"]    = mFPortfolioTransaction.CostOfAcquisition; //
                                drReturnTransaction["SellDate"]        = mFPortfolioTransaction.SellDate;
                                drReturnTransaction["SellPrice"]       = mFPortfolioTransaction.SellPrice;
                                drReturnTransaction["SaleProceed"]     = mFPortfolioTransaction.RealizedSalesValue;
                                drReturnTransaction["AsonDateNAV"]     = mFPortfolioTransaction.CurrentNAV;//
                                drReturnTransaction["AsOnDateValue"]   = mFPortfolioTransaction.CurrentValue;
                                drReturnTransaction["AgeOfInvestment"] = mFPortfolioTransaction.AgeOfInvestment;
                                drReturnTransaction["ActualPL"]        = mFPortfolioTransaction.RealizedProfitLoss;
                                drReturnTransaction["NotionalPL"]      = mFPortfolioTransaction.NotionalProfitLoss;
                                drReturnTransaction["TotalPL"]         = mFPortfolioTransaction.TotalProfitLoss;
                                drReturnTransaction["AbsoluteReturn"]  = mFPortfolioTransaction.AbsoluteReturns;
                                drReturnTransaction["AnnualReturn"]    = mFPortfolioTransaction.AnnualReturns;


                                drReturnTransaction["SchemePlanCode"] = mFPortfolioVo.MFCode;
                                drReturnTransaction["SchemePlanName"] = mFPortfolioVo.SchemePlan;
                                drReturnTransaction["FolioNum"]       = mFPortfolioVo.Folio;
                                drReturnTransaction["CustomerName"]   = drPortfolioCustomer["C_FirstName"].ToString();
                                drReturnTransaction["CustomerId"]     = mFPortfolioVo.CustomerId;
                                if (drPortfolioCustomer["CP_PortfolioName"] != null)
                                {
                                    drReturnTransaction["PortfolioName"] = drPortfolioCustomer["CP_PortfolioName"].ToString();
                                }
                                drReturnTransaction["PortfolioId"] = portfoliioId;
                                dtReturnTransaction.Rows.Add(drReturnTransaction);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(dtReturnTransaction);
        }
Esempio n. 8
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);
            }
        }
Esempio n. 9
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);
        }
        private bool ExportToPDF(MFReportVo reportVo)
        {
            MFReportsBo mfReports  = new MFReportsBo();
            CustomerBo  customerBo = new CustomerBo();
            AdvisorBo   advisorBo  = new AdvisorBo();
            ////////////////////////////report = (MFReportVo)Session["reportParams"];
            //customerVo = (CustomerVo)Session["CusVo"];
            //if (Session["CusVo"] != null)
            //    customerVo = (CustomerVo)Session["CusVo"];
            string fileExtension        = ".pdf";
            string finalReportPath      = string.Empty;
            string exportReportFullPath = string.Empty;

            crmain = new ReportDocument();
            try
            {
                if (string.IsNullOrEmpty(tempAdviserId))
                {
                    tempAdviserId = reportVo.AdviserId.ToString();
                    advisorVo     = advisorBo.GetAdvisor(reportVo.AdviserId);
                }

                if (string.IsNullOrEmpty(tempCustomerId))
                {
                    tempCustomerId = reportVo.CustomerIds.ToString();
                    customerVo     = customerBo.GetCustomer(Convert.ToInt32(reportVo.CustomerIds));
                }

                if (tempAdviserId != reportVo.AdviserId.ToString())
                {
                    advisorVo = advisorBo.GetAdvisor(reportVo.AdviserId);
                }
                if (tempRMId != reportVo.RMId.ToString())
                {
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(reportVo.RMId);
                }
                if (tempCustomerId != reportVo.CustomerIds.ToString())
                {
                    customerVo = customerBo.GetCustomer(Convert.ToInt32(reportVo.CustomerIds));
                }
                if (string.IsNullOrEmpty(tempRMId))
                {
                    tempRMId     = reportVo.RMId.ToString();
                    customerRMVo = adviserStaffBo.GetAdvisorStaffDetails(customerVo.RmId);
                }



                switch (reportVo.SubType)
                {
                case "CAPITAL_GAIN_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\CapitalGainSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtCapitalGainSummary = mfReports.GetCapitalGainSummaryReport(reportVo);
                    if (dtCapitalGainSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtCapitalGainSummary);
                        setLogo(adviserLogoPath);

                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("FromDate", report.FromDate.ToShortDateString());
                        //crmain.SetParameterValue("ToDate", report.ToDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "CAPITAL_GAIN_DETAILS":
                {
                    finalReportPath = reportFilePath + @"\CapitalGainDetails.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtCapitalGainDetails = mfReports.GetCapitalGainDetailsReport(reportVo);
                    if (dtCapitalGainDetails.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtCapitalGainDetails);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("FromDate", report.FromDate.ToShortDateString());
                        //crmain.SetParameterValue("ToDate", report.ToDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }


                case "CATEGORY_WISE":
                {
                    finalReportPath = reportFilePath + @"\MFFundSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataSet dsMFFundSummary = mfReports.GetMFFundSummaryReport(reportVo, advisorVo.advisorId);
                    if (dsMFFundSummary.Tables[0].Rows.Count > 0 || dsMFFundSummary.Tables[1].Rows.Count > 0)
                    {
                        crmain.Subreports["OpenPositionReport"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[0]);
                        crmain.Subreports["AllPositionReport1"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[1]);
                        crmain.Subreports["AllPositionReport2"].Database.Tables[0].SetDataSource(dsMFFundSummary.Tables[1]);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("PreviousMonthDate", DateBo.GetPreviousMonthLastDate(reportVo.FromDate).ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "TRANSACTION_REPORT":
                {
                    finalReportPath = reportFilePath + @"\MFTransactions.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtTransactions = mfReports.GetTransactionReport(reportVo);
                    if (dtTransactions.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtTransactions);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtTransactions.Rows[0]["CustomerName"].ToString()))
                        // crmain.SetParameterValue("CustomerName", "Cust");
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));

                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "DIVIDEND_STATEMENT":
                {
                    finalReportPath = reportFilePath + @"\MFDividend.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtDividend = mfReports.GetDivdendReport(reportVo);
                    if (dtDividend.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtDividend);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        //crmain.SetParameterValue("CustomerName", "--");
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }

                case "RETURNS_PORTFOLIO":
                {
                    finalReportPath = reportFilePath + @"\MFReturns.rpt";
                    crmain.Load(finalReportPath);
                    //DataTable dtDividendReturnHolding = mfReports.GetDivdendReport(reportVo);
                    CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();
                    //DataTable dtReturnsPortfolio = mfReports.GetReturnSummaryReport(reportVo, advisorVo.advisorId);

                    //DataTable dtPortfolioXIRR = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);
                    //dtPortfolioXIRR = GetAbsolutereturnToXIRRDt(dtPortfolioXIRR, dtReturnsPortfolio);

                    DataSet   dsReturnsPortfolioHoldings = mfReports.GetReturnSummaryReport(reportVo, advisorVo.advisorId);
                    DataTable dtReturnsPortfolio         = dsReturnsPortfolioHoldings.Tables[0];
                    DataTable dtPortfolioXIRR            = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);
                    dtReturnsPortfolio = dsReturnsPortfolioHoldings.Tables[1];
                    dtPortfolioXIRR    = GetAbsolutereturnToXIRRDt(dtPortfolioXIRR, dtReturnsPortfolio);

                    if (dtReturnsPortfolio.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dsReturnsPortfolioHoldings.Tables[0]);
                        setLogo(adviserLogoPath);
                        crmain.Subreports["PortfolioXIRR"].Database.Tables["PortfolioXIRR"].SetDataSource(dtPortfolioXIRR);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        //crmain.SetParameterValue("CustomerName", "--");
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "COMPREHENSIVE":
                {
                    finalReportPath = reportFilePath + @"\ComprehensiveMFReport.rpt";
                    crmain.Load(finalReportPath);
                    CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();
                    DataSet             dsReturnsPortfolio  = mfReports.GetPortfolioAnalyticsReport(reportVo, advisorVo.advisorId);
                    DataTable           dtReturnsPortfolio  = dsReturnsPortfolio.Tables[0];

                    DataTable dtPortfolioXIRRComp = customerPortfolioBo.GetCustomerPortfolioLabelXIRR(reportVo.PortfolioIds);

                    dtReturnsPortfolio = dsReturnsPortfolio.Tables[1];
                    DataTable dtPortfolioXIRR = GetAbsolutereturnToXIRRDt(dtPortfolioXIRRComp, dtReturnsPortfolio);
                    if (dsReturnsPortfolio.Tables[0].Rows.Count > 0)
                    {
                        crmain.SetDataSource(dsReturnsPortfolio.Tables[0]);
                        crmain.Subreports["Portfolio_XIRR"].Database.Tables["PortfolioXIRR"].SetDataSource(dtPortfolioXIRRComp);
                        //crmain.Subreports["MFSchemePerformance"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[1]);
                        //crmain.Subreports["MFTopTenHoldings"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[2]);
                        //crmain.Subreports["MFTopTenSectors"].Database.Tables[0].SetDataSource(dsReturnsPortfolio.Tables[5]);

                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);

                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "DIVIDEND_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\MFDividendSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtDividendSummary = mfReports.GetDivdendReport(reportVo);
                    //customerVo = (CustomerVo)Session["CusVo"];
                    if (dtDividendSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtDividendSummary);
                        setLogo(adviserLogoPath);
                        //if (!String.IsNullOrEmpty(dtDividend.Rows[0]["Name"].ToString()))
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));

                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }
                //Added Three more cases for Display three new report : Author-Pramod
                //case "RETURNS_PORTFOLIO_REALIZED":
                //    {
                //        finalReportPath = reportFilePath + @"\MFReturnsRealized.rpt";
                //        crmain.Load(finalReportPath);
                //        DataTable dtReturnsREPortfolio = mfReports.GetMFReturnRESummaryReport(reportVo, advisorVo.advisorId);
                //        if (dtReturnsREPortfolio.Rows.Count > 0)
                //        {
                //            crmain.SetDataSource(dtReturnsREPortfolio);
                //            setLogo(adviserLogoPath);
                //            crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                //            crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToShortDateString());
                //            crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToShortDateString());
                //            AssignReportViewerProperties();
                //            reportFileName = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                //            exportReportFullPath = savedLocation + @"/" + reportFileName;
                //            crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                //        }

                //        break;
                //    }

                case "ELIGIBLE_CAPITAL_GAIN_DETAILS":
                {
                    finalReportPath = reportFilePath + @"\EligibleCapitalGainsSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtEligibleCapitalGainsDetails = mfReports.GetEligibleCapitalGainDetailsReport(reportVo);
                    if (dtEligibleCapitalGainsDetails.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtEligibleCapitalGainsDetails);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        //crmain.SetParameterValue("AsOnDate", report.FromDate.ToShortDateString());
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;
                }

                case "ELIGIBLE_CAPITAL_GAIN_SUMMARY":
                {
                    finalReportPath = reportFilePath + @"\EligibleCapitalGainsSummary.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtEligibleCapitalGainsSummary = mfReports.GetEligibleCapitalGainDetailsReport(reportVo);
                    if (dtEligibleCapitalGainsSummary.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtEligibleCapitalGainsSummary);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        //crmain.SetParameterValue("DateRange", "As on: " + report.ToDate.ToShortDateString());
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();
                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                }
                break;

                case "TRANSACTION_REPORT_OPEN_CLOSE_BALANCE":
                    finalReportPath = reportFilePath + @"\MFOpenCloseTransactionReport.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtOpeningClosingTransactions = mfReports.GetOpeningClosingTransactionReport(reportVo);
                    if (dtOpeningClosingTransactions.Rows.Count > 0)
                    {
                        setLogo(adviserLogoPath);
                        //crmain.SetDataSource(dtOpeningClosingTransactions);
                        crmain.Database.Tables["MFOpenCloseTransactionReport"].SetDataSource((DataTable)dtOpeningClosingTransactions);

                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "Period: " + reportVo.FromDate.ToString("dd/MM/yy") + " to " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("FromDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("ToDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;

                case "REALIZED_REPORT":
                    finalReportPath = reportFilePath + @"\MFRealized.rpt";
                    crmain.Load(finalReportPath);
                    DataTable dtMFRealized = mfReports.GetMFRealizedReport(reportVo, advisorVo.advisorId);
                    if (dtMFRealized.Rows.Count > 0)
                    {
                        crmain.SetDataSource(dtMFRealized);
                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.ToDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.FromDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }

                    break;

                case "COMPOSITION_REPORT":
                    finalReportPath = reportFilePath + @"\SchemePerformance.rpt";
                    crmain.Load(finalReportPath);
                    DataSet dsCustomerPortfolioComposition = mfReports.GetPortfolioCompositionReport(reportVo, advisorVo.advisorId);

                    if (dsCustomerPortfolioComposition.Tables[0].Rows.Count > 0)
                    {
                        //crmain.SetDataSource(dsCustomerPortfolioComposition.Tables[0]);
                        crmain.Database.Tables["PortfolioComposition"].SetDataSource(dsCustomerPortfolioComposition.Tables[0]);
                        crmain.Subreports["MFTopTenHoldings"].Database.Tables["ToptenHoldings"].SetDataSource(dsCustomerPortfolioComposition.Tables[1]);
                        crmain.Subreports["MFTopTenSectors"].Database.Tables["TopTenSectors"].SetDataSource(dsCustomerPortfolioComposition.Tables[4]);

                        setLogo(adviserLogoPath);
                        crmain.SetParameterValue("CustomerName", customerVo.FirstName + " " + customerVo.MiddleName + " " + customerVo.LastName);
                        crmain.SetParameterValue("DateRange", "As on: " + reportVo.FromDate.ToString("dd/MM/yy"));
                        crmain.SetParameterValue("AsOnDate", reportVo.ToDate.ToString("dd/MM/yy"));
                        AssignReportViewerProperties();

                        reportFileName       = reportVo.SubType + "_" + DateTime.Now.Ticks.ToString() + fileExtension;
                        exportReportFullPath = savedLocation + @"/" + reportFileName;
                        crmain.ExportToDisk(ExportFormatType.PortableDocFormat, exportReportFullPath);
                        reportStatus = "Exported_Successfully";
                    }
                    else
                    {
                        reportStatus = "No_Record_Found";
                    }
                    break;
                }
                //Filling Emails
            }
            catch (Exception ex)
            {
                throw (ex);
            }

            if (!string.IsNullOrEmpty(reportFileName))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 11
0
        //protected void gvCustomerPortfolio_RowDataBound(object sender, GridViewRowEventArgs e)
        //{
        //    customerPortfolioList = portfolioBo.GetCustomerPortfolios(customerVo.CustomerId);

        //    DataTable dt = new DataTable();
        //    dt.Columns.Add("PortfolioId");
        //    dt.Columns.Add("lblPortfolioName");

        //    DataRowView drv = e.Row.DataItem as DataRowView;


        //    if (e.Row.RowType == DataControlRowType.DataRow)
        //    {

        //        DropDownList ddlType;

        //        ddlType = e.Row.FindControl("ddlType") as DropDownList;

        //        RadioButton rbtn;
        //        rbtn = e.Row.FindControl("rbtnPortfolio") as RadioButton;
        //        if (ddlType != null)
        //        {

        //            ddlType.DataSource = BindPortfolioType(path);
        //            ddlType.DataTextField = "PortfolioType";
        //            ddlType.DataValueField = "PortfolioTypeCode";
        //            ddlType.DataBind();
        //            customerPortfolioVo = new CustomerPortfolioVo();
        //            customerPortfolioVo = customerPortfolioList[gvCustomerPortfolio.Rows.Count];
        //            /*Bind the Selected Value to the Drop Down*/

        //            ddlType.SelectedValue = customerPortfolioVo.PortfolioTypeCode.ToString();

        //            if (customerPortfolioVo.IsMainPortfolio == 1)
        //            {



        //                rbtn.Checked = true;

        //            }
        //            else
        //            {
        //                rbtn.Checked = false;
        //            }
        //        }
        //    }
        //    if (e.Row.RowType == DataControlRowType.Footer)
        //    {
        //        DropDownList ddlAddType;

        //        ddlAddType = e.Row.FindControl("ddlAddType") as DropDownList;
        //        if (ddlAddType != null)
        //        {
        //            ddlAddType.DataSource = BindPortfolioType(path);
        //            ddlAddType.DataTextField = "PortfolioType";
        //            ddlAddType.DataValueField = "PortfolioTypeCode";
        //            ddlAddType.DataBind();
        //            ddlAddType.Items.Insert(0, "Select the Portfolio Type");
        //        }

        //    }
        //}

        //protected void gvCustomerPortfolio_SelectedIndexChanged(object sender, EventArgs e)
        //{
        //    int index = int.Parse(gvCustomerPortfolio.SelectedRow.RowIndex.ToString());
        //    int portfolioId = int.Parse(gvCustomerPortfolio.DataKeys[index].Value.ToString());
        //    Session[SessionContents.PortfolioId] = portfolioId;
        //    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "leftpane", "loadcontrol('PortfolioDashboard','none');", true);
        //}

        protected void btnAddPortfolio_Click(object sender, EventArgs e)
        {
            string newPortfolioName = string.Empty;
            string newPMSIdentifier = string.Empty;
            string newPortfolioType = "RGL";
            int    IsMainPortfolio;

            CustomerPortfolioBo customerPortfolioBo    = new CustomerPortfolioBo();
            CustomerPortfolioVo newCustomerPortfolioVo = new CustomerPortfolioVo();



            GridViewRow footerRow = gvCustomerPortfolio.FooterRow;

            DropDownList ddl = (DropDownList)footerRow.FindControl("ddlAddType");

            if (footerRow.Enabled)
            {
                if (((TextBox)footerRow.FindControl("txtPortfolioName")).Text.Trim() != "")
                {
                    newPortfolioName = ((TextBox)footerRow.FindControl("txtPortfolioName")).Text;
                }
                if (((RadioButton)footerRow.FindControl("rbtnAddMainPortfolio")).Checked)
                {
                    IsMainPortfolio = 1;
                    foreach (GridViewRow oldrow in gvCustomerPortfolio.Rows)
                    {
                        ((RadioButton)oldrow.FindControl("rbtnPortfolio")).Checked = false;
                    }
                }
                else
                {
                    IsMainPortfolio = 0;
                }
                if (((DropDownList)footerRow.FindControl("ddlAddType")).SelectedItem.Value.Trim().ToString() != "")
                {
                    if (ddl.SelectedIndex != 0)
                    {
                        newPortfolioType = ddl.SelectedItem.Value.ToString();
                    }
                }
                if (((TextBox)footerRow.FindControl("txtPMSIdentifier")).Text.Trim() != "")
                {
                    if (newPortfolioType == "PMS")
                    {
                        newPMSIdentifier = ((TextBox)footerRow.FindControl("txtPMSIdentifier")).Text;
                    }
                }

                if (newPMSIdentifier == "" && newPortfolioName == "" && ddl.SelectedIndex == 0)
                {
                }
                else
                {
                    newCustomerPortfolioVo.CustomerId        = customerVo.CustomerId;
                    newCustomerPortfolioVo.IsMainPortfolio   = IsMainPortfolio;
                    newCustomerPortfolioVo.PMSIdentifier     = newPMSIdentifier;
                    newCustomerPortfolioVo.PortfolioName     = newPortfolioName;
                    newCustomerPortfolioVo.PortfolioTypeCode = newPortfolioType;


                    portfolioBo.CreateCustomerPortfolio(newCustomerPortfolioVo, userVo.UserId);

                    newPMSIdentifier = string.Empty;
                    newPortfolioName = string.Empty;
                }
            }



            foreach (GridViewRow dr in gvCustomerPortfolio.Rows)
            {
                if (((Label)dr.FindControl("lblPortfolioName")).Text.Trim() != "")
                {
                    newPortfolioName = ((Label)dr.FindControl("lblPortfolioName")).Text;
                }
                if (((RadioButton)dr.FindControl("rbtnPortfolio")).Checked)
                {
                    IsMainPortfolio = 1;
                }
                else
                {
                    IsMainPortfolio = 0;
                }
                if (((DropDownList)dr.FindControl("ddlType")).SelectedItem.Value.Trim().ToString() != "")
                {
                    DropDownList ddlType = (DropDownList)dr.FindControl("ddlType");

                    newPortfolioType = ddlType.SelectedItem.Value.ToString();
                }
                if (((Label)dr.FindControl("lblPMSIdentifier")).Text.Trim() != "")
                {
                    if (newPortfolioType == "PMS")
                    {
                        newPMSIdentifier = ((Label)dr.FindControl("lblPMSIdentifier")).Text;
                    }
                }
                else
                {
                    newPMSIdentifier = string.Empty;
                }

                newCustomerPortfolioVo.CustomerId        = customerVo.CustomerId;
                newCustomerPortfolioVo.IsMainPortfolio   = IsMainPortfolio;
                newCustomerPortfolioVo.PMSIdentifier     = newPMSIdentifier;
                newCustomerPortfolioVo.PortfolioName     = newPortfolioName;
                newCustomerPortfolioVo.PortfolioTypeCode = newPortfolioType;
                if (((Label)dr.FindControl("PortfolioId")).Text.Trim() != "")
                {
                    newCustomerPortfolioVo.PortfolioId = int.Parse(((Label)dr.FindControl("PortfolioId")).Text);
                }

                portfolioBo.UpdateCustomerPortfolio(newCustomerPortfolioVo, userVo.UserId);
                newPortfolioName = string.Empty;
                newPMSIdentifier = string.Empty;
            }

            customerPortfolioVo = portfolioBo.GetCustomerDefaultPortfolio(customerVo.CustomerId);
            Session[SessionContents.PortfolioId] = customerPortfolioVo.PortfolioId;
            // BindGrid

            BindGridView();
        }
        private bool SaveEquityTransaction()
        {
            EQTransactionVo       eqTransactionVo       = new EQTransactionVo();
            CustomerTransactionBo customerTransactionBo = new CustomerTransactionBo();

            try
            {
                // dt = productEquityBo.GetBrokerCode(portfolioId, ddlTradeAcc.SelectedItem.Text.ToString());

                eqTransactionVo.IsSourceManual = 1;
                eqTransactionVo.Brokerage      = float.Parse(txtBrokerage.Text);
                //eqTransactionVo.BrokerCode = dt.Rows[0]["XB_BrokerCode"].ToString();

                if (ddlTransactionType.SelectedItem.Text.ToString() == "Purchase")
                {
                    eqTransactionVo.BuySell         = "B";
                    eqTransactionVo.TransactionCode = 1;
                }
                if (ddlTransactionType.SelectedItem.Text.ToString() == "Sell")
                {
                    eqTransactionVo.BuySell         = "S";
                    eqTransactionVo.TransactionCode = 2;
                }
                if (ddlTransactionType.SelectedItem.Text.ToString() == "Holdings")
                {
                    eqTransactionVo.BuySell         = "B";
                    eqTransactionVo.TransactionCode = 13;
                }
                if (txtParentCustomerId.Value != string.Empty)
                {
                    eqTransactionVo.CustomerId = Convert.ToInt32(txtParentCustomerId.Value); //customerVo.CustomerId;
                }
                eqTransactionVo.IsCorpAction = 0;
                if (rdoDelivery.Checked)
                {
                    eqTransactionVo.IsSpeculative = 0;
                }
                else if (rdoSpeculative.Checked)
                {
                    eqTransactionVo.IsSpeculative = 1;
                }
                //eqTransactionVo.EducationCess = (float)tempEducation;
                eqTransactionVo.ScripCode = Convert.ToInt32(hidScrip.Value);
                //eqTransactionVo.Exchange = ddlExchange.SelectedItem.Value.ToString();
                if (txtOtherCharges.Text != string.Empty)
                {
                    eqTransactionVo.OtherCharges = float.Parse(txtOtherCharges.Text);
                }
                if (txtQuantity.Text != string.Empty)
                {
                    eqTransactionVo.Quantity = float.Parse(txtQuantity.Text);
                }
                //eqTransactionVo.IsSpeculative = 0;
                eqTransactionVo.TradeType = "D";



                // eqTransactionVo.AccountId = ;
                if (txtRate.Text != string.Empty)
                {
                    eqTransactionVo.Rate = float.Parse(txtRate.Text);
                }
                //eqTransactionVo.RateInclBrokerage = float.Parse(txtRateIncBrokerage.Text);
                //temp = decimal.Round(Convert.ToDecimal(tempService), 3);
                //eqTransactionVo.ServiceTax = (float)temp;
                if (txtSTT.Text != string.Empty)
                {
                    eqTransactionVo.STT = float.Parse(txtSTT.Text);
                }

                eqTransactionVo.TradeDate = Convert.ToDateTime(txtTransactionDate.Text.Trim());// DateTime.Parse(txtTradeDate.Text);//ddlDay.SelectedItem.Text.ToString() + "/" + ddlMonth.SelectedItem.Value.ToString() + "/" + ddlYear.SelectedItem.Value.ToString()
                //eqTransactionVo.TradeTotal = float.Parse(txtTotal.Text);
                if (ddlTradeAccountNos.SelectedValue != "-1")
                {
                    eqTransactionVo.AccountId = int.Parse(ddlTradeAccountNos.SelectedValue);
                }
                //long.Parse(ddlTradeAcc.SelectedItem.Text.ToString());

                if (customerTransactionBo.AddEquityTransaction(eqTransactionVo, eqTransactionVo.CustomerId))
                {
                    CustomerPortfolioBo customerPortfolioBo = new CustomerPortfolioBo();
                    AdvisorVo           advisorVo           = new AdvisorVo();
                    advisorVo = (AdvisorVo)Session["advisorVo"];

                    customerPortfolioBo.UpdateAdviserDailyEODLogRevaluateForTransaction(advisorVo.advisorId, "EQ", eqTransactionVo.TradeDate);
                }
                //btnSubmit.Enabled = false;
            }

            catch (BaseApplicationException Ex)
            {
                throw Ex;
            }

            catch (Exception Ex)
            {
                BaseApplicationException exBase       = new BaseApplicationException(Ex.Message, Ex);
                NameValueCollection      FunctionInfo = new NameValueCollection();
                FunctionInfo.Add("Method", "EquityManualSingleTransaction.ascx:btnSubmit_Click()");
                object[] objects = new object[3];
                //objects[0] = portfolioId; ;
                //objects[1] = eqTransactionVo;
                //objects[2] = customerVo;
                FunctionInfo = exBase.AddObject(FunctionInfo, objects);
                exBase.AdditionalInformation = FunctionInfo;
                ExceptionManager.Publish(exBase);
                throw exBase;
            }
            return(false);
        }