예제 #1
0
 public BusScheduleModel Fill(BusScheduleModel model)
 {
     model.ddlBusCategoryList = ddlCategoryList();
     model.ddlBusCityList     = ddlCityList();
     model.ddlBusMasterList   = ddlMasterList();
     model.ddlTypeList        = ddlTypeList();
     return(model);
 }
예제 #2
0
        public ActionResult Create()
        {
            BusScheduleModel      _model = new BusScheduleModel();
            BusScheduleRepository _rep   = new BusScheduleRepository();

            _model.Message = _res;
            _model         = _rep.Fill(_model);
            return(View(_model));
        }
예제 #3
0
        public BusMessageModel Edit(BusScheduleModel model)
        {
            if (IsExists(model.ScheduleId, model.BusMasterId, model.BusCategoryId, model.DepartureCityId, model.DestinationCityId, model.DepartureTime) == false)
            {
                var obj = _ent.Bus_Schedules.Where(x => x.ScheduleId == model.ScheduleId).FirstOrDefault();
                if (obj != null)
                {
                    obj.ArrivalTime       = model.ArrivalTime;
                    obj.BusCategoryId     = model.BusCategoryId;
                    obj.BusMasterId       = model.BusMasterId;
                    obj.DepartureCityId   = model.DepartureCityId;
                    obj.DepartureTime     = model.DepartureTime;
                    obj.DestinationCityId = model.DestinationCityId;
                    obj.Friday            = model.Friday;
                    obj.Monday            = model.Monday;
                    obj.Saturday          = model.Saturday;
                    obj.Sunday            = model.Sunday;
                    obj.Thursday          = model.Thursday;
                    obj.Tuesday           = model.Tuesday;
                    obj.Wednesday         = model.Wednesday;
                    obj.GovRate           = model.Rate;
                    obj.ActualRate        = model.ActualRate;
                    obj.KM              = model.KiloMeter;
                    obj.UpdateBy        = ATLTravelPortal.Repository.GeneralRepository.LogedUserId();
                    obj.UpdateDate      = ATLTravelPortal.Repository.GeneralRepository.CurrentDate();
                    obj.BusType         = model.TypeName;
                    obj.DurationHHMM    = model.DurationHHMM;
                    obj.PurchaseRate    = model.PurchaseRate;
                    obj.AgentCommission = model.AgentCommission;
                    _ent.ApplyCurrentValues(obj.EntityKey.EntitySetName, obj);
                    _ent.SaveChanges();
                    _res.ActionMessage = String.Format(Resources.Message.SuccessfullyUpdated, "Bus Schedule ");
                    _res.MsgNumber     = 0;
                    _res.MsgStatus     = true;
                }
                else
                {
                    _res.ActionMessage = String.Format(Resources.Message.InvalidOperation, "Bus Schedule ");
                    _res.MsgNumber     = 1005;
                    _res.ErrSource     = "DataBase";
                    _res.MsgType       = 3;
                    _res.MsgStatus     = true;
                }
            }
            else
            {
                _res.ActionMessage = String.Format(Resources.Message.AlreadyExist, "Bus Schedule ");
                _res.MsgNumber     = 1001;
                _res.ErrSource     = "DataBase";
                _res.MsgType       = 3;
                _res.MsgStatus     = true;
            }


            return(_res);
        }
