Inheritance: System.Web.UI.Page
コード例 #1
0
ファイル: CityRepository.cs プロジェクト: Djcoyer/Software-2
        public void Update(city city, int id)
        {
            var dbCity = _db.cities.Find(id);

            dbCity = city;
            _db.SaveChanges();
        }
コード例 #2
0
        static List <image> GetImagesForCity(city c)
        {
            TourContext  db     = new TourContext();
            List <image> result = (from image in db.images where image.IdCity == c.IdCity select image).ToList <image>();

            return(result);
        }
コード例 #3
0
        private void cmbIl_SelectedIndexChanged(object sender, EventArgs e)
        {
            city selectedCity = entities.city.Where(x => x.name == cmbIl.Text).FirstOrDefault();

            cmbIlce.Enabled = selectedCity != null;
            if (selectedCity == null)
            {
                return;
            }

            cmbIlce.DataSource = entities.district.Where(x => x.cityid == selectedCity.id).ToList();
            var list = entities.district.Where(x => x.cityid == selectedCity.id).ToList();

            cmbIlce.DisplayMember = "name";
            cmbIlce.ValueMember   = "id";
            cmbIlce.Text          = "";

            foreach (district item in cmbIlce.Items)
            {
                if (item.name == "MERKEZ")
                {
                    cmbIlce.SelectedItem = item;
                    break;
                }
            }
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,CountryCode,District,Population")] city city)
        {
            if (id != city.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(city);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!cityExists(city.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(city));
        }
コード例 #5
0
        public IHttpActionResult Putcity(decimal id, city city)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != city.City_id)
            {
                return(BadRequest());
            }

            db.Entry(city).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!cityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
ファイル: Item.cs プロジェクト: Coderoper/WorldData
        public static List <city> GetAll()
        {
            List <city> allCity  = new List <city> {
            };
            MySqlConnection conn = DB.Connection();

            conn.Open();
            MySqlCommand cmd = conn.CreateCommand() as MySqlCommand;

            cmd.CommandText = @"SELECT * FROM city;";
            MySqlDataReader rdr = cmd.ExecuteReader() as MySqlDataReader;

            while (rdr.Read())
            {
                int    cityId          = rdr.GetInt32(0);
                string cityDescription = rdr.GetString(1);
                city   newCity         = new city(cityDescription, cityId);
                allcitys.Add(newCity);
            }
            conn.Close();
            if (conn != null)
            {
                conn.Dispose();
            }
            return(allCaity);
        }
コード例 #7
0
        public async Task <IActionResult> Create(cityViewModel model)
        {
            if (ModelState.IsValid)
            {
                var objcategory = new city
                {
                    id = model.id
                    ,
                    Name = model.Name
                    ,
                    stateid = model.stateid

                    ,
                    isdeleted = false
                    ,
                    isactive = false
                };

                _unitofWork.city.Add(objcategory);
                _unitofWork.Save();
                TempData["success"] = "Record Save successfully";
                return(RedirectToAction(nameof(Index)));
            }
            else
            {
                return(View());
            }
        }
コード例 #8
0
        public IHttpActionResult Postcity(city city)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.cities.Add(city);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (cityExists(city.City_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = city.City_id }, city));
        }
