protected void serviceview_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "request") { string freelancerId = e.CommandArgument.ToString(); string serviceId = Request.QueryString["id"].ToString(); List <BL.service.Service> service = new BL.service.Service().SelectById(serviceId); User curruser = new User().SelectById(LblUid.Value); User freelancer = new User().SelectById(freelancerId); Jobs existjob = new Jobs().SelectByCidSid(curruser.Id.ToString(), service[0].Id.ToString()); if (int.Parse(freelancerId) == curruser.Id) { Session["error"] = "You cannot purchase your own service"; Response.Redirect("~/Views/service/servicelist.aspx"); } if (curruser.type == "freelancer") { Session["error"] = "Only clients are able to request services"; Response.Redirect("~/Views/service/servicelist.aspx"); } if (existjob == null) { TextBox tbRemark = (TextBox)e.Item.FindControl("tbRemarks"); Jobs job = new Jobs(int.Parse(LblUid.Value), int.Parse(freelancerId), int.Parse(serviceId), service[0].name, curruser.username, freelancer.username, tbRemark.Text, service[0].price); int result = job.AddJob(); if (result == 0) { Session["error"] = "An error occured while requesting the service"; Response.Redirect("~/Views/service/servicelist.aspx"); } else { Notification notif = new Notification(int.Parse(LblUid.Value), curruser.username, int.Parse(serviceId), service[0].name, freelancer.Id.ToString(), "job"); notif.AddNotif(); Session["success"] = "Service requested successfully, please wait for " + freelancer.username + "\\'s response"; Response.Redirect("~/Views/service/servicelist.aspx"); } } else { Session["error"] = "You cannot request for this service until completion of previous request"; Response.Redirect("~/Views/service/servicelist.aspx"); } } if (e.CommandName == "viewprofile") { Response.Redirect("~/Views/profile/view.aspx?id=" + e.CommandArgument.ToString()); } }
public static void Main() { Jobs.Subscribe(); List <Employee> employees = new List <Employee>(); string input = Console.ReadLine(); while (input != "End") { string[] data = input.Split(); switch (data[0]) { case "Job": string employeeName = data[3]; Employee employee = employees.First(e => e.Name == employeeName); Job job = new Job(data[1], int.Parse(data[2]), employee); Jobs.AddJob(job); break; case "StandartEmployee": Employee employeeNew = new StandartEmployee(data[1]); employees.Add(employeeNew); break; case "PartTimeEmployee": Employee employeeNew2 = new PartTimeEmployee(data[1]); employees.Add(employeeNew2); break; case "Pass": foreach (var jobToUpdate in Jobs.jobs) { jobToUpdate.Update(); } Jobs.RemoveFinishedJobs(); break; case "Status": foreach (var jobToPrint in Jobs.jobs) { Console.WriteLine(jobToPrint); } break; default: break; } input = Console.ReadLine(); } }