public ActionResult AddEditStation(long?stationId, string copyInd)
        {
            var viewModel = new AddEditStationViewModel();

            if (stationId.HasValue)
            {
                var drStation = CRCDataAccess.GetStation(stationId.Value);
                drStation.MapTo(viewModel);

                viewModel.EnabledInd = !(drStation["DisabledDate"] is DateTime);
                viewModel.CopyInd    = copyInd.Equals("Y", StringComparison.OrdinalIgnoreCase) ? "Y" : "N";

                using (var dtStationAffiliates = CRCDataAccess.GetStationAffiliates(stationId.Value))
                {
                    viewModel.AffiliateIds = dtStationAffiliates.AsEnumerable().Select(row => (long)row["AffiliateId"]);
                }
            }
            else
            {
                //Set default values when adding a new station
                viewModel.EnabledInd       = true;
                viewModel.MemberStatusId   = InfLookupHelper.ReverseLookup("MemberStatus", "MemberStatusName", "Full");
                viewModel.MinorityStatusId = InfLookupHelper.ReverseLookup("MinorityStatus", "MinorityStatusName", "None");
                viewModel.StatusDate       = DateTime.UtcNow.AddHours(InfDate.GetUtcOffSet);
                //viewModel.TimeZoneId = InfLookupHelper.ReverseLookup("TimeZone", "TimeZoneCode", "Eastern Standard Time");
                viewModel.MaxNumberOfUsers = 4;
            }

            return(View(viewModel));
        }
Exemplo n.º 2
0
        public ActionResult GetSelectedStationInfo(long stationId)
        {
            var dataRow = CRCDataAccess.GetStation(stationId);

            if (dataRow != null)
            {
                return(Json(
                           new
                {
                    StationDisplayName = dataRow["StationDisplayName"].ToString(),
                    PrimaryUserDisplayName = dataRow["PrimaryUserDisplayName"].ToString(),
                    PrimaryUserPhone = dataRow["PrimaryUserPhone"].ToString(),
                    PrimaryUserEmail = dataRow["PrimaryUserEmail"].ToString(),
                    RepeaterStatusId = dataRow["RepeaterStatusId"].ToString(),
                    Flagship = dataRow["flagship"].ToString()
                }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }