Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
MockTest
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here Console.WriteLine("Hello, world!"); } } } ANGULAR 6 ------------------------------------- FETCH OPERATION PRODUCT.SERVICE.TS ---------------------------- import { Injectable } from '@angular/core'; import { IProduct } from '../../app/quickKart-interfaces/product'; import { ICategory } from '../../app/quickKart-interfaces/category'; import { HttpClient, HttpErrorResponse } from '@angular/common/http'; import { Observable, throwError } from 'rxjs'; import { catchError } from 'rxjs/operators'; @Injectable({ providedIn: 'root' }) export class ProductService { products: IProduct[]; categories: ICategory[]; constructor(private http: HttpClient) { } getProducts(): Observable<IProduct[]> { let tempVar = this.http.get<IProduct[]>('http://localhost:11990//api/Product/GetAllProducts').pipe(catchError(this.errorHandler)); return tempVar; } getProductCategories(): Observable<ICategory[]> { let tempVar = this.http.get<ICategory[]>('http://localhost:11990/api/Category/GetCategories').pipe(catchError(this.errorHandler)); return tempVar; } errorHandler(error: HttpErrorResponse) { console.error(error); return throwError(error.message || "Server Error"); } } -------------------------- VIEW PRODUCTS.COMPONENT.TS -------------------------------------- constructor(private _productService: ProductService, private router: Router) { } ngOnInit() { this.getProducts(); this.getProductCategories(); if (this.products == null) { this.showMsgDiv = true; } this.filteredProducts = this.products; this.imageSrc = "../../assets/add-item.jpg"; } getProducts() { this._productService.getProducts().subscribe( responseProductData => { this.products = responseProductData; this.filteredProducts = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.products = null; this.errMsg = responseProductError; console.log(this.errMsg); }, () => console.log("GetProducts method excuted succesfully") ); } getProductCategories() { this._productService.getProductCategory().subscribe( responseCategoryData => this.categories = responseCategoryData, responseCategoryError => { this.categories = null; this.errMsg = responseCategoryError; console.log(this.errMsg); }, () => console.log("GetProductCategoies method excuted successfully") ); } VIEW-PURCHASE ASSIGNMENT ------------------------------------ VIEW-PURCHASE.COMPONENT.TS export class ViewPurchasesComponent implements OnInit { purchase: IPurchase[]; showMsgDiv: boolean = false; errMsg: string; constructor(private _purchaseService: PurchaseService) { } ngOnInit() { this.getPurchaseDetails(); if (this.purchase == null) { this.showMsgDiv = true; } } getPurchaseDetails() { this._purchaseService.getPurchase().subscribe( responseProductData => { this.purchase = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.purchase = null; this.errMsg = responseProductError; console.log(this.errMsg); }, () => console.log("GetPurchase method excuted successfully") ); } } ---------------------------- product.service.ts export class PurchaseService { purchase: IPurchase[]; constructor(private http: HttpClient) { } getPurchase(): Observable<IPurchase[]> { let tempVar = this.http.get<IPurchase[]>('http://localhost:11990/api/purchase/GetPurchaseDetailsByEmailId?emailId=Franken@gmail.com').pipe(catchError(this.errorHandler)) return tempVar; } errorHandler(error: HttpErrorResponse) { console.error(error); return throwError(error.message || "Server error") } } ----------------------------------------------------- VIEW CART EXERCISE VIEW CART COMPONENT.TS ---------------------------------------------- export class ViewCartComponent implements OnInit { cartDetails: ICart[]; emailId: string; showMsgDiv: boolean = false; errMsg: string; result: boolean; constructor(private _cartService: CartService, private router: Router, private _userService: UserService) { } ngOnInit() { this.getCartDetails(); if (this.cartDetails == null) { this.showMsgDiv = true; } this.emailId = sessionStorage.getItem('userEmail'); } getCartDetails() { this._cartService.getCartDetails().subscribe( responseCartData => { this.cartDetails = responseCartData; this.showMsgDiv = false; }, responseCartError => { this.cartDetails = null; this.errMsg = responseCartError; console.log(this.errMsg); }, () => console.log("GetCartDetails method excuted successfully") ); } CART SEVICE.TS ------------------------- export class CartService { cart: ICart[]; constructor(private http: HttpClient) { } getCartDetails(): Observable<ICart[]> { let tempVar = this.http.get<ICart[]>('http://localhost:11990/api/User/GetCartProducts?emailId=Albert@gmail.com').pipe(catchError(this.errorHandler)) return tempVar; } VIEW RATING EXCERCISE --------------------------------------------- export class ViewRatingComponent implements OnInit { rating: IRating[]; emailId: string; showMsgDiv: boolean = false; errMsg: string; result: boolean; constructor(private _ratingService: RatingService, private router: Router) { } ngOnInit() { this.getRating(); if (this.rating == null) { this.showMsgDiv = true; } this.emailId = sessionStorage.getItem('userEmail'); } getRating() { this._ratingService.getRating().subscribe( responseRatingData => { this.rating= responseRatingData; this.showMsgDiv = false; }, responseRatingError => { this.rating = null; this.errMsg = responseRatingError; console.log(this.errMsg); }, () => console.log("GetRating method excuted successfully") ); } ----------------------------- USER SERVIICE.TS export class RatingService { rating: IRating[]; constructor(private http: HttpClient) { } getRating(): Observable<IRating[]> { let tempVar = this.http.get<IRating[]>('http://localhost:11990/api/rating/DisplayAllReviewDetailsByEmailId?emailId=Davis@gmail.com').pipe(catchError(this.errorHandler)) return tempVar; } ------------------------------------------ LOGIN FORM VALIDATE CREDENTIALS ----------------------------------------getTodaySurgery() { //To do implement necessary logic this._curewellService.getAllSurgeriesForToday().subscribe( responseProductData => { this.surgeryList = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.surgeryList = null; this.errorMsg = responseProductError; this.showMsgDiv = true; console.log(this.errorMsg); }, () => console.log("Todays surgery method excuted successfully") ); } editSurgery(surgery: Surgery) { //To do implement necessary logic this.router.navigate(['/editSurgery', surgery.doctorId, surgery.endTime, surgery.startTime, surgery.surgeryCategory, surgery.surgeryDate, surgery.surgeryId]); }------------------- CureBillDB ---------------------------------------------------- view-todays-surgery.component ----------------------------- getTodaySurgery() { //To do implement necessary logic this._curewellService.getAllSurgeriesForToday().subscribe( responseProductData => { this.surgeryList = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.surgeryList = null; this.errorMsg = responseProductError; this.showMsgDiv = true; console.log(this.errorMsg); }, () => console.log("Todays surgery method excuted successfully") ); } editSurgery(surgery: Surgery) { //To do implement necessary logic this.router.navigate(['/editSurgery', surgery.doctorId, surgery.endTime, surgery.startTime, surgery.surgeryCategory, surgery.surgeryDate, surgery.surgeryId]); } --------------view-todays surgery.html---------- <td> <button class="btn" #updateSurgeryButton (click)="editSurgery(item)">Edit Surgery Time</button></td> -------------------------------------------------------------------------------- view specialization component getSpecialization() { this._curewellService.getAllSpecializations().subscribe( responseProductData => { this.specializationList = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.specializationList = null; this.errorMsg = responseProductError; this.showMsgDiv = true; console.log(this.errorMsg); }, () => console.log("GetSpecialization method excuted successfully") ); } getDoctorBySpecialization(specialization: Specialization) { //To do implement necessary logic this.router.navigate(['/getDoctorBySpecialization', specialization.specializationCode, specialization.specializationName]); } } view specializtion.html ----------------------------------- no code ---------------------------- view doctors by specialization this.specializationCode = this.route.snapshot.params['specializationCode']; console.log(this.specializationCode); this.getDoctorBySpecialization(this.specializationCode); } getDoctorBySpecialization(specializationCode: string) { //To do implement necessary logic this._curewellService.getDoctorBySpecialization(specializationCode).subscribe( responseProductData => { this.doctor = responseProductData; console.log(this.doctor); this.showMsgDiv = false; }, responseProductError => { this.doctor = null; this.errorMsg = responseProductError; this.showMsgDiv = true; console.log(this.errorMsg); }, () => console.log("Doctor fetched by specialization method excuted successfully") ); } editDoctorDetails(doctor: Doctor) { //To do implement necessary logic this.router.navigate(['/editDoctorDetails', doctor.doctorId, doctor.doctorName]); } ------------------------------------- view doctor component.ts ------------------- getDoctor() { //To do implement necessary logic this._curewellService.getDoctors().subscribe( responseProductData => { this.doctorList = responseProductData; this.showMsgDiv = false; }, responseProductError => { this.doctorList = null; this.errorMsg = responseProductError; console.log(this.errorMsg); }, () => console.log("GetDoctors method excuted successfully") ); } editDoctorDetails(doctor: Doctor) { //To do implement necessary logic this.router.navigate(['/editDoctorDetails', doctor.doctorId, doctor.doctorName]); } -------------------------------------- update surgery component.ts this.doctorId = this.route.snapshot.params['doctorId']; this.surgeryId = this.route.snapshot.params['surgeryId']; this.surgeryDate = this.route.snapshot.params['surgeryDate']; this.startTime = this.route.snapshot.params['startTime']; this.endTime = this.route.snapshot.params['endTime']; this.surgeryCategory = this.route.snapshot.params['surgeryCategory']; } editSurgery(startTime: number, endTime: number) { //To do implement necessary logic this._cureWellService.editSurgery(this.doctorId, endTime, startTime, this.surgeryCategory, this.surgeryDate, this.surgeryId).subscribe( responseStatus => { this.status = responseStatus; if (this.status) { alert("Surgery Details Updated Successfully."); this.router.navigate(['/viewTodaySurgery']); } else { alert("surgery Details not updated."); this.router.navigate(['/viewTodaySurgery']); } }, responseUpdateCartError => { this.errorMsg = responseUpdateCartError; console.log(this.errorMsg); alert("Some error occured, please try after some time."); }, () => console.log("Updated Surgery Details method executed successfully.") ); } } ----------------------- update surgery component.html ------------------------- <div class="myContent"> <div class="container"> <h2 align="justify" style="color:brown">Update Surgery</h2> <!--Add angular form logic here--> <form #updateSurgeryForm="ngForm" (ngSubmit)="editSurgery(starttime.value,endtime.value)" > <div class="row"> <div class="col-md-4"> </div> <div class="col-md-4"> <div class="form-group"> <div class="col" style="text-align:left"> <label>Surgery Id</label> </div> <div class="col; input-group"> <input type="text" name="surgeryId" [ngModel]="surgeryId" class="form-control qkinput" readonly> </div> </div> <div class="form-group"> <div class="col" style="text-align:left"> <label>Doctor Id</label> </div> <div class="col; input-group"> <input type="text" name="doctorId" [ngModel]="doctorId" class="form-control qkinput" readonly> </div> </div> <div class="form-group"> <div class="col" style="text-align:left"> <label>Surgery Date</label> </div> <div class="col; input-group"> <input type="text" name="surgeryDate" [ngModel]="surgeryDate" class="form-control qkinput" readonly> </div> </div> <div class="form-group"> <div class="col" style="text-align:left"> <label>Start Time(24 Hours Format)</label> </div> <div class="col; input-group"> <!--Add angular form logic here--> <input type="text" name="starttime" [ngModel]="startTime" #starttime="ngModel" class="form-control qkinput" required ngModel> <!--Add angular validation logic here--> <div *ngIf="starttime.errors && (starttime.dirty || starttime.touched)" style="text-align:left; padding-top:5px; color:red;"> <div [hidden]="!starttime.errors.required"> <p> starttime is mandatory</p> </div> </div> </div> </div> <div class="form-group"> <div class="col" style="text-align:left"> <label>End Time(24 Hours Format)</label> </div> <div class="col; input-group"> <!--Add angular form logic here--> <input type="text" name="endtime" [ngModel]="endTime" #endtime="ngModel" class="form-control qkinput" required ngModel> <!--Add angular validation logic here--> <div *ngIf="endtime.errors && (endtime.dirty || endtime.touched)" style="text-align:left; padding-top:5px; color:red;"> <div [hidden]="!endtime.errors.required"> <p> endtime is mandatory</p> </div> </div> </div> </div> <div class="form-group"> <div class="col" style="text-align:left"> <label>Surgery Category</label> </div> <div class="col; input-group"> <input type="text" name="surgeryCategory" [ngModel]="surgeryCategory" class="form-control qkinput" readonly> </div> </div> <div class="form-group" style="text-align:left"> <button type="submit" [disabled]="!updateSurgeryForm.form.valid" class="btn">Update</button> <a routerLink="/viewTodaySurgery">Cancel</a> </div> </div> <div class="col-md-4"> </div> </div> </form> </div> </div> --------------------------------- update doctor component.html -------------- this.doctorId = parseInt(this.route.snapshot.params['doctorId']); this.doctorName = this.route.snapshot.params['doctorName']; } editDoctorDetails(doctorname: string) { //To do implement necessary logic this._cureWellService.editDoctorDetails(this.doctorId, doctorname).subscribe( responseStatus => { this.status = responseStatus; if (this.status) { alert("Doctor Name Updated Successfully."); this.router.navigate(['/viewDoctors']); } else { alert("Error updating Details."); this.router.navigate(['/viewDoctors']); } }, responseUpdateCartError => { this.errorMsg = responseUpdateCartError; console.log(this.errorMsg); alert("Some error occured, please try after some time."); }, () => console.log("Updated Doctor Details method executed successfully.") ); } }---------------- update doctor component.html -------------- <div class="myContent"> <div class="container"> <!--Add angular form logic here--> <form #updateDoctorForm="ngForm" (ngSubmit)="editDoctorDetails(doctorname.value)"> <h2 style="text-align:center">Update Doctor</h2> <h6 style="text-align:center;color:dimgrey;font-size:small">All fields are mandatory</h6> <table align="center"> <tr> <th align="justify"> <label>Doctor Id</label> </th> <th> <input type="text" name="doctorId" [ngModel]="doctorId" class="form-control qkinput" readonly> </th> </tr> <tr></tr> <tr></tr> <tr></tr> <tr> <th align="justify"> <label>Doctor Name</label> </th> <th> <!--Add angular form logic here--> <input type="text" class="form-control qkinput" name="doctorname" [ngModel]="doctorName" #doctorname="ngModel" ngModel required> <!--Add your validation logic here--> <div *ngIf="doctorname.errors && (doctorname.dirty || doctorname.touched)" style="text-align:left; padding-top:5px; color:red;"> <div [hidden]="!doctorname.errors.required"> <p> doctorname is mandatory</p> </div> </div> </th> </tr> <tr></tr> <tr></tr> <tr></tr> <tr> <th></th> <th> <div class="form-group" style="text-align:left"> <button type="submit" [disabled]="!updateDoctorForm.form.valid" class="btn">Update</button> <a routerLink="/viewDoctors">Cancel</a> </div> </th> </tr> </table> </form> </div> </div> ------------------------------------------------------------------------------- addDoctorcomponent.ts ----------- addDoctor(doctorName: string) { //To do implement necessary logic this._curewellService.addDoctor(doctorName) .subscribe( responseProductData => { this.status = responseProductData this.showDiv = true; this.msg = "Doctor Details Added Successfully"; }, responseProductError => { this.errorAddMsg = responseProductError, console.log(this.errorAddMsg), this.msg = "some error"; }, () => console.log("AddDoctor method executed successfully") ); } ----------- add doctorcomponent.html ----------------- <div class="row title"> <h2 align="center">Add a new Doctor</h2> </div> <!--Add angular form logic here--> <form align="center" #addDoctorForm="ngForm" (ngSubmit)="addDoctor(doctorName.value)"> <table align="center"> <tr> <th align="justify"> <label>Doctor Name</label> </th> <th> <!--Add angular form logic here--> <input type="text" class="form-control cwinput" name="doctorName" #doctorName="ngModel" required ngModel> <!--Add your validation logic here--> <div *ngIf="doctorName.errors && (doctorName.dirty && doctorName.touched)" style="text-align:left; padding-top:5px; color:red;"> <div [hidden]="!doctorName.errors.required"> <p> DoctorName is mandatory</p> </div> </div> </th> </tr> <tr> <th></th> <th align="justify"> <button class="btn" type="submit" [disabled]="ToggleButton">Add Doctor</button> <a routerLink="/class" routerLinkActive="active">Cancel</a> </th> </table> <div *ngIf="showDiv" style="color:red;text-align:center;"> {{msg}} </div> </form>
run
|
edit
|
history
|
help
0
iMacPro
NumberToWords C# Structural
project euler 10, C#
text
test coeur
bubbleSort
StopJoin.cs
Šovljanski - beskonačna petlja bez goto-a
buble sort
a