public List <AvailableBalanceModel> GetAvailableBalance()
        {
            var agents = ent.Agents.OrderBy(x => x.AgentName);


            List <AvailableBalanceModel> Listmodel = new List <AvailableBalanceModel>();

            foreach (var agentinfo in agents)
            {
                var data = ent.Air_GetAvailableBalance(agentinfo.AgentId).ToList();

                var otherData = data.FirstOrDefault();

                AvailableBalanceModel model = new AvailableBalanceModel();
                model.CreditLimit      = otherData.CreditLimit.Value;
                model.RemainingBalance = otherData.Amount.Value;
                model.AgentName        = otherData.AgentName;

                foreach (var currency in data)
                {
                    CurrencyDetail detail = new CurrencyDetail();
                    detail.Amount       = currency.Amount.ToString();
                    detail.CreditLimit  = currency.CreditLimit.ToString();
                    detail.CurrenyCode  = currency.CurrencyCode.ToString();
                    detail.LedgerAmount = currency.LedgerAmount.ToString();

                    model.CurrencyList.Add(detail);
                    // model.Currency = item.CurrencyCode;
                }
                Listmodel.Add(model);
            }

            return(Listmodel);
        }
        public ActionResult Index()
        {
            var cstock = cn.Products.Where(x => x.Stock < x.CriticalPoint).Count();

            ViewBag.sd = cstock;
            string[] dolar = GetCurrencyNode();

            var kurlar = new Currencies()
            {
                Name = "USD"
            };
            var kur = new List <Currency>()
            {
                new Currency()
                {
                    Name = dolar[0], Alis = dolar[1], Satis = dolar[2], Tarih = dolar[3]
                },
                new Currency()
                {
                    Name = dolar[4], Alis = dolar[5], Satis = dolar[6], Tarih = dolar[7]
                }
            };
            var model = new CurrencyDetail()
            {
                Degerler = kur, İsimler = kurlar
            };

            return(View(model));
        }
Пример #3
0
        public object Get(Messages.Currency request)
        {
            CurrencyIsoCode code     = request.IsoCode;
            Currency        currency = Currency.Get(code);

            var detail = new CurrencyDetail
            {
                IsoCode     = currency.IsoCode,
                NumericCode = currency.NumericCode,
                EnglishName = currency.EnglishName,
                NativeName  = currency.NativeName,
                Symbol      = currency.Symbol,
                IsObsolete  = currency.IsObsolete
            };

            return(new Messages.CurrencyResponse
            {
                Detail = detail
            });
        }
Пример #4
0
        ///<summary>
        ///validate User Name and Password of user. -PS
        ///</summary>
        ///<param name="obj"></param>
        private void ValidateUser(object obj)
        {
            SettingHelpers.LocalizationDictionary = _posRepository.GetLanguageWiseLabels(int.Parse(Language));

            if (!String.IsNullOrEmpty(UserName) && !String.IsNullOrEmpty(((System.Windows.Controls.PasswordBox)(obj)).Password))
            {
                isAuthenticated             = false;
                SettingHelpers.IsCustomerPO = false;
                MerchantService.Repository.ApplicationClasses.LoginViewModel loginViewController = new MerchantService.Repository.ApplicationClasses.LoginViewModel();
                loginViewController.UserName = UserName;
                loginViewController.Password = ((System.Windows.Controls.PasswordBox)(obj)).Password;
                var user = _posRepository.ValidateLogin(loginViewController.UserName, loginViewController.Password);
                if (user != null)
                {
                    var userDetail = _posRepository.GetUserDetailByAspNetUserId(user.Id);
                    if (userDetail != null)
                    {
                        //Admin User.
                        if (userDetail.RoleId == 1)
                        {
                            // you are not authorized.
                            isAuthenticated = true;
                            return;
                        }
                        //get the Branch Detail object by BranchId
                        var branchDetail = _posRepository.GetBranchById(userDetail.BranchId.Value);
                        if (branchDetail != null)
                        {
                            Utility.SettingHelpers.CurrentBranchId = branchDetail.Id;
                            var rolepermissionResponse = _posRepository.GetRolPermissionByChildPermissionId((int)MerchantService.DomainModel.Enums.RolePermission.POSSystemLogin, branchDetail.CompanyId);
                            if (rolepermissionResponse != null && rolepermissionResponse.Any())
                            {
                                //update by ankit
                                bool validRole = false;
                                foreach (var role in rolepermissionResponse)
                                {
                                    if (userDetail.RoleId == role.RoleId)
                                    {
                                        validRole = true;
                                    }
                                }
                                if (validRole)
                                {
                                    SettingHelpers.IsReconciled = true;
                                    var companyDetail = _posRepository.GetCompanyConfigurationByCompanyId(branchDetail.CompanyId);
                                    if (companyDetail != null)
                                    {
                                        SettingHelpers.CompanyConfigruationObject        = companyDetail;
                                        SettingHelpers.BalanceBarcodeConfigurationObject = _posRepository.GetBalanceBarcodeConfiguration(companyDetail.CompanyId);
                                        var currencyResponse = _posRepository.GetAllCurrencyDetail();
                                        if (currencyResponse.Any())
                                        {
                                            CurrencyDetail currencyDetail = currencyResponse.Where(x => x.Id == companyDetail.CurrencyId).FirstOrDefault();
                                            SettingHelpers.CurrentCultureInfo     = new System.Globalization.CultureInfo(currencyDetail.CultureInfoValue);
                                            Thread.CurrentThread.CurrentUICulture = SettingHelpers.CurrentCultureInfo;
                                            Thread.CurrentThread.CurrentCulture   = SettingHelpers.CurrentCultureInfo;
                                        }
                                        // Get the Incident Report Data for Cashier by compan id.
                                        var reponseIncidentReport = _posRepository.GetIncidentReportList(branchDetail.CompanyId);
                                        SettingHelpers.OperationIncidentReport = reponseIncidentReport;
                                    }
                                    Utility.SettingHelpers.CurrentUserId = userDetail.Id;
                                    BackgroundWorker bgCheckUserSession = new BackgroundWorker();
                                    bgCheckUserSession.DoWork             += bgCheckUserSession_DoWork;
                                    bgCheckUserSession.RunWorkerCompleted += bgCheckUserSession_RunWorkerCompleted;
                                    bgCheckUserSession.RunWorkerAsync();
                                }
                                else
                                {
                                    // not Authorized
                                    IsBusy          = false;
                                    isAuthenticated = true;
                                }
                            }
                            else
                            {
                                //not Authorized
                                IsBusy          = false;
                                isAuthenticated = true;
                            }
                        }
                        else
                        {
                            // User not Exists.
                            IsBusy          = false;
                            isAuthenticated = true;
                        }
                    }
                    else
                    {
                        // User not Exists.
                        IsBusy          = false;
                        isAuthenticated = true;
                    }
                }
                else
                {
                    //User not Exists.
                    IsBusy          = false;
                    isAuthenticated = true;
                    _loginScreen.txtUserName.Focus();
                }
            }
            else
            {
                IsBusy          = false;
                isAuthenticated = true;
                _loginScreen.txtUserName.Focus();
            }
        }