public async Task <IActionResult> Edit(int id, [Bind("Id,ImagePath,ImageText,Title,SubTitle,Name,Price,Description,ServiceId,UserId")] GroupTour groupTour)
        {
            if (id != groupTour.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(groupTour);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!GroupTourExists(groupTour.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", groupTour.ServiceId);
            return(View(groupTour));
        }
        public IActionResult GroupTour()
        {
            ViewBag.Setting = _toursDbContext.Settings.First();
            GroupTour model = _toursDbContext.GroupTours.FirstOrDefault();

            return(View(model));
        }
Esempio n. 3
0
        private void btnCreateTour_Click(object sender, RoutedEventArgs e)
        {
            decimal defaultCost = 100;

            gt = new GroupTour(txtTourName.Text);
            gt.UpdateTotalCost(defaultCost);
            lblTourName.Content     = txtTourName.Text;
            btnCreateTour.IsEnabled = false;
        }
        public async Task <IActionResult> Create([Bind("Id,ImagePath,ImageText,Title,SubTitle,Name,Price,Description,ServiceId,UserId")] GroupTour groupTour)
        {
            if (ModelState.IsValid)
            {
                _context.Add(groupTour);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ServiceId"] = new SelectList(_context.Services, "Id", "Id", groupTour.ServiceId);
            return(View(groupTour));
        }
        public bool Delete(int id)
        {
            GroupTour currObject = db.GroupTours.FirstOrDefault(x => x.GroupID == id);

            if (currObject != null)
            {
                db.GroupTours.DeleteOnSubmit(currObject);
                db.SubmitChanges();
                return(true);
            }
            return(false);
        }
Esempio n. 6
0
 public void UpdateDisplay(AObservable data)
 {
     TourData             = (GroupTour)data;
     lblTotalCost.Content = TourData.GetTotalCost();
     foreach (string location in TourData.GetLocations())
     {
         if (!lstvwlocations.Items.Contains(location))
         {
             lstvwlocations.Items.Add(location);
         }
     }
 }
Esempio n. 7
0
        public xtraRPBaoCaoCongNoDoiTac(int partnerID, int groupID, int month, int year)
        {
            InitializeComponent();
            objService       = new BookService();
            partnerService   = new PartnerService();
            groupTourService = new GroupTourService();
            this.objectDataSource1.DataSource = objService.GetListBookedDoneReport(partnerID, month, year, true);
            GroupTour g     = groupTourService.GetByID(groupID);
            string    title = "CÔNG NỢ " + g.Name + " THÁNG " + month + "/" + year;

            lblTitle.Text = title.ToUpper();
            Partner p = partnerService.GetByID(partnerID);

            lblPartnerName.Text  = p.Name;
            lblPartnerPhone.Text = p.Phone;
        }
        public bool Insert(GroupTour gTour)
        {
            bool checkName = db.GroupTours.Count(x => x.Name == gTour.Name) > 0 ? true : false;

            //bool check = db.ApplicationUsers.Count(x => x.Username == user.Username) > 0 ? true : false;
            if (!checkName)
            {
                db.GroupTours.InsertOnSubmit(gTour);
                db.SubmitChanges();
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 9
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (txtGroupName.Text == "")
            {
                XtraMessageBox.Show("Tên nhóm không thể để trống.");
                return;
            }
            GroupTour groupTourNew = new GroupTour();

            groupTourNew.GroupID = _groupID;
            groupTourNew.Name    = txtGroupName.Text;
            groupTourNew.MinPax  = int.Parse(txtMinPax.Text);
            groupTourNew.MaxPax  = int.Parse(txtMaxPax.Text);
            groupTourNew.Enable  = ckEnabled.Checked;
            groupTourNew.Note    = txtNote.Text;
            var rs  = false;
            var msg = "";

            if (_action == -1)
            {
                groupTourNew.DateCreate = DateTime.Now;
                rs  = this.gtService.Insert(groupTourNew);
                msg = "Thêm mới nhóm tour thành công";
            }
            else
            {
                rs  = this.gtService.Update(groupTourNew);
                msg = "Cập nhật nhóm tour thành công";
            }
            if (rs)
            {
                XtraMessageBox.Show(msg);

                if (loadData != null)
                {
                    loadData();
                }
                this.Close();
            }
            else
            {
                XtraMessageBox.Show("Tên group tồn tại trong hệ thống. Vui lòng kiểm tra lại.");
            }
        }
        public bool Update(GroupTour gTour)
        {
            bool checkUName = db.GroupTours.Count(x => x.Name == gTour.Name && x.GroupID != gTour.GroupID) > 0 ? true : false;

            //bool check = db.ApplicationUsers.Count(x => x.Username == user.Username) > 0 ? true : false;
            if (!checkUName)
            {
                GroupTour currObject = db.GroupTours.FirstOrDefault(x => x.GroupID == gTour.GroupID);
                if (currObject != null)
                {
                    currObject.Name   = gTour.Name;
                    currObject.MinPax = gTour.MinPax;
                    currObject.MaxPax = gTour.MaxPax;
                    currObject.Enable = gTour.Enable;
                    currObject.Note   = gTour.Note;
                    db.SubmitChanges();
                }
                return(true);
            }
            return(false);
        }
Esempio n. 11
0
 public frmActionGroupTour(int action = -1, int GroupTourID = -1)
 {
     InitializeComponent();
     if (action == -1)
     {
         this.Text = "Thêm mới nhóm tour";
     }
     else
     {
         this.Text = "Cập nhật nhóm tour";
     }
     _action    = action;
     _groupID   = GroupTourID;
     _groupTour = gtService.GetByID(GroupTourID);
     if (_groupTour != null)
     {
         txtGroupName.Text = _groupTour.Name;
         txtMinPax.Text    = _groupTour.MinPax.ToString();
         txtMaxPax.Text    = _groupTour.MaxPax.ToString();
         ckEnabled.Checked = _groupTour.Enable == true ? true : false;
         txtNote.Text      = _groupTour.Note;
     }
 }
Esempio n. 12
0
 /// <summary>
 /// Creates a new GroupTour with values copied from another.
 /// </summary>
 public GroupTour(GroupTour clone) : base(clone)
 {
     PlatoonIDScriptActivate = clone.PlatoonIDScriptActivate;
     State           = clone.State;
     GroupPartsNames = (string[])clone.GroupPartsNames.Clone();
 }
Esempio n. 13
0
 private void Reset_Tour_Click(object sender, RoutedEventArgs e)
 {
     gt = null;
     lblTourName.Content = "Tour Name Here!";
     lstvwlocation.Items.Clear();
 }
Esempio n. 14
0
 /// <summary>
 /// Creates a new GroupTour with values copied from another.
 /// </summary>
 public GroupTour(GroupTour clone) : base(clone)
 {
     UnkT00          = clone.UnkT00;
     UnkT04          = clone.UnkT04;
     GroupPartsNames = (string[])clone.GroupPartsNames.Clone();
 }
        public GroupTour GetByID(int id)
        {
            GroupTour data = db.GroupTours.FirstOrDefault(x => x.GroupID == id);

            return(data);
        }