public IActionResult Index(long invoiceId) { ViewBag.Name = User.FindFirst(ClaimTypes.NameIdentifier).Value; IDBService dbService = new DBservice(_helper); var invoices = dbService.GetInvoice(invoiceId); var numberOfDocs = dbService.FetchDocumentsForInvoice(invoiceId); InvoiceViewModel model = new InvoiceViewModel(); model.InvoiceId = invoiceId; model.AccountDate = invoices.AccountDate.ToString("dd / M / yyyy", CultureInfo.InvariantCulture); model.InvoiceNumber = invoices.InvoiceNo; model.TotalLocalAmount = invoices.TotalLocalAmt.ToString("N", CultureInfo.CreateSpecificCulture("en-IN")); model.ExchangeRate = invoices.ExRate; model.CustomerName = invoices.CustomerName; model.DelivaryDate = invoices.DeliveryDate.ToString("dd / M / yyyy", CultureInfo.InvariantCulture); model.CurrencyCode = invoices.CurrencyCode; model.VesselName = invoices.VesselName; model.Remarks = invoices.Remarks; model.Amount = invoices.TotalAmt.ToString("N", CultureInfo.CreateSpecificCulture("en-IN")); InvoiceStatus invStatus = (InvoiceStatus)invoices.InvoiceStatus; model.InvoiceStatus = invStatus.ToString(); model.NoOfDocuments = numberOfDocs != null ? numberOfDocs.Count : 0; if (invoices.InvoiceStatus > 4 || invoices.InvoiceStatus == 2) { model.Showbuttons = true; } return(View(model)); }
public string UpdateStatusForInvoice(long invoiceId, InvoiceStatus status, string remarks) { string color = string.Empty; IDBService service = new DBservice(_helper); var username = User.FindFirst(ClaimTypes.NameIdentifier).Value; string email = service.GetEmailForUser(username); var invoice = service.GetInvoice(invoiceId); var invoiveViewModel = new InvoiceViewModel { AccountDate = invoice.AccountDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture), CustomerName = invoice.CustomerName, DelivaryDate = invoice.DeliveryDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture), TotalLocalAmount = invoice.TotalLocalAmt.ToString("C", CultureInfo.CreateSpecificCulture("en-IN")), DueDate = invoice.DueDate, InvoiceNumber = invoice.InvoiceNo }; if (status == InvoiceStatus.CheckPending) { service.UpdatePendingStatusForChecker(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.CheckPending); } else if (status == InvoiceStatus.Checked) { service.UpdateCheckedStatusForChecker(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.Checked); ConstructEmail construct = new ConstructEmail(); construct.SendEmail(invoiveViewModel, email); } else if (status == InvoiceStatus.CheckRejected) { service.UpdateRejectedStatusForChecker(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.CheckRejected); } else if (status == InvoiceStatus.Approved) { service.UpdateApprovedStatusForApprover(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.Approved); } else if (status == InvoiceStatus.ApprovePending) { service.UpdatePendingStatusForApprover(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.ApprovePending); } else if (status == InvoiceStatus.ApproveRejected) { service.UpdateRejectedStatusForApprover(invoiceId, username, remarks); color = service.getColorToUpdate((int)InvoiceStatus.ApproveRejected); } else { throw new Exception("Invalid Status"); } return(color); }
public RequestsController(DBservice context) { _context = context; if (_context.Requests.Count() == 0) { _context.SaveChanges(); } }
public Task <bool> ValidateCredentials(string username, string password, out DbUserModel user) { user = null; IDBService _dbService = new DBservice(dbHelper); var verifyUser = _dbService.FetchUser(username); if (verifyUser != null) { user = verifyUser; return(Task.FromResult(true)); } return(Task.FromResult(false)); }
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, CheckingAuthorityRequirement requirement) { if (context.User.FindFirst(ClaimTypes.NameIdentifier) != null) { var username = context.User.FindFirst(ClaimTypes.NameIdentifier).Value; IDBService service = new DBservice(_helper); var user = service.FetchUser(username); if (user != null && user.CategoryId == 1) { context.Succeed(requirement); } } return(Task.CompletedTask); }
public JsonResult GetFilePath([FromBody] int id) { IDBService service = new DBservice(_helper); var Roles = User.FindFirst(ClaimTypes.Role).Value; var documents = service.FetchFile(id); if (Roles == "1") { ViewBag.controller = "CheckingAuthority"; } else { ViewBag.controller = "ApproverAuthority"; } return(Json(documents)); }
public IActionResult Index(long id = 1) { IDBService service = new DBservice(_helper); var Roles = User.FindFirst(ClaimTypes.Role).Value; var documents = service.FetchDocumentsForInvoice(id); if (Roles == "1") { ViewBag.controller = "CheckingAuthority"; } else { ViewBag.controller = "ApproverAuthority"; } if (documents.Count() > 0) { ViewBag.InvoiceId = documents.ElementAt(0).InvoiceId; } ViewBag.Name = User.FindFirst(ClaimTypes.NameIdentifier).Value; ViewBag.IsMobile = IsMobileDevice(); return(View(documents)); }
static void Main(string[] args) { var tableGruppa = new DBservice(); tableGruppa.AddTable(); }
public ActualTasksController(DBservice context) { _context = context; }
public IActionResult ViewInvoices(InvoiceSearchViewModel model1) { DateTime from = DateTime.MinValue; DateTime to = DateTime.MinValue; if (model1.Status == null || model1.Status == string.Empty) { model1.Status = "pending"; } if (model1.From != null) { if (model1.From != "" || model1.From != string.Empty) { from = DateTime.Parse(model1.From, new CultureInfo("zh-SG")); } } if (model1.To != null) { if (model1.To != "" || model1.To != string.Empty) { to = DateTime.Parse(model1.To, new CultureInfo("zh-SG")); } } var userRole = ""; var role = User.FindFirst(ClaimTypes.Role).Value; if (role == "1") { userRole = "CheckingAuthority"; } else if (role == "2") { userRole = "ApproverAuthority"; } ViewBag.Name = User.FindFirst(ClaimTypes.NameIdentifier).Value; IDBService service = new DBservice(_helper); var fetchedResults = service.GetAllInvoices(from, to, model1.Status, userRole); var results = fetchedResults.Skip(model1.Results * 5).Take(5).OrderBy(e => e.DueDate); InvoicePagingResults pagingResults = new InvoicePagingResults(); List <InvoiceResults> list = new List <InvoiceResults>(); foreach (var invoice in results) { InvoiceResults model = new InvoiceResults(); model.InvoiceId = invoice.InvoiceId; model.InvoiceNo = invoice.InvoiceNo; model.AccountDate = invoice.AccountDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture); model.DueDate = invoice.DueDate.ToString("dd/M/yyyy", CultureInfo.InvariantCulture); model.CurrencyCode = invoice.CurrencyCode; model.CustomerName = invoice.CustomerName; model.VesselName = invoice.VesselName; model.TotalAmt = invoice.TotalLocalAmt.ToString("N", CultureInfo.CreateSpecificCulture("en-IN")); list.Add(model); } pagingResults.currentPageNumber = model1.Results; int records = fetchedResults.Count(); int remainder = records % 5; pagingResults.totalNumberOfRecords = remainder > 0 ? (records / 5) + 1 : (records / 5); pagingResults.invoiceResults = list; pagingResults.modelInvoice = model1; return(View(pagingResults)); }
public EmployeesController(DBservice context) { _context = context; }
public ProjectsController(DBservice context) { _context = context; }