protected void RequestsGrid_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label reqFrom = (Label)e.Row.FindControl("RequestFrom"); Panel swapPanel = (Panel)e.Row.FindControl("SwapRequestPanel"); Label swapDate = (Label)swapPanel.FindControl("SwapDate"); RequestNotice.Visible = true; swapPanel.Visible = true; Label fromVeId = (Label)swapPanel.FindControl("FromVeLabel"); Label toVeId = (Label)swapPanel.FindControl("ToVeLabel"); Label otherVeLabel = (Label)swapPanel.FindControl("OtherVeLabel"); Label myVeLabel = (Label)swapPanel.FindControl("MyVeLabel"); Label fromName = (Label)swapPanel.FindControl("RequestFromLabel"); Guid fromVeGuid = Guid.Parse(fromVeId.Text); Guid toVeGuid = Guid.Parse(toVeId.Text); using (SwapEntities ent = new SwapEntities()) { CarClass cc = new CarClass(Profile.UserName); UserVehicle getOtherVe = cc.GetVehicleInfo(fromVeGuid); UserVehicle getMyVe = cc.GetVehicleInfo(toVeGuid); if (getOtherVe != null) { otherVeLabel.Text = getOtherVe.VehicleYear + " " + getOtherVe.VehicleMake + " " + getOtherVe.VehicleModel; myVeLabel.Text = getMyVe.VehicleYear + " " + getMyVe.VehicleMake + " " + getMyVe.VehicleModel; UserClass uc = new UserClass(getOtherVe.UserName); fromName.Text = uc.PublicFirstName; } } } }
protected void Page_Load(object sender, EventArgs e) { string getMyVeId = Request.QueryString.Get("toVeId"); string getOtherVeId = Request.QueryString.Get("fromVeId"); string requestFrom = Request.QueryString.Get("requestfrom"); string requestId = Request.QueryString.Get("id"); Guid myVeGuid = Guid.Parse(getMyVeId); Guid otherVeGuid = Guid.Parse(getOtherVeId); Guid requestGuid = Guid.Parse(requestId); UserClass uc = new UserClass(Profile.UserName); UserClass ouc = new UserClass(requestFrom); RequestGuidLabel.Text = requestId; string imgUrl = uc.PublicImgMainUrl(myVeGuid); using (SwapEntities ent = new SwapEntities()) { CarClass cc = new CarClass(Profile.UserName); var fromVe = (from tbl in ent.VeImages orderby tbl.IsMain descending where tbl.VehicleId == otherVeGuid select tbl); Repeater.DataSource = fromVe; Repeater.DataBind(); UserVehicle myVe = cc.GetVehicleInfo(myVeGuid); UserVehicle otherVe = cc.GetVehicleInfo(otherVeGuid); RequestEvent thisRequest = cc.GetSwapRequestInfo(requestGuid); OtherUser.Text = ouc.PublicFirstName; OtherUser2.Text = ouc.PublicFirstName; SwapFromDate.Text = thisRequest.DateFrom.ToShortDateString(); SwapToDate.Text = thisRequest.DateTo.ToShortDateString(); MyVeLabel.Text = myVe.VehicleYear + " " + myVe.VehicleMake + " " + myVe.VehicleModel; OtherVeLabel.Text = otherVe.VehicleYear + " " + otherVe.VehicleMake + " " + otherVe.VehicleModel; VeMiles.Text = otherVe.VehicleMiles.ToString(); CityState.Text = ouc.PublicCity + ", " + ouc.PublicState; Distance.Text = cc.GetDistance(uc.PublicZip, ouc.PublicZip).ToString(); } MyImg.ImageUrl = imgUrl; }
protected void ScheduleListView_ItemDataBound(object sender, ListViewItemEventArgs e) { ListViewItem myItem = (ListViewItem)e.Item; Label userMain = (Label)myItem.FindControl("UserMain"); Label userOther = (Label)myItem.FindControl("UserOther"); Label swapWith = (Label)myItem.FindControl("SwappingWith"); Label swapVe = (Label)myItem.FindControl("SwapVe"); Label vMain = (Label)myItem.FindControl("VMain"); Label vOther = (Label)myItem.FindControl("VOther"); Label swapFrom = (Label)myItem.FindControl("SwapFromDate"); Label swapTo = (Label)myItem.FindControl("SwapToDate"); Label phone = (Label)myItem.FindControl("Phone"); Label swapId = (Label)myItem.FindControl("ScheduleId"); Image swapImg = (Image)myItem.FindControl("SchedSwapVeImage"); Image persSwapImg = (Image)myItem.FindControl("SchedSwapPersImg"); HyperLink rateLink = (HyperLink)myItem.FindControl("RateSwapLink"); HyperLink msgLink = (HyperLink)myItem.FindControl("SendMsgLink"); Guid veMainGuid = Guid.Parse(vMain.Text); Guid veOtherGuid = Guid.Parse(vOther.Text); if (userMain.Text == Profile.UserName) { UserClass uc = new UserClass(userOther.Text); CarClass cc = new CarClass(userOther.Text); swapWith.Text = uc.PublicFirstName; UserVehicle userVe = cc.GetVehicleInfo(veOtherGuid); swapImg.ImageUrl = uc.PublicImgMainUrl(veOtherGuid); persSwapImg.ImageUrl = uc.PublicPersonalImage; swapVe.Text = userVe.VehicleYear + " " + userVe.VehicleMake + " " + userVe.VehicleModel; rateLink.NavigateUrl = rateLink.NavigateUrl + "?Id=" + swapId.Text + "&User="******"&FirstName=" + uc.PublicFirstName + "&DateFrom=" + swapFrom.Text + "&DateTo=" + swapTo.Text; phone.Text = uc.PublicFormattedPhone; msgLink.NavigateUrl = msgLink.NavigateUrl + "?from=" + uc.PublicUserName; } else { UserClass uc = new UserClass(userMain.Text); CarClass cc = new CarClass(userMain.Text); swapWith.Text = uc.PublicFirstName; UserVehicle userVe = cc.GetVehicleInfo(veMainGuid); swapImg.ImageUrl = uc.PublicImgMainUrl(veMainGuid); persSwapImg.ImageUrl = uc.PublicPersonalImage; swapVe.Text = userVe.VehicleYear + " " + userVe.VehicleMake + " " + userVe.VehicleModel; rateLink.NavigateUrl = rateLink.NavigateUrl + "?Id=" + swapId.Text + "&User="******"&FirstName=" + uc.PublicFirstName + "&DateFrom=" + swapFrom.Text + "&DateTo=" + swapTo.Text; phone.Text = uc.PublicFormattedPhone; msgLink.NavigateUrl = msgLink.NavigateUrl + "?from=" + uc.PublicUserName; } }