public LearningWordPage(int CategoryID)
        {
            InitializeComponent();
            wdal        = new WordDAL();
            idal        = new ImageDAL();
            _CategoryID = CategoryID;
            //LoadRandomWordByCategory(_CategoryID);
            //LoadRandomListWordByCategory(_CategoryID);
            lstW = new List <Word>();
            lstW = wdal.getRandomWordForLearningWord(_CategoryID);

            //lấy từ đầu tiên trong danh sách
            _currentW       = lstW[0];
            lblWord.Content = lstW[0].Word1;
            lblWord.HorizontalContentAlignment = HorizontalAlignment.Center;
            lblWord.VerticalContentAlignment   = VerticalAlignment.Center;
            lblTranslate.Content = lstW[0].Translate;
            lblTranslate.HorizontalContentAlignment = HorizontalAlignment.Center;
            lblTranslate.VerticalContentAlignment   = VerticalAlignment.Center;
            DataAccess.Image img = idal.getImageOfWord(lstW[0].Word1);
            byte[]           i   = img.Image1.ToArray();
            if (img == null)
            {
                throw new Exception("#113 Từ " + lstW[0].Word1 + "chưa có hình.");
            }
            BitmapImage image = LoadImage(i);

            img_word.Source  = image;
            img_word.Stretch = Stretch.Fill;
            PlayThePronunciation(lstW[0]);
        }
Exemplo n.º 2
0
 int count = 0; // The time that player answer right
 public PickAndAskGamePage(List <Word> list)
 {
     InitializeComponent();
     idal      = new ImageDAL();
     wdal      = new WordDAL();
     this.list = list;
     NewGame();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Metod check if valid Image and also redirect if Update or new Image.
        /// </summary>
        /// <param name="image"></param>
        public void SaveImage(Image image)
        {
            ICollection <ValidationResult> validationresults;

            if (!image.Validate(out validationresults))
            {
                throw new ApplicationException();
            }
            ImageDAL.SaveImage(image);
        }
Exemplo n.º 4
0
        public PairGameController(Grid grid, int CategoryID)
        {
            if (grid == null)
            {
                throw new ArgumentNullException("gameGrid can not be null.");
            }
            // if (String.IsNullOrEmpty(iconSet)) throw new ArgumentException("iconSet can not be null or empty.");

            this.gameGrid = grid;
            // this.iconSet = iconSet;
            wordDAL         = new WordDAL();
            imgDAL          = new ImageDAL();
            this.CategoryID = CategoryID;
            list            = getWordByCategory(CategoryID);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 修改个人头像
        /// </summary>
        /// <param name="userImage"></param>
        /// <returns></returns>
        public ResultModel <object> SavePicToDB(UserImage userImage)
        {
            ResultModel <object> msg = new ResultModel <object>();
            int result = 0;

            userImage.ImageCode = new CreateEmpCode().GetRandomEmpCode(2, 4);
            result = new ImageDAL().SavePicToDB(userImage);
            if (result > 0)
            {
                msg.Message = "操作成功";
            }
            else
            {
                msg.Code    = 2001;
                msg.Message = "操作失败";
            }
            return(msg);
        }
Exemplo n.º 6
0
 public ImageBLL()
 {
     _imageDAL = new ImageDAL();
 }
Exemplo n.º 7
0
 /// <summary>
 /// Metod to delete image that belongs to certain category.
 /// </summary>
 /// <param name="imageID"></param>
 /// <param name="categoryID"></param>
 /// <returns>Interger</returns>
 public int DeleteImage(int imageID, short categoryID)
 {
     return(ImageDAL.DeleteImage(imageID, categoryID));
 }
Exemplo n.º 8
0
        // Methods to make SQL Calls toward Image table.

        /// <summary>
        /// Method to generate all Images from CategoryID
        /// </summary>
        /// <param name="categoryID"></param>
        /// <returns>Image List</returns>
        public List <Image> GetImagesByCategoryID(short categoryID)
        {
            return(ImageDAL.GetImagesByCategoryID(categoryID));
        }
Exemplo n.º 9
0
 public byte[] Get(string name)
 {
     return(ImageDAL.Get(name));
 }
Exemplo n.º 10
0
 public void Upload(byte[] file, string name)
 {
     ImageDAL.Upload(file, name);
 }