Пример #1
0
        //
        // GET: /UserAccess/

        public ViewResult Index()
        {
            Models.TestAccessEDMContainer context    = new Models.TestAccessEDMContainer();
            Models.UserAccess             userAccess = new Models.UserAccess();

            userAccess.AccessTime  = DateTime.Now;
            userAccess.AccountName = System.Threading.Thread.CurrentPrincipal.Identity.Name;
            context.UserAccesses.Add(userAccess);
            context.SaveChanges();
            return(View(db.UserAccesses.ToList()));
        }
Пример #2
0
        public bool ApplyCreditPayment(PermitImpactFee permit, string IpAddress, Models.UserAccess ua)
        {
            if (permit.ImpactFee_Amount != Amount_Allocated)
            {
                // Partial Waiver Process:
                // This process needs to do the following:
                // 1. Reduce the amount of the current impact fee (captured in permit) by the amount in permit.
                // 2. Insert a new charge that has the following properties:
                //    a. Same Catcode as the original impact fee
                //    b. Same amount in permit object
                //    c. Can probably do this easily with a Select Insert.
                // 3. Capture the freshly inserted row's ItemId.
                // 4. Use the waiver/exemption process on the new ItemId
                // So largely, this process will just pre-empt the ApplyWaiver process.
                // We should just be able to update the permit object with the new item id and
                // proceed as normal.
                var NewItemId = PermitWaiver.PartialImpactFeeHandling(permit, Amount_Allocated);
                if (NewItemId == -1)
                {
                    Constants.Log("Error Applying Partial Credit", permit.ItemId.Value.ToString(), permit.Permit_Number, permit.ImpactFee_Amount_Formatted, "");
                }
                permit.ItemId = NewItemId; // Set it to the newly created row
            }

            var nt = new Claypay.NewTransaction();

            nt.ItemIds.Add(permit.ItemId.Value);
            var ifPayment = new Claypay.Payment(Claypay.Payment.payment_type.impact_fee_credit)
            {
                Amount         = Amount_Allocated,
                AmountTendered = 0,
                AmountApplied  = Amount_Allocated,
                Validated      = true
            };

            nt.TransactionCashierData.PayerCompanyName = permit.Contractor_Name;
            nt.Payments.Add(ifPayment);
            nt.TransactionCashierData.ipAddress   = IpAddress;
            nt.TransactionCashierData.CurrentUser = ua;
            return(nt.SaveTransaction());
        }
        public ActionResult Login(Models.UserAccess model)
        {
            bool log = repo.validateUser(model.EmailID, model.Password);

            if (log)
            {
                Session["User"]   = model.EmailID;
                Session["UserID"] = model.ID;
                if (repo.searchUser(model.EmailID))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    return(RedirectToAction("saveUserDetails", "Home"));
                }
            }
            else
            {
                ViewBag.ErrMsg = "Invalid Login Attempt";
            }
            return(View());
        }
Пример #4
0
        // remove access
        public IActionResult RemoveAccess(int id)
        {
            var employeeDataString = HttpContext.Session.GetString("employee");

            if (employeeDataString == "")
            {
                return(RedirectToAction("Login", "Auth"));
            }
            else
            {
                Employee employee = JsonConvert.DeserializeObject <Employee>(employeeDataString);

                if (userAccessManager.IsAccessExists(employee.Id, 4))
                {
                    if (userAccessManager.IsIdExists(id))
                    {
                        Models.UserAccess userAccess = userAccessManager.GetById(id);
                        userAccess.ActionBy   = employee.UserName;
                        userAccess.ActionTime = DateTime.Now.ToString("F");
                        userAccess.ActionDone = ActionAttributes.ActionRemove;
                        userAccess.State      = 0;

                        userAccessManager.Update(userAccess);

                        return(RedirectToAction("UserAccess", "Employee", new { id = userAccess.UserId }));
                    }
                    else
                    {
                        return(NotFound("404- Not Found"));
                    }
                }
                else
                {
                    return(NotFound("No Access"));
                }
            }
        }
Пример #5
0
        public bool Update(Models.UserAccess ua, string IpAddress)
        {
            var current = PermitAllocation.Get(Permit_Number);

            if (current == null)
            {
                return(false);                // some kind of error occurred while getting the current permit data.
            }
            if (current.Audit_Log.Length > 0) // this record already exists
            {
                if (!Data_Changed(current))
                {
                    return(true);                // if the data doesn't change, we don't need to do anything.
                }
                string s = "";
                if (Amount_Allocated_Formatted != current.Amount_Allocated_Formatted)
                {
                    // If the amount changes, we will also need to reapply the credit
                    // to the ccCashierItem table.
                    s         = Constants.Create_Audit_Log(ua.user_name, "Amount Allocated", current.Amount_Allocated_Formatted, Amount_Allocated_Formatted);
                    Audit_Log = s + '\n' + current.Audit_Log;
                }

                if (Builder_Id != current.Builder_Id)
                {
                    // we're going to get all of the combined allocation data now
                    // in order to create a proper audit log
                    var data           = CombinedAllocation.Get();
                    var currentBuilder = (from d in data
                                          where d.Builder_Id == current.Builder_Id
                                          select d).First();

                    var newBuilder = (from d in data
                                      where d.Builder_Id == Builder_Id
                                      select d).First();
                    // check to see if the builder name changed here
                    var currentBuilderName = currentBuilder.Builder_Name + " (" + currentBuilder.Builder_Id + ")";
                    var newBuilderName     = newBuilder.Builder_Name + " (" + newBuilder.Builder_Id + ")";
                    s         = Constants.Create_Audit_Log(ua.user_name, "Builder", currentBuilderName, newBuilderName);
                    Audit_Log = s + '\n' + current.Audit_Log;

                    // check to see if the agreement changed
                    if (currentBuilder.Agreement_Number != newBuilder.Agreement_Number)
                    {
                        s         = Constants.Create_Audit_Log(ua.user_name, "Agreement Number", currentBuilder.Agreement_Number, newBuilder.Agreement_Number);
                        Audit_Log = s + '\n' + current.Audit_Log;
                    }
                }
            }
            else // this is a new permit number
            {
                Audit_Log = Constants.Create_Audit_Log(ua.user_name, "Record Created");
                // will also need to apply the credit.
            }
            if (!SaveAllocation())
            {
                return(false);
            }
            var permit = PermitImpactFee.Get(Permit_Number, "IFCR");

            if (!permit.ItemId.HasValue)
            {
                return(false);
            }
            if (permit.ImpactFee_Amount < this.Amount_Allocated)
            {
                // This is a partial impact fee credit.
                // Those credits are applied when the remainder is paid.
                return(true);
            }
            return(ApplyCreditPayment(permit, IpAddress, ua));
        }