public IHttpActionResult GetAllAccountingEntry()
        {
            try
            {
                decimal totalDebit        = 0;
                decimal totalCredit       = 0;
                var     account           = new AccountingAc();
                var     accountCollection = new List <DoubleEntryAc>();
                var     accountlist       = _accountingRepository.GetAllAccountingEntry(MerchantContext.UserDetails.BranchId);
                foreach (var accountInfo in accountlist)
                {
                    var accountAc = new DoubleEntryAc();
                    accountAc = ApplicationClassHelper.ConvertType <DoubleEntry, DoubleEntryAc>(accountInfo);
                    accountAc.DoubleEntryId = accountInfo.Id;
                    totalDebit           = totalDebit + accountInfo.Debit;
                    totalCredit          = totalCredit + accountInfo.Credit;
                    accountAc.LedgerName = accountInfo.Ledger.Name;
                    accountCollection.Add(accountAc);
                }
                account.TotalCredit   = totalCredit;
                account.TotalDebit    = totalDebit;
                account.DoubleEntryAc = accountCollection.OrderByDescending(x => x.DoubleEntryId);

                return(Ok(account));
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
 public IHttpActionResult GetSupplierTypeList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var supplierTypeList       = _supplierProfileContext.GetSupplierTypeList();
             var supplierTypeCollection = new List <ParamTypeAC>();
             var supplierTypeAC         = new ParamTypeAC();
             foreach (var type in supplierTypeList)
             {
                 supplierTypeAC    = ApplicationClassHelper.ConvertType <ParamType, ParamTypeAC>(type);
                 supplierTypeAC.Id = type.Id;
                 supplierTypeCollection.Add(supplierTypeAC);
             }
             return(Ok(supplierTypeCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult GetAllLanguage()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var languageCollection = new List <LanguageAC>();
             foreach (var language in _companyRepository.GetAllLanguage())
             {
                 var languageAC = new LanguageAC();
                 languageAC            = ApplicationClassHelper.ConvertType <Language, LanguageAC>(language);
                 languageAC.LanguageId = language.Id;
                 languageCollection.Add(languageAC);
             }
             return(Ok(languageCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #4
0
        public List <LedgerAccountAC> GetAllLedgerAccountListByCompanyId(int companyId)
        {
            try
            {
                var ledgerAccountCollection = new List <LedgerAccountAC>();
                foreach (var ledgerse in _accountLedgerContext.Fetch(x => x.ParentLedgerId == null && x.CompanyId == companyId).ToList())
                {
                    var ledgerAccountAc = new LedgerAccountAC();
                    ledgerAccountAc           = ApplicationClassHelper.ConvertType <Ledgers, LedgerAccountAC>(ledgerse);
                    ledgerAccountAc.LedgerId  = ledgerse.Id;
                    ledgerAccountAc.LableName = ledgerse.Name;
                    ledgerAccountAc.SubLedgerAccountCollection = GetSubLedgerList(ledgerse.Id, companyId);
                    if (ledgerAccountAc.SubLedgerAccountCollection.Count() != 0)
                    {
                        ledgerAccountAc.IsChild = true;
                    }
                    ledgerAccountCollection.Add(ledgerAccountAc);
                }

                return(ledgerAccountCollection);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
 public IHttpActionResult GetCustomerList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var customerCollection = new List <CustomerProfileAc>();
             foreach (var customer in _customerRepository.GetCustomerList())
             {
                 var customerProfileAc = new CustomerProfileAc();
                 customerProfileAc            = ApplicationClassHelper.ConvertType <CustomerProfile, CustomerProfileAc>(customer);
                 customerProfileAc.CustomerId = customer.Id;
                 customerProfileAc            = GetCustomerProfileAc(customerProfileAc, customer);
                 customerCollection.Add(customerProfileAc);
             }
             return(Ok(customerCollection.OrderByDescending(x => x.CustomerId)));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #6
0
 public IHttpActionResult GetGroupList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var groupList       = _groupAccountContext.GetGroupListByCompanyId(CurrentCompanyId);
             var groupCollection = new List <GroupAccountAC>();
             var groupAC         = new GroupAccountAC();
             foreach (var group in groupList)
             {
                 //it will convert model class to appliation class based on naming conversions.
                 groupAC             = ApplicationClassHelper.ConvertType <Group, GroupAccountAC>(group);
                 groupAC.GroupId     = group.Id;
                 groupAC.HasBalanced = group.HasBalanced;
                 groupAC.UnderId     = @group.UnderId ?? 0;
                 groupCollection.Add(groupAC);
             }
             return(Ok(groupCollection));
         }
         return(BadRequest());
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #7
0
 public IHttpActionResult GetAllUserList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var userName       = HttpContext.Current.User.Identity.Name;
             var user           = _userDetailContext.GetAllUserList(userName);
             var userCollection = new List <UserDetailAc>();
             foreach (var userDetail in user)
             {
                 var userAC = new UserDetailAc();
                 userAC            = ApplicationClassHelper.ConvertType <UserDetail, UserDetailAc>(userDetail);
                 userAC.UserId     = userDetail.Id;
                 userAC.BranchName = userDetail.Branch.Name;
                 userCollection.Add(userAC);
             }
             return(Ok(userCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult GetContactPersonList(int id)
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var contactPersonList       = _supplierProfileContext.GetContactPersonList(id);
             var contactPersonCollection = new List <ContactPersonAC>();
             var contactAC = new ContactPersonAC();
             foreach (var contact in contactPersonList)
             {
                 contactAC           = ApplicationClassHelper.ConvertType <SupplierContactPerson, ContactPersonAC>(contact);
                 contactAC.ContactId = contact.Id;
                 contactPersonCollection.Add(contactAC);
             }
             return(Ok(contactPersonCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 public IHttpActionResult GetSupplierProfileList()
 {
     try
     {
         if (HttpContext.Current.User.Identity.IsAuthenticated)
         {
             var supplierList       = _supplierProfileContext.GetSupplierList(companyId);
             var supplierCollection = new List <SupplierProfileAC>();
             var supplierAC         = new SupplierProfileAC();
             foreach (var supplier in supplierList)
             {
                 supplierAC    = ApplicationClassHelper.ConvertType <SupplierProfile, SupplierProfileAC>(supplier);
                 supplierAC.Id = supplier.Id;
                 supplierAC.IsAcceptReturnForExpiredItem = supplier.IsAcceptReturnForExpiredItem;
                 supplierCollection.Add(supplierAC);
             }
             return(Ok(supplierCollection));
         }
         else
         {
             return(BadRequest());
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #10
0
        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;
            }
        }
Exemple #11
0
 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;
     }
 }
 /// <summary>
 /// get company detials by the companyId
 /// </summary>
 /// <param name="companyId">contain comapnyId to get company basic details.</param>
 /// <returns>object of company detail with the basic details of company</returns>
 public CompanyDetailAC GetCompanyDetailsById(int companyId, string userId)
 {
     try
     {
         var companyDetail = _companyConfigurationContext.FirstOrDefault(x => x.CompanyId == companyId);
         if (companyDetail != null)
         {
             var companyDetails    = _companyDataRepository.FirstOrDefault(x => x.Id == companyDetail.CompanyId && x.UserId == userId);
             var copConfigurations = _cpoConfigurationContext.Fetch(x => x.CompanyId == companyDetails.Id).ToList();
             if (companyDetails != null)
             {
                 var companyAC = new CompanyDetailAC();
                 companyAC = ApplicationClassHelper.ConvertType <CompanyConfiguration, CompanyDetailAC>(companyDetail);
                 companyAC.CompanyConfigId                   = companyDetail.Id;
                 companyAC.LowerBound                        = companyDetail.LowerBound != null ? companyDetail.LowerBound.Value : 0;
                 companyAC.UpperBound                        = companyDetail.UpperBound != null ? companyDetail.UpperBound.Value : 0;
                 companyAC.ReturnItem                        = companyDetail.ReturnItem;
                 companyAC.CurrencyId                        = companyDetail.CurrencyId;
                 companyAC.Name                              = companyDetail.CompanyDetail.Name;
                 companyAC.NameSL                            = companyDetail.CompanyDetail.NameSL;
                 companyAC.Location                          = companyDetail.CompanyDetail.Location;
                 companyAC.Email                             = companyDetail.CompanyDetail.Email;
                 companyAC.Zipcode                           = companyDetail.CompanyDetail.Zipcode;
                 companyAC.PhoneNumber                       = companyDetail.CompanyDetail.PhoneNumber;
                 companyAC.CompanyBarcodeConfiguration       = GetCompanyBarcodeConfiguration(companyDetail.Id);
                 companyAC.ListOfBalanceBarcodeConfiguration = GetBalanceBarcodeConfiguration(companyDetail.Id);
                 companyAC.CPOConfigurations                 = GetCpoConfiguration(copConfigurations);
                 return(companyAC);
             }
             else
             {
                 throw new ArgumentException("No Record Found.");
             }
         }
         else
         {
             throw new ArgumentException("No Record Found.");
         }
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        /// <summary>
        /// This method used for get ledger account ac list
        /// </summary>
        /// <param name="listOfLedgers">pass ledgers list</param>
        /// <returns></returns>
        private List <LedgerAccountAC> GetLedgerAccountAC(List <Ledgers> listOfLedgers)
        {
            var ledgerCollection = new List <LedgerAccountAC>();
            var ledgerAc         = new LedgerAccountAC();

            foreach (var ledger in listOfLedgers)
            {
                //it will convert model class to appliation class based on naming conversions.
                ledgerAc            = ApplicationClassHelper.ConvertType <Ledgers, LedgerAccountAC>(ledger);
                ledgerAc.LedgerId   = ledger.Id;
                ledgerAc.LedgerName = ledger.LedgerName;
                ledgerAc.Address    = ledger.Address;
                ledgerAc.State      = ledger.State;
                ledgerAc.GroupName  = ledger.Group.GroupName;
                ledgerCollection.Add((ledgerAc));
            }
            return(ledgerCollection);
        }
 /// <summary>
 /// this methos is used to get item details by item id.
 /// </summary>
 /// <param name="itemId"></param>
 /// <returns></returns>
 public ItemProfileAC GetItemProfileByItemId(int itemId)
 {
     try
     {
         var itemProfile       = new ItemProfileAC();
         var itemProfileDetail = _itemProfileContext.FirstOrDefault(x => x.Id == itemId && x.IsDeleted == false);
         if (itemProfileDetail != null)
         {
             var itemQuantiyCollection = new List <ItemQuantityList>();
             var itemQuantityList      = new ItemQuantityList();
             itemProfile = ApplicationClassHelper.ConvertType <ItemProfile, ItemProfileAC>(itemProfileDetail);
             itemProfile.ItemProfileId = itemProfileDetail.Id;
             itemProfile.ItemType      = itemProfileDetail.Category.BrandParamType.ValueEn + "-" + itemProfileDetail.Category.GroupParamType.ValueEn;
             var posIncidentReportDetails = _posIncidentReportDataRepository.FirstOrDefault(x => x.ItemId == itemProfileDetail.Id);
             itemProfile.PosIncidentReportId = posIncidentReportDetails.Id;
             var posIncidentDetails = _posIncidentReportDataRepository.FirstOrDefault(x => x.ItemId == itemId);
             if (posIncidentDetails != null)
             {
                 itemProfile.BranchId   = (int)posIncidentDetails.BranchId;
                 itemProfile.BranchName = posIncidentDetails.BranchDetail.Name;
             }
             var itemQuantityDetails = _itemQuantityContext.FirstOrDefault(x => x.ItemId == itemProfile.Id && x.Branch.CompanyId == itemProfileDetail.CompanyId);
             if (itemQuantityDetails != null)
             {
                 itemQuantityList = ApplicationClassHelper.ConvertType <ItemQuantity, ItemQuantityList>(itemQuantityDetails);
                 itemQuantityList.ItemQuantityId  = itemQuantityDetails.Id;
                 itemProfile.BranchId             = itemQuantityDetails.BranchId;
                 itemProfile.ActualQuantity       = itemQuantityDetails.ActualQuantity;
                 itemQuantityList.MaximumQuantity = itemQuantityDetails.MaxQuantity;
                 itemQuantityList.MinimumQuantity = itemQuantityDetails.MinQuantity;
             }
             itemQuantiyCollection.Add(itemQuantityList);
             itemProfile.ListOfItemQuantityList = itemQuantiyCollection;
         }
         return(itemProfile);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #15
0
 public List <StatusTypeAc> GetallStatus()
 {
     try
     {
         var statusCollection = new List <StatusTypeAc>();
         foreach (var status in _statusDataRepository.GetAll().ToList())
         {
             var statusAc = new StatusTypeAc();
             statusAc          = ApplicationClassHelper.ConvertType <StatusType, StatusTypeAc>(status);
             statusAc.StatusId = status.Id;
             statusCollection.Add(statusAc);
         }
         return(statusCollection);
     }
     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;
            }
        }
 /// <summary>
 /// get role list
 /// </summary>
 /// <returns>return list of role</returns>
 public List <RoleAc> GetRoleList(int companyId)
 {
     try
     {
         var roleList       = _roleContext1.Fetch(x => x.RoleName != StringConstants.AdminRoleName && x.RoleName != StringConstants.SuperAdminRoleName && x.CompanyId == companyId && x.IsDeleted == false).ToList();
         var roleCollection = new List <RoleAc>();
         foreach (var role in roleList)
         {
             var roleAc = new RoleAc();
             roleAc             = ApplicationClassHelper.ConvertType <Role, RoleAc>(role);
             roleAc.IsAdminRole = false;
             roleCollection.Add(roleAc);
         }
         return(roleCollection);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #18
0
 public IHttpActionResult GetParamTypeByParamId(int paramId)
 {
     try
     {
         List <ParamType> paramTypeList = _systemParameterContext.GetParamTypeByParamId(paramId);
         var paramTypeCollection        = new List <ParamTypeAc>();
         var paramTypeAC = new ParamTypeAc();
         foreach (var paramType in paramTypeList)
         {
             paramTypeAC    = ApplicationClassHelper.ConvertType <ParamType, ParamTypeAc>(paramType);
             paramTypeAC.Id = paramType.Id;
             paramTypeCollection.Add(paramTypeAC);
         }
         return(Ok(paramTypeCollection));
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #19
0
        private List <LedgerAccountAC> GetSubLedgerList(int id, int companyId)
        {
            try
            {
                var ledgerAccountCollection = new List <LedgerAccountAC>();
                foreach (var ledgerse in _accountLedgerContext.Fetch(x => x.ParentLedgerId == id && x.CompanyId == companyId))
                {
                    var ledgerAccountAc = new LedgerAccountAC();
                    ledgerAccountAc           = ApplicationClassHelper.ConvertType <Ledgers, LedgerAccountAC>(ledgerse);
                    ledgerAccountAc.LedgerId  = ledgerse.Id;
                    ledgerAccountAc.LableName = "Sub account of " + ledgerse.ParentLedger.Name;
                    ledgerAccountCollection.Add(ledgerAccountAc);
                }

                return(ledgerAccountCollection);
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
Exemple #20
0
        /// <summary>
        /// this method is used to get all permission list
        /// </summary>
        /// <returns></returns>
        public IOrderedEnumerable <RoleAc> GetAllRoleList(int companyId)
        {
            try
            {
                var roleCollection = new List <RoleAc>();
                foreach (var role in _roleRepository.Fetch(x => !x.IsDeleted && x.RoleName != StringConstants.AdminRoleName && x.RoleName != StringConstants.SuperAdminRoleName && x.CompanyId == companyId).ToList())
                {
                    var roleAc = new RoleAc();
                    roleAc          = ApplicationClassHelper.ConvertType <Role, RoleAc>(role);
                    roleAc.Id       = role.Id;
                    roleAc.RoleName = role.RoleName;
                    roleCollection.Add(roleAc);
                }

                return(roleCollection.OrderBy(x => x.RoleName));
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
Exemple #21
0
        /// <summary>
        /// This method used for get Ledger Account list By Comapny Id.
        /// </summary>
        /// <param name="companyId"></param>
        /// <returns></returns>
        public List <LedgerAccountAC> GetLedgerAccountListByCompanyId(int companyId)
        {
            var ledgerAccountCollection = new List <LedgerAccountAC>();

            foreach (var ledgerse in _accountLedgerContext.Fetch(x => x.CompanyId == companyId).ToList())
            {
                var ledgerAccountAc = ApplicationClassHelper.ConvertType <Ledgers, LedgerAccountAC>(ledgerse);
                ledgerAccountAc.LedgerId = ledgerse.Id;

                if (ledgerse.ParentLedger != null)
                {
                    ledgerAccountAc.LableName = "Sub account of " + ledgerse.ParentLedger.Name;
                    ledgerAccountAc.IsChild   = true;
                }
                else
                {
                    ledgerAccountAc.LableName = ledgerse.Group.GroupName;
                }

                ledgerAccountCollection.Add(ledgerAccountAc);
            }
            return(ledgerAccountCollection);
        }
 private PosIncidentReportAc MapPosIncidentReportAc(DomainModel.Models.IncidentReport.PosIncidentReport incidentReportDetails)
 {
     try
     {
         var incidentAc = new PosIncidentReportAc();
         incidentAc = ApplicationClassHelper.ConvertType <DomainModel.Models.IncidentReport.PosIncidentReport, PosIncidentReportAc>(incidentReportDetails);
         if (incidentReportDetails.RecordId != null)
         {
             var parentRecredDetails = _parentRecordContext.FirstOrDefault(x => x.Id == incidentReportDetails.RecordId);
             if (parentRecredDetails != null)
             {
                 var workFlowStatusDetails = _workFLowLogContext.Fetch(x => x.RecordId == parentRecredDetails.Id).ToList().Last();
                 if (workFlowStatusDetails != null)
                 {
                     incidentAc.WorkFlowStatus = workFlowStatusDetails.Action;
                 }
             }
         }
         incidentAc.PosIncidentReportId = incidentReportDetails.Id;
         incidentAc.IncidentTypeName    = incidentReportDetails.IncidentTypes.ValueEn;
         incidentAc.LossValue           = incidentReportDetails.CommittedLossValue;
         incidentAc.GainValue           = incidentReportDetails.CommittedGainValue;
         incidentAc.ResolveQuantity     = incidentReportDetails.CommitedQuantity;
         incidentAc.ItemName            = incidentReportDetails.ItemProfile.ItemNameEn;
         incidentAc.BranchName          = incidentReportDetails.BranchDetail.Name;
         incidentAc.BranchId            = (int)incidentReportDetails.BranchId;
         incidentAc.CostPrice           = incidentReportDetails.ItemProfile.CostPrice;
         incidentAc.IncidentDate        = incidentReportDetails.CreatedDateTime.ToString("dd/MM/yyyy hh:mm");
         return(incidentAc);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
        public IHttpActionResult GetAllCompanyDetail()
        {
            try
            {
                if (HttpContext.Current.User.Identity.IsAuthenticated)
                {
                    var companyCollection = new List <CompanyDetailAC>();
                    var currentUser       = HttpContext.Current.User.Identity.GetUserId();

                    foreach (var companyDetail in _companyRepository.GetCurrentUserCompanyDetailList(currentUser))
                    {
                        var companyDetailAC = new CompanyDetailAC();
                        companyDetailAC                = ApplicationClassHelper.ConvertType <CompanyDetail, CompanyDetailAC>(companyDetail);
                        companyDetailAC.CompanyId      = companyDetail.Id;
                        companyDetailAC.Name           = companyDetail.Name;
                        companyDetailAC.NameSL         = companyDetail.NameSL;
                        companyDetailAC.Location       = companyDetail.Location;
                        companyDetailAC.Email          = companyDetail.Email;
                        companyDetailAC.Zipcode        = companyDetail.Zipcode;
                        companyDetailAC.PhoneNumber    = companyDetail.PhoneNumber;
                        companyDetailAC.IsDeleteOrEdit = true;
                        companyCollection.Add(companyDetailAC);
                    }
                    return(Ok(companyCollection));
                }
                else
                {
                    return(BadRequest());
                }
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }
 public IHttpActionResult GetReceiptPaymentAccount()
 {
     try
     {
         var ledgerList       = _ledgerAccountRepository.GetReceiptPaymentLeadgers(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.LedgerName = ledger.LedgerName;
             ledgerAc.GroupName  = ledger.Group.GroupName;
             ledgerCollection.Add((ledgerAc));
         }
         return(Ok(ledgerCollection));
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
 /// <summary>
 /// this method is used to get incident report details by id.
 /// </summary>
 /// <param name="incidentId"></param>
 /// <param name="userDetail"></param>
 /// <returns></returns>
 public PosIncidentReportAc GetIncidentReportDetailsById(int incidentId, UserDetail userDetail, bool isAllowToAccessAllBranch)
 {
     try
     {
         var incidentReportDetail = _posIncidentReportDataRepository.FirstOrDefault(x => x.Id == incidentId);
         var incidentAc           = new PosIncidentReportAc();
         incidentAc = ApplicationClassHelper.ConvertType <DomainModel.Models.IncidentReport.PosIncidentReport, PosIncidentReportAc>(incidentReportDetail);
         incidentAc.PosIncidentReportId = incidentReportDetail.Id;
         incidentAc.IncidentTypeName    = incidentReportDetail.IncidentTypes.ValueEn;
         incidentAc.LossValue           = incidentReportDetail.CommittedLossValue;
         incidentAc.GainValue           = incidentReportDetail.CommittedGainValue;
         incidentAc.ResolveQuantity     = incidentReportDetail.CommitedQuantity;
         incidentAc.ItemName            = incidentReportDetail.ItemProfile.ItemNameEn;
         incidentAc.BranchName          = incidentReportDetail.BranchDetail.Name;
         incidentAc.IsDisabledInfo      = true;
         incidentAc.CostPrice           = incidentReportDetail.ItemProfile.CostPrice;
         incidentAc.IncidentDate        = incidentReportDetail.CreatedDateTime.ToString("dd/MM/yyyy hh:mm");
         incidentAc.SellPrice           = incidentReportDetail.ItemProfile.SellPrice;
         var itemQuantityDetails =
             _itemQuantityContext.FirstOrDefault(x => x.ItemId == incidentReportDetail.ItemId && x.BranchId == incidentReportDetail.BranchId);
         if (itemQuantityDetails != null)
         {
             incidentAc.CurrentSystemQuantity = itemQuantityDetails.ActualQuantity;
         }
         var itemOfferDetail = new ItemOfferDetailAC
         {
             ItemId            = incidentReportDetail.ItemId,
             Barcode           = incidentReportDetail.ItemProfile.Barcode,
             ItemNameEn        = incidentReportDetail.ItemProfile.ItemNameEn,
             FlavourEn         = incidentReportDetail.ItemProfile.FlavourEn,
             ItemCode          = incidentReportDetail.ItemProfile.Code,
             SellPriceA        = incidentReportDetail.ItemProfile.SellPriceA,
             SellPrice         = incidentReportDetail.ItemProfile.SellPrice,
             SellPriceB        = incidentReportDetail.ItemProfile.SellPriceB,
             SellPriceC        = incidentReportDetail.ItemProfile.SellPriceC,
             SellPriceD        = incidentReportDetail.ItemProfile.SellPriceD,
             UnitType          = incidentReportDetail.ItemProfile.SystemParameter.ValueEn,
             BaseUnitCount     = incidentReportDetail.ItemProfile.BaseUnit,
             CostPrice         = incidentReportDetail.ItemProfile.CostPrice,
             ItemNameAr        = incidentReportDetail.ItemProfile.ItemNameSl,
             FlavourAr         = incidentReportDetail.ItemProfile.FlavourSl,
             ItemType          = incidentReportDetail.ItemProfile.Category.BrandParamType.ValueEn + "-" + incidentReportDetail.ItemProfile.Category.GroupParamType.ValueEn,
             IsOfferItem       = incidentReportDetail.ItemProfile.IsOfferItem == true ? "Yes" : "No",
             PreviousCostPrice = incidentReportDetail.ItemProfile.PreviousCostPrice,
             AverageCostPrice  = incidentReportDetail.ItemProfile.AverageCostPrice,
             IsActiveItem      = incidentReportDetail.ItemProfile.IsActive == true ? "Yes" : "No"
         };
         incidentAc.ItemDetails = itemOfferDetail;
         if (isAllowToAccessAllBranch)
         {
             incidentAc.IsCurrentUser = true;
         }
         else
         {
             if (incidentReportDetail.BranchId == userDetail.BranchId)
             {
                 incidentAc.IsCurrentUser = true;
             }
         }
         var workflowCollection = new List <WorkFlowActionAc>();
         if (incidentReportDetail.RecordId != null)
         {
             foreach (var workflowInfo in _workFLowLogContext.Fetch(x => x.RecordId == incidentReportDetail.RecordId).ToList())
             {
                 var workFlowActionAc = new WorkFlowActionAc();
                 workFlowActionAc.Stage            = workflowInfo.Stage;
                 workFlowActionAc.Action           = workflowInfo.Action;
                 workFlowActionAc.WorkFlowActionId = workflowInfo.Id;
                 workFlowActionAc.RoleName         = workflowInfo.RoleDetails.RoleName;
                 workFlowActionAc.Comment          = workflowInfo.Comments;
                 workFlowActionAc.ActionDate       = workflowInfo.CreatedDateTime.ToString("dd/MM/yyyy hh:mm");;
                 var userNames = _userDetailContext.FirstOrDefault(x => x.UserId == workflowInfo.UserId);
                 if (userNames != null)
                 {
                     workFlowActionAc.UserName = userNames.UserName;
                 }
                 workflowCollection.Add(workFlowActionAc);
             }
             incidentAc.WorkFlowAction = workflowCollection.OrderBy(x => x.WorkFlowActionId);
             var workFLowLastDetails = _workFLowLogContext.Fetch(x => x.RecordId == incidentReportDetail.RecordId).ToList().Last();
             if (incidentReportDetail.IsReject)
             {
                 var workFlowCurrentDetails =
                     _workFlowDetailContext.FirstOrDefault(x => x.Id == workFLowLastDetails.WorkFlowDetail.ParentActivityId);
                 if (workFlowCurrentDetails != null)
                 {
                     WorkFlowDetail workDetailsById = _workFlowDetailContext.FirstOrDefault(x => x.Id == workFlowCurrentDetails.ParentActivityId && x.AssignedId == userDetail.RoleId);
                     if (workDetailsById != null)
                     {
                         incidentAc.IsReview   = workDetailsById.IsReview;
                         incidentAc.IsApproval = workDetailsById.IsApproval;
                     }
                 }
             }
             else
             {
                 var workFlowCurrentDetails =
                     _workFlowDetailContext.FirstOrDefault(x => x.Id == workFLowLastDetails.WorkFlowId && x.AssignedId == userDetail.RoleId);
                 if (workFlowCurrentDetails != null)
                 {
                     incidentAc.IsReview   = workFlowCurrentDetails.IsReview;
                     incidentAc.IsApproval = workFlowCurrentDetails.IsApproval;
                 }
             }
         }
         return(incidentAc);
     }
     catch (Exception ex)
     {
         _errorLog.LogException(ex);
         throw;
     }
 }
Exemple #26
0
        public WorkFlowAc EditWorkFlowInformationById(int workFlowId)
        {
            try
            {
                var workFlowAc      = new WorkFlowAc();
                var workFlowDetails = _workFlowDataRepository.GetById(workFlowId);
                if (workFlowDetails != null)
                {
                    int parentId;
                    if (workFlowDetails.ParentActivityId == 0)
                    {
                        parentId = workFlowDetails.Id;
                    }
                    else
                    {
                        parentId = ParentNodeForTreeView(workFlowDetails.ParentActivityId);
                    }

                    var parentActivityDetails = _workFlowDataRepository.FirstOrDefault(x => x.Id == parentId);
                    //int getParentId = ParentNodeForTreeView(workFlowDetails.ParentActivityId);
                    workFlowAc.ParentActivityId         = parentActivityDetails.ActivityId;
                    workFlowAc.WorkFlowParentActivityId = workFlowDetails.ParentActivityId;
                    workFlowAc.WorkFlowDetailParentId   = parentId;
                    workFlowAc.PermissionId             = workFlowDetails.WorkFlowId;
                    workFlowAc.ActivityId             = workFlowDetails.ActivityId;
                    workFlowAc.IsApproval             = workFlowDetails.IsApproval;
                    workFlowAc.IsCondition            = workFlowDetails.IsCondition;
                    workFlowAc.WorkFlowName           = parentActivityDetails.WorkFlowName;
                    workFlowAc.IsAllowOtherBranchUser = parentActivityDetails.Activity.IsAllowOtherBranchUser;
                    //  workFlowAc.Operator = workFlowDetails.Operator;
                    var workFlowColllection = new List <WorkFlowPermission>();
                    if (workFlowDetails.IsParentAction)
                    {
                        var workFlowDetail = new WorkFlowPermission
                        {
                            WorkFlowId  = workFlowDetails.WorkFlowId,
                            InitiatorId = workFlowDetails.InitiatorId,
                            AssignedId  = workFlowDetails.AssignedId,
                            //OldStatus = childAction.OldStatusId,
                            //NewStatus = childAction.NewStatusId,
                            IsApproval             = workFlowDetails.IsApproval,
                            IsReview               = workFlowDetails.IsReview,
                            IsParentAction         = workFlowDetails.IsParentAction,
                            IsApprovePanel         = workFlowDetails.IsApprovePanel,
                            IsRejectPanel          = workFlowDetails.IsRejectPanel,
                            ActivityId             = workFlowDetails.ActivityId,
                            NextActivityId         = workFlowDetails.NextActivityId,
                            ParentActivityId       = workFlowDetails.ParentActivityId,
                            IsActivityClose        = workFlowDetails.NextActivity.IsClosed,
                            workFlowActionId       = workFlowDetails.Id,
                            IsChild                = workFlowDetails.IsChildAction,
                            IsCondition            = workFlowDetails.IsCondition,
                            OtherWorkFlowId        = workFlowDetails.OtherWorkFlowId,
                            IsAllowOtherBranchUser = workFlowDetails.IsAllowOtherBranchUser,
                            //Variable1 = workFlowDetails.Variable1,
                            //Variable2 = workFlowDetails.Variable2,
                            //Operator = workFlowDetails.Operator
                        };
                        if (workFlowDetails.IsCondition)
                        {
                            var condtitionalOperatorCollection = new List <WorkFlowConditionalOperator>();
                            var conditionalDetails             =
                                _conditionalDataRepository.Fetch(x => x.WorkFlowDetailId == workFlowDetails.Id);
                            foreach (var conditionalOperator in conditionalDetails)
                            {
                                WorkFlowConditionalOperator workFlowConditionalOperator =
                                    ApplicationClassHelper.ConvertType <ConditionalOperator, WorkFlowConditionalOperator>
                                        (conditionalOperator);
                                workFlowConditionalOperator.ConditionalOperatorId = conditionalOperator.Id;
                                workFlowConditionalOperator.ConditionInfo         = conditionalOperator.Condition;
                                workFlowConditionalOperator.IsActiveConditional   = true;
                                condtitionalOperatorCollection.Add(workFlowConditionalOperator);
                            }
                            workFlowDetail.ConditionalOperator = condtitionalOperatorCollection;
                        }
                        workFlowDetail.Children = ChildWorkFlowPermissio(workFlowDetails.Id);
                        workFlowColllection.Add(workFlowDetail);
                        workFlowAc.Permission = workFlowColllection;
                    }
                    else
                    {
                        var workFlowDetail = new WorkFlowPermission
                        {
                            WorkFlowId  = workFlowDetails.WorkFlowId,
                            InitiatorId = workFlowDetails.InitiatorId,
                            AssignedId  = workFlowDetails.AssignedId,
                            //OldStatus = workFlowDetails.OldStatusId,
                            //NewStatus = workFlowDetails.NewStatusId,
                            IsChild                = workFlowDetails.IsParentAction,
                            IsParentAction         = workFlowDetails.IsParentAction,
                            IsApprovePanel         = false,
                            IsRejectPanel          = false,
                            ActivityId             = workFlowDetails.ActivityId,
                            NextActivityId         = workFlowDetails.NextActivityId,
                            ParentActivityId       = workFlowDetails.ParentActivityId,
                            workFlowActionId       = workFlowDetails.Id,
                            IsActivityClose        = workFlowDetails.NextActivity.IsClosed,
                            IsCondition            = workFlowDetails.IsCondition,
                            IsAllowOtherWorkFlow   = workFlowDetails.IsAllowOtherWorkFlow,
                            OtherWorkFlowId        = workFlowDetails.OtherWorkFlowId,
                            IsAllowOtherBranchUser = workFlowDetails.IsAllowOtherBranchUser
                                                     //Variable1 = workFlowDetails.Variable1,
                                                     //Variable2 = workFlowDetails.Variable2,Operator = workFlowDetails.Operator
                        };
                        workFlowColllection.Add(workFlowDetail);
                        workFlowAc.Permission = workFlowColllection;
                    }
                    return(workFlowAc);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
                _errorLog.LogException(ex);
                throw;
            }
        }