예제 #1
0
        //
        // GET: /SysAdmin/State/Details/5
        public ActionResult Details(int id)
        {
            StateVM  viewModel = new StateVM();
            StateBAL balObject = new StateBAL();
            IQueryable <Entities.State> entites = balObject.FindBy(a => a.StateId == id);

            if (entites != null && entites.Count() > 0)
            {
                Entities.State entity = entites.FirstOrDefault();
                viewModel.StateId   = entity.StateId;
                viewModel.StateName = entity.StateName;
                CountryBAL countryBAL = new CountryBAL();
                viewModel.CountryName = countryBAL.FindBy(c => c.CountryId == entity.CountryId).FirstOrDefault().CountryName;
                viewModel.Status      = entity.Status;
                viewModel.Remark      = entity.Remark;
            }
            return(View(viewModel));
        }
예제 #2
0
        public ActionResult Edit(StateVM viewModel)
        {
            try
            {
                // TODO: Add update logic here
                if (ModelState.IsValid)
                {
                    Entities.State entity = new Entities.State();
                    entity.StateId   = viewModel.StateId;
                    entity.CountryId = viewModel.CountryId;
                    entity.StateName = viewModel.StateName;
                    entity.Status    = viewModel.Status;
                    entity.Remark    = viewModel.Remark;

                    StateBAL balObject = new StateBAL();
                    balObject.Edit(entity);
                    return(RedirectToAction("Index"));
                }
                else
                {
                    //AcademicYearBAL academicYearBAL = new AcademicYearBAL();
                    //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() };
                    CountryBAL countryBAL = new CountryBAL();
                    viewModel.Countries = from obj in countryBAL.GetAll() select new SelectListItem()
                    {
                        Text = obj.CountryName, Value = obj.CountryId.ToString()
                    };
                    return(View(viewModel));
                }
            }
            catch
            {
                //AcademicYearBAL academicYearBAL = new AcademicYearBAL();
                //viewModel.AcademicYears = from obj in academicYearBAL.GetAll() select new SelectListItem() { Text = obj.AcademicYearName, Value = obj.AcademicYearId.ToString() };
                CountryBAL countryBAL = new CountryBAL();
                viewModel.Countries = from obj in countryBAL.GetAll() select new SelectListItem()
                {
                    Text = obj.CountryName, Value = obj.CountryId.ToString()
                };
                return(View());
            }
        }
예제 #3
0
        public List <Entities.State> GetStatesByCountry(Int32 countryId)
        {
            var states = new List <Entities.State>();

            DbCommand dbCommand = null;

            try
            {
                using (dbCommand = database.GetStoredProcCommand(DBStoredProcedure.GetListOfStatesByCountryId))
                {
                    database.AddInParameter(dbCommand, "@country_id", DbType.Int32, countryId);

                    using (IDataReader reader = database.ExecuteReader(dbCommand))
                    {
                        while (reader.Read())
                        {
                            var state = new Entities.State
                            {
                                StateId   = DRE.GetNullableInt32(reader, "state_id", 0),
                                StateName = DRE.GetNullableString(reader, "state_name", null),
                                StateCode = DRE.GetNullableString(reader, "state_code", null),
                                TINNo     = DRE.GetNullableString(reader, "tin_no", null)
                            };

                            states.Add(state);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                dbCommand = null;
            }

            return(states);
        }
예제 #4
0
        public async Task IsOpenWindowDetectedTest()
        {
            Entities.State response = await session.GetZoneState(HomeId, ZoneId);

            Assert.IsInstanceOfType(response.OpenWindowDetected, typeof(bool));
        }
예제 #5
0
 public StateModel(Entities.State state)
 {
     this.Id           = state.Id;
     this.Abbreviation = state.Abbreviation;
 }