예제 #4
0
        public BusScheduleModel Detail(int?Pid)
        {
            BusScheduleModel model = new BusScheduleModel();

            if (Pid != null)
            {
                var result = _ent.Bus_Schedules.Where(x => x.ScheduleId == Pid).FirstOrDefault();
                if (result != null)
                {
                    model.ArrivalTime         = result.ArrivalTime;
                    model.BusCategoryId       = result.BusCategoryId;
                    model.BusCategoryName     = result.Bus_Categories.BusCategoryName;
                    model.BusMasterId         = result.BusMasterId;
                    model.BusMasterName       = result.Bus_Master.BusMasterName;
                    model.DepartureCityId     = result.DepartureCityId;
                    model.DepartureCityName   = result.Bus_Cities.BusCityName + "(" + result.Bus_Cities.BusCityCode + ")";
                    model.DepartureTime       = result.DepartureTime;
                    model.DestinationCityId   = result.DestinationCityId;
                    model.DestinationCityName = result.Bus_Cities1.BusCityName + "(" + result.Bus_Cities1.BusCityCode + ")";
                    model.Friday          = result.Friday;
                    model.Monday          = result.Monday;
                    model.Saturday        = result.Saturday;
                    model.ScheduleId      = result.ScheduleId;
                    model.Sunday          = result.Sunday;
                    model.Thursday        = result.Thursday;
                    model.Tuesday         = result.Tuesday;
                    model.Wednesday       = result.Wednesday;
                    model.Rate            = result.GovRate;
                    model.ActualRate      = result.ActualRate;
                    model.KiloMeter       = result.KM;
                    model.TypeName        = result.BusType;
                    model.DurationHHMM    = result.DurationHHMM;
                    model.PurchaseRate    = result.PurchaseRate;
                    model.AgentCommission = result.AgentCommission;
                }
                else
                {
                    _res.ActionMessage = String.Format(Resources.Message.InvalidOperation, "Bus Schedule ");
                    _res.MsgNumber     = 1005;
                    _res.ErrSource     = "DataBase";
                    _res.MsgType       = 3;
                    _res.MsgStatus     = true;
                }
            }
            else
            {
                _res.ActionMessage = String.Format(Resources.Message.InvalidOperation, "Bus Schedule ");
                _res.MsgNumber     = 1005;
                _res.ErrSource     = "DataBase";
                _res.MsgType       = 3;
                _res.MsgStatus     = true;
            }
            model.Message = _res;
            return(model);
        }
예제 #5
0
        public BusMessageModel Create(BusScheduleModel model)
        {
            if (IsExists(model.ScheduleId, model.BusMasterId, model.BusCategoryId, model.DepartureCityId, model.DestinationCityId, model.DepartureTime) == false)
            {
                TravelPortalEntity.Bus_Schedules obj = new TravelPortalEntity.Bus_Schedules
                {
                    ArrivalTime       = model.ArrivalTime,
                    BusCategoryId     = model.BusCategoryId,
                    BusMasterId       = model.BusMasterId,
                    DepartureCityId   = model.DepartureCityId,
                    DepartureTime     = model.DepartureTime,
                    DestinationCityId = model.DestinationCityId,
                    Friday            = model.Friday,
                    Monday            = model.Monday,
                    Saturday          = model.Saturday,
                    Sunday            = model.Sunday,
                    Thursday          = model.Thursday,
                    Tuesday           = model.Tuesday,
                    Wednesday         = model.Wednesday,
                    GovRate           = model.Rate,
                    ActualRate        = model.ActualRate,
                    KM              = model.KiloMeter,
                    CreatedBy       = ATLTravelPortal.Repository.GeneralRepository.LogedUserId(),
                    CreatedDate     = ATLTravelPortal.Repository.GeneralRepository.CurrentDate(),
                    DurationHHMM    = model.DurationHHMM,
                    BusType         = model.TypeName,
                    PurchaseRate    = model.PurchaseRate,
                    AgentCommission = model.AgentCommission
                };
                _ent.AddToBus_Schedules(obj);
                _ent.SaveChanges();
                _res.ActionMessage = String.Format(Resources.Message.SuccessfullyCreated, "Bus Schedule ");
                _res.ErrSource     = "DataBase";
                _res.MsgType       = 0;
                _res.MsgNumber     = 0;
                _res.MsgStatus     = true;
            }
            else
            {
                _res.ActionMessage = String.Format(Resources.Message.AlreadyExist, "Bus Schedule ");
                _res.MsgNumber     = 1001;
                _res.ErrSource     = "DataBase";
                _res.MsgType       = 3;
                _res.MsgStatus     = true;
            }

            return(_res);
        }
