public SalesController() { var dbfactory = new DatabaseFactory(); var unitOfWork = new UnitOfWork(dbfactory); _salesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), unitOfWork); _approvalController = new ApprovalController<SlsSalesOrderApproval, SlsSalesOrderViewModel>(_salesOrderService); _deliveryService = new DeliveryService(new DeliveryRepository(dbfactory), new DeliveryDetailRepository(dbfactory), unitOfWork); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), unitOfWork); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), unitOfWork); _officeService = new OfficeService(new OfficeRepository(dbfactory), unitOfWork); _DistributorService = new DistributorService(new DistributorRepository(dbfactory), unitOfWork); _DealerService = new DealerService(new DealerRepository(dbfactory), unitOfWork); _CorporateClientService = new CorporateClientService(new CorporateClientRepository(dbfactory), unitOfWork); _RetailerService = new RetailerService(new RetailerRepository(dbfactory), unitOfWork); _FreeProductService = new FreeProductService(new FreeProductRepository(dbfactory), new ChartOfProductRepository(dbfactory), new UnitOfMeasurementRepository(dbfactory), unitOfWork); _ProductService = new ChartOfProductService(new ChartOfProductRepository(dbfactory), unitOfWork); _UnitService = new UnitOfMeasurementService(new UnitOfMeasurementRepository(dbfactory), unitOfWork); _salesDiscountSettingService = new SalesDiscountSettingService(new SalesDiscountSettingRepository(dbfactory), unitOfWork); _PartyCreditService = new PartyCreditReportService(new InvStoreOpeningRepository(dbfactory), unitOfWork); _promotionalOfferService = new PromotionalOfferService(new PromotionalOfferRepository(dbfactory), new PromotionalOfferDetailRepository(dbfactory), new UnitOfWork(dbfactory)); }
public CollectionController() { var dbfactory = new DatabaseFactory(); _collectionEntryService = new CollectionEntryService(new CollectionEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public FixedAssetController() { var dbfactory = new DatabaseFactory(); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _AnFFixedAssetService = new AnFFixedAssetService(new AnFFixedAssetRepository(dbfactory), new AnFFixedAcquisitionRepository(dbfactory), new AnFFixedAssetRevalueRepository(dbfactory), new UnitOfWork(dbfactory)); _AnFFixedAssetRevalueService = new AnFFixedAssetRevalueService(new AnFFixedAssetRevalueRepository(dbfactory), new UnitOfWork(dbfactory)); }
public IssueController() { var dbfactory = new DatabaseFactory(); _IssueService = new IssueService(new IssueRepository(dbfactory), new UnitOfWork(dbfactory)); _IssueDetailService = new IssueDetailService(new IssueDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public SalesReturnController() { var dbfactory = new DatabaseFactory(); _SalesReturnService = new SalesReturnService(new SalesReturnRepository(dbfactory), new SalesReturnDetailRepository(dbfactory), new StockInRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public DefectReplacementController() { var dbfactory = new DatabaseFactory(); _IDefectReplacementService = new DefectEntryService(new DefectEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _IDefectDetailService = new DefectDetailEntryService(new DefectDetailEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _ProductService = new ChartOfProductService(new ChartOfProductRepository(dbfactory), new UnitOfWork(dbfactory)); _UnitService = new UnitOfMeasurementService(new UnitOfMeasurementRepository(dbfactory), new UnitOfWork(dbfactory)); }
public DefectEntryController() { var dbfactory = new DatabaseFactory(); _IDefectEntryService = new DefectEntryService(new DefectEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _IDefectDetailService = new DefectDetailEntryService(new DefectDetailEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
private ISecCompanyService _SecCompanyService; //Add by Bably #endregion Fields #region Constructors public AdvanceController() { var dbfactory = new DatabaseFactory(); _advanceListService = new AnfAdvancetListService(new AnfAdvancetListepository(dbfactory),new UnitOfWork(dbfactory)); _advancetAdjustmentService = new AnfAdvancetAdjustmentService(new AnfAdvanceAdjustmentRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public ExpenseController() { var dbfactory = new DatabaseFactory(); _anfExpenseService = new AnFExpenseService(new ERPOptima.Data.Accounts.Repository.AnFExpenseRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _ccService = new AnFCostCenterService(new AnFCostCenterRepository(dbfactory), new UnitOfWork(dbfactory)); //Add by Bably }
public SalesTargetController() { var dbfactory = new DatabaseFactory(); _SalesTargetService = new SalesTargetService(new SalesTargetRepository(dbfactory), new UnitOfWork(dbfactory)); _SalesTargetDetailService = new SalesTargetDetailService(new SalesTargetDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public FieldVisitController() { var dbfactory = new DatabaseFactory(); _fieldVisitListService = new FieldVisitListService(new FieldVisitListRepository(dbfactory), new UnitOfWork(dbfactory)); _fieldVisitService = new FieldVisitService(new FieldVisitRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _SecUserService = new SecUserService(new ERPOptima.Data.Security.Repository.SecUserRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
//private IAnFOpeningBalanceService _opBalanceService; public ReportController() { var dbfactory = new DatabaseFactory(); _anfVoucherService = new AnFVoucherService(new AnFVoucherRepository(dbfactory), new UnitOfWork(dbfactory)); _CmnCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); //_CmnProjectService = new CmnProjectService(new CmnProjectRepository(dbfactory), new UnitOfWork(dbfactory)); _ccService = new AnFCostCenterService(new AnFCostCenterRepository(dbfactory), new UnitOfWork(dbfactory)); _coaService = new ChartOfAccountService(new AnFChartOfAccountRepository(dbfactory), new UnitOfWork(dbfactory)); //_opBalanceService = new AnFOpeningBalanceService(new AnFOpeningBalanceRepository(dbfactory), new UnitOfWork(dbfactory)); }
public ProductReceiveController() { var dbfactory = new DatabaseFactory(); _ProductReceiveService = new ProductReceiveService(new ProductReceiveRepository(dbfactory), new UnitOfWork(dbfactory)); _ProductReceiveDetailService = new ProductReceiveDetailService(new ProductReceiveDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _ProductDetailService = new ProductDetailService(new IssueDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SlsProductReceiveService = new SlsProductReceiveService(new SlsProductReceiveRepository(dbfactory), new SlsProductReceiveDetailRepository(dbfactory), new ChartOfProductRepository(dbfactory), new UnitOfMeasurementRepository(dbfactory), new UnitOfWork(dbfactory)); }
public TransferController() { var dbfactory = new DatabaseFactory(); _TransferService = new TransferService(new TransferRepository(dbfactory), new UnitOfWork(dbfactory)); _TransferDetailService = new TransferDetailService(new TransferDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _StoreService = new StoreService(new InvStoreRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public DamageRequestController() { var dbfactory = new DatabaseFactory(); _IDamageService = new DamageService(new InvDamageRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new InvDamageApprovalRepository(dbfactory), new UnitOfWork(dbfactory)); _IDamageDetailService = new DamageDetailService(new InvDamageDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public SalesReplacementController() { var dbfactory = new DatabaseFactory(); _SalesReplacementService = new SalesReplacementService(new SalesReplacementRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _SalesReplacementDetailService = new SalesReplacementDetailService(new SalesReplacementDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _ChartOfProductService = new ChartOfProductService(new ChartOfProductRepository(dbfactory), new UnitOfWork(dbfactory)); _unitOfMeasurementService = new UnitOfMeasurementService(new UnitOfMeasurementRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); }
public RequisitionController() { var dbfactory = new DatabaseFactory(); _RequisitionService = new RequisitionService(new RequisitionRepository(dbfactory), new RequisitionApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _RequisitionDetailService = new RequisitionDetailService(new RequisitionDetailRepository(dbfactory), new UnitOfWork(dbfactory)); //approval controller - to control all approvals _approvalController = new ApprovalController<InvRequisitionApproval, InvRequisitionViewModel>(_RequisitionService); }
public DamageController() { var dbfactory = new DatabaseFactory(); _DamageService = new DamageService(new InvDamageRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new InvDamageApprovalRepository(dbfactory), new UnitOfWork(dbfactory)); _approvalController = new ApprovalController<InvDamageApproval, InvDamage>(_DamageService); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _DamageDetailService = new DamageDetailService(new InvDamageDetailRepository(dbfactory), new UnitOfWork(dbfactory)); //approval controller - to control all approvals }
public SalesIncentiveSettingsController() { var dbfactory = new DatabaseFactory(); _salesIncentiveService = new SalesIncentiveSettingsService(new SalesIncentiveSettingsRepository(dbfactory), new UnitOfWork(dbfactory)); _salesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _incentivePaymentService = new IncentivePaymentService(new IncentivePaymentRepository(dbfactory), new SalesIncentiveSettingsRepository(dbfactory) ,new UnitOfWork(dbfactory)); _hrmDesignationService = new HrmDesignationService(new HrmDesignationRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); }
public DashboardController() { InitStyle(); randomGen = new Random(); var dbfactory = new DatabaseFactory(); var newUoW = new UnitOfWork(dbfactory); _SalesTargetService = new SalesTargetService(new SalesTargetRepository(dbfactory), newUoW); _SalesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), newUoW); _collectionTargetService = new CollectionTargetService(new CollectionTargetRepository(dbfactory), newUoW); _collectionEntryService = new CollectionEntryService(new CollectionEntryRepository(dbfactory), newUoW); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), newUoW); _companyService = new SecCompanyService(new SecCompanyRepository(dbfactory), newUoW); }
public CorporateSalesController() { var dbfactory = new DatabaseFactory(); _service = new CorporateSalesService(new CorporateSalesRepository(dbfactory), new CorporateSalesDetailRepository(dbfactory), new CorporateSalesApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _approvalController = new ApprovalController<SlsCorporateSalesApproval, SlsCorporateSalesApplication>(_service); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _CorporateClientService = new CorporateClientService(new CorporateClientRepository(dbfactory), new UnitOfWork(dbfactory)); _salesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new UnitOfWork(dbfactory)); }
public CorporateSalesOrderController() { var dbfactory = new DatabaseFactory(); var unitOfWork = new UnitOfWork(dbfactory); _salesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), unitOfWork); _officeService = new OfficeService(new OfficeRepository(dbfactory), unitOfWork); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), unitOfWork); _FreeProductService = new FreeProductService(new FreeProductRepository(dbfactory), new ChartOfProductRepository(dbfactory), new UnitOfMeasurementRepository(dbfactory), unitOfWork); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), unitOfWork); _salesDiscountSettingService = new SalesDiscountSettingService(new SalesDiscountSettingRepository(dbfactory), unitOfWork); _PartyCreditService = new PartyCreditReportService(new InvStoreOpeningRepository(dbfactory), unitOfWork); }
//// // GET: /Sales/Delivery/ public DeliveryController() { var dbfactory = new DatabaseFactory(); _DeliveryService = new DeliveryService(new DeliveryRepository(dbfactory), new DeliveryDetailRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _DeliveryDetailsService = new DeliveryDetailsService(new DeliveryDetailsRepository(dbfactory), new ChartOfProductRepository(dbfactory), new UnitOfMeasurementRepository(dbfactory), new DeliveryRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _salesOrderService = new SalesOrderService(new SalesOrderRepository(dbfactory), new SalesOrderDetailRepository(dbfactory), new SalesOrderApprovalRepository(dbfactory), new NotificationRepository(dbfactory), new NotificationDetailRepository(dbfactory), new UnitOfWork(dbfactory)); _officeService = new OfficeService(new OfficeRepository(dbfactory), new UnitOfWork(dbfactory)); _hrmEmployeeService = new HrmEmployeeService(new HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); _objRptInvoiceService = new RptInvoiceService(new DistributorRepository(dbfactory), new UnitOfWork(dbfactory)); _objChallenReportService = new ChallenReportService(new DistributorRepository(dbfactory), new UnitOfWork(dbfactory)); }
public SalesReportController() { var dbfactory = new DatabaseFactory(); _objCollectionEntryMoneyReceiptReportService = new CollectionEntryService(new CollectionEntryRepository(dbfactory), new UnitOfWork(dbfactory)); _objPartyListReportService = new PartyListReportService(new DistributorRepository(dbfactory), new UnitOfWork(dbfactory)); _SecCompanyService = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); _ChartOfProductService = new ChartOfProductService(new ChartOfProductRepository(dbfactory), new UnitOfWork(dbfactory)); _objProductPriceReportService = new ProductPriceReportService(new ProductPriceRepository(dbfactory), new UnitOfWork(dbfactory)); _objFreeProductReportService = new FreeProductReportService(new FreeProductRepository(dbfactory), new UnitOfWork(dbfactory)); _objDailySalesReportService = new DailySalesReportService(new SalesOrderRepository(dbfactory), new UnitOfWork(dbfactory)); _objChallenReportService = new ChallenReportService(new DistributorRepository(dbfactory), new UnitOfWork(dbfactory)); _objTargetNAchievementReportService = new TargetNAchievementReportService(new SalesOrderRepository(dbfactory), new UnitOfWork(dbfactory)); _objRptInvoiceService = new RptInvoiceService(new DistributorRepository(dbfactory), new UnitOfWork(dbfactory)); _objSalesOrderListReportService = new SalesOrderListReportService(new SalesOrderRepository(dbfactory), new UnitOfWork(dbfactory)); _objStockBalanceReportService = new StockBalanceReportService(new InvStoreOpeningRepository(dbfactory), new UnitOfWork(dbfactory)); _objSalesCommissionReportService = new SalesCommissionReportService(new InvStoreOpeningRepository(dbfactory), new UnitOfWork(dbfactory)); _objPartyCreditReportService = new PartyCreditReportService(new InvStoreOpeningRepository(dbfactory), new UnitOfWork(dbfactory)); _objSalesReturnListReportService = new SalesReturnListReportService(new SalesReturnRepository(dbfactory), new UnitOfWork(dbfactory)); _objProductService = new ProductReportService(new ProductRepository(dbfactory), new UnitOfWork(dbfactory)); _objCollectionReportService = new CollectionReportService(new CollectionReportRepository(dbfactory), new UnitOfWork(dbfactory)); _objPartyLedgerReportService = new PartyLedgerReportService(new InvStoreOpeningRepository(dbfactory), new UnitOfWork(dbfactory)); _objSalesTargetReportService = new RptSalesTargetService(new RptSalesTargetRepository(dbfactory), new UnitOfWork(dbfactory)); }
public ActionResult CompaniesForUser() { ISecUserService _su; _su = new SecUserService(new SecUserRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); if (Session["userId"] != null) { int userId = Convert.ToInt32(Session["userId"]); SecUser user = _su.GetById(userId); ISecCompanyUserService _compUserService = new SecCompanyUserService(new SecCompanyUserRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var compUserList = _compUserService.GetAll(); if (compUserList != null && compUserList.Count() > 0) { compUserList = compUserList.Where(i => i.SecUserId == userId).ToList(); if (compUserList != null && compUserList.Count() > 0) { var companyIds = compUserList.Select(i => i.SecCompanyId).ToList(); var permittedCompanyList = _company.GetAll(); IList<SecCompany> result = permittedCompanyList.Where(b => companyIds.Contains(b.Id)).ToList(); List<CompanyIdAndName> list = GetCompanyList(result); //Default compnay if (user.HrmEmployeeId != null) { ERPOptima.Model.HRM.HrmEmployee emp = new ERPOptima.Model.HRM.HrmEmployee(); ERPOptima.Service.Hrm.HrmEmployeeService es = new ERPOptima.Service.Hrm.HrmEmployeeService(new ERPOptima.Data.Hrm.Repository.HrmEmployeeRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); emp = es.GetById(user.HrmEmployeeId.Value); if (emp != null) { _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var defaultCompany = _company.GetById(emp.SecCompanyId.Value); if (defaultCompany != null) { CompanyIdAndName obj = new CompanyIdAndName(); obj.Id = defaultCompany.Id; obj.Name = defaultCompany.Name; if (!list.Contains(obj)) { list.Insert(0, obj); } } } } return Json(list, JsonRequestBehavior.AllowGet); } else { List<CompanyIdAndName> list = new List<CompanyIdAndName>(); //default company if (user.HrmEmployeeId != null) { ERPOptima.Model.HRM.HrmEmployee emp = new ERPOptima.Model.HRM.HrmEmployee(); ERPOptima.Service.Hrm.HrmEmployeeService es = new ERPOptima.Service.Hrm.HrmEmployeeService(new ERPOptima.Data.Hrm.Repository.HrmEmployeeRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); emp = es.GetById(user.HrmEmployeeId.Value); if (emp != null) { _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var defaultCompany = _company.GetById(emp.SecCompanyId.Value); if (defaultCompany != null) { CompanyIdAndName obj = new CompanyIdAndName(); obj.Id = defaultCompany.Id; obj.Name = defaultCompany.Name; if (!list.Contains(obj)) { list.Insert(0, obj); } } } } return Json(list, JsonRequestBehavior.AllowGet); } } //var a = _company.GetModuleIdAndName(); //List<CompanyIdAndName> list = new List<CompanyIdAndName>(); //foreach (var item in a) //{ // CompanyIdAndName company = new CompanyIdAndName { Id = item.Key, Name = item.Value }; // list.Add(company); //} //return Json(list, JsonRequestBehavior.AllowGet); else { //default company //IList<SecCompany> defaultCompanyList = new List<SecCompany>(); //var defaultCompany = _company.GetById(1); //defaultCompanyList.Add(defaultCompany); //List<CompanyIdAndName> list = GetCompanyList(defaultCompanyList); List<CompanyIdAndName> list = new List<CompanyIdAndName>(); //default company if (user.HrmEmployeeId != null) { ERPOptima.Model.HRM.HrmEmployee emp = new ERPOptima.Model.HRM.HrmEmployee(); ERPOptima.Service.Hrm.HrmEmployeeService es = new ERPOptima.Service.Hrm.HrmEmployeeService(new ERPOptima.Data.Hrm.Repository.HrmEmployeeRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); emp = es.GetById(user.HrmEmployeeId.Value); if (emp != null) { _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var defaultCompany = _company.GetById(emp.SecCompanyId.Value); if (defaultCompany != null) { CompanyIdAndName obj = new CompanyIdAndName(); obj.Id = defaultCompany.Id; obj.Name = defaultCompany.Name; if (!list.Contains(obj)) { list.Insert(0, obj); } } } } return Json(list, JsonRequestBehavior.AllowGet); } } else { Operation ret = new Operation(); ret.Success = false; ret.Message = "Unauthenticated user "; ret.OperationId = -1; return Json(ret, JsonRequestBehavior.AllowGet); } }
public ActionResult GetCompaniesByUserId(int userId) { //ISecUserService _su; ISecCompanyUserService _cu; var dbfactory = new DatabaseFactory(); SecUser user = _su.GetById(userId); _su = new SecUserService(new SecUserRepository(dbfactory), new UnitOfWork(dbfactory)); _cu = new SecCompanyUserService(new SecCompanyUserRepository(dbfactory), new UnitOfWork(dbfactory)); DataTable dt = _cu.GetCompanyUsers(userId); var list = dt.DataTableToList<CompanyUserViewModel>().Where(t => t.Status == true).Select(t => new { Id = t.Id, Name = t.Name }).ToList(); if(user.HrmEmployeeId!=null) { ERPOptima.Model.HRM.HrmEmployee emp = new ERPOptima.Model.HRM.HrmEmployee(); ERPOptima.Service.Hrm.HrmEmployeeService es = new ERPOptima.Service.Hrm.HrmEmployeeService(new ERPOptima.Data.Hrm.Repository.HrmEmployeeRepository(dbfactory), new UnitOfWork(dbfactory)); emp = es.GetById(user.HrmEmployeeId.Value); if(emp!=null) { ISecCompanyService _company; _company = new SecCompanyService(new SecCompanyRepository(dbfactory), new UnitOfWork(dbfactory)); var defaultCompany = _company.GetById(emp.SecCompanyId.Value); if (defaultCompany != null) { var obj = new { Id = defaultCompany.Id, Name = defaultCompany.Name }; if (!list.Contains(obj)) { list.Insert(0, obj); } } } } return Json(list, JsonRequestBehavior.AllowGet); }
public ActionResult GetCompanies() { DatabaseFactory _databaseFactory = new DatabaseFactory(); _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); if (Session["userId"] != null) { int userId = Convert.ToInt32(Session["userId"]); ISecCompanyUserService _compUserService = new SecCompanyUserService(new SecCompanyUserRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var compUserList = _compUserService.GetAll(); if (compUserList != null && compUserList.Count() > 0) { compUserList = compUserList.Where(i => i.SecUserId == userId).ToList(); if (compUserList != null && compUserList.Count() > 0) { var companyIds = compUserList.Select(i => i.SecCompanyId).ToList(); var permittedCompanyList = _company.GetAll(); IList<SecCompany> result = permittedCompanyList.Where(b => companyIds.Contains(b.Id)).ToList(); List<CompanyIdAndName> list = GetCompanyList(result); return Json(list, JsonRequestBehavior.AllowGet); } else { //default company IList<SecCompany> defaultCompanyList = new List<SecCompany>(); var defaultCompany = _company.GetById(1); defaultCompanyList.Add(defaultCompany); List<CompanyIdAndName> list = GetCompanyList(defaultCompanyList); return Json(list, JsonRequestBehavior.AllowGet); } } //var a = _company.GetModuleIdAndName(); //List<CompanyIdAndName> list = new List<CompanyIdAndName>(); //foreach (var item in a) //{ // CompanyIdAndName company = new CompanyIdAndName { Id = item.Key, Name = item.Value }; // list.Add(company); //} //return Json(list, JsonRequestBehavior.AllowGet); else { //default company IList<SecCompany> defaultCompanyList = new List<SecCompany>(); var defaultCompany = _company.GetById(1); defaultCompanyList.Add(defaultCompany); List<CompanyIdAndName> list = GetCompanyList(defaultCompanyList); return Json(list, JsonRequestBehavior.AllowGet); } } else { Operation ret = new Operation(); ret.Success = false; ret.Message = "Unauthenticated user "; ret.OperationId = -1; return Json(ret, JsonRequestBehavior.AllowGet); } }
public ActionResult GetAllCompanies() { try { DatabaseFactory _databaseFactory = new DatabaseFactory(); _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); var list = _company.GetAll().Select(t => new { Id = t.Id, Name = t.Name }).ToList(); return Json(list, JsonRequestBehavior.AllowGet); } catch(Exception ex) { throw ex; } }
public CompanyController() { _company = new SecCompanyService(new SecCompanyRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); _financialYear = new CmnFinancialYearService(new CmnFinancialYearRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); _groupService = new SecGroupService(new SecGroupRepository(_databaseFactory), new UnitOfWork(_databaseFactory)); }