public override IEnumerable <Tuple <string, string> > GetShortInfoList() { // Информация о текущем состоянии Абонемента. Добавляем всё что должно выводиться для Пользователя var result = new List <Tuple <string, string> > { new Tuple <string, string>("Тип: ", AbonementName), new Tuple <string, string>("Доступные Тренировки ", TypeWorkout.ToString()), new Tuple <string, string>("Услуги", Spa.ToString()), new Tuple <string, string>("Дата Покупки", BuyDate.ToShortDateString()), new Tuple <string, string>("Дата Активации", BuyActivationDate.ToShortDateString()) }; if (NumPersonalTr > 0) { result.Add(new Tuple <string, string>("Осталось Персональных", NumPersonalTr.ToString())); } if (NumAerobicTr > 0) { result.Add(new Tuple <string, string>("Осталось Аэробных", NumAerobicTr.ToString())); } if (PayStatus == Pay.Не_Оплачено) { result.Add(new Tuple <string, string>("Статус Оплаты ", PayStatus.ToString())); } return(result); }
public ActionResult Create(Spa spa, HttpPostedFileBase spaResim) { if (ModelState.IsValid) { if (spaResim != null) { WebImage img = new WebImage(spaResim.InputStream); FileInfo fotoinfo = new FileInfo(spaResim.FileName); string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension; img.Resize(300, 200); img.Save("~/Uploads/" + newfoto); spa.spaResim = "/Uploads/" + newfoto; spa.active = true; db.Spas.Add(spa); db.SaveChanges(); return(RedirectToAction("Index", "AdminSpa")); } else { ModelState.AddModelError("Fotoğraf", "Fotoğraf Seçiniz"); } } return(View(spa)); }
public ActionResult Edit(Spa spa, int spaID, HttpPostedFileBase spaResim) { if (ModelState.IsValid) { var spas = db.Spas.Where(u => u.spaID == spaID).SingleOrDefault(); if (spaResim != null) { if (System.IO.File.Exists(Server.MapPath(spa.spaResim))) { System.IO.File.Delete(Server.MapPath(spa.spaResim)); } WebImage img = new WebImage(spaResim.InputStream); FileInfo fotoinfo = new FileInfo(spaResim.FileName); string newfoto = Guid.NewGuid().ToString() + fotoinfo.Extension; img.Resize(150, 150); img.Save("~/Uploads/" + newfoto); spas.spaResim = "/Uploads/" + newfoto; } spas.spaAd = spa.spaAd; spas.spaAciklama = spa.spaAciklama; spas.active = spa.active; spas.spaFiyat = spa.spaFiyat; spas.spaSuresi = spa.spaSuresi; db.SaveChanges(); return(RedirectToAction("Index", "AdminSpa", new { spaID = spas.spaID })); } return(View()); }
public FormAdminKomentari(Letovanje l, Zimovanje z, Spa s, Ekskurzija e) { InitializeComponent(); letovanje = l; zimovanje = z; spa = s; ekskurzija = e; labels = new Label[30]; chbs = new CheckBox[30]; Init(); }
public FormAdministrator() { InitializeComponent(); Init(); letovanje = new Letovanje(); zimovanje = new Zimovanje(); spa = new Spa(); ekskurzija = new Ekskurzija(); tipPutovanja = null; cbParnoKupatilo.Visible = false; cbSezonaSkiSkolaSauna.Visible = false; }
public JsonResult DeleteSpaRecord(int spaID) { bool result = false; Spa usr = db.Spas.SingleOrDefault(x => x.spaID == spaID); if (usr != null) { usr.active = false; db.SaveChanges(); result = true; } return(Json(result, JsonRequestBehavior.AllowGet)); }
public IActionResult SpaAndFitness(Spa model) { if (model.Time == "-1") { ModelState.AddModelError("Time", "Tell us when do want this service"); } if (ModelState.IsValid) { ViewBag.SpaAppointment = "Thanks"; ModelState.Clear(); } return(View()); }
public override IEnumerable <Tuple <string, string> > GetShortInfoList() { var numFreezDays = Freeze?.GetSpentDays() ?? 0; //Продлим на замороженные дни var clubCardEndDate = IsActivated ? EndDate.Date.AddDays(numFreezDays).ToString("d") : BuyDate.AddMonths(12).ToString("d"); // Информация о текущем состоянии Абонемента. Добавляем всё что должно выводиться для Пользователя var result = new List <Tuple <string, string> > { new Tuple <string, string>("Тип: ", AbonementName), new Tuple <string, string>("Доступные Тренировки ", TypeWorkout.ToString()), new Tuple <string, string>("Время Тренировок ", TimeTraining.ToString()), new Tuple <string, string>("Услуги", Spa.ToString()), new Tuple <string, string>("Срок Клубной Карты", _numberMonths + " мес."), new Tuple <string, string>("Дата Покупки", BuyDate.ToString("d")), new Tuple <string, string>("Дата Активации", BuyActivationDate.ToString("d")), new Tuple <string, string>("Дата Окончания", clubCardEndDate), new Tuple <string, string>("Осталось Дней", GetRemainderDays().ToString()) }; if (NumPersonalTr > 0) { result.Add(new Tuple <string, string>("Осталось Персональных", NumPersonalTr.ToString())); } if (NumAerobicTr > 0) { result.Add(new Tuple <string, string>("Осталось Аэробных", NumAerobicTr.ToString())); } if (NumMiniGroup > 0) { result.Add(new Tuple <string, string>("Осталось МиниГрупп", NumMiniGroup.ToString())); } if (PayStatus == Pay.Не_Оплачено) { result.Add(new Tuple <string, string>("Статус Оплаты ", PayStatus.ToString())); } if (Freeze != null) { result.Add(new Tuple <string, string>("Осталось дней Заморозки", Freeze.GetAvailableDays().ToString())); } return(result); }
public override int GetHashCode() { int hash = 1; if (TrainerId != 0L) { hash ^= TrainerId.GetHashCode(); } if (TrainerBuildupConfigId != 0) { hash ^= TrainerBuildupConfigId.GetHashCode(); } if (Hp != 0) { hash ^= Hp.GetHashCode(); } if (Atk != 0) { hash ^= Atk.GetHashCode(); } if (Def != 0) { hash ^= Def.GetHashCode(); } if (Spa != 0) { hash ^= Spa.GetHashCode(); } if (Spd != 0) { hash ^= Spd.GetHashCode(); } if (Spe != 0) { hash ^= Spe.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override IEnumerable <Tuple <string, string> > GetShortInfoList() { // Информация о текущем состоянии Абонемента. Добавляем всё что должно выводиться для Пользователя var result = new List <Tuple <string, string> > { new Tuple <string, string>("Тип: ", AbonementName), new Tuple <string, string>("Доступные Тренировки ", TypeWorkout.ToString()), new Tuple <string, string>("Время Тренировок ", TimeTraining.ToString()), new Tuple <string, string>("Осталось Занятий", GetRemainderDays().ToString()), new Tuple <string, string>("Услуги", Spa.ToString()), new Tuple <string, string>("Дата Покупки", BuyDate.ToString("d")), new Tuple <string, string>("Дата Активации", BuyActivationDate.ToString("d")), new Tuple <string, string>("Дата Окончания", CalculateEndDate(BuyActivationDate, Options.ValidPeriodInMonth).ToString("d")) }; if (PayStatus == Pay.Не_Оплачено) { result.Add(new Tuple <string, string>("Статус Оплаты ", PayStatus.ToString())); } return(result); }
public async Task <EntityOperationResult <Spa> > AddSpa(string name) { var spa = await _context.Spas.FirstOrDefaultAsync(x => x.Name == name); if (spa != null) { var result = new EntityOperationResult <Spa>(); result.AddError("Duplicado", "Ya existe el nombre del balneario"); return(result); } var newSpa = new Spa { Name = name, Active = true }; _context.Spas.Add(newSpa); await _context.SaveChangesAsync(); return(new EntityOperationResult <Spa>(newSpa)); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { app.UseCors(options => options.WithOrigins("http://localhost:3000").AllowAnyMethod().AllowAnyHeader()); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images")), RequestPath = "/Images" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/OwnerImages")), RequestPath = "/Images/OwnerImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/MenuImages")), RequestPath = "/Images/MenuImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/VegSnacksImages")), RequestPath = "/Images/VegSnacksImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/VegCurriesImages")), RequestPath = "/Images/VegCurriesImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/BiryaniImages")), RequestPath = "/Images/BiryaniImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/ChickenSnacksImages")), RequestPath = "/Images/ChickenSnacksImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/MuttonSnacksImages")), RequestPath = "/Images/MuttonSnacksImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/FishPrawnsSnacksImages")), RequestPath = "/Images/FishPrawnsSnacksImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/ChickenCurriesImages")), RequestPath = "/Images/ChickenCurriesImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/MuttonCurriesImages")), RequestPath = "/Images/MuttonCurriesImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/TandooriImages")), RequestPath = "/Images/TandooriImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/RotiNaanImages")), RequestPath = "/Images/RotiNaanImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/SaveCartImages")), RequestPath = "/Images/SaveCartImages" }); app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "Images/BestOfSevenHillsImages")), RequestPath = "/Images/BestOfSevenHillsImages" }); app.UseRouting(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); }); app.UseSpa(Spa => { Spa.Options.SourcePath = "clientapp"; if (env.IsDevelopment()) { Spa.UseReactDevelopmentServer(npmScript: "start"); } }); }
public bool Modify() { return(MyClassState.Method1HasExecuted && MyClassState.Method2HasExecuted && MyClassState.Method3HasExecuted ? Spa.ClientModify() : false); }
protected override void Render(HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); ClientScriptManager cs = this.Page.ClientScript; #region Tham số string _ID = Request["ID"]; string _DM_ID = Request["DM_ID"]; string _Ten = Request["Ten"]; string _Phone = Request["Phone"]; string _KV_ID = Request["KV_ID"]; string _Sao = Request["Sao"]; string _Alias = Request["Alias"]; string _Diem = Request["Diem"]; string _ToaDo = Request["ToaDo"]; string _MoTa = Request["MoTa"]; string _DiaChi = Request["DiaChi"]; string _NoiDung = Request["NoiDung"]; string _Publish = Request["Publish"]; string _Moi = Request["Moi"]; string _KhuyenMai = Request["KhuyenMai"]; string _KhaiTruong = Request["KhaiTruong"]; string _Anh = Request["Anh"]; string _LoaiThanhVien = Request["LoaiThanhVien"]; string _Website = Request["Website"]; string _Email = Request["Email"]; string _BaoDam = Request["BaoDam"]; Spa Item; List<jgridRow> ListRow = new List<jgridRow>(); Pager<Spa> PagerGet; #endregion switch (subAct) { case "get": #region lấy dữ liệu cho grid if (string.IsNullOrEmpty(jgrsidx)) jgrsidx = "SPA_ID"; if (string.IsNullOrEmpty(jgrsord)) jgrsord = "desc"; PagerGet = SpaDal.pagerByQ(Request["q"], jgrsidx + " " + jgrsord, 10); foreach (Spa dm in PagerGet.List) { ListRow.Add(new jgridRow(dm.ID.ToString(), new string[] { string.Format("{0}",dm.ID) , string.Format("<img style=\"width: 50px;\" src=\"../up/i/{0}\" />", linh.common.Lib.imgSize(dm.Anh,"150x115")) , dm.KV_Ten , dm.Ten , dm.DiaChi , dm.Phone , dm.NgayTao.ToString("hh:mm - dd/MM/yyyy") , dm.Moi.ToString() , dm.KhaiTruong.ToString() , dm.KhuyenMai.ToString() , dm.Publish.ToString() , dm.Sao.ToString() })); } jgrid grid = new jgrid(string.IsNullOrEmpty(jgrpage) ? "1" : jgrpage, PagerGet.TotalPages.ToString(), PagerGet.Total.ToString(), ListRow); sb.Append(JavaScriptConvert.SerializeObject(grid)); break; #endregion case "del": #region xóa if (!string.IsNullOrEmpty(_ID)) { SpaDal.DeleteById(Convert.ToInt32(_ID)); } break; #endregion case "edit": #region chỉnh sửa if (!string.IsNullOrEmpty(_ID)) { sb.Append("(" + JavaScriptConvert.SerializeObject(SpaDal.SelectById(Convert.ToInt32(_ID))) + ")"); } break; #endregion case "save": #region lưu if (!string.IsNullOrEmpty(_ID)) { Item = SpaDal.SelectById(Convert.ToInt32(_ID)); } else { Item = new Spa(); } if (!string.IsNullOrEmpty(_DM_ID)) { Item.DM_ID = Convert.ToInt32(_DM_ID); } Item.Alias = _Alias; Item.Anh = _Anh; Item.DiaChi = _DiaChi; Item.Diem = Convert.ToInt32(_Diem); Item.KhaiTruong = Convert.ToBoolean(_KhaiTruong); Item.KhuyenMai = Convert.ToBoolean(_KhuyenMai); Item.Website = _Website; Item.Email = _Email; Item.BaoDam = Convert.ToBoolean(_BaoDam); if (!string.IsNullOrEmpty(_LoaiThanhVien)) { Item.LoaiThanhVien = Convert.ToInt32(_LoaiThanhVien); } if (!string.IsNullOrEmpty(_KV_ID)) { Item.KV_ID = Convert.ToInt32(_KV_ID); } if (!string.IsNullOrEmpty(_DM_ID)) { Item.DM_ID = Convert.ToInt32(_DM_ID); } Item.Mobile = string.Empty; Item.Moi = Convert.ToBoolean(_Moi); Item.Mota = _MoTa; Item.NgayCapNhat = DateTime.Now; Item.NoiDung = _NoiDung; Item.Phone = _Phone; Item.Publish = Convert.ToBoolean(_Publish); Item.Sao = Convert.ToByte(_Sao); Item.SolanDanhGia = 0; Item.Ten = _Ten; Item.ToaDo = _ToaDo; if (!string.IsNullOrEmpty(_ID)) { Item = SpaDal.Update(Item); } else { Item.NgayTao = DateTime.Now; Item.RowId = Guid.NewGuid(); Item = SpaDal.Insert(Item); } sb.Append("1"); break; #endregion case "autoComplete": #region lưu PagerGet = SpaDal.pagerByQ(Request["q"], string.Empty, 20); sb.Append(JavaScriptConvert.SerializeObject(PagerGet.List)); break; #endregion case "scpt": #region Nạp js sb.AppendFormat(@"{0}" , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.quanLySpa.JScript1.js")); break; #endregion default: #region nạp FunctionCollection ListFn = FunctionDal.SelectByUserAndFNID(Security.Username, fnId); sb.Append(@" <div class=""mdl-head""> <span class=""mdl-head-searchPnl ui-state-default ui-corner-all""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" class=""mdl-head-txt mdl-head-search mdl-head-search-quanLySpaMdl"" /> </span> <a class=""mdl-head-btn mdl-head-add"" id=""quanLySpaMdl-addBtn"" href=""javascript:quanLySpaFn.add();"">Thêm</a> <a class=""mdl-head-btn mdl-head-edit"" id=""quanLySpaMdl-editBtn"" href=""javascript:quanLySpaFn.edit();"">Sửa</a> <a class=""mdl-head-btn mdl-head-del"" id=""quanLySpaMdl-delBtn"" href=""javascript:quanLySpaFn.del();"">Xóa</a> <a class=""mdl-head-btn mdl-head-del"" href=""javascript:;"" onclick=""$('#quanLySpaMdl-List').trigger('reloadGrid');"">Nạp</a> <span class=""mdl-head-filterPnl ui-state-default ui-corner-all""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" _value="""" class=""mdl-head-filter mdl-head-spaFilterByKv""/> </span> <span class=""mdl-head-filterPnl ui-state-default ui-corner-all""> <a href=""javascript:;"" class=""mdl-head-clearSearch""></a> <input type=""text"" _value="""" class=""mdl-head-filter mdl-head-spaFilterByDm""/> </span> </div> <table id=""quanLySpaMdl-List"" class=""mdl-list""></table> <div id=""quanLySpaMdl-Pager""></div> "); sb.AppendFormat(@"<script>$.getScript('{0}',function(){1});</script>" , cs.GetWebResourceUrl(typeof(Class1), "plugin.spa.quanLySpa.JScript1.js") , "{quanLySpaFn.loadgrid();}"); sb.AppendFormat("<script>adm.validFn('{0}');</script>", JavaScriptConvert.SerializeObject(ListFn)); break; #endregion } writer.Write(sb.ToString()); base.Render(writer); }
// This method is only called when a frame is going to be displayed // Avoids unnecessary costly functions public void DisplayPrep() { if (FrameType != FrameType.Method5Natures && FrameType != FrameType.BredAlternate && FrameType != FrameType.BredSplit && FrameType != FrameType.Bred && FrameType != FrameType.DPPtBred && FrameType != FrameType.HGSSBred && FrameType != FrameType.BWBred && FrameType != FrameType.BWBredInternational && FrameType != FrameType.RSBredUpper && FrameType != FrameType.RSBredUpperSplit) { DisplayHp = Hp.ToString(); DisplayAtk = Atk.ToString(); DisplayDef = Def.ToString(); DisplaySpa = Spa.ToString(); DisplaySpd = Spd.ToString(); DisplaySpe = Spe.ToString(); } if (FrameType == FrameType.BWBred || FrameType == FrameType.BWBredInternational) { var rngArray = new uint[6]; rngArray[0] = inh1; rngArray[1] = inh2; rngArray[2] = inh3; rngArray[3] = par1; rngArray[4] = par2; rngArray[5] = par3; DisplayHpAlt = Hp.ToString(); DisplayAtkAlt = Atk.ToString(); DisplayDefAlt = Def.ToString(); DisplaySpaAlt = Spa.ToString(); DisplaySpdAlt = Spd.ToString(); DisplaySpeAlt = Spe.ToString(); for (uint cnt = 0; cnt < 3; cnt++) { uint parent = rngArray[3 + cnt] & 1; // We have our parent and we have our slot, so lets // put them in the correct place here string parentString = (parent == 1 ? "Fe" : "Ma"); switch (rngArray[cnt]) { case 0: DisplayHp = parentString; break; case 1: DisplayAtk = parentString; break; case 2: DisplayDef = parentString; break; case 3: DisplaySpa = parentString; break; case 4: DisplaySpd = parentString; break; case 5: DisplaySpe = parentString; break; } } } }
// PUT api/<controller>/5 public void Put(int id, [FromBody] Spa value) { throw new NotImplementedException(); }
// POST api/<controller> public void Post([FromBody] Spa value) { throw new NotImplementedException(); }
public int SpaDataCalculate(SpaData spaValues) { //declare the SPA structure int result; double min, sec; /* //_spaValues = new Spa_Data(); * * ////enter required input values into SPA structure * //_spaValues.Function = (int)SpaSelect.SPA_ALL; * //_spaValues.Year = _spaDataLink.SpaDataProp.Year; * //_spaValues.Month = _spaDataLink.SpaDataProp.Month; * //_spaValues.Day = _spaDataLink.SpaDataProp.Day; * //_spaValues.Hour = _spaDataLink.SpaDataProp.Hour; * //_spaValues.Minute = _spaDataLink.SpaDataProp.Minute; * //_spaValues.Second = _spaDataLink.SpaDataProp.Second; * //_spaValues.Timezone = _spaDataLink.SpaDataProp.Timezone; * //_spaValues.Delta_ut1 = _spaDataLink.SpaDataProp.Delta_ut1; * //_spaValues.Delta_t = _spaDataLink.SpaDataProp.Delta_t; * //_spaValues.Longitude = _spaDataLink.SpaDataProp.Longitude; * //_spaValues.Latitude = _spaDataLink.SpaDataProp.Latitude; * //_spaValues.Elevation = _spaDataLink.SpaDataProp.Elevation; * //_spaValues.Pressure = _spaDataLink.SpaDataProp.Pressure; * //_spaValues.Temperature = _spaDataLink.SpaDataProp.Temperature; * //_spaValues.Slope = _spaDataLink.SpaDataProp.Slope; * //_spaValues.Azm_rotation = _spaDataLink.SpaDataProp.Azm_rotation; * //_spaValues.Atmos_refract = _spaDataLink.SpaDataProp.Atmos_refract; * //_spaValues.Function = _spaDataLink.SpaDataProp.Function; * //call the _spaValues calculate function and pass the _spaValues structure*/ Spa spawork = new Spa(); result = spawork.spa_calculate(ref spaValues); if (result == 0) //check for SPA errors { //display the results inside the SPA structure //Console.WriteLine("Julian Day: {0}", _spaValues.jd); //Console.WriteLine("L: {0} degrees", _spaValues.l); //Console.WriteLine("B: {0} degrees", _spaValues.b); //Console.WriteLine("R: {0} AU", _spaValues.r); //Console.WriteLine("H: {0} degrees", _spaValues.h); //Console.WriteLine("Delta Psi: {0} degrees", _spaValues.del_psi); //Console.WriteLine("Delta Epsilon: {0} degrees", _spaValues.del_epsilon); //Console.WriteLine("Epsilon: {0} degrees", _spaValues.epsilon); //Console.WriteLine("Zenith: {0} degrees", _spaValues.zenith); //Console.WriteLine("Azimuth: {0} degrees", _spaValues.azimuth); //Console.WriteLine("Incidence: {0} degrees", _spaValues.incidence); min = 60.0 * (spaValues.Sunrise - (int)(spaValues.Sunrise)); sec = 60.0 * (min - (int)min); //Console.Write("Sunrise: {0}:{1}:{2} Local Time\n", (int)(_spaValues.sunrise), (int)min, (int)sec); min = 60.0 * (spaValues.Sunset - (int)(spaValues.Sunset)); sec = 60.0 * (min - (int)min); //Console.Write("Sunset: {0}:{1}:{2} Local Time\n", (int)(_spaValues.sunset), (int)min, (int)sec); //_spaDataLink.SpaDataProp = _spaValues; } else { return(result); } return(0); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { string lokacija = comboBox2.SelectedItem.ToString(); var connectionString = "mongodb://localhost/?safe=true"; var server = MongoServer.Create(connectionString); var database = server.GetDatabase("agencija"); var collectionPutovanje = database.GetCollection <Putovanje>("putovanja"); var query1 = from letovanje in collectionPutovanje.AsQueryable <Letovanje>() where letovanje.Lokacija == lokacija where letovanje.TipPutovanja == "Letovanje" select new Letovanje { Cena = letovanje.Cena, DatumDo = letovanje.DatumDo, DatumOd = letovanje.DatumOd, Komentari = letovanje.Komentari, Id = letovanje.Id, Lokacija = letovanje.Lokacija, TipLetovanja = letovanje.TipLetovanja, Opis = letovanje.Opis, Sezona = letovanje.Sezona, Slika = letovanje.Slika, TipPutovanja = letovanje.TipPutovanja }; if (query1.FirstOrDefault() != null && query1.First().GetType().Equals(typeof(Letovanje))) { tipPutovanja = "Letovanje"; letovanje = query1.FirstOrDefault(); zimovanje = null; spa = null; ekskurzija = null; } else { var query2 = from z in collectionPutovanje.AsQueryable <Zimovanje>() where z.Lokacija == lokacija where z.TipPutovanja == "Zimovanje" select new Zimovanje { Cena = z.Cena, DatumDo = z.DatumDo, DatumOd = z.DatumOd, Komentari = z.Komentari, Id = z.Id, Lokacija = z.Lokacija, Opis = z.Opis, Slika = z.Slika, TipPutovanja = z.TipPutovanja, SkiPass = z.SkiPass, SkolaSkijanja = z.SkolaSkijanja }; if (query2.FirstOrDefault() != null && query2.First().GetType().Equals(typeof(Zimovanje))) { tipPutovanja = "Zimovanje"; zimovanje = query2.FirstOrDefault(); letovanje = null; spa = null; ekskurzija = null; } else { var query3 = from putovanje in collectionPutovanje.AsQueryable <Spa>() where putovanje.Lokacija == lokacija where putovanje.TipPutovanja == "Spa" select new Spa { Cena = putovanje.Cena, DatumDo = putovanje.DatumDo, DatumOd = putovanje.DatumOd, Komentari = putovanje.Komentari, Id = putovanje.Id, Lokacija = putovanje.Lokacija, Opis = putovanje.Opis, Slika = putovanje.Slika, TipPutovanja = putovanje.TipPutovanja, DoplataMasaza = putovanje.DoplataMasaza, ParnoKupatilo = putovanje.ParnoKupatilo, Sauna = putovanje.Sauna }; if (query3.FirstOrDefault() != null && query3.First().GetType().Equals(typeof(Spa))) { tipPutovanja = "Spa"; spa = query3.FirstOrDefault(); letovanje = null; zimovanje = null; ekskurzija = null; } else { var query4 = from z in collectionPutovanje.AsQueryable <Ekskurzija>() where z.Lokacija == lokacija where z.TipPutovanja == "Ekskurzija" select new Ekskurzija { Cena = z.Cena, DatumDo = z.DatumDo, DatumOd = z.DatumOd, Komentari = z.Komentari, Id = z.Id, Lokacija = z.Lokacija, Opis = z.Opis, Slika = z.Slika, TipPutovanja = z.TipPutovanja, TipEkskurzije = z.TipEkskurzije }; if (query4.FirstOrDefault() != null && query4.First().GetType().Equals(typeof(Ekskurzija))) { tipPutovanja = "Ekskurzija"; ekskurzija = query4.FirstOrDefault(); zimovanje = null; letovanje = null; spa = null; } } } } if (tipPutovanja.Equals("Letovanje")) { cbSezonaSkiSkolaSauna.Text = "Sezona"; cbSezonaSkiSkolaSauna.Checked = letovanje.Sezona; cbSezonaSkiSkolaSauna.Visible = true; comboEnum.Items.Clear(); comboEnum.Items.Add("letoZaMlade"); comboEnum.Items.Add("porodicnoLetovanje"); comboEnum.Items.Add("egzoticnaDestinacija"); if (letovanje.TipLetovanja == TipLetovanja.letoZaMlade) { comboEnum.SelectedItem = comboEnum.Items[0]; } else if (letovanje.TipLetovanja == TipLetovanja.porodicnoLetovanje) { comboEnum.SelectedItem = comboEnum.Items[1]; } else { comboEnum.SelectedItem = comboEnum.Items[2]; } //vrati za ostale cbParnoKupatilo.Visible = false; lblNamena.Visible = false; tbSkiPassMassage.Visible = false; if (letovanje.Slika == null) { return; } byte[] buffer = letovanje.Slika.ToArray(); MemoryStream memStream = new MemoryStream(); memStream.Write(buffer, 0, buffer.Length); pbSlika.SizeMode = PictureBoxSizeMode.StretchImage; pbSlika.Image = Image.FromStream(memStream); tbOpis.Text = letovanje.Opis; tbLok.Text = letovanje.Lokacija; tbCena.Text = letovanje.Cena.ToString(); dateTimePicker1.Text = letovanje.DatumOd; dateTimePicker2.Text = letovanje.DatumDo; } else if (tipPutovanja.Equals("Zimovanje")) { cbSezonaSkiSkolaSauna.Checked = zimovanje.SkolaSkijanja; cbSezonaSkiSkolaSauna.Text = "Ski skola ukljucena"; cbSezonaSkiSkolaSauna.Visible = true; tbSkiPassMassage.Text = zimovanje.SkiPass.ToString(); lblNamena.Text = "SkiPass doplata"; lblNamena.Visible = true; tbSkiPassMassage.Visible = true; if (zimovanje.Slika == null) { return; } byte[] buffer = zimovanje.Slika.ToArray(); MemoryStream memStream = new MemoryStream(); memStream.Write(buffer, 0, buffer.Length); pbSlika.SizeMode = PictureBoxSizeMode.StretchImage; pbSlika.Image = Image.FromStream(memStream); tbOpis.Text = zimovanje.Opis; tbLok.Text = zimovanje.Lokacija; tbCena.Text = zimovanje.Cena.ToString(); dateTimePicker1.Text = zimovanje.DatumOd; dateTimePicker2.Text = zimovanje.DatumDo; } else if (tipPutovanja.Equals("Ekskurzija")) { comboEnum.Items.Clear(); comboEnum.Items.Add("apsolventska"); comboEnum.Items.Add("springBreak"); comboEnum.Items.Add("skolska"); if (ekskurzija.TipEkskurzije == TipEkskurzije.apsolventska) { comboEnum.SelectedItem = comboEnum.Items[0]; } else if (ekskurzija.TipEkskurzije == TipEkskurzije.springBreak) { comboEnum.SelectedItem = comboEnum.Items[1]; } else { comboEnum.SelectedItem = comboEnum.Items[2]; } cbParnoKupatilo.Visible = false; cbSezonaSkiSkolaSauna.Visible = false; lblNamena.Visible = false; tbSkiPassMassage.Visible = false; comboEnum.Visible = true; if (ekskurzija.Slika == null) { return; } byte[] buffer = ekskurzija.Slika.ToArray(); MemoryStream memStream = new MemoryStream(); memStream.Write(buffer, 0, buffer.Length); pbSlika.SizeMode = PictureBoxSizeMode.StretchImage; pbSlika.Image = Image.FromStream(memStream); tbOpis.Text = ekskurzija.Opis; tbLok.Text = ekskurzija.Lokacija; tbCena.Text = ekskurzija.Cena.ToString(); dateTimePicker1.Text = ekskurzija.DatumOd; dateTimePicker2.Text = ekskurzija.DatumDo; } else { cbParnoKupatilo.Checked = spa.ParnoKupatilo; cbParnoKupatilo.Text = "Parno kupatilo"; cbParnoKupatilo.Visible = true; cbSezonaSkiSkolaSauna.Checked = spa.Sauna; cbSezonaSkiSkolaSauna.Text = "Sauna"; cbSezonaSkiSkolaSauna.Visible = true; tbSkiPassMassage.Text = spa.DoplataMasaza.ToString(); tbSkiPassMassage.Visible = true; lblNamena.Text = "Doplata za masazu"; comboEnum.Visible = false; if (spa.Slika == null) { return; } byte[] buffer = spa.Slika.ToArray(); MemoryStream memStream = new MemoryStream(); memStream.Write(buffer, 0, buffer.Length); pbSlika.SizeMode = PictureBoxSizeMode.StretchImage; pbSlika.Image = Image.FromStream(memStream); tbOpis.Text = spa.Opis; tbLok.Text = spa.Lokacija; tbCena.Text = spa.Cena.ToString(); dateTimePicker1.Text = spa.DatumOd; dateTimePicker2.Text = spa.DatumDo; } }