예제 #6
0
        public ActionResult Edit(int?id)
        {
            BusScheduleModel      _model = new BusScheduleModel();
            BusScheduleRepository _rep   = new BusScheduleRepository();

            try
            {
                _model = _rep.Detail(id);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }
            BusGeneralRepository.ActionMessage = _model.Message;
            _model = _rep.Fill(_model);
            return(View(_model));
        }
예제 #7
0
        public ActionResult Index(int?page)
        {
            BusScheduleModel      _model = new BusScheduleModel();
            BusScheduleRepository _rep   = new BusScheduleRepository();

            BusGeneralRepository.SetRequestPageRow();
            try
            {
                _model.TabularList = _rep.GetPagedList(page);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }
            _model.Message = _res;
            return(View(_model));
        }
예제 #8
0
        public ActionResult Delete(int?id)
        {
            BusScheduleModel      _model = new BusScheduleModel();
            BusScheduleRepository _rep   = new BusScheduleRepository();

            try
            {
                _model.Message = _rep.Delete(id);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }

            BusGeneralRepository.ActionMessage = _model.Message;
            return(RedirectToAction("Index"));
        }
예제 #9
0
        public IEnumerable <BusScheduleModel> List()
        {
            var _res = _ent.Bus_Schedules.OrderBy(x => x.Bus_Master.BusMasterName).OrderBy(o => o.Bus_Categories.BusCategoryName);
            List <BusScheduleModel> model = new List <BusScheduleModel>();

            foreach (var items in _res)
            {
                BusScheduleModel obj = new BusScheduleModel
                {
                    Sno                 = SNo++,
                    ArrivalTime         = items.ArrivalTime,
                    BusCategoryId       = items.BusCategoryId,
                    BusCategoryName     = items.Bus_Categories.BusCategoryName,
                    BusMasterId         = items.BusMasterId,
                    BusMasterName       = items.Bus_Master.BusMasterName,
                    DepartureCityId     = items.DepartureCityId,
                    DepartureCityName   = items.Bus_Cities.BusCityName + "(" + items.Bus_Cities.BusCityCode + ")",
                    DepartureTime       = items.DepartureTime,
                    DestinationCityId   = items.DestinationCityId,
                    DestinationCityName = items.Bus_Cities1.BusCityName + "(" + items.Bus_Cities1.BusCityCode + ")",
                    Friday              = items.Friday,
                    Monday              = items.Monday,
                    Saturday            = items.Saturday,
                    ScheduleId          = items.ScheduleId,
                    Sunday              = items.Sunday,
                    Thursday            = items.Thursday,
                    Tuesday             = items.Tuesday,
                    Wednesday           = items.Wednesday,
                    Rate                = items.GovRate,
                    ActualRate          = items.ActualRate,
                    TypeName            = items.BusType,
                    PurchaseRate        = items.PurchaseRate,
                    AgentCommission     = items.AgentCommission
                };
                model.Add(obj);
            }
            return(model.AsEnumerable());
        }
예제 #10
0
        public ActionResult Create(BusScheduleModel model)
        {
            BusScheduleRepository _rep = new BusScheduleRepository();

            model = _rep.Fill(model);
            try
            {
                model.Message = _rep.Create(model);
            }
            catch (Exception ex)
            {
                model.Message = BusGeneralRepository.CatchException(ex);
            }
            BusGeneralRepository.ActionMessage = _res;
            if (model.Message.MsgNumber == 0)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(model));
            }
        }
예제 #11
0
        public ActionResult Details(int?id)
        {
            BusScheduleModel      _model = new BusScheduleModel();
            BusScheduleRepository _rep   = new BusScheduleRepository();

            try
            {
                _model = _rep.Detail(id);
            }
            catch (Exception ex)
            {
                _model.Message = BusGeneralRepository.CatchException(ex);
            }
            BusGeneralRepository.ActionMessage = _res;
            if (_model.Message.MsgNumber == 0)
            {
                return(View(_model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }