public ActionResult Login(LoginRequest loginRequest)
        {
            var ipAddress = UserFunctions.GetIPAddress();

            int logID = UserFunctions.InsertLog(ipAddress, "Login", loginRequest.Username, loginRequest.Username, JsonConvert.SerializeObject(loginRequest.Username));

            string message;

            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.ElementAt(0);

                var messList = errors.Errors.ElementAt(0);

                message = messList.ErrorMessage;

                UserFunctions.UpdateLogs(logID, StaticVariables.FAILSTATUS, message);

                return(View());
            }

            bool worked = UserFunctions.Login(logID, loginRequest.Username, loginRequest.Password, out LoginObject loginDetails, out message);


            if (worked)
            {
                Session["Branch"] = loginDetails.MESSAGE.UserData.UserBranch;

                Session["SourceName"] = string.Format("{0} {1}", loginDetails.MESSAGE.UserData.FirstName, loginDetails.MESSAGE.UserData.LastName);

                Session["SourceID"] = loginDetails.MESSAGE.UserData.UserId;

                //  Session["Till"] = loginDetails.MESSAGE.UserData.PointingAccount;


                //Session["Branch"] = "Head Office";

                //Session["SourceName"] = "John Amoah";

                //Session["SourceID"] = "1234";

                Session["Till"] = "0051441101017";

                UserFunctions.UpdateLogs(logID, StaticVariables.SUCCESSSTATUS, message);

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ViewBag.NotValidUser = message;

                UserFunctions.UpdateLogs(logID, StaticVariables.FAILSTATUS, message);

                return(View());
            }
        }
Esempio n. 2
0
        //[ValidateAntiForgeryToken]
        public ActionResult GetTransactionsServerSide()
        {
            //Server Side Parameter
            CultureInfo culture        = new CultureInfo("en-US");
            int         start          = Convert.ToInt32(Request["start"], culture);
            int         length         = Convert.ToInt32(Request["length"], culture);
            string      searchValue    = Request["search[value]"];
            string      sortColumnName = Request["columns[" + Request["order[0][column]"] + "][name]"];
            string      sortDirection  = Request["order[0][dir]"];

            int totalCount = 0;

            int totalrowsafterfiltering = 0;

            List <TellerTransaction> tellerTransactionsDev = null;

            var    ipAddress  = UserFunctions.GetIPAddress();
            string sourceId   = Session["SourceID"].ToString();
            string sourceName = Session["SourceName"].ToString();
            string branch     = Session["Branch"].ToString();

            string requestBody = string.Empty;

            DateTime?startDate = null;

            DateTime?endDate = null;

            int logID = UserFunctions.InsertLog(ipAddress, "GetTransactionsServerSide", sourceId, sourceName, sourceId);

            if (UserFunctions.GetTellerTransactions(logID, sourceId, branch, startDate, endDate, out List <TellerTransaction> tellerTransactions, out decimal totalTransactionValue, out int totalTransactionVolume))
            {
                UserFunctions.TellerTransaction(0, tellerTransactions, searchValue, sortColumnName, sortDirection, start, length, out totalCount, out totalrowsafterfiltering, out tellerTransactionsDev);

                tellerTransactionsDev.ForEach(x => x.PrintAction = "<a class='fa fa-print' href='" + this.Url.Action("GenerateReceipt", "Home", new { x.Id }) + "' target = '_blank'>Print Receipt</a>");

                var response = new { data = tellerTransactionsDev, draw = Request["draw"], recordsTotal = totalCount, recordsFiltered = totalrowsafterfiltering };

                UserFunctions.UpdateLogs(logID, StaticVariables.SUCCESSSTATUS, JsonConvert.SerializeObject(response));

                ViewBag.TotalTransactionValue = totalTransactionValue;

                ViewBag.TotalTransactionVolume = totalTransactionVolume;

                return(Json(response, JsonRequestBehavior.AllowGet));
            }
Esempio n. 3
0
        public ActionResult Index()
        {
            var ipAddress = UserFunctions.GetIPAddress();

            string sourceId   = Session["SourceID"].ToString();
            string sourceName = Session["SourceName"].ToString();
            string branch     = Session["Branch"].ToString();

            string requestBody = string.Empty;

            DateTime?startDate = null;

            DateTime?endDate = null;

            int logID = UserFunctions.InsertLog(ipAddress, "Home/Index", sourceId, sourceName, requestBody);

            UserFunctions.GetTellerTransactions(logID, sourceId, branch, startDate, endDate, out List <TellerTransaction> tellerTransactions, out decimal totalTransactionValue, out int totalTransactionVolume);

            ViewBag.TotalTransactionValue = totalTransactionValue;

            ViewBag.TotalTransactionVolume = totalTransactionVolume;

            UserFunctions.UpdateLogs(logID, StaticVariables.FAILSTATUS, JsonConvert.SerializeObject(tellerTransactions));

            ExportRequest exportRequest = new ExportRequest
            {
                StartDate = DateTime.Now.Date.ToString("dd/MM/yyy"),
                EndDate   = DateTime.Now.Date.AddDays(1).ToString("dd/MM/yyy")
            };

            ViewBag.fromDate = exportRequest.StartDate;

            ViewBag.toDate = exportRequest.EndDate;

            return(View(exportRequest));
        }