コード例 #9
0
        ////City Controls
        private void addCity_Button_Click(object sender, EventArgs e)
        {
            if (!IsNewCityValid())
            {
                return;
            }

            try
            {
                using (ent = new ScheduleEntities())
                {
                    var newCity = new city
                    {
                        cityName     = cityName_TextBox.Text,
                        countryId    = selectedCountryID,
                        createDate   = UserTracker.CurrentTime,
                        createdBy    = UserTracker.ActiveUser.userName,
                        lastUpdate   = UserTracker.CurrentTime,
                        lastUpdateBy = UserTracker.ActiveUser.userName
                    };

                    ent.cities.Add(newCity);
                    ent.SaveChanges();

                    PopulateCityComboBox();
                    ClearCityFields();
                    MessageBox.Show($"'{newCity.cityName}' was added", "New City");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong", "Error");
            }
        }
コード例 #10
0
        //[AjaxErrorHandler]
        //[MyAuthorize(Roles =("r1"))]
        public ActionResult CityRegister(city pCity)
        {
            if (User.IsInRole("AddCity") || User.IsInRole("SuperAdmin"))
            {
                var _cityName = pCity.cityName;
                var findCity  = Context.cities.Any(p => p.cityName == _cityName);
                if (findCity)
                {
                    //ViewBag.ErrorCity = "اطلاعات تکراری است";

                    //TempData["ErorrCity"] = "اطلاعات تکراری است";

                    return(Json("fail"));
                }
                else
                {
                    if (pCity.id == 0)
                    {
                        Context.cities.Add(pCity);
                    }
                    else
                    {
                        Context.Entry(pCity).State = System.Data.Entity.EntityState.Modified;
                    }
                    Context.SaveChanges();
                }
                return(RedirectToAction("AddCity"));
            }
            return(RedirectToAction("AddCity"));
        }
コード例 #11
0
        protected void Button1_Click1(object sender, EventArgs e)
        {
            {
                using (DataClasses1DataContext dbCITY = new DataClasses1DataContext())
                {
                    try
                    {
                        var count = new city();
                        count.country_id = Convert.ToInt32(TextBox2.Text);
                        count.city_name  = TextBox3.Text;
                        count.city_id    = Convert.ToInt32(TextBox1.Text);

                        dbCITY.cities.InsertOnSubmit(count);

                        dbCITY.SubmitChanges();
                        BindGridView();
                    }
                    catch (System.Exception excep)

                    {
                        ch_();
                    }
                }
            }
        }
コード例 #12
0
ファイル: CityService.cs プロジェクト: pninar/KolgraphWeb

        
コード例 #13
0
ファイル: CityService.cs プロジェクト: pninar/KolgraphWeb

        
コード例 #14
0
 public DefaultMapPresentationStub(city dbItem)
 {
     this.Id            = dbItem.id;
     this.City          = dbItem.name;
     this.LatitudeCity  = dbItem.latitude;
     this.LongitudeCity = dbItem.longitude;
 }
コード例 #15
0
ファイル: CityService.cs プロジェクト: pninar/KolgraphWeb

        
コード例 #16
0
 public OwnerPresentationStub(city dbItem)
 {
     this.IdCity    = dbItem.id;
     this.CityName  = dbItem.name;
     this.Latitude  = dbItem.latitude;
     this.Longitude = dbItem.longitude;
 }
コード例 #17
0
 public ActionResult savedata(city ct)
 {
     ////dsfdsfdsfdsfdsf
     en.cities.Add(ct);
     en.SaveChanges();
     return(View());
 }
コード例 #18
0
        private void btnKEKaydet_Click(object sender, EventArgs e)
        {
            if (_plant.speciesid == null)
            {
                MessageBox.Show("Tür boş bırakılamaz");
                return;
            }

            _plant.localname   = txtLocalName.Text;
            _plant.subsp       = txtSubsp.Text;
            _plant.variety     = txtVaryete.Text;
            _plant.endemism    = rdbYes.Checked;
            _plant.typeexample = txtTypeExample.Text;
            _plant.localite    = txtlocalite.Text;
            _plant.date        = dtPicker.Value;
            _plant.minimum     = Convert.ToDouble(nmMin.Value);
            _plant.maximum     = Convert.ToDouble(nmMaks.Value);
            _plant.diagnose    = rchDiagnose.Text;
            _plant.collector   = rchCollector.Text;
            _plant.explanation = rchDetails.Text;
            _plant.herbno      = lblKod.Text;

            //_plantBLL.addGrids(_plant, txtGrids.Text);
            _plant.habitat = _plantBLL.getHabitatId(txtHabitat.Text);

            city city = entities.city.FirstOrDefault(x => x.name == cmbIl.Text);

            if (city != null)
            {
                district district = entities.district.FirstOrDefault(x => x.name == cmbIlce.Text && x.cityid == city.id);
                district = district is null?entities.district.FirstOrDefault(x => x.cityid == city.id) : district;

                _plant.districtid = district.id;
            }
            if (_plantBLL.Location != null && _plantBLL.Location.Valid)
            {
                _plant.latitude  = Convert.ToDouble(_plantBLL.Location.DecLatitude);
                _plant.longitude = Convert.ToDouble(_plantBLL.Location.DecLongitude);
            }

            if (!isUpdate)
            {
                _plantBLL.AddPlant(_plant);
                var satir = Tablo.NewRow();
                satir = SatiriDoldur(satir);
                Tablo.Rows.InsertAt(satir, 0);
                Log.Debug("[Yeni Bitki]: " + _plant.herbno, "Eklenen bitki:\n" + Log.PlantRowToJson(satir));
            }
            else
            {
                _plantBLL.UpdatePlant(_plant);
                DataRow satir = GetRowOfPlant();
                SatiriDoldur(satir);
                satir.AcceptChanges();
                Log.Debug("[Güncellenen Bitki]: " + _plant.herbno, "Değişiklikler:\n" + Log.DiffBetweenTwoDict(Log.PlantRowToDict(satir), oldRow) + "\nGüncelleme sonrası:\n" + Log.PlantRowToJson(satir) + "\nGüncelleme öncesi:\n" + Log.DictToJson(oldRow));
            }

            MessageBox.Show("Başarıyla Eklendi");
        }
コード例 #19
0
ファイル: CityRepository.cs プロジェクト: Djcoyer/Software-2
        public void Add(city city)
        {
            var lastId = _db.cities.Max(p => p.cityId);

            city.cityId = lastId + 1;
            _db.cities.Add(city);
            _db.SaveChanges();
        }
        public static CityModel MapCityForDisplay(city model)
        {
            infringementEntities entity = new infringementEntities();

            return(new CityModel {
                Id = model.id, Name = model.name, SortOrder = model.SortOrder ?? 0
            });
        }
コード例 #21
0
 public CityTranslate(city city)
 {
     City = city;
     //CityName = Translate(city.Name);
     CityName = city.Name;
     //CountryName = Translate(city.country.Name);
     CountryName = city.country.Name;
 }
コード例 #22
0
ファイル: SaveLoad.cs プロジェクト: Artur5435/an-old-tale
 public Game(byte[,,] bloks, Vector3 playerp, bool star)
 {
     started   = star;
     playerPos = new pos3(playerp.x, playerp.y, playerp.z);
     blocks    = bloks;
     current   = this;
     CITY      = new city();
 }
コード例 #23
0
ファイル: SaveLoad.cs プロジェクト: Artur5435/an-old-tale
 public Game()
 {
     current   = this;
     blocks    = null;
     playerPos = new pos3(0, 0, 0);
     CITY      = new city();
     started   = false;
 }
コード例 #24
0
        public void update(city city, int id)
        {
            findOne(id);

            //Validation logic

            _repository.Update(city, id);
        }
コード例 #25
0
        // GET: /city/Delete/5
        public ActionResult Delete(int?id)
        {
            city city = db.cities.Find(id);

            db.cities.Remove(city);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #26
0
ファイル: CityEditVM.cs プロジェクト: Ocph23/TrireksaNewApp
 public CityEditVM(city selectedItem)
 {
     this.Id       = selectedItem.Id;
     this.CityCode = selectedItem.CityCode;
     this.CityName = selectedItem.CityName;
     this.Province = selectedItem.Province;
     this.Regency  = selectedItem.Regency;
 }
コード例 #27
0
        public async Task <city> GenerateCity(city _city)
        {
            await _context.City.AddAsync(_city);

            await _context.SaveChangesAsync();

            return(_city);
        }
コード例 #28
0
ファイル: CityRepository.cs プロジェクト: pninar/KolgraphWeb
        public city GetDefault()
        {
            using (var context = this._context)
            {
                city entity = context.city.Where(i => (bool)i.isDefault).FirstOrDefault();

                return(entity);
            }
        }
コード例 #29
0
        public CityInfo(int idCity)
        {
            city c = db.cities.SingleOrDefault <city>(m => m.IdCity == idCity);

            IdCity    = c.IdCity;
            Name      = c.Name;
            IdCountry = c.IdСountry;
            Images    = ImageInfo.GetImagesForElem("city", IdCity);
        }
        public static city MapCityForCreate(CityModel model)
        {
            infringementEntities entity = new infringementEntities();

            var result = new city();

            MapCityForEdit(model, result);
            return(result);
        }
コード例 #31
0
  public static void AddressMethod(string person, city)
  {
	Console.WriteLine("To : {0}", person);
	Console.WriteLine("{0}", city);
  }