public string BuildURL() { StringBuilder sb = new StringBuilder(); sb.Append(baseURL); sb.Append("string=").Append(WebUtility.UrlEncode(Title)); if (SearchType != SearchType.NotSet) { sb.Append("&search_type=").Append(SearchType == SearchType.AllWords ? 1 : 3); } if (SearchInDescription) { sb.Append("&description=1"); } if (!String.IsNullOrEmpty(ExcludeWords)) { sb.Append("&exclude=").Append(ExcludeWords); } if (PriceFrom != 0) { sb.Append("&price_from=").Append(PriceFrom.ToString(CultureInfo.InvariantCulture)); } if (PriceTo != 0) { sb.Append("&price_to=").Append(PriceTo.ToString(CultureInfo.InvariantCulture)); } if (OfferType != OfferType.NotSet) { sb.Append("&offer_type=").Append(OfferType == OfferType.BuyNow ? 1 : 2); } if (CollectInPerson) { sb.Append("&personal_rec=1"); } if (PayU) { sb.Append("&pay=1"); } if (CategoryID != 0) { sb.Append("&category=").Append(CategoryID); } return(sb.ToString()); }
public DoctorViewModel(Doctor obj, string connectionString) : this() { context = new MySqlContext(new MySqlConnectionFactory(connectionString)); AcademicId = obj.AcademicId; Address = obj.Address; AllowBooking = obj.AllowBooking; AllowFilter = obj.AllowFilter; AllowSearch = obj.AllowSearch; Avatar = obj.Avatar; BirthDate = obj.BirthDate; BirthMonth = obj.BirthMonth; BirthYear = obj.BirthYear; CertificationCode = obj.CertificationCode; CertificationDate = obj.CertificationDate; CreateUserId = obj.CreateUserId; DegreeId = obj.DegreeId; Description = obj.Description; DistrictCode = obj.DistrictCode; DoctorId = obj.DoctorId; EducationCountryCode = obj.EducationCountryCode; Email = obj.Email; EthnicityCode = obj.EthnicityCode; FullName = obj.FullName; Gender = obj.Gender; IsActive = obj.IsActive; IsDelete = obj.IsDelete; IsSync = obj.IsSync; NationCode = obj.NationCode; PhoneNumber = obj.PhoneNumber; PositionCode = obj.PositionCode; PriceFrom = obj.PriceFrom; PriceTo = obj.PriceTo; PriceDescription = obj.PriceDescription; ProvinceCode = obj.ProvinceCode; Summary = obj.Summary; TitleCode = obj.TitleCode; CreateDate = obj.CreateDate; UpdateDate = obj.UpdateDate; UpdateUserId = obj.UpdateUserId; Description = obj.Description; if (obj.PriceFrom != null && obj.PriceTo != null) { Price = PriceFrom + " - " + PriceTo; } else if (obj.PriceFrom != null && obj.PriceTo == null) { Price = PriceFrom.ToString(); } else if (obj.PriceFrom == null && obj.PriceTo != null) { Price = PriceTo.ToString(); } else { Price = ""; } var academic = context.JoinQuery <Doctor, CategoryCommon>((d, c) => new object[] { JoinType.InnerJoin, d.AcademicId == c.Id }) .Where((d, c) => d.DoctorId == obj.DoctorId) .Select((d, c) => c).FirstOrDefault(); var degree = context.JoinQuery <Doctor, CategoryCommon>((d, c) => new object[] { JoinType.InnerJoin, d.DegreeId == c.Id }) .Where((d, c) => d.DoctorId == obj.DoctorId) .Select((d, c) => c).FirstOrDefault(); Specialist = context.JoinQuery <Doctor, DoctorSpecialists>((d, ds) => new object[] { JoinType.InnerJoin, d.DoctorId == ds.DoctorId }) .Where((d, ds) => ds.IsDelete == false && ds.IsActive == true && ds.DoctorId == obj.DoctorId).Select((d, ds) => new DoctorSpecialistsViewModel(ds, connectionString)).ToList(); HealthFacilities = context.JoinQuery <Doctor, HealthFacilitiesDoctors>((d, hf) => new object[] { JoinType.InnerJoin, d.DoctorId == hf.DoctorId }).Where((d, hf) => hf.IsDelete == false && hf.IsActive == true && hf.DoctorId == obj.DoctorId).Select((d, hf) => new HealthFacilitiesDoctorViewModel(hf, connectionString)).ToList(); Academic = academic != null ? academic.Name : ""; Degree = degree != null ? degree.Name : ""; }