public async Task <Pagination <MongoAccount> > Search(AccountSearch search, string projectId)
        {
            var wrapperQuery = new List <FilterDefinition <MongoAccount> >();

            if (!string.IsNullOrWhiteSpace(search.searchStr))
            {
                wrapperQuery.Add(Builders <MongoAccount> .Filter.Regex(p => p.DisplayName, new BsonRegularExpression($"/{search.searchStr}/i")));
                wrapperQuery.Add(Builders <MongoAccount> .Filter.Regex(p => p.Firstname, new BsonRegularExpression($"/{search.searchStr}/i")));
                wrapperQuery.Add(Builders <MongoAccount> .Filter.Regex(p => p.Lastname, new BsonRegularExpression($"/{search.searchStr}/i")));
            }
            if (!string.IsNullOrWhiteSpace(search.role))
            {
                wrapperQuery.Add($@"{{Role':'{search.role}'}}");
            }
            wrapperQuery.Add(Builders <MongoAccount> .Filter.Eq(p => p.ProjectId, projectId));
            _filter = Builders <MongoAccount> .Filter.Or(wrapperQuery.ToArray());

            var sortBuilder = Builders <MongoAccount> .Sort;
            SortDefinition <MongoAccount> sort = null;
            var response = await GetPaginationAsync(_collection, search.page, search.limit, _filter, sort);

            Pagination <MongoAccount> result = new Pagination <MongoAccount>
            {
                TotalRecord = response.total,
                Datas       = response.datas.ToList()
            };

            return(result);
        }
        public HttpResponseMessage GetAccountSearch([FromBody] AccountSearch accountSearch)
        {
            AccountManagementService    accService  = new AccountManagementService();
            HttpStatusCode              ReturnCode  = HttpStatusCode.OK;
            TranInfo <SearchResult>     transaction = new TranInfo <SearchResult>();
            ReturnResult <SearchResult> result      = new ReturnResult <SearchResult>();

            try
            {
                result = accService.GetAccountSearch(accountSearch);
                if (result.status.Status == StatusEnum.Success)
                {
                    transaction.data   = result.result;
                    transaction.status = true;
                }
                else
                {
                    transaction.status = false;
                    transaction.AddException(result.status.StatusMessage);
                }
            }
            catch (Exception ex)
            {
                transaction.status = false;
                transaction.AddException(ex.Message);
                ReturnCode    = HttpStatusCode.InternalServerError;
                result.status = _eHandler.HandleException(ex);
                _commonService.LogError(result.status);
            }
            return(Request.CreateResponse <TranInfo <SearchResult> >(ReturnCode, transaction));
        }
示例#3
0
        public void DownloadWordAccountDetails()
        {
            CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();

            AccountSearch acc = new AccountSearch();

            acc.AccountDATA = obj.AccountSearch(Convert.ToInt32(Session["acc_data"]), Session["acc_mode"].ToString());
            GridView gv = new GridView();

            gv.DataSource = acc.AccountDATA;
            gv.DataBind();
            Response.ClearContent();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=accountdetails.doc");
            //Response.ContentType = "application/vnd.ms-word ";
            //Response.Write(gv);
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-word ";
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            gv.RenderControl(hw);
            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();
        }
        /// <summary>
        /// Sql operation to view all the account details.
        /// </summary>
        /// <returns></returns>
        public List <AccountSearch> viewALLAccount()
        {
            string        connectionstring = "data source=.;" + "database=Binoy;" + "Integrated Security=true";
            SqlConnection connection       = new SqlConnection(connectionstring);

            connection.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "View_Account_StatusAll_s2por_Procedure";
            cmd.Connection  = connection;
            List <AccountSearch> aclist = new List <AccountSearch>();
            SqlDataReader        reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                int           a_id     = Convert.ToInt32(reader["AccountID"]);
                int           c_id     = Convert.ToInt32(reader["CustomerID"]);
                string        acc_type = reader["AccountType"].ToString();
                string        status   = reader["Status"].ToString();
                string        message  = reader["Message"].ToString();
                DateTime      up_date  = Convert.ToDateTime(reader["Last_Updated"]);
                AccountSearch cus      = new AccountSearch(a_id, c_id, acc_type, status, message, up_date);
                aclist.Add(cus);
            }
            connection.Close();
            return(aclist);
        }
示例#5
0
 public ActionResult Deposit(AccountSearch PD)
 {
     if (PD.DepositAmount == 0 || PD.DepositAmount < 0)
     {
         TempData["AlertMessage"] = "Please enter some valid amount to deposit.";
         return(View("Deposit", PD));
     }
     else
     {
         ViewBag.accid        = PD.AccountID;
         ViewBag.BalBeforwith = PD.BalanceAmount;
         int latbalance = PD.BalanceAmount + PD.DepositAmount;
         CreateCustomerAccounts2porDbData objad = new CreateCustomerAccounts2porDbData();
         int mi = objad.depositamount(PD, latbalance);
         if (mi > 0)
         {
             if (Request.HttpMethod == "POST")
             {
                 TempData["AlertMessage"] = "Amount INR " + PD.DepositAmount + " deposited successfully.";
             }
             ViewBag.latbalance = latbalance;
             return(View("AfterDeposit"));
         }
         else
         {
             return(RedirectToAction("Exception"));
         }
     }
 }
        /// <summary>
        /// Sql operation to deposit certain amount to existing source account.
        /// </summary>
        /// <param name="ab"></param>
        /// <param name="latest"></param>
        /// <returns></returns>
        public int depositamount(AccountSearch ab, int latest)
        {
            try
            {
                DateTime date = DateTime.Now;


                string        connectionstring = "data source=.;" + "database=Binoy;" + "Integrated Security=true";
                SqlConnection connection       = new SqlConnection(connectionstring);
                connection.Open();

                SqlCommand command = new SqlCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "sp_depositcash_s2por";
                command.Connection  = connection;


                command.Parameters.AddWithValue("@accountid", ab.AccountID);
                command.Parameters.AddWithValue("@amount", latest);
                command.Parameters.AddWithValue("@value", ab.DepositAmount);
                command.Parameters.AddWithValue("@date", date);

                int rowaffected = command.ExecuteNonQuery();
                connection.Close();

                return(rowaffected);
            }
            catch (Exception e)
            {
                return(0);
            }
        }
        /// <summary>
        /// Sql operation to view account statement based on number of transactions.
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cyc"></param>
        /// <returns></returns>
        public List <AccountSearch> viewAccountStatement(int id, int cyc)
        {
            string        connectionstring = "data source=.;" + "database=Binoy;" + "Integrated Security=true";
            SqlConnection connection       = new SqlConnection(connectionstring);

            connection.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "sp_viewAccountstatement_s2por";
            cmd.Connection  = connection;
            cmd.Parameters.AddWithValue("@acc_id", id);
            cmd.Parameters.AddWithValue("@no", cyc);

            List <AccountSearch> aclist = new List <AccountSearch>();
            SqlDataReader        reader = cmd.ExecuteReader();

            while (reader.Read())
            {
                int           t_id     = Convert.ToInt32(reader["TransactionID"]);
                string        descript = reader["Dessript"].ToString();
                DateTime      Date     = Convert.ToDateTime(reader["Trnct_date"]);
                int           amount   = Convert.ToInt32(reader["Amount"]);
                AccountSearch ac       = new AccountSearch(t_id, descript, Date, amount);
                aclist.Add(ac);
            }
            connection.Close();
            return(aclist);
        }
示例#8
0
        public ActionResult AccountsearchExecutive(int data, string mode)
        {
            CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();

            AccountSearch acc = new AccountSearch();

            acc.AccountDATA = obj.AccountSearch(data, mode);
            return(View(acc));
        }
示例#9
0
        public ActionResult AccountById(int data, string mode)
        {
            CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();

            AccountSearch acc = new AccountSearch();

            Session["acc_data"] = data;
            Session["acc_mode"] = mode;
            acc.AccountDATA     = obj.AccountSearch(data, mode);
            return(View(acc));
        }
示例#10
0
    public async Task Test_Find()
    {
        #region Arrange
        //Add code to create required resources
        #endregion Arrange

        var testKeyMark = TestUtils.RandomInt();

        var connector  = FortnoxClient.AccountConnector;
        var newAccount = new Account()
        {
            Description        = "Test Account",
            Active             = false,
            CostCenterSettings = CostCenterSettings.Allowed,
            ProjectSettings    = ProjectSettings.Allowed,
            SRU = testKeyMark
        };

        //Add entries
        for (var i = 0; i < 5; i++)
        {
            newAccount.Number = TestUtils.GetUnusedAccountNumber();
            await connector.CreateAsync(newAccount);
        }

        //Apply base test filter
        var searchSettings = new AccountSearch();
        searchSettings.SRU = testKeyMark.ToString();

        var fullCollection = await connector.FindAsync(searchSettings);

        Assert.AreEqual(5, fullCollection.TotalResources);
        Assert.AreEqual(5, fullCollection.Entities.Count);
        Assert.AreEqual(1, fullCollection.TotalPages);

        //Apply Limit
        searchSettings.Limit = 2;
        var limitedCollection = await connector.FindAsync(searchSettings);

        Assert.AreEqual(5, limitedCollection.TotalResources);
        Assert.AreEqual(2, limitedCollection.Entities.Count);
        Assert.AreEqual(3, limitedCollection.TotalPages);

        //Delete entries
        foreach (var entry in fullCollection.Entities)
        {
            await connector.DeleteAsync(entry.Number);
        }
        #region Delete arranged resources

        //Add code to delete temporary resources

        #endregion Delete arranged resources
    }
 private async Task <AccountManagerViewModel> CreateAccountManagerViewModel(
     AccountSearch accountSearchData, string message)
 {
     return(new AccountManagerViewModel
     {
         Accounts = await _userRepo.GetUsersBySearchData(accountSearchData),
         AvailableIdentityRoles = await _userRepo.GetAllRoles(),
         AccountSearch = accountSearchData,
         ResultMsg = message
     });
 }
示例#12
0
        public ActionResult Withdraw(int id)
        {
            CreateCustomerAccounts2porDbData objDB = new CreateCustomerAccounts2porDbData();
            DataSet       ds = objDB.AccountSearch(id, "ByAccountID");
            AccountSearch PD = new AccountSearch();

            PD.AccountID     = Convert.ToInt32(ds.Tables[0].Rows[0]["AccountID"].ToString());
            PD.CustomerID    = Convert.ToInt32(ds.Tables[0].Rows[0]["CustomerID"].ToString());
            PD.AccountType   = ds.Tables[0].Rows[0]["AccountType"].ToString();
            PD.BalanceAmount = Convert.ToInt32(ds.Tables[0].Rows[0]["DepositAmount"].ToString());

            return(View("Withdraw", PD));
        }
示例#13
0
        public ActionResult DeleteAccount(int id, int accountID)
        {
            CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();
            DataSet       ds = obj.AccountSearch(id, "ByCustomerID");
            AccountSearch MB = new AccountSearch();

            //MB.AccountID = Convert.ToInt32(ds.Tables[0].Rows[0]["AccountID"].ToString());
            MB.CustomerID    = Convert.ToInt32(ds.Tables[0].Rows[0]["CustomerID"].ToString());
            MB.AccountType   = ds.Tables[0].Rows[0]["AccountType"].ToString();
            MB.DepositAmount = Convert.ToInt32(ds.Tables[0].Rows[0]["DepositAmount"].ToString());
            MB.AccountID     = accountID;

            return(View(MB));
        }
示例#14
0
        public ActionResult DeleteAccount(AccountSearch MB)
        {
            int c_id = Convert.ToInt32(MB.CustomerID);
            int bal  = Convert.ToInt32(MB.DepositAmount);
            int a_id = Convert.ToInt32(MB.AccountID);
            CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();
            int result = obj.DeleteAccount(c_id, bal, a_id);

            if (result == 0)
            {
                return(RedirectToAction("Exception"));
            }
            ViewData["resultDelete"] = result;
            return(View());
        }
示例#15
0
        public ActionResult Withdraw(AccountSearch PD)
        {
            if (!(PD.withdrawamount == 0 || PD.BalanceAmount == 0 || PD.withdrawamount < 0))
            {
                if (PD.withdrawamount <= PD.BalanceAmount)
                {
                    ViewBag.accid        = PD.AccountID;
                    ViewBag.BalBeforwith = PD.BalanceAmount;
                    int latbalance = PD.BalanceAmount - PD.withdrawamount;
                    CreateCustomerAccounts2porDbData objad = new CreateCustomerAccounts2porDbData();
                    int mi = objad.withdrawamount(PD, latbalance);
                    if (mi > 0)
                    {
                        if (Request.HttpMethod == "POST")
                        {
                            TempData["AlertMessage"] = "Amount INR " + PD.withdrawamount + " withdrawn successfull.";
                        }
                        ViewBag.latbalance = latbalance;
                        return(View("AfterWithdraw"));
                    }
                    else
                    {
                        return(RedirectToAction("Exception"));
                    }
                }
                else
                {
                    if (Request.HttpMethod == "POST")
                    {
                        TempData["AlertMessage"] = "Withdraw is not allowed choose a amount smaller than balance amount.";
                    }

                    return(View("Withdraw", PD));
                }
            }
            else
            {
                if (PD.withdrawamount == 0 || PD.withdrawamount < 0)
                {
                    TempData["AlertMessage"] = "Please enter some valid amount to withdraw.";
                }
                else if (PD.BalanceAmount == 0)
                {
                    TempData["AlertMessage"] = "Please deposit some amount.";
                }
                return(View("Withdraw", PD));
            }
        }
        public JArray Search([FromBody] AccountSearch data)
        {
            Dictionary <string, object> commandParams = new Dictionary <string, object>();

            commandParams.Add("@p_SortColumn", data.SortColumn);
            commandParams.Add("@p_SortOrder", data.SortOrder);
            commandParams.Add("@p_PageSize", data.PageSize);
            commandParams.Add("@p_PageStart", data.PageStart);

            if (data.AccountID.HasValue)
            {
                commandParams.Add("@p_GLAccountID", data.AccountID.Value);
            }

            if (data.AccountTypeID.HasValue)
            {
                commandParams.Add("@p_GLAccountTypeID", data.AccountTypeID.Value);
            }

            if (data.AdministratorID.HasValue)
            {
                commandParams.Add("@p_AdministratorID", data.AdministratorID.Value);
            }

            if (data.EntityTypeID.HasValue)
            {
                commandParams.Add("@p_EntityTypeID", data.EntityTypeID.Value);
            }

            if (data.EntityID.HasValue)
            {
                commandParams.Add("@p_EntityID", data.EntityID.Value);
            }

            commandParams.Add("@p_HighBalanceOnly", data.HighBalanceOnly);
            commandParams.Add("@p_ShowInactive", data.ShowInactive);

            DynamicList lst = DynamicList.GetData("[dbo].[spCFM_GLAccount_SelectForGrid]", commandParams);

            if (lst.Count > 0)
            {
                var data1 = (JArray)lst[0].GetValue("Data");
                return(data1);
            }

            return(null);
        }
示例#17
0
        public string Search([FromBody] AccountSearch info)
        {
            var query = (from ac in _context.Account
                         where (ac.Name.Contains(info.Name) || ac.Name.Equals("")) &&
                         (ac.Ownerid.Contains(info.Ownerid) || ac.Ownerid.Equals("")) &&
                         (ac.Phone.Contains(info.Phone) || ac.Phone.Equals(""))
                         select ac
                         ).ToList <Account>();

            // 사용자에게 읽기권한(=검색)이 있는지 체크
            if (_userAuth.Read.Equals("4-3"))
            {
                return("");
            }
            else
            {
                return(JsonConvert.SerializeObject(query));
            }
        }
示例#18
0
        public IList<Account> FindAccounts(AccountSearch searchType, string searchValue)
        {
            IList<Account> accounts = new List<Account>();
            switch (searchType)
            {
                case AccountSearch.AccountNumber:
                    accounts = _accountRepository.FindAccountsByAccountNumber(searchValue);
                    break;

                case AccountSearch.Company:
                    accounts = _accountRepository.FindAccountsByCopmpany(searchValue);
                    break;

                case AccountSearch.Contact:
                    accounts = _accountRepository.FindAccountsByContact(searchValue);
                    break;
            }
            return accounts;
        }
示例#19
0
        //Find users using search data
        public async Task <ICollection <User> > GetUsersBySearchData(AccountSearch searchModel)
        {
            var result = await GetUsers();

            if (searchModel == null)
            {
                return(result.ToList());
            }

            if (!string.IsNullOrEmpty(searchModel.UserName))
            {
                result = result.Where(x => x.UserName.Contains(searchModel.UserName,
                                                               StringComparison.OrdinalIgnoreCase)).ToList();
            }

            if (!string.IsNullOrEmpty(searchModel.Role))
            {
                result = result.Where(x => x.Role.Contains(searchModel.Role,
                                                           StringComparison.OrdinalIgnoreCase)).ToList();
            }

            return(result.ToList());
        }
示例#20
0
 public ActionResult AccountStatement(AccountSearch acc)
 {
     if (!ModelState.IsValid)
     {
         CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();
         int temp_id = acc.AccountID;
         int check   = obj.checkAccount(temp_id, "ByAccountID");
         if (check > 0)
         {
             int cycle = Convert.ToInt32(acc.transaction_no);
             return(RedirectToAction("viewAccountStatement", new { Temp_id = temp_id, Cycle = cycle }));
         }
         else
         {
             if (Request.HttpMethod == "POST")
             {
                 TempData["AlertMessage"] = "Requested account is not present in the system.";
                 ModelState.Clear();
             }
             return(View());
         }
     }
     return(View());
 }
示例#21
0
 public ActionResult AccountsearchforExecutive(AccountSearch cu)
 {
     if (!ModelState.IsValid)
     {
         CreateCustomerAccounts2porDbData obj = new CreateCustomerAccounts2porDbData();
         int    temp_id     = cu.Customer_Id;
         string temp_search = cu.Account_Search;
         int    check       = obj.checkAccount(temp_id, temp_search);
         if (check > 0)
         {
             return(RedirectToAction("AccountsearchExecutive", new { data = temp_id, mode = temp_search }));
         }
         else
         {
             if (Request.HttpMethod == "POST")
             {
                 TempData["AlertMessage"] = "Requested account is not present in system.";
                 ModelState.Clear();
             }
             return(View());
         }
     }
     return(View());
 }
 public ReturnResult <SearchResult> GetAccountSearch(AccountSearch accountSearch)
 {
     return(accDBHandler.GetAccountSearch(accountSearch));
 }
示例#23
0
 public Task <Pagination <MongoAccount> > Search(AccountSearch search, string projectId)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// 查找命令
        /// </summary>
        private void SearchExecute()
        {
            AccountSearch AccSearch = new AccountSearch(likesearchCommand);

            AccSearch.ShowDialog();
        }
        public static string GetAccountId(string strAccountNumber)
        {
            string strId = "";
            AccountSearch objAccountSearch = new AccountSearch();
            objAccountSearch.basic = new AccountSearchBasic();
            objAccountSearch.basic.number = new SearchStringField();
            objAccountSearch.basic.number.@operator = SearchStringFieldOperator.@is;
            objAccountSearch.basic.number.operatorSpecified = true;
            objAccountSearch.basic.number.searchValue = strAccountNumber;

            SearchResult objSearchResult = _service.search(objAccountSearch);
            if (objSearchResult.recordList != null && objSearchResult.recordList.Length == 1)
            {
                if (objSearchResult.recordList[0] is Account)
                {
                    strId = ((Account)objSearchResult.recordList[0]).internalId;
                }
            }
            return strId;
        }