Esempio n. 1
0
 /// <summary>
 /// Khi ấn nút Save, lưu Service nếu đang edit, insert nếu đang thêm mới
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnSave_Click(object sender, EventArgs e)
 {
     ActiveService.Name        = textBoxServiceName.Text;
     ActiveService.Description = fckEditorDescription.Value;
     if (ddlParent.SelectedIndex > 0 && ActiveService.Id.ToString() != ddlParent.SelectedValue)
     {
         ActiveService.Parent = Module.TourTypeGetById(Convert.ToInt32(ddlParent.SelectedValue));
     }
     else
     {
         ActiveService.Parent = null;
     }
     // Kiểm tra trong View State
     if (ActiveService.Id > 0)
     {
         Module.Update(ActiveService);
     }
     else
     {
         Module.Save(ActiveService);
     }
     ActiveService = ActiveService;
     repeaterServices.DataSource = Module.TourTypeGetAllRoot();
     repeaterServices.DataBind();
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name,StillActive")] TourType tourType)
        {
            if (id != tourType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(tourType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TourTypeExists(tourType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(tourType));
        }
Esempio n. 3
0
 public void SetData(int id, int budget, TourType tourType, int[] lengthVacation)
 {
     _id             = id;
     _travelBudget   = budget;
     _tourType       = tourType;
     _lengthVacation = lengthVacation;
 }
Esempio n. 4
0
        protected void repeaterServices_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            TourType service = e.Item.DataItem as TourType;

            if (service != null)
            {
                using (LinkButton linkServiceEdit = e.Item.FindControl("linkButtonServiceEdit") as LinkButton)
                {
                    if (linkServiceEdit != null)
                    {
                        // Gán text và command argument, điều này cũng có thể làm ngay trên aspx
                        linkServiceEdit.Text            = service.Name;
                        linkServiceEdit.CommandArgument = service.Id.ToString();
                    }
                }

                Repeater repeaterSubCategories = e.Item.FindControl("repeaterSubCategories") as Repeater;
                if (repeaterSubCategories != null)
                {
                    if (service.Children.Count > 0)
                    {
                        repeaterSubCategories.DataSource = service.Children;
                        repeaterSubCategories.DataBind();
                    }
                }
            }
        }
Esempio n. 5
0
        public UnitTests()
        {
            defaultLocation = new Location
            {
                LocationID  = 1,
                Name        = "Photo area",
                X           = 3,
                Y           = 4,
                Description = "A place that you can take photo",
                MinTime     = new TimeSpan(0, 10, 0), //10 mins
            };

            defaultTourType = new TourType
            {
                Label = "Default"
            };
            defaultAccount = new User
            {
                UserID = 1,
                Name   = "test name",
                Role   = "admin"
            };
            defaultLogin = new Login
            {
                UserID           = 1,
                LoginID          = 123456,
                PasswordHash     = "YBNbEL4Lk8yMEWxiKkGBeoILHTU7WZ9n8jJSy8TNx0DAzNEFVsIVNRktiQV+I8d2",
                ActivationStatus = true
            };
        }
Esempio n. 6
0
    public static CustomerRequestData Create(int id, int budget, TourType tourType, int[] lengthVacation)
    {
        CustomerRequestData data = ScriptableObject.CreateInstance <CustomerRequestData>();

        AssetDatabase.CreateAsset(data, "Assets/Scripts/Resources/CustomerRequestData/" + id + ".asset");
        data.SetData(id, budget, tourType, lengthVacation);
        AssetDatabase.Refresh();
        return(data);
    }
Esempio n. 7
0
        public void AddNewTourType()
        {
            var locationType = new TourType
            {
                Label = "Tech"
            };

            Assert.Equal("Tech", locationType.Label);
        }
Esempio n. 8
0
 /// <summary>
 /// Khi ấn nút Add New, đưa trạng thái trở về thêm mới, xóa các textbox
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     ActiveService              = new TourType();
     textBoxServiceName.Text    = String.Empty;
     fckEditorDescription.Value = String.Empty;
     labelFormTitle.Text        = Resources.labelNewTourType;
     btnDelete.Visible          = false;
     btnDelete.Enabled          = false;
 }
 public ActionResult Edit(TourType tourtype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tourtype).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(tourtype);
 }
        public async Task <IActionResult> Create([Bind("Id,Name,StillActive")] TourType tourType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tourType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tourType));
        }
Esempio n. 11
0
        public void Navigate(TourType t)
        {
            switch (t)
            {
            case TourType.csgo:
                Navigate("http://www.gosugamers.net/counterstrike/gosubet"); break;

            case TourType.dota2:
                break;
            }
        }
Esempio n. 12
0
        public async Task <IActionResult> Create([FromForm][Bind("Id,TourTypeName,TourTypeTagName,TourTypeDescription,Amount,TourDateFrom,TourDateTo")] TourType tourType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tourType);
                await _context.SaveChangesAsync().ConfigureAwait(true);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(tourType));
        }
Esempio n. 13
0
        private TourType Update(TourType tourType, TourType newTourType)
        {
            tourType.TourTypeId  = newTourType.TourTypeId;
            tourType.Price       = newTourType.Price;
            tourType.PricePerDay = newTourType.PricePerDay;
            tourType.Name        = newTourType.Name;
            tourType.MaxTourists = newTourType.MaxTourists;
            tourType.Location    = newTourType.Location;

            return(tourType);
        }
Esempio n. 14
0
 public TourTypeCol()
 {
     dict = new Dictionary <int, string>();
     list = new TourType[6];
     AddToList();
     for (int i = 0; i < 6; i++)
     {
         list[i]      = new TourType();
         list[i].Name = dict[i];
     }
 }
Esempio n. 15
0
 public void Type(string nameType)
 {
     TourType[] arr = TourTypeCol.list;
     _type = new TourType();
     foreach (TourType i in arr)
     {
         if (nameType == i.Name)
         {
             _type = i;
         }
     }
 }
Esempio n. 16
0
        public ActionResult Create(TourType tourtype)
        {
            if (ModelState.IsValid)
            {
                tourtype.TourTypeId = Guid.NewGuid();
                db.TourTypes.Add(tourtype);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(tourtype);
        }
Esempio n. 17
0
 public Tour(string Nom, TourType Type)
 {
     this.Nom  = Nom;
     this.Type = Type;
     //switch (Type)
     //{
     //    case TourType.Acrobatie:
     //        this.Nom = "Tour d'acrobatie";
     //        break;
     //    case TourType.Musique:
     //        this.Nom = "Tour de musique";
     //        break;
     //}
 }
Esempio n. 18
0
        public Tour(
            String _country
            , String _description
            , TourType _type
            )
        {
            if (_country.Length == 0)
            {
                throw new ArgumentException("Country should be filled");
            }

            this.Country     = _country;
            this.Description = _description;
            this.Type        = _type;
        }
Esempio n. 19
0
        async Task <TourType> IRepository <TourType, int> .Update(TourType entity)
        {
            TourType resTourType;

            try
            {
                resTourType = _dbSet.Update(entity).Entity;
                await _context.SaveChangesAsync();
            }
            catch
            {
                resTourType = null;
            }
            return(resTourType);
        }
Esempio n. 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     //绑定团队类型
     string[] typeList = Enum.GetNames(typeof(EyouSoft.Model.EnumType.TourStructure.TourType));
     if (typeList != null && typeList.Length > 0)
     {
         foreach (string str in typeList)
         {
             this.ddlTourType.Items.Add(new ListItem(str, ((int)Enum.Parse(typeof(EyouSoft.Model.EnumType.TourStructure.TourType), str)).ToString()));
         }
     }
     this.ddlTourType.Items.Insert(0, new ListItem("-请选择-", "-1"));
     if (TourType > -1)
     {
         this.ddlTourType.Items.FindByValue(TourType.ToString()).Selected = true;
     }
     //释放资源
     typeList = null;
 }
Esempio n. 21
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var check = MessageBox.Show(msgAdd, "Thông báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);

            if (check.Equals(DialogResult.Cancel))
            {
                return;
            }

            var name = txtAdd.Text.Trim();

            if (!ValidateNewName(name))
            {
                MessageBox.Show("Tên đã tồn tại", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            if (_type.Equals(typeof(Location)))
            {
                var obj = new Location(name);
                _unitOfWork.Locations.Add(obj);
            }
            else if (_type.Equals(typeof(CostType)))
            {
                var obj = new CostType(name);
                _unitOfWork.CostTypes.Add(obj);
            }
            else if (_type.Equals(typeof(TourType)))
            {
                var obj = new TourType(name);
                _unitOfWork.TourTypes.Add(obj);
            }
            else
            {
                var obj = new Job(name);
                _unitOfWork.Jobs.Add(obj);
            }
            MessageBox.Show("Thêm thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            LoadData();
            Search();
            LoadGridView(selectedIndex);
        }
Esempio n. 22
0
        public void MakeTour(TourDTO tourDTO)//(TourDTO tourDTO)
        {
            //deserialize = new TourDeserialize();
            //TourDTO tourDTO = deserialize.deserializeVary(TourVary);

            TourType type = Database.TourTypes.Get(tourDTO.TourTypeId);
            TourInfo info = Database.TourInfos.Get(tourDTO.InfoId);

            if (type == null || info == null)
            {
                throw new ValidationException("Data - info/type is not found", "");
            }
            Tour tour = new Tour
            {
                Name       = tourDTO.Name,
                TourTypeId = tourDTO.TourTypeId,
                InfoId     = tourDTO.InfoId,
            };

            Database.Tours.Create(tour);
            Database.Save();
        }
Esempio n. 23
0
    public GameObject GetTowerObject(RessourceType resssource, TourType tourType)
    {
        if (towers.Count <= 0)
        {
            return(null);
        }

        foreach (TowerDataLists towerList in towers)
        {
            if (towerList.ressourceType == resssource)
            {
                foreach (TowerData tower in towerList.towerData)
                {
                    if (tower.tourType == tourType)
                    {
                        return(tower.gameObject);
                    }
                }
            }
        }
        return(null);
    }
Esempio n. 24
0
        /// <summary>
        /// 根据订单编号获取团款结算单
        /// </summary>
        /// <param name="orderId">订单编号</param>
        /// <param name="tourType">计划类型</param>
        /// <returns></returns>
        public MOrderSale GetSettlementOrderByOrderId(string orderId, TourType tourType)
        {
            if (string.IsNullOrEmpty(orderId))
            {
                throw new System.Exception("bll error:查询id为null或string.IsNullOrEmpty(id)==true。");
            }

            var info = dal.GetSettlementOrderByOrderId(orderId, tourType);

            if (info != null)
            {
                if (info.KeHuLevId > 0)
                {
                    info.KeHuLevName = new EyouSoft.BLL.ComStructure.BComLev().GetName(info.KeHuLevId, info.CompanyId);
                }
                if (info.BaoJiaBiaoZhunId > 0)
                {
                    info.BaoJiaBiaoZhunName = new EyouSoft.BLL.ComStructure.BComStand().GetName(info.BaoJiaBiaoZhunId, info.CompanyId);
                }
            }

            return(info);
        }
        private void SearchVisualTree(DependencyObject targetElement, TourType type)
        {
            var count = VisualTreeHelper.GetChildrenCount(targetElement);

            if (count == 0)
            {
                return;
            }

            for (int i = 0; i < count; i++)
            {
                var child = VisualTreeHelper.GetChild(targetElement, i);
                if (child is CheckButtonUserControl)
                {
                    CheckButtonUserControl targetItem = (CheckButtonUserControl)child;
                    targetItem.IsChecked = targetItem.Type == type;
                }
                else
                {
                    SearchVisualTree(child, type);
                }
            }
        }
Esempio n. 26
0
        protected void repeaterServices_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            switch (e.CommandName.ToLower())
            {
            case "edit":

                #region -- Lấy thông tin dịch vụ

                ActiveService              = Module.TourTypeGetById(Convert.ToInt32(e.CommandArgument));
                textBoxServiceName.Text    = ActiveService.Name;
                fckEditorDescription.Value = ActiveService.Description;

                #endregion

                btnDelete.Visible   = true;
                btnDelete.Enabled   = true;
                labelFormTitle.Text = ActiveService.Name;
                break;

            default:
                break;
            }
        }
Esempio n. 27
0
 public async Task <IActionResult> Edit([FromForm] int id, [FromForm][Bind("Id,TourTypeName,TourTypeTagName,TourTypeDescription,Amount,TourDateFrom,TourDateTo")] TourType tourType)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _context.Update(tourType);
             await _context.SaveChangesAsync().ConfigureAwait(true);
         }
         catch (DbUpdateConcurrencyException)
         {
             if (!TourTypeExists(tourType.Id))
             {
                 return(NotFound());
             }
             else
             {
                 throw;
             }
         }
         return(RedirectToAction(nameof(Index)));
     }
     return(View(tourType));
 }
Esempio n. 28
0
        async Task <TourTypeDTO> IService <TourTypeDTO, int> .Get(int id)
        {
            TourType tourType = await _tourTypeRepository.Get(id);

            return(_mapper.Map <TourType, TourTypeDTO>(tourType));
        }
Esempio n. 29
0
        async Task <TourTypeDTO> IService <TourTypeDTO, int> .Update(TourTypeDTO entity)
        {
            TourType tourType = await _tourTypeRepository.Update(_mapper.Map <TourTypeDTO, TourType>(entity));

            return(_mapper.Map <TourType, TourTypeDTO>(tourType));
        }
Esempio n. 30
0
    public void StartActionOnLane(Lane laneComponent, RessourceType tourRes, RessourceType pigType, TourType tourType)
    {
        if (!laneComponent)
        {
            return;
        }

        StartCoroutine(ActivateInput());

        List <Transform> pigPath = new List <Transform>();

        foreach (Transform pathPoint in m_PigsStartPath)
        {
            pigPath.Add(pathPoint);
        }

        pigPath.AddRange(laneComponent.PigPath);

        Pig pigComponent = GetPigComponentByType(pigType);

        if (pigComponent)
        {
            pigComponent.UsePig(pigPath, m_towers.GetTowerObject(tourRes, tourType), laneComponent);
        }
    }
 public IHttpActionResult CreateTourType([FromBody] TourType tourType)
 {
     return(Ok(_tourTypeService.CreateTourType(tourType)));
 }
        private void SearchVisualTree(DependencyObject targetElement, TourType type)
        {
            var count = VisualTreeHelper.GetChildrenCount(targetElement);
            if (count == 0)
                return;

            for (int i = 0; i < count; i++)
            {
                var child = VisualTreeHelper.GetChild(targetElement, i);
                if (child is CheckButtonUserControl)
                {
                    CheckButtonUserControl targetItem = (CheckButtonUserControl)child;
                    targetItem.IsChecked = targetItem.Type == type;
                }
                else
                {
                    SearchVisualTree(child, type);
                }
            }
        }
 public IHttpActionResult UpdateTourType(int tourTypeId, [FromBody] TourType tourType)
 {
     tourType.TourTypeId = tourTypeId;
     return(Ok(_tourTypeService.UpdateTourType(tourType)));
 }