/// <summary>
 /// Transpose LINQ object to Value object
 /// </summary>
 /// <param name="costcentre">LINQ costcenter object</param>
 public CostCentreVO(OACostCentre costcentre)
 {
     Id             = costcentre.ID;
     OACostCenterId = costcentre.CostCentreID;
     Name           = costcentre.CostCentreName;
     CostCenterName = costcentre.CostCentreID + '-' + costcentre.CostCentreName;
     CompanyId      = costcentre.CompanyID;
 }
示例#2
0
        /// <summary>
        /// Gets the Profitloss details by profitloss id.
        /// </summary>
        /// <param name="profitlossId">profitlossid</param>
        /// <returns>Profitloss details</returns>
        public ProfitLossVO GetPandLbyId(int profitlossId = 0)
        {
            P_LMapping   profitloss   = mdbDataContext.P_LMappings.SingleOrDefault(c => c.ID == profitlossId);
            ProfitLossVO profitlossVO = null;

            if (profitloss != null)
            {
                profitlossVO = new ProfitLossVO(profitloss);

                //Set the Costcenter Name
                OACostCentre costcenter = mdbDataContext.OACostCentres.FirstOrDefault(oac => oac.ID == profitloss.CostCentreID);
                profitlossVO.CostCenterName = costcenter.CostCentreName;

                //set the company name
                OACompany company = mdbDataContext.OACompanies.SingleOrDefault(oac => oac.ID == profitloss.CompanyID);
                profitlossVO.CompanyName = company.CompanyName;
            }
            return(profitlossVO);
        }
示例#3
0
        /// <summary>
        /// Gets the CostCenter by CostCenterId
        /// </summary>
        /// <param name="costCentreId">CostCenter Id</param>
        /// <param name="companyId">Company Id</param>
        /// <returns>Return value object of P&L</returns>
        public ProfitLossVO GetCostCenterById(int costCentreId, int companyId)
        {
            P_LMapping profitLoss = mdbDataContext.P_LMappings.Where(c => c.CostCentreID == costCentreId && c.CompanyID == companyId && c.IsDeleted == false).SingleOrDefault();

            ProfitLossVO selectedProfitLoss = null;

            if (profitLoss != null)
            {
                selectedProfitLoss = new ProfitLossVO(profitLoss);

                //Set the Costcenter Name
                OACostCentre costcenter = mdbDataContext.OACostCentres.FirstOrDefault(oac => oac.ID == costCentreId);
                selectedProfitLoss.CostCenterName = costcenter.CostCentreName;

                //set the company name
                OACompany company = mdbDataContext.OACompanies.SingleOrDefault(oac => oac.ID == companyId);
                selectedProfitLoss.CompanyName = company.CompanyName;
            }
            return(selectedProfitLoss);
        }