/// <summary> /// Get company name by company id /// </summary> /// <param name="id">company id</param> /// <returns>company name</returns> public string GetCompanyNameByID(int id) { string companyName = string.Empty; OACompany company = mdbDataContext.OACompanies.Where(c => c.ID == id).SingleOrDefault(); if (company != null) { companyName = company.CompanyName; } return(companyName); }
/// <summary> /// Check whether division is associated with company /// </summary> /// <param name="divisionVO">division Value Object</param> /// <returns></returns> public DivisionVO IsDivisionActivatedInCompany(DivisionVO divisionVO) { Division division = mdbDataContext.Divisions.Where(div => div.DivisionName.Equals(divisionVO.DivisionName) && (div.IsActive == true) && div.CompanyID != divisionVO.CompanyId).SingleOrDefault(); DivisionVO selectedDivision = null; if (division != null) { selectedDivision = new DivisionVO(division); //set the company name OACompany company = mdbDataContext.OACompanies.SingleOrDefault(oac => oac.ID == selectedDivision.CompanyId); selectedDivision.CompanyName = company.CompanyName; } return(selectedDivision); }
/// <summary> /// Gets Divisiondetails by DivisionId /// </summary> /// <param name="DivisionId">Division Id</param> /// <returns>Division details</returns> public DivisionVO GetDivisionById(int DivisionId = 0) { Division division = mdbDataContext.Divisions.SingleOrDefault(c => c.ID == DivisionId); DivisionVO divisionVO = null; if (division != null) { divisionVO = new DivisionVO(division); //set the company name OACompany company = mdbDataContext.OACompanies .SingleOrDefault(oac => oac.ID == division.CompanyID); divisionVO.CompanyName = company.CompanyName; } return(divisionVO); }
/// <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); }
/// <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); }
/// <summary> /// Constructor /// </summary> public CompanyVO(OACompany company) { Name = company.CompanyName; CompanyID = company.ID; }