public ReceiptPaymentVoucher SaveReceiptVoucher(ReceiptPaymentVoucherAC receiptPaymentVoucherAc, int companyId) { try { var receiptPaymentVoucher = new ReceiptPaymentVoucher { BranchId = 1, IsReceipt = receiptPaymentVoucherAc.IsReceipt, Narration = receiptPaymentVoucherAc.Narration, TotalAmount = receiptPaymentVoucherAc.TotalAmount, CreatedDateTime = DateTime.UtcNow, AccountId = receiptPaymentVoucherAc.AccountId, BankName = receiptPaymentVoucherAc.BankName, BankBranch = receiptPaymentVoucherAc.BankBranch, ChequeNo = receiptPaymentVoucherAc.ChequeNo, ParamTypeId = receiptPaymentVoucherAc.ParamTypeId, ReceivedFromId = receiptPaymentVoucherAc.ReceivedFromId, ChequeDate = receiptPaymentVoucherAc.ChequeDate, companyId = companyId }; _receiptPaymnetContext.Add(receiptPaymentVoucher); _receiptPaymnetContext.SaveChanges(); SaveReceiptVoucherDetail(receiptPaymentVoucherAc.ReceiptPaymentDetail, receiptPaymentVoucher.Id); return(receiptPaymentVoucher); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetItemQuantityList(int id) { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (MerchantContext.Permission.IsAllowToAccessAllBranch) { var itemQuantityList = _icrContext.GetItemQuantityList(id, null); return(Ok(itemQuantityList)); } else { var itemQuantityList = _icrContext.GetItemQuantityList(id, MerchantContext.UserDetails.BranchId); return(Ok(itemQuantityList)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetSupplierBill() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (MerchantContext.Permission.IsAllowToAccessAllBranch) { var billList = _spoPaymentContext.GetSupplierBillList(null, true); return(Ok(billList)); } else { var billList = _spoPaymentContext.GetSupplierBillList(MerchantContext.UserDetails.BranchId, false); return(Ok(billList)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult SaveSupplierReturnRequest(SupplierReturnRequest SupplierReturnRequest) { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (MerchantContext.Permission.IsAllowToInitiateSupplierReturnRequest) { var supplierReturnRequest = _ISupplierReturnRepositoryContext.SaveSupplierReturnRequest(SupplierReturnRequest, MerchantContext.UserDetails, MerchantContext.CompanyDetails); return(Ok(supplierReturnRequest)); } else { SupplierReturnRequest.Status = StringConstants.PermissionDenied; return(Ok(SupplierReturnRequest)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetBranchList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { var userName = HttpContext.Current.User.Identity.Name; if (userName == StringConstants.AdminName) { return(Ok()); } else { var branchList = _branchContext.GetBranchList(userName, companyId); return(Ok(branchList)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetSupplierPOWorkList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { var userName = HttpContext.Current.User.Identity.Name; if (MerchantContext.Permission.IsAllowToCreateSupplierPurchaseOrderForOtherBranch || MerchantContext.Permission.IsAllowToAccessAllBranch) { var workList = _supplierPOWorkListContext.GetSupplierPOWorkList(userName, true); return(Ok(workList)); } else { var workList = _supplierPOWorkListContext.GetSupplierPOWorkList(userName, false); return(Ok(workList)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetAllLedgerAccountList() { try { var ledgerCollection = _accountingRepository.GetLedgerAccountListByCompanyId(MerchantContext.CompanyDetails.Id); return(Ok(ledgerCollection)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> ///This method is used to get Additional Services list -JJ ///<param name="companyId">Company Id</param> /// </summary> /// <returns>return list of Additional Services</returns> public List <AdditionalService> GetAdditionalServicesList(int companyId) { try { var additionalServiceList = _additionalServiceContext.Fetch(x => x.CompanyId == companyId).ToList(); return(additionalServiceList); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// Method disposes the repository context /// </summary> public void Dispose() { try { _moduleContext.Dispose(); _globalizationContext.Dispose(); GC.SuppressFinalize(this); } catch (Exception ex) { _errorLog.LogException(ex); } }
public IHttpActionResult GetConstantList() { try { List <Param> constantList = _systemParameterContext.GetParamList(); return(Ok(constantList)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult SaveSalesPurchaseVocuher(SalesPurchaseVoucherAC resource) { try { var salesVoucher = _salesPurchaseVoucherRepository.SaveSalesPurchaseVoucher(resource, currentCompanyId); return(Ok(salesVoucher)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetIncidentReportWorkList() { try { List <IncidentReportWorkListAC> incidentReportWorkList = new List <IncidentReportWorkListAC>(); if (HttpContext.Current.User.Identity.IsAuthenticated) { //Get Incident Report By Comapany Id. IncidentReport incidentReport = _incidentReportRepository.GetIncidentReportByCompanyId(companyId); if (incidentReport != null) { //Get Cashier Incident Report BY Company Id. List <CashierIncidentReport> listOfCashierIncidentReport = _incidentReportRepository.GetListOfCashierIncidentReportByCompanyId(companyId); if (listOfCashierIncidentReport.Count > 0) { //Group By Cashier. var cashierIncidentList = listOfCashierIncidentReport.GroupBy(x => x.UserId); foreach (var cashierIncidentReport in cashierIncidentList) { var incidentReportDeatil = GetCashierIncidentReport(cashierIncidentReport.Key, false, listOfCashierIncidentReport); if (incidentReportDeatil.Amount >= incidentReport.AmountLimit || incidentReportDeatil.OperationCount >= incidentReport.OperationCounter) { IncidentReportWorkListAC incidentReportWorkListAC = new IncidentReportWorkListAC(); incidentReportWorkListAC.Amount = incidentReportDeatil.Amount; incidentReportWorkListAC.OperationCount = incidentReportDeatil.OperationCount; incidentReportWorkListAC.ReachedDateTime = incidentReportDeatil.ReachedDateTime; incidentReportWorkListAC.BranchName = incidentReportDeatil.BranchName; incidentReportWorkListAC.BranchId = incidentReportDeatil.BranchId; incidentReportWorkListAC.ModifiedDate = incidentReportDeatil.ModifiedDate; incidentReportWorkListAC.CashierId = incidentReportDeatil.CashierId; incidentReportWorkListAC.CashierName = incidentReportDeatil.CashierName; List <CashierIncidentReport> checkCashierIncidentReportListCount = listOfCashierIncidentReport.Where(x => x.UserId == cashierIncidentReport.Key && x.IsRefreshRequset == true).OrderByDescending(x => x.CreatedDateTime).ToList(); if (checkCashierIncidentReportListCount.Count > 0) { incidentReportWorkListAC.HasChildItem = true; List <SubIncidentReportWorkListAC> listOfSubIncidentReportWorkListAC = GetSubIncidentReportWorkFlowListAC(checkCashierIncidentReportListCount); incidentReportWorkListAC.ListOfSubIncidentReportWorkListAC = listOfSubIncidentReportWorkListAC; } incidentReportWorkList.Add(incidentReportWorkListAC); } } } } return(Ok(incidentReportWorkList)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// Method to add payload to database /// </summary> /// <param name="payLoad"></param> /// <returns></returns> public MerchantService.DomainModel.Models.PayLoad AddPayLoad(MerchantService.DomainModel.Models.PayLoad payLoad) { try { _payLoadContext.Add(payLoad); _payLoadContext.SaveChanges(); return(payLoad); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetUserList() { try { var userName = HttpContext.Current.User.Identity.Name; if (HttpContext.Current.User.Identity.IsAuthenticated) { var userCollection = new List <UserDetailAc>(); if (HttpContext.Current.Session["RoleName"].ToString() == StringConstants.SuperAdminRoleName) { var user = _userDetailContext.GetAdminUserList(); foreach (var userDetail in user) { var userAC = new UserDetailAc(); userAC = ApplicationClassHelper.ConvertType <UserDetail, UserDetailAc>(userDetail); userAC.UserId = userDetail.Id; userAC.IsAdminRole = true; userCollection.Add(userAC); } } else { var user = _userDetailContext.GetUserList(userName); foreach (var userDetail in user) { var userAC = new UserDetailAc(); userAC = ApplicationClassHelper.ConvertType <UserDetail, UserDetailAc>(userDetail); userAC.UserId = userDetail.Id; if (userDetail.Branch != null) { userAC.BranchName = userDetail.Branch.Name; } else { userAC.BranchName = ""; } userAC.IsAdminRole = false; userCollection.Add(userAC); } } return(Ok(userCollection)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// Method disposes the repository context /// </summary> public void Dispose() { try { _userAccessDetailContext.Dispose(); GC.SuppressFinalize(this); } catch (Exception ex) { _errorLog.LogException(ex); } }
public IHttpActionResult SaveGroup(GroupAccountAC group) { try { group.CompanyId = CurrentCompanyId; var groupDetails = _groupAccountContext.SaveGroup(group); //it will convert model class to appliation class based on naming conversions. group = ApplicationClassHelper.ConvertType <Group, GroupAccountAC>(groupDetails); group.GroupId = groupDetails.Id; return(Ok(group)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetModuleList() { try { if (_companyContext.CheckSecondaryLanguageSelectedOrNot()) { List <ModuleInfo> moduleInfo = _globalizationContext.GetModuleList(); return(Ok(new { moduleInfo = moduleInfo })); } return(Ok(new { isLanguageAdded = false })); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetSupReturnWorkList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (MerchantContext.Permission.IsAllowToAccessAllBranch) { var workList = _ISupReturnWorkListRepositoryContext.GetSupReturnWorkList(MerchantContext.CompanyDetails.Id, true, 0); return(Ok(workList)); } else { var workList = _ISupReturnWorkListRepositoryContext.GetSupReturnWorkList(MerchantContext.CompanyDetails.Id, false, MerchantContext.UserDetails.BranchId); return(Ok(workList)); } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// This method is used for insert new category in database. - JJ /// </summary> /// <param name="category">object of CategoryAC</param> /// <param name="companyId"></param> /// <returns>saved object of CategoryAC</returns> public CategoryAC SaveCategory(CategoryAC category, int companyId) { try { var categorys = new Category { CompanyId = companyId, GroupParamTypeId = category.GroupParamTypeId, BrandParamTypeId = category.BrandParamTypeId, CreatedDateTime = DateTime.UtcNow, }; _categoryContext.Add(categorys); _categoryContext.SaveChanges(); category.CategoryId = categorys.Id; var supplier = new ItemSupplier { SupplierId = category.SupplierId, CategoryId = category.CategoryId, CreatedDateTime = DateTime.UtcNow }; _itemSupplierContext.Add(supplier); _itemSupplierContext.SaveChanges(); return(category); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// this method is used for fetching customer purchase order list. /// </summary> /// <param name="companyId"></param> /// <returns>list of object of CustomerPOAC</returns> public List <CustomerPOAC> GetCustomerPOList(int companyId) { try { var date = DateTime.UtcNow.Subtract(TimeSpan.FromDays(14)); var customerpoList = new List <CustomerPOAC>(); var cpoList = _customerPOContext.Fetch(x => x.UserDetail.Branch.CompanyId == companyId).OrderByDescending(x => x.CreatedDateTime).ToList(); foreach (var cpo in cpoList) { var isInList = false; if (cpo.CollectionDate != null) { if (cpo.CollectionDate > date) { isInList = true; } } else { isInList = true; } if (isInList) { CustomerPOAC cpoAC = new CustomerPOAC { CollectingBranchId = cpo.CollectingBranchId, CancelationDate = cpo.CancelationDate, CollectingBranchName = cpo.CollectingBranch.Name, CollectionDate = cpo.CollectionDate, Comments = cpo.Comments, CustomerId = cpo.CustomerId, CustomerPOId = cpo.Id, MembershipCode = cpo.CustomerProfile.MembershipCode, DueDate = cpo.DueDate, InitiationBranchId = cpo.InitiationBranchId, InitiationBranchName = cpo.InitiationBranch.Name, InitiationDate = cpo.InitiationDate, InitiatorId = cpo.InitiatorId, IsCancel = cpo.IsCancel, IsSPORequired = cpo.IsSPORequired, IsCollected = cpo.IsCollected, ModifiedBy = cpo.ModifiedBy, PurchaseOrderNo = cpo.PurchaseOrderNo, Total = cpo.TotalCPOAmount, CustomerName = cpo.CustomerProfile.Name, CustomerMobile = cpo.CustomerProfile.Mobile }; customerpoList.Add(cpoAC); } } return(customerpoList); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetOprationList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { List <ParamType> listOfParamType = _incidentReportRepository.GetListOfOpration(53); return(Ok(listOfParamType)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetSupplierPOReceiving(int id) { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { var spoReceiving = _spoReceivingContext.GetSupplierPO(id); return(Ok(spoReceiving)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetCustomerPOWorkList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { var workList = _customerPOWorkListContext.GetCustomerPOList(companyId); return(Ok(workList)); } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetLedgerList() { try { var ledgerList = _ledgerAccountRepository.GetLedgerListByCompanyId(CurrentCompanyId); var ledgerCollection = new List <LedgerAccountAC>(); var ledgerAc = new LedgerAccountAC(); foreach (var ledger in ledgerList) { //it will convert model class to appliation class based on naming conversions. ledgerAc = ApplicationClassHelper.ConvertType <Ledgers, LedgerAccountAC>(ledger); ledgerAc.LedgerId = ledger.Id; ledgerAc.IsEditable = ledger.IsEditable; if (!ledger.IsEditable) { ledgerAc.BranchName = ledger.BranchDetail != null ? ledger.BranchDetail.Name : ""; } else { ledgerAc.BranchName = ""; } ledgerAc.LedgerName = ledger.LedgerName; ledgerAc.Address = ledger.Address; ledgerAc.State = ledger.State; ledgerAc.GroupTypeId = ledger.GroupTypId != null?Convert.ToInt32(ledger.GroupTypId) : 0; ledgerAc.GroupTypeName = ledger.GroupType != null ? ledger.GroupType.Name : ""; ledgerAc.ParentLedgerId = ledger.ParentLedgerId != null?Convert.ToInt32(ledger.ParentLedgerId) : 0; ledgerAc.Balance = ledger.Balance; ledgerAc.GroupName = ledger.Group.GroupName; ledgerCollection.Add((ledgerAc)); } return(Ok(ledgerCollection)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public void Dispose() { try { _posIncidentReportContext.Dispose(); GC.SuppressFinalize(this); } catch (Exception ex) { _errorLog.LogException(ex); } }
public IHttpActionResult GetICRWorkList() { try { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (MerchantContext.Permission.IsAllowToAccessAllBranch) { var workList = _icrWorkListContext.GetICRWorkList(); return(Ok(workList)); } else { if (MerchantContext.UserDetails.Branch != null && (MerchantContext.UserDetails.BranchId != null && MerchantContext.UserDetails.BranchId > 0)) { var workList = _icrWorkListContext.GetICRWorkListForParticularBranch(MerchantContext.UserDetails.BranchId); return(Ok(workList)); } else { return(null); } } } else { return(BadRequest()); } } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public Group SaveGroup(GroupAccountAC group) { try { //check the same gorup name is exists or not int groupCount = _groupContext.Fetch(x => x.GroupName == @group.GroupName && x.CompanyId == 0).Count() == 1 ? 1 : _groupContext.Fetch(x => x.GroupName == @group.GroupName && x.CompanyId == group.CompanyId).Count(); if (groupCount != 0) { throw new ArgumentException("The entered group name already exists"); } var groups = new Group { GroupName = group.GroupName, UnderId = group.UnderId, CreatedDateTime = DateTime.UtcNow, CompanyId = group.CompanyId }; _groupContext.Add(groups); _groupContext.SaveChanges(); return(groups); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
/// <summary> /// this method is used for fetching Item Change Request list. /// </summary> /// <returns>list of object of ItemChangedDetailsAC</returns> public List <ItemChangedDetailsAC> GetICRWorkList() { try { var itemcrList = new List <ItemChangedDetailsAC>(); var icrList = _icrDetailContext.Fetch(x => !x.IsDeleted).OrderByDescending(x => x.CreatedDateTime).ToList(); foreach (var icr in icrList) { ItemChangedDetailsAC icrAC = new ItemChangedDetailsAC { ItemName = icr.ItemProfile.ItemNameEn, RequestedDate = icr.CreatedDateTime, Barcode = icr.ItemProfile.Barcode, Id = icr.Id, IsPriceChangeRequest = icr.IsPriceChangeRequest, IsRejected = icr.IsRejected, Action = GetActionName(icr.RecordId) }; itemcrList.Add(icrAC); } return(itemcrList); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult GetAdditionalServicesList() { try { var additionalServicesList = _additionalServiceContext.GetAdditionalServicesList(MerchantContext.CompanyDetails.Id); return(Ok(additionalServicesList)); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }
public IHttpActionResult CountReceiptVoucherRecord(bool isReceipt) { try { int companyId = MerchantContext.CompanyDetails.Id; int count = _receiptPaymentVoucherRepository.CountReceiptOrPaymentVoucherRecord(isReceipt, companyId); return(Ok(new { recordCount = count })); } catch (Exception ex) { _errorLog.LogException(ex); throw; } }