public AddLecturesViewModel() { foreach (var uniqueGroup in _lecturesStorageModel.UniqueGroups) { Audiences.Add(uniqueGroup); } foreach (var uniqueTeacher in _lecturesStorageModel.UniqueTeachers) { Lecturers.Add(uniqueTeacher); } foreach (var combinedLecture in _lecturesStorageModel.CombinedLectures) { Lectures.Add(combinedLecture); } _lectures = new List <Lecture>(_lecturesStorageModel.Lectures); if (_lecturesStorageModel.CombinedLectures != null && _lecturesStorageModel.CombinedLectures.Count > 0) { FillCombinedLectures(); } UpdateLists(); UpdateLectures(); }
private CollectionDataService() { var xmlRegionCollection = context .Deserialize <RegionsCollection>("..\\..\\Data_Source\\RegionsData.xml") .Region; RegionCollection.AddRange(xmlRegionCollection); var xmlGendersType = context .Deserialize <GendersCollection>("..\\..\\Data_Source\\GenderData.xml") .Gender; GenderTypes.AddRange(xmlGendersType); var xmlSubjects = context .Deserialize <SubjectsCollection>("..\\..\\Data_Source\\SubjectsWithStudentsData.xml") .Subjects; SubjWithStudents.AddRange(xmlSubjects); var users = context .Deserialize <UsersCollection>("..\\..\\Data_Source\\UniversitySystemData.xml"); List <Lecturer> xmlLecturers = users.Lecturers; Lecturers.AddRange(xmlLecturers); List <Student> xmlStudents = users.Students; Students.AddRange(xmlStudents); }
public bool AddProject(ProjectModel model, ref string errorMessage) { using (SZPNUWContext context = new SZPNUWContext()) { Lecturers lecturer = context.Lecturers.FirstOrDefault(x => x.Userid == model.UserId); if (lecturer == null) { errorMessage = PortalMessages.UserDoesNotExist; return(false); } if (!context.Projects.Any(x => x.Topic == model.Topic)) { Projects project = new Projects() { Topic = model.Topic, Active = model.Active, Description = model.Description, Lecturerid = lecturer.Id, Subjectid = model.SubjectId, }; context.Projects.Add(project); context.SaveChanges(); return(true); } errorMessage = PortalMessages.TopicIsUsed; return(false); } }
public async Task <IActionResult> PutLecturers(int id, Lecturers lecturers) { if (id != lecturers.LecturerId) { return(BadRequest()); } var result = await _context.Lecturers.FindAsync(id); result.Name = lecturers.Name; result.Birthdate = lecturers.Birthdate; result.PhoneNumber = lecturers.PhoneNumber; result.Address = lecturers.Address; result.Email = lecturers.Email; result.Password = EncryptPassword(lecturers.Password); try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LecturersExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
/// <summary> /// изтрива конкретния преподавател /// </summary> private void DeleteCurrentLecturer(object obj) { // изтриване в базата databaseService.DeleteUser(selectedLecturer); // изтриване в xml XDocument doc = XDocument.Load(XmlDatabase.PathSystData); doc.Descendants("Users") .Descendants("Lecturer") .Where(x => (string)x.Element("PersonalNumber") == selectedLecturer.PersonalNumber) .Remove(); doc.Save(XmlDatabase.PathSystData); // изтриване от колекцията CollectionDataService.Instance.Lecturers.Remove(selectedLecturer); Lecturers.Remove(selectedLecturer); if (Lecturers.Count < 1) { SelectedLectViewModel.FirstName = string.Empty; SelectedLectViewModel.LastName = string.Empty; SelectedLectViewModel.PersonalNumber = string.Empty; SelectedLectViewModel.Gender = string.Empty; SelectedLectViewModel.Title = string.Empty; SelectedLectViewModel.Faculty = string.Empty; SelectedLectViewModel.Region = string.Empty; SelectedLectViewModel.BirthDate = string.Empty; Image = null; } }
public async Task <ApiReturnValue <Lecturers> > GetLecturer(int pageSize = 100, int pageNumber = 1) { ApiReturnValue <Lecturers> apiReturnValue = new ApiReturnValue <Lecturers>(); try { Lecturers lecturers = new Lecturers() { TotalCount = await GetLecturerCount(), PageSize = pageSize, PageNumber = pageNumber, Rows = await GetListLecturer(pageSize, pageNumber) }; apiReturnValue.IsSuccess = true; apiReturnValue.Object = lecturers; } catch (Exception e) { apiReturnValue.IsSuccess = false; apiReturnValue.Object = null; apiReturnValue.Error = new ApiReturnError() { displayMessage = "Error - GetLecturer", errorMessage = e.Message }; } return(apiReturnValue); }
public void AddNewLecturer(Lecturers lec, System.Web.UI.WebControls.Label lblAddedBy) { try { DatabaseConnection DB = new DatabaseConnection(); DB.openConnection(); vLecturerId = lec.txAddLecturerId.Text; vPassword = lec.txAddLecturerId.Text; vAuthorityLevel = 2; vFirstName = lec.txAddFirstName.Text; vLastName = lec.txAddLastName.Text; vAddress = lec.txAddAddress.Text; vContactNo = lec.txAddContactNo.Text; vDOB = lec.txAddDOB.Text; vSalary = Convert.ToDouble(lec.txAddSalary.Text); vEmailAddress = lec.txAddEmail.Text; vAddedBy = lblAddedBy.Text; vAddedDateTime = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"); string sqlInsertCmd = "INSERT INTO Employees VALUES('" + vLecturerId + "', '" + vPassword + "', '" + vAuthorityLevel + "', '" + vFirstName + "', '" + vLastName + "', '" + vAddress + "', '" + vContactNo + "', '" + vDOB + "', '" + vSalary + "', '" + vEmailAddress + "', '" + vAddedBy + "', '" + vAddedDateTime + "')"; SqlCommand cmd = new SqlCommand(sqlInsertCmd, DatabaseConnection.dbConnection); cmd.ExecuteNonQuery(); DB.closeConnection(); } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
public InstructorModel GetInstructorByUserId(int id) { using (SZPNUWContext context = new SZPNUWContext()) { Lecturers lecturer = context.Lecturers.Include(x => x.User).FirstOrDefault(s => s.User.Id == id); if (lecturer == null) { return(null); } InstructorModel model = new InstructorModel { Id = lecturer.Id, Login = lecturer.User.Login, FirstName = lecturer.User.Firstname, LastName = lecturer.User.Lastname, PESEL = lecturer.User.Pesel, Address = lecturer.User.Address, City = lecturer.User.City, Code = lecturer.Code, DateOfBirth = lecturer.User.Dateofbirth, UserId = lecturer.Userid, UserType = (UserTypes)lecturer.User.Usertype, }; return(model); } }
public void UpdateLecturer(Lecturers lec) { try { DatabaseConnection DB = new DatabaseConnection(); DB.openConnection(); vLecturerId = lec.txUpdateLecturerId.Text; vFirstName = lec.txUpdateFirstName.Text; vLastName = lec.txUpdateLastName.Text; vAddress = lec.txUpdateAddress.Text; vContactNo = lec.txUpdateContactNo.Text; vDOB = lec.txUpdateDOB.Text; vSalary = Convert.ToDouble(lec.txUpdateSalary.Text); vEmailAddress = lec.txUpdateEmail.Text; string sqlUpdateCmd = "Update Employees SET firstName = '" + vFirstName + "', lastName = '" + vLastName + "', address = '" + vAddress + "', contactNo = '" + vContactNo + "', DOB = '" + vDOB + "', salary = '" + vSalary + "', emailAddress = '" + vEmailAddress + "' WHERE employeeId = '" + vLecturerId + "'"; SqlCommand cmd = new SqlCommand(sqlUpdateCmd, DatabaseConnection.dbConnection); cmd.ExecuteNonQuery(); DB.closeConnection(); } catch (Exception ex) { MessageBox.Show("Error" + ex); } }
/* * private ApiReturnValue<Lecturers> MakeReturnValue(bool isSuccess, List<Lecturer> lstLecturer, ApiReturnError error) * { * ApiReturnValue<Lecturers> apiReturnValue = new ApiReturnValue<Lecturers>(); * * apiReturnValue.IsSuccess = isSuccess; * * if (isSuccess) * { * Lecturers lecturers = new Lecturers() { TotalCount = lstLecturer.Count, PageSize = 0, PageNumber = 1, Rows = lstLecturer }; * apiReturnValue.Object = lecturers; * } * else * { * apiReturnValue.Object = null; * apiReturnValue.Error = error; * } * * return apiReturnValue; * } */ public async Task <ApiReturnValue <Lecturers> > GetLecturer(int pageSize = 100, int pageNumber = 1) { return(await Task.Run(() => { ApiReturnValue <Lecturers> apiReturnValue = new ApiReturnValue <Lecturers>(); try { var lstLecturer = JsonConvert.DeserializeObject <List <Lecturer> >(System.IO.File.ReadAllText(Path.Combine(CurrentDirectory, "Data", "Lecturer.json"))); Lecturers lecturers = new Lecturers(); lecturers.TotalCount = lstLecturer.Count(); lecturers.PageNumber = pageNumber; lecturers.PageSize = pageSize; lecturers.Rows = lstLecturer.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList(); apiReturnValue.IsSuccess = true; apiReturnValue.Object = lecturers; } catch (Exception e) { apiReturnValue.IsSuccess = false; apiReturnValue.Object = null; apiReturnValue.Error.displayMessage = ""; apiReturnValue.Error.errorMessage = e.Message; } return apiReturnValue; })); }
public async Task <ApiReturnValue <Lecturers> > GetLecturer(string lecturerName) { return(await Task.Run(() => { ApiReturnValue <Lecturers> apiReturnValue = new ApiReturnValue <Lecturers>(); try { var lstLecturer = JsonConvert.DeserializeObject <List <Lecturer> >(System.IO.File.ReadAllText(Path.Combine(CurrentDirectory, "Data", "Lecturer.json"))); //List<Lecturer> lstLecturer = new List<Lecturer>(); Lecturers lecturers = new Lecturers(); lecturers.TotalCount = 70; lecturers.PageNumber = 1; lecturers.PageSize = 20; lecturers.Rows = lstLecturer; apiReturnValue.IsSuccess = true; apiReturnValue.Object = lecturers; } catch (Exception e) { apiReturnValue.IsSuccess = false; } return apiReturnValue; })); }
private void HandleReviews() { var root = this.xDoc.Root; var courses = Courses.Get(); foreach (var course in courses.Where(x => x.Reviews.Count > 0)) { root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Review/Course/", course.Id)), new XElement(ns + "priority", "0.5"), new XElement(ns + "changefreq", "daily") ) ); } var lecturers = Lecturers.Get(true); foreach (var lecturer in lecturers.Where(x => x.Reviews.Count > 0)) { root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Review/Lecturer/", lecturer.Id)), new XElement(ns + "priority", "0.5"), new XElement(ns + "changefreq", "daily") ) ); } }
public bool UpdateProject(ProjectModel model, ref string errorMessage) { using (SZPNUWContext context = new SZPNUWContext()) { Lecturers lecturer = context.Lecturers.FirstOrDefault(x => x.Userid == model.UserId); if (lecturer == null) { errorMessage = PortalMessages.UserDoesNotExist; return(false); } if (!context.Projects.Any(x => x.Topic == model.Topic && x.Id != model.Id)) { Projects project = context.Projects.FirstOrDefault(x => x.Id == model.Id); if (project != null) { project.Topic = model.Topic; project.Active = model.Active; project.Description = model.Description; project.Lecturerid = lecturer.Id; project.Subjectid = model.SubjectId; context.SaveChanges(); return(true); } errorMessage = PortalMessages.NoSuchElement; return(false); } errorMessage = PortalMessages.TopicIsUsed; return(false); } }
private void DeleteCurrentLecturer(object obj) { var view = CollectionViewSource.GetDefaultView(Lecturers); LecturerModel selectedLecturer = view.CurrentItem as LecturerModel; Lecturers.Remove(selectedLecturer); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Surname,Age,Salary")] Lecturers lecturer) { if (ModelState.IsValid) { await _lecturersService.Update(id); return(RedirectToAction(nameof(Index))); } return(View(lecturer)); }
public ActionResult AssignLecture(int lecID, int acaID) { Lecturers new_lec = new Lecturers(); new_lec.UserID = acaID; new_lec.LecID = lecID; db.Lecturers.Add(new_lec); db.SaveChanges(); return(RedirectToAction("AssignLecture", "User")); }
public void RemoveLecturer(Lecturer lecturer) { Lecturers.Remove(lecturer); foreach (var classRecord in ClassRecords) { if (classRecord.Lecturer == lecturer) { classRecord.Lecturer = null; } } }
public async Task <ActionResult <Lecturers> > PostLecturers(Lecturers lecturers) { var result = await _context.Lecturers .Where(l => l.Email == lecturers.Email) .FirstOrDefaultAsync(); if (result != null) { return(Conflict("Email has been used")); } lecturers.Password = EncryptPassword(lecturers.Password); _context.Lecturers.Add(lecturers); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLecturers", new { id = lecturers.LecturerId }, lecturers)); }
public async Task <ApiReturnValue <Lecturers> > GetLecturer(string lecturerName) { ApiReturnValue <Lecturers> apiReturnValue = new ApiReturnValue <Lecturers>(); var lstLecturer = await GetLecturerById(lecturerName); Lecturers lecturers = new Lecturers(); lecturers.TotalCount = 70; lecturers.PageNumber = 1; lecturers.PageSize = 20; lecturers.Rows = lstLecturer; apiReturnValue.IsSuccess = true; apiReturnValue.Object = lecturers; await Task.Delay(1000); return(apiReturnValue); }
private void HandleLecturers() { var root = this.xDoc.Root; root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Lecturer/Register")), new XElement(ns + "priority", "0.5"), new XElement(ns + "changefreq", "weekly") ) ); root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Lecturer/Login")), new XElement(ns + "priority", "0.5"), new XElement(ns + "changefreq", "weekly") ) ); root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Search/Lecturers")), new XElement(ns + "priority", "1.0"), new XElement(ns + "changefreq", "daily") ) ); var lecturers = Lecturers.Get(true); foreach (var lecturer in lecturers) { root.Add( new XElement(ns + "url", new XElement(ns + "loc", string.Concat(baseURL, "Lecturer/", lecturer.Id)), new XElement(ns + "priority", "1.0"), new XElement(ns + "changefreq", "daily") ) ); } }
public bool UpdateInstructor(InstructorModel model, ref string errorMessage) { using (SZPNUWContext context = new SZPNUWContext()) { Lecturers lecturer = context.Lecturers.Include(x => x.User).FirstOrDefault(p => p.Id == model.Id); if (lecturer != null) { lecturer.User.Firstname = model.FirstName; lecturer.User.Lastname = model.LastName; lecturer.User.Pesel = model.PESEL; lecturer.User.Address = model.Address; lecturer.User.City = model.City; lecturer.Code = model.Code; lecturer.User.Dateofbirth = model.DateOfBirth; context.SaveChanges(); return(true); } errorMessage = PortalMessages.NoSuchElement; return(false); } }
public bool RegisterInstructor(InstructorModel model, ref string errorMessage) { using (SZPNUWContext context = new SZPNUWContext()) { if (!context.Users.Where(x => x.Login == model.Login).Any()) { if (!context.Lecturers.Where(x => x.Code == model.Code).Any()) { using (var transaction = context.Database.BeginTransaction()) { Users user = new Users { Login = model.Login, Password = SecurityService.GetSHA256Hash(model.Password), Firstname = model.FirstName, Lastname = model.LastName, Pesel = model.PESEL, City = model.City, Address = model.Address, Dateofbirth = model.DateOfBirth, Usertype = (int)UserTypes.Instructor }; Lecturers lecturer = new Lecturers { Code = model.Code }; user.Lecturers = lecturer; try { context.Add(user); context.SaveChanges(); transaction.Commit(); } catch (Exception) { transaction.Rollback(); errorMessage = PortalMessages.InsertDBError; } } return(true); } } errorMessage = ValidationMessages.UsedLogin; return(false); } }
public async Task <ActionResult <Lecturers> > Login(Lecturers lecturers) { var result = await _context.Lecturers.FirstOrDefaultAsync(l => l.Email == lecturers.Email); if (result == null) { return(Unauthorized("The email or password is incorrect")); } var validationStatus = VerifyPassword(lecturers.Password, result.Password); if (!validationStatus) { return(Unauthorized("The email or password is incorrect")); } result.LastLogin = DateTime.Now; result.Status = true; await _context.SaveChangesAsync(); var filtered = new { result.LecturerId, result.Name, result.Birthdate, result.PhoneNumber, result.Address, result.Email, result.LastLogin, result.Status, result.CreatedDate, result.UpdatedDate }; return(Ok(filtered)); }
public void Update(Lecturers lecturers) { }
public void Insert(Lecturers lecturers) { context.Lecturers.Add(lecturers); }
public void Delete(Lecturers lecturers) { context.Lecturers.Remove(lecturers); }
public bool Equals(TimetableEvent other) { if (other is null) { return(false); } if (Department != other.Department) { return(false); } if (FieldOfStudy != other.FieldOfStudy) { return(false); } if (Mode != other.Mode) { return(false); } if (Year != other.Year) { return(false); } if (Semester != other.Semester) { return(false); } if (IsFaculty != other.IsFaculty) { return(false); } if (FacultyGroup != other.FacultyGroup) { return(false); } if (Degree != other.Degree) { return(false); } if (Name != other.Name) { return(false); } if (DayOfWeek != other.DayOfWeek) { return(false); } if (StartTime != other.StartTime) { return(false); } if (EndTime != other.EndTime) { return(false); } if (Building != other.Building) { return(false); } if (Room != other.Room) { return(false); } if (!Lecturers.SetEquals(other.Lecturers)) { return(false); } if (Type != other.Type) { return(false); } if (Remarks != other.Remarks) { return(false); } if (AcademicYear != other.AcademicYear) { return(false); } return(true); }
public void AddLecturer(Lecturer lecturer) { Lecturers.Add(lecturer); }
public async Task Add(Lecturers lecturer) { _genericRepository.Add(lecturer); await _genericRepository.Save(); }
static async Task Main(string[] args) { Console.WriteLine("------------------Mutable------------------------"); //Values are mutable int x = 10; x = 20; x = 30; x = 50; Console.WriteLine(x); Console.WriteLine("------------------Dynamically implemented properties------------------------"); Students student = new Students("James", 18, "21/ug-223/BSCS", 3000); //age mutable student.age = 28; //name is readyOnly(immutable); cannot rewrite //student.name="Job"; //regNo is mutable student.regNo = "21/ug-335/BSSE-S"; student.tution = 7000; Console.WriteLine(student.name); Console.WriteLine(student.age); Console.WriteLine(student.regNo); Console.WriteLine(student.tution); Console.WriteLine("------------------Implicity typing------------------------"); var scores = new[] { 1, 2.5, 3, 4, 5 }; foreach (double element in scores) { Console.WriteLine(element); } Console.WriteLine("------------------Object and collactions initializers------------------------"); Products phone = new Products { pPrice = 3000, pName = "Smart Phone", pQuantity = 20, pBrand = "Oppo" }; phone = new Products(); Console.WriteLine(phone.pName + "" + phone.pPrice); // List<Products> products = new List<Products>{ // new Products { pPrice = 3000, pName = "Smart Phone", pQuantity = 20, pBrand = "Oppo" }, // new Products { pPrice = 6000, pName = "Smart Tv", pQuantity = 10, pBrand = "Samsung" } , // new Products { pPrice = 4000, pName = "Fridge", pQuantity = 5, pBrand = "LG" }, // new Products { pPrice = 5000, pName = "Oven", pQuantity = 2, pBrand = "LG" }, // }; GetProductsDelegate productsDelegate = new GetProductsDelegate(getProducts); List <Products> products = productsDelegate.Invoke(); Console.WriteLine("------------------Lambda expression ------------------------"); //Lambda expression //Lambda calculus //Anything coming after the arrow funtion, should be condition. List <Products> hightPrices = products.FindAll(value => value.pPrice < 4000); foreach (Products product in hightPrices) { Console.WriteLine(product.pName + " " + product.pPrice); } Console.WriteLine("------------------LINQ Expression queries------------------------"); // IEnumerable <Products> lowPrices = from product in products where product.pPrice < 5000 orderby product.pName ascending select product; foreach (Products product in lowPrices) { Console.WriteLine(product.pName + " " + product.pPrice); } Console.WriteLine("------------------ANONYMOUS DATATYPE------------------------"); // Example in Js /* * Example in Js * var user={ * fristname:'', * lastname:'', * nationality:'', * } */ // Example in C# var user = new { firstname = "Victor", lastname = "Manakana", nationality = "SA" }; Console.WriteLine(user.firstname); Console.WriteLine(user.lastname); Console.WriteLine(user.nationality); //Dynamic Console.WriteLine("--------------------------dynamic typing ----------------------------"); Calculator <double> calculator = new Calculator <double>(); dynamic sum = calculator.sum(10.9, 12.9); Console.WriteLine("Sum is" + sum); //Optional parameters Console.WriteLine("--------------------------Optional parameters ----------------------------"); Lecturers lecturers = new Lecturers(200.0); Console.WriteLine("Sum is: " + lecturers.name + " " + lecturers.wages); Lecturers lecturers2 = new Lecturers(name: "James", wages: 200.0); //Asynchronous Console.WriteLine("--------------------------Asynchronous----------------------------"); // synchronization , asynchronization // T1 & T2, waits for t1 to finish // OS dictionary Program program = new Program(); await program.checkin(); await fetchUserData(); await fetchResultsData(); //Asynchronous Pending tasks Console.WriteLine("--------------------------Moving next within Pending tasks----------------------------"); IAsyncEnumerator <int> asyncEnumerator = pendingTasks(1, 4).GetAsyncEnumerator(); while (await asyncEnumerator.MoveNextAsync()) { Console.WriteLine($"Current task value is :{asyncEnumerator.Current}"); } //Tasks, threads, Jobs Console.WriteLine("--------------------------Custom task types revisited----------------------------"); // Thread thread= new Thread(new ThreadStart(thread1)); // thread.Start(); // await doPurchaseJob1(); //Run multiple tasks at the same time //Tasks, threads, Jobs Console.WriteLine("--------------------------Run multiple tasks at the same time----------------------------"); List <Task> tasks = new List <Task>(); tasks.Add(Task.Run(async() => { await Task.Delay(1000); Console.WriteLine("Task1"); })); tasks.Add(Task.Run(async() => { await Task.Delay(2000); Console.WriteLine("Task2"); })); tasks.Add(Task.Run(async() => { //await Task.Delay(3000); await fetchUserData(); Console.WriteLine("Task3"); })); tasks.Add(Task.Run(async() => { await Task.Delay(2000); Console.WriteLine("Task4"); })); // Task.WaitAll(tasks.ToArray()); //Convariance and contravariance Console.WriteLine("-------------------------------------Convariance and contravariance------------------------------"); //------------contravariance // Cow cow= new Mammars(); Mammars mammars = new Cow(); // Mammars mammars1= new Animal(); Animal animal = new Mammars(); //------------convariance IEnumerable <Animal> animals = new List <Mammars>(); //out , in //SmartPhone<PhoneTypes> smartPhones= new List<IApple>(); Console.WriteLine("-------------------------------------Convariance and contravariance------------------------------"); string studentDetails = String.Format(" Hey Mr {0} and {1}", "James", "John"); long workerId = 11100000; string workerDetails = String.Format(" Hey My ID is {0}", workerId); // Decimal //double x= 30.00000000000000000000000000000000E25; Decimal wages = 5000000000000000.50m; //5,000,000,000,000,000 string engineerWages = String.Format("James wages is {0:N0}", wages); Console.WriteLine(studentDetails); Console.WriteLine(wages); String[] students = { "Victor", "Faith", "Khoza" }; Decimal[] marks = new Decimal[] { 80000000, 8000000, 90000000 }; String[] positions = new String[] { "Senior softwareEng ", "Senior softwareEng", "Senior softwareEng" }; var stringBuilder = new System.Text.StringBuilder(); stringBuilder.Append(String.Format("{0,5} {1,8} {2,7} \n\n", "Engineers", "Salary", "Position")); for (int i = 0; i < students.Length; i++) { stringBuilder.Append(String.Format("{0,5} {1,8:N0} {2,7} \n\n", students[i], marks[i], positions[i])); } Console.WriteLine(stringBuilder); }