protected void saveBTTN_ServerClick(object sender, EventArgs e) { TourGuide ist = new TourGuide(); string nric = Session["Nric"].ToString(); if (FileUpload1.HasFiles) { //string s1 =Path.GetFileName(FileUpload1.FileName); //string path = Server.MapPath("images") + "/" + s1; //FileUpload1.SaveAs(path); HttpPostedFile postedfile = FileUpload1.PostedFile; Stream stream = postedfile.InputStream; BinaryReader binaryReader = new BinaryReader(stream); byte[] bytes = binaryReader.ReadBytes((int)stream.Length); //string s1 = Convert.ToBase64String(bytes); int picresult = ist.InsertProfilePic(bytes, nric); } int re = ist.Update(Convert.ToInt32(salarytb.Text), nric); if (bonusamttb.Text != "") { int result = ist.InsertTest(Convert.ToInt32(bonusamttb.Text), Commentstb.Text, nric); } Response.Redirect("PaymentSimulation.aspx"); }
public TourGuideDisplayCard(int index, Canvas CurrentCanvas, TourGuide CurrentTourGuide, MainWindow CurrentWindow) { this.CurrentTourGuide = CurrentTourGuide; this.CurrentWindow = CurrentWindow; double BaseLoc = (index * 230) + 140; //creating BackGroung BackGround = new Rectangle(); BackGround.Width = 800; BackGround.Height = 220; Canvas.SetLeft(BackGround, 111); Canvas.SetTop(BackGround, BaseLoc); BackGround.Fill = new SolidColorBrush(Color.FromRgb(255, 255, 255)); BackGround.Stroke = new SolidColorBrush(Color.FromRgb(0, 0, 0)); BackGround.StrokeThickness = 3; CurrentCanvas.Children.Add(BackGround); this.TourGuideImage = CurrentTourGuide.UserImage.GetImage(); this.TourGuideImage.MaxHeight = 200; this.TourGuideImage.MaxWidth = 300; Canvas.SetLeft(this.TourGuideImage, 140); Canvas.SetTop(this.TourGuideImage, BaseLoc + 20); CurrentCanvas.Children.Add(this.TourGuideImage); this.TourGuideName = new Label(); this.TourGuideName.Content = "Name: " + CurrentTourGuide.Name; this.TourGuideName.FontSize = 25; this.TourGuideName.FontWeight = FontWeights.Bold; this.TourGuideName.HorizontalAlignment = HorizontalAlignment.Left; this.TourGuideName.VerticalAlignment = VerticalAlignment.Center; Canvas.SetLeft(this.TourGuideName, 450); Canvas.SetTop(this.TourGuideName, BaseLoc + 20); CurrentCanvas.Children.Add(this.TourGuideName); this.TourGuideEmail = new Label(); this.TourGuideEmail.Content = "Email: " + CurrentTourGuide.Email; this.TourGuideEmail.FontSize = 25; this.TourGuideEmail.FontWeight = FontWeights.Bold; this.TourGuideEmail.HorizontalAlignment = HorizontalAlignment.Left; this.TourGuideEmail.VerticalAlignment = VerticalAlignment.Center; Canvas.SetLeft(this.TourGuideEmail, 450); Canvas.SetTop(this.TourGuideEmail, BaseLoc + 50); CurrentCanvas.Children.Add(this.TourGuideEmail); this.View_More = new Button(); this.View_More.Content = "View More"; Canvas.SetLeft(this.View_More, 750); Canvas.SetTop(this.View_More, BaseLoc + 150); View_More.Width = 152; View_More.Height = 48; View_More.Background = new SolidColorBrush(Color.FromRgb(232, 126, 49)); View_More.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); View_More.FontSize = 20; View_More.Click += View_More_Click; View_More.Cursor = Cursors.Hand; CurrentCanvas.Children.Add(this.View_More); CurrentCanvas.Height = BaseLoc + 250; }
public static TourGuide SelectTourGuideByEmail(string email) { SqlConnection myConn = new SqlConnection(DBConnect); string sqlStmt = "Select TourGuides.tourguide_id, TourGuides.user_id, Users.name, Users.password, Users.email, TourGuides.description, TourGuides.languages, TourGuides.credentials, TourGuides.tourguideimage " + "From TourGuides " + "Inner Join Users On TourGuides.user_id = Users.user_id Where Users.email = @paraEmail"; SqlDataAdapter da = new SqlDataAdapter(sqlStmt, myConn); da.SelectCommand.Parameters.AddWithValue("@paraEmail", email); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count == 1) { DataRow row = ds.Tables[0].Rows[0]; int id = int.Parse(row["tourguide_id"].ToString()); int user_id = int.Parse(row["user_id"].ToString()); string name = row["name"].ToString(); string password = row["password"].ToString(); string desc = row["description"].ToString(); string languages = row["languages"].ToString(); string credentials = row["credentials"].ToString(); string tourguideimage = row["tourguideimage"].ToString(); TourGuide obj = new TourGuide(id, user_id, name, email, password, desc, languages, credentials, tourguideimage); return(obj); } else { return(null); } }
public void save_guide(HttpContext context) { int id = Convert.ToInt32(context.Request["id"]); string title = context.Request["title"]; int tourrange = Convert.ToInt32(context.Request["tourrange"]); int tourtype = Convert.ToInt32(context.Request["tourtype"]); TourGuideTemp temp = tgt.GetModel(id); TourGuide gde = new TourGuide(); gde.userid = temp.userid; gde.nickname = temp.nickname; gde.title = temp.title; gde.createtime = temp.createtime; gde.imagelist = temp.imagelist; gde.imagecount = temp.imagecount; gde.commentcount = temp.commentcount; gde.areamatch = temp.areamatch; gde.areamathrow = temp.areamathrow; gde.istuijian = temp.istuijian; gde.ispublish = 0; gde.tourdays = temp.tourdays; gde.browsecount = 0; gde.updatetime = temp.updatetime; gde.prasecount = temp.prasecount; gde.ishot = temp.ishot; gde.isindex = temp.isindex; gde.tourrange = temp.tourrange; gde.tourtype = temp.tourtype; gde.temp_id = temp.Id; guide.Add(gde); }
public static void UpdateTourGuide(TourGuide tg) { SqlConnection myConn = new SqlConnection(DBConnect); string sqlStmt = "Update TourGuides Set description = @paraDesc, languages = @paraLang, credentials = @paraCred, tourguideimage = @paraImage Where tourguide_id = @paraTG; " + "Update Users Set name = @paraName, password = @paraPswd, email = @paraEmail Where user_id = @paraUser;"; SqlCommand cmd = new SqlCommand(sqlStmt, myConn); cmd.Parameters.AddWithValue("@paraDesc", tg.Description); cmd.Parameters.AddWithValue("@paraLang", tg.Languages); cmd.Parameters.AddWithValue("@paraCred", tg.Credentials); cmd.Parameters.AddWithValue("@paraImage", tg.TourGuideImage); cmd.Parameters.AddWithValue("@paraTG", tg.TourGuideId); cmd.Parameters.AddWithValue("@paraName", tg.Name); cmd.Parameters.AddWithValue("@paraPswd", tg.Password); cmd.Parameters.AddWithValue("@paraEmail", tg.Email); cmd.Parameters.AddWithValue("@paraUser", tg.UserId); try { myConn.Open(); cmd.ExecuteNonQuery(); myConn.Close(); } catch (Exception ex) { Console.WriteLine(ex); } }
public static void InsertTourGuide(TourGuide tg) { SqlConnection myConn = new SqlConnection(DBConnect); string sqlStmt = "Insert into Users (password, name, email) Values (@paraPswd, @paraName, @paraEmail); " + "Select Cast(scope_identity() as int)"; SqlCommand cmdUsers = new SqlCommand(sqlStmt, myConn); cmdUsers.Parameters.AddWithValue("@paraPswd", tg.Password); cmdUsers.Parameters.AddWithValue("@paraName", tg.Name); cmdUsers.Parameters.AddWithValue("@paraEmail", tg.Email); try { myConn.Open(); int user_id = (int)cmdUsers.ExecuteScalar(); string newStmt = "Insert into TourGuides (user_id, description, languages, credentials, tourguideimage) Values (@paraUser, @paraDesc, @paraLang, @paraCred, @paraImage);"; SqlCommand cmdTG = new SqlCommand(newStmt, myConn); cmdTG.Parameters.AddWithValue("@paraUser", user_id); cmdTG.Parameters.AddWithValue("@paraDesc", tg.Description); cmdTG.Parameters.AddWithValue("@paraLang", tg.Languages); cmdTG.Parameters.AddWithValue("@paraCred", tg.Credentials); cmdTG.Parameters.AddWithValue("@paraImage", tg.TourGuideImage); cmdTG.ExecuteNonQuery(); } catch (Exception ex) { Console.WriteLine(ex); } }
// delete Tour Guide informantion to database and stored completely in memory to work offline. public void removeTourGuide(int?Id) { TourGuide dbEntity = db.tbl_TourGuide.Find(Id); dbEntity.isDelete = true; db.SaveChanges(); }
static void Main(string[] args) { TourGuide tourGuide = new TourGuide(); do {//enter program Console.Clear(); //introduce app and get user input on first. have helper return the tour guide after giving him correct things to say tourGuide.Speak(tourGuide.Words); tourGuide.Speak(tourGuide.Options); tourGuide.Result=Console.ReadLine(); if(!((tourGuide.AcceptableResponses).Contains(tourGuide.Result))){ Console.WriteLine("This input isn't listed!\nIf you're trying to potentially skip a menu, your tour guide has a list of acceptable answers that are given above!\n Press enter to continue..."); tourGuide.Result="0"; Console.ReadLine(); } tourGuide=PrintToScreenHelper.TourGuideHelper(tourGuide); }while(tourGuide.Result!="-1"); tourGuide.Speak(tourGuide.Words); //say goodbye }//end main
protected void Page_Load(object sender, EventArgs e) { TourGuide tg = TourGuideDAO.SelectTourGuideById(int.Parse(Session["tourguide_id"].ToString())); tourguideidLabel.Text = tg.TourGuideId.ToString(); tourguideuseridLabel.Text = tg.UserId.ToString(); }
public IActionResult Create(TourGuide model) { if (HttpContext.Session.GetString("ID") == null) { return(RedirectToAction("Login", "Admin")); } else { if (ModelState.IsValid) { bool check = tourGuideRepostory.checkID(model.TourGuideID); if (check) { tourGuideRepostory.addTourGuide(model); return(RedirectToAction("Index")); } else { ModelState.AddModelError(string.Empty, "This ID already exists."); return(View()); } } return(View(model)); } }
protected void btnLogin_Click(object sender, EventArgs e) { if (Page.IsValid) { if (tbEmail.Text == "*****@*****.**") { Session["admin"] = true; Response.Redirect("IndexAdmin.aspx"); return; } try { TourGuide user = TourGuideDAO.SelectTourGuideByEmail(tbEmail.Text); Session["tourguide_id"] = user.TourGuideId.ToString(); } catch (Exception) { Tourist user = TouristDAO.SelectTouristByEmail(tbEmail.Text); Session["tourist_id"] = user.TouristId.ToString(); } finally { if (Session["tourguide_id"] != null) { Response.Redirect("TourGuideRequestsPage.aspx"); } else if (Session["tourist_id"] != null) { Response.Redirect("Index.aspx"); } } } }
public void comment(HttpContext context) { string user_id = TravelAgent.Tool.CookieHelper.GetCookieValue("uid"); string msg = ""; if (string.Empty == user_id) { msg = "{\"result\":\"false\",\"reason\":\"needlogin\"}"; context.Response.Write(msg); return; } string contents = context.Request["contents"]; int comment_type = Convert.ToInt32(context.Request["comment_type"]); int comment_rel_id = Convert.ToInt32(context.Request["comment_rel_id"]); Club user = club.GetModel(Convert.ToInt32(user_id)); TourComment comm = new TourComment(); comm.contents = contents; comm.comment_type = comment_type; comm.comment_rel_id = comment_rel_id; comm.user_id = user.id; comm.nickname = user.clubMobile; comm.create_time = DateTime.Now; comments.Add(comm); //更新评论数 TourGuide tg = guide.GetModel(comment_rel_id); List <TourComment> tclist = comments.GetList(comment_rel_id); tg.commentcount = (tclist.Count); guide.Update(tg); msg = "{\"result\":\"true\",\"reason\":\"true\"}"; context.Response.Write(msg); }
public void Check(HttpContext context) { int id = Convert.ToInt32(context.Request["id"]); TourGuide gd = guide.GetModel(id); gd.ispublish = 1; guide.Update(gd); }
protected void BtnSubmit_Click(object sender, EventArgs e) { string tourguideImage = LbImage.Text; TourGuide tg = new TourGuide(int.Parse(tourguideidLabel.Text), int.Parse(tourguideuseridLabel.Text), tourguidenameTextBox.Text, tourguideemailLabel.Text, tourguidepasswordLabel.Text, tourguidedescriptionTextBox.Text, tourguidelanguagesTextBox.Text, tourguidecredentialsTextBox.Text, tourguideImage); TourGuide.UpdateTourGuide(tg); }
public string RegisterTourGuide([FromBody] TourGuide guide) { using (thanujaEntities entities = new thanujaEntities()) { entities.TourGuides.Add(guide); entities.SaveChanges(); } return("successful"); }
public async Task <ActionResult> DeleteConfirmed(int id) { TourGuide tourGuide = await db.TourGuides.FindAsync(id); db.TourGuides.Remove(tourGuide); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "GuideID,GuideName,GuideSpeciality,GuideSuitability")] TourGuide tourGuide) { if (ModelState.IsValid) { db.Entry(tourGuide).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tourGuide)); }
// edit Tour Guide informantion to database and stored completely in memory to work offline. public void editTourGuide(TourGuide _TourGuide) { var dbEntity = db.tbl_TourGuide.Find(_TourGuide.TourGuideID); dbEntity.FirstName = _TourGuide.FirstName; dbEntity.LastName = _TourGuide.LastName; dbEntity.Phone = _TourGuide.Phone; dbEntity.Address = _TourGuide.Address; dbEntity.isDelete = _TourGuide.isDelete; db.SaveChanges(); }
public ActionResult List() { TourGuide obj = new TourGuide(); using (DbModels dbModel = new DbModels()) { //obj = db.images.Where(x => x.id == id).First(); var list = dbModel.TourGuides.ToList(); return(View(list)); } }
public async Task <ActionResult> Create([Bind(Include = "GuideID,GuideName,GuideSpeciality,GuideSuitability")] TourGuide tourGuide) { if (ModelState.IsValid) { db.TourGuides.Add(tourGuide); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(tourGuide)); }
public Trip(Ticket ticketditails, TourGuide tourguide, int NoOfSeats, int NoOfAvailableSeats, City From, City To, DateTime Date, TimeSpan Duration, TimeSpan ArrivalTime, TimeSpan DepartureTime) { this.TicketDitails = ticketditails; this.tourguide = tourguide; this.NoOfSeats = NoOfSeats; this.NoOfAvailableSeats = NoOfAvailableSeats; this.From = From; this.To = To; this.Date = Date; this.Duration = Duration; this.ArrivalTime = ArrivalTime; this.DepartureTime = DepartureTime; }
// GET: TourGuides/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TourGuide tourGuide = await db.TourGuides.FindAsync(id); if (tourGuide == null) { return(HttpNotFound()); } return(View(tourGuide)); }
// GET: TourGuide public ActionResult TourGuideView(int id) { TourGuide guide = new TourGuide(); using (DbModels dbModel = new DbModels()) { var guides = dbModel.TourGuides.Where(x => x.TourGuideId == id).ToList(); return(View(guides));; // dbModel.UserTables.Add(userModel); // dbModel.SaveChanges(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { TourGuide tg = TourGuideDAO.SelectTourGuideById(int.Parse(Session["tourguide_id"].ToString())); tourguidenameTextBox.Text = tg.Name; tourguidedescriptionTextBox.Text = tg.Description; tourguidelanguagesTextBox.Text = tg.Languages; tourguidecredentialsTextBox.Text = tg.Credentials; tourguideemailLabel.Text = tg.Email; tourguideidLabel.Text = tg.TourGuideId.ToString(); tourguideuseridLabel.Text = tg.UserId.ToString(); tourguidepasswordLabel.Text = tg.Password.ToString(); } }
public TourGuide RetrieveTGDetailsbyID(string nric) { string DBConnect = ConfigurationManager.ConnectionStrings["ConnStr"].ConnectionString; SqlConnection myConn = new SqlConnection(DBConnect); //Step 2 - Create a DataAdapter to retrieve data from the database table string sqlStmt = "Select * from TGDetails where nric = @paranri"; SqlDataAdapter da = new SqlDataAdapter(sqlStmt, myConn); da.SelectCommand.Parameters.AddWithValue("@paranri", nric); //Step 3 - Create a DataSet to store the data to be retrieved DataSet ds = new DataSet(); //Step 4 - Use the DataAdapter to fill the DataSet with data retrieved da.Fill(ds); //Step 5 - Read data from DataSet to List TourGuide TG = null; int rec_cnt = ds.Tables[0].Rows.Count; if (rec_cnt == 1) { DataRow row = ds.Tables[0].Rows[0]; string name = row["Name"].ToString(); string gender = row["Gender"].ToString(); string dob = row["D.O.B"].ToString(); string email = row["Email"].ToString(); string phonestring = row["Phone"].ToString(); int phone = Convert.ToInt32(phonestring); string dateregistered = row["Date Registered"].ToString(); string salarystring = row["Salary"].ToString(); int salary = Convert.ToInt32(salarystring); byte[] p = (byte[])row["ProfilePicData"]; string strBase64 = Convert.ToBase64String(p); TG = new TourGuide(nric, name, gender, dob, email, phone, dateregistered, salary, strBase64); } else { TG = null; } return(TG); }
public IActionResult Edit(TourGuide model) { if (HttpContext.Session.GetString("ID") == null) { return(RedirectToAction("Login", "Admin")); } else { if (ModelState.IsValid) { tourGuideRepostory.editTourGuide(model); return(RedirectToAction("Index")); } return(View(model)); } }
private void loadRepeater(string language) { tourguideList = TourGuide.GetAllTourGuidesByLanguage(language); if (language == "All") { tourguideList = TourGuide.GetAllTourGuide(); } else { tourguideList = TourGuide.GetAllTourGuidesByLanguage(language); } Repeater1.DataSource = tourguideList; Repeater1.DataBind(); }
public ActionResult Update(TourGuideModel tourViewModel) { if (!ModelState.IsValid) { return(View("AddTourGuide", tourViewModel)); } tourViewModel = SortLanguages(tourViewModel); //Sorting languages of the tourguide using (AgencyDBEntities db = new AgencyDBEntities()) { if (tourViewModel.ID == 0) { var tour = new TourGuide { Name = tourViewModel.Name, Phone_Number = tourViewModel.PhoneNO, Date_Of_Birth = tourViewModel.BirthDate, Language1 = tourViewModel.Language1, Language2 = tourViewModel.Language2, Language3 = tourViewModel.Language3, Number_Of_Trips = 0, }; db.TourGuides.Add(tour); } else { var tour = db.TourGuides.Single(c => c.ID == tourViewModel.ID); tour.Name = tourViewModel.Name; tour.Phone_Number = tourViewModel.PhoneNO; tour.Date_Of_Birth = tourViewModel.BirthDate; tour.Language1 = tourViewModel.Language1; tour.Language2 = tourViewModel.Language2; tour.Language3 = tourViewModel.Language3; tour.Number_Of_Trips = tourViewModel.Num_Trips; } db.SaveChanges(); return(RedirectToAction("ManageTourGuide", "TourGuide")); } }
public string guidelist(HttpContext context) { int id; int.TryParse(context.Request["id"], out id); TourGuide gde = guide.GetModel(id); if (gde != null) { TourGuideRoute route = tre.GetModel(gde.temp_id); List <TourGuideSpot> sp = spot.GetList(gde.temp_id); List <TourGuideGallery> gylist = tgy.GetListByguideid(gde.temp_id); gde.routetitle = route.title; gde.routecontent = route.contents; if (gylist.Count > 0) { gde.image = gylist[0].image; } else { gde.image = ""; } } return(JsonConvert.SerializeObject(gde)); //StringBuilder sb = new StringBuilder(); //sb.Append("<div class=\"item\">"); //sb.Append("<div class=\"notes_title\">"); //sb.Append("<a href=\"show.aspx?id=\" class=\"title_pic\"><img src=\"\"></a> <a href=\"\" class=\"title_content\">上海东方明珠塔</a>"); //sb.Append("</div>"); //sb.Append("<div class=\"notes_count\">"); //sb.Append("<span class=\"reply_count\">0</span>"); //sb.Append("<span class=\"view_count\">2</span>"); //sb.Append("</div>"); //sb.Append("<div class=\"notes_info\">"); //sb.Append("<a href=\"\"><img class=\"GUID\" uid=\"1\" src=\"\"></a>"); //sb.Append("<span><a href=\"\">fanwe</a></span>"); //sb.Append("<div><a href=\"\" class=\"notes_info_content\">匙、二是做消费凭证(每张卡可关联自己信用卡,并每卡有三百美元消费额度)…</a></div>"); //sb.Append("</div>"); //sb.Append("</div>"); //return ""; }
public IActionResult Delete(int?Id) { if (HttpContext.Session.GetString("ID") == null) { return(RedirectToAction("Login", "Admin")); } else { if (Id == null) { return(RedirectToAction("NotFoundPage")); } else { TourGuide model = tourGuideRepostory.getTourGuide(Id); return(View(model)); } } }