예제 #1
0
        //
        // GET: /Players/

        public ActionResult Index()
        {
            List <Models.Player> players = new List <Models.Player>();

            Data.SQLite.DataStore ds = Data.SQLite.DataStore.Instance;
            using (ds.Lock())
            {
                Data.Setting setting = ds.GetSetting("Version");
                if (setting != null)
                {
                    string version = setting.Value;
                    Logger.Info("Version: {0}", version);
                }

                List <Data.Player> results = ds.GetPlayers();
                foreach (Data.Player p in results)
                {
                    Models.Player player = new Models.Player();
                    player.Id              = p.Id;
                    player.SiteId          = p.SiteId;
                    player.Name            = p.Name;
                    player.Notes           = p.Notes;
                    player.HandPlayerCount = ds.GetHandPlayerCount(p.Id);

                    player.DateAdded = p.DateAdded.UtcTime.ToLocalTime().ToString();
                    if (p.DateUpdated != null)
                    {
                        player.DateUpdated = p.DateUpdated.UtcTime.ToLocalTime().ToString();
                    }
                    players.Add(player);
                }
            }

            return(View(players));
        }
예제 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            var db = new Data.GymContextDataContext();

            Data.Setting insurance = db.Settings.Where(s => s.Key == "insurance_price").FirstOrDefault();
            txtInsurancePrice.Value = int.Parse(insurance.Value);

            Data.Setting singlesession = db.Settings.Where(s => s.Key == "single_price").FirstOrDefault();
            txtSingleSessionPrice.Value = int.Parse(singlesession.Value);

            Data.Setting extend = db.Settings.Where(s => s.Key == "extend_days").FirstOrDefault();
            txtExtendDays.Value = int.Parse(extend.Value);

            Data.Setting transithours = db.Settings.Where(s => s.Key == "transit_hours").FirstOrDefault();
            txtTransitHours.Value = int.Parse(transithours.Value);

            Data.Setting title = db.Settings.Where(s => s.Key == "app_title").FirstOrDefault();
            txtTitle.Text = title.Value.ToString();

            Data.Setting closetwidth = db.Settings.Where(s => s.Key == "closets_width").FirstOrDefault();
            txtClosetsWidth.Value = int.Parse(closetwidth.Value);

            Data.Setting infotimeout = db.Settings.Where(s => s.Key == "info_timeout").FirstOrDefault();
            txtInfoTimeout.Value = int.Parse(infotimeout.Value);

            Data.Setting guestfinger = db.Settings.Where(s => s.Key == "guest_finger_id").FirstOrDefault();
            txtGuestFinger.Value = int.Parse(guestfinger.Value);
        }
예제 #3
0
        internal void ResetBackground()
        {
            var _Image = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.BaseDirectory + "/CamelBackground.jpg"));

            BackGroundImageBrush.ImageSource = _Image;
            //Domain.Dynamics.BackgroundImage = "background.jpg";
            var db = new Data.GymContextDataContext();

            Data.Setting background = db.Settings.Where(s => s.Key == "background_image").FirstOrDefault();
            background.Value = "CamelBackground.jpg";
        }
예제 #4
0
        public void saveOBJ(Data.Solution solution, Data.Setting setting, string path)
        {
            ObjWriter      objWriter   = new ObjWriter(path + "//result.obj");
            List <Point3D> listPoint3D = new List <Point3D>();

            for (int x = 0; x < solution.sharpImage.Width; x++)
            {
                for (int y = 0; y < solution.sharpImage.Height; y++)
                {
                    if (solution.getValue(x, y) != -1)
                    {
                        listPoint3D.Add(
                            new Point3D(x / (double)solution.Width * setting.FWIDTH,
                                        y / (double)solution.Height * setting.FWIDTH,
                                        solution.getValue(x, y) * setting.HCOEFF));
                    }
                }
            }
            objWriter.addPoints(listPoint3D);
        }
예제 #5
0
        public void ChangeBackground_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "jpg images|*.jpg";
            if (ofd.ShowDialog() == true)
            {
                if (ofd.FileName != "")
                {
                    if (System.IO.File.Exists(ofd.FileName))
                    {
                        var _Image = new BitmapImage();
                        _Image.BeginInit();
                        _Image.StreamSource = System.IO.File.OpenRead(ofd.FileName);
                        _Image.EndInit();
                        BackGroundImageBrush.ImageSource = _Image;
                        var filename = ofd.FileName.Split('\\')[ofd.FileName.Split('\\').Count() - 1];
                        if (filename.Length > 45)
                        {
                            filename = Guid.NewGuid().ToString();
                        }
                        System.IO.File.Copy(ofd.FileName, System.AppDomain.CurrentDomain.BaseDirectory + filename, true);
                        //Domain.Dynamics.BackgroundImage = "background.jpg";
                        var          db         = new Data.GymContextDataContext();
                        Data.Setting background = db.Settings.Where(s => s.Key == "background_image").FirstOrDefault();
                        if (background == null)
                        {
                            db.Settings.InsertOnSubmit(new Setting {
                                Key = "background_image", Value = filename
                            });
                            db.SubmitChanges();
                        }
                        else
                        {
                            background.Value = filename;
                            db.SubmitChanges();
                        }
                    }
                }
            }
        }
예제 #6
0
        void SetBackground()
        {
            var file = "CamelBackground.jpg";
            var back = (new Data.GymContextDataContext()).Settings.Where(s => s.Key == "background_image");

            if (back != null)
            {
                file = back.FirstOrDefault().Value;
            }
            if (!System.IO.File.Exists(System.AppDomain.CurrentDomain.BaseDirectory + "/" + file))
            {
                file = "CamelBackground.jpg";
            }
            var _Image = new BitmapImage(new Uri(System.AppDomain.CurrentDomain.BaseDirectory + "/" + file));

            BackGroundImageBrush.ImageSource = _Image;
            //Domain.Dynamics.BackgroundImage = "background.jpg";
            var db = new Data.GymContextDataContext();

            Data.Setting background = db.Settings.Where(s => s.Key == "background_image").FirstOrDefault();
            background.Value = "CamelBackground.jpg";
        }
예제 #7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var db = new Data.GymContextDataContext();

            Data.Setting insurance = db.Settings.Where(s => s.Key == "insurance_price").FirstOrDefault();
            insurance.Value = (txtInsurancePrice.Value > 0 ? txtInsurancePrice.Value.ToString() : insurance.Value);

            Data.Setting singlesession = db.Settings.Where(s => s.Key == "single_price").FirstOrDefault();
            singlesession.Value = (txtSingleSessionPrice.Value > 0 ? txtSingleSessionPrice.Value.ToString() : singlesession.Value);

            Data.Setting extend = db.Settings.Where(s => s.Key == "extend_days").FirstOrDefault();
            extend.Value = (txtExtendDays.Value > 0 ? txtExtendDays.Value.ToString() : extend.Value);

            Data.Setting transithours = db.Settings.Where(s => s.Key == "transit_hours").FirstOrDefault();
            transithours.Value = (txtTransitHours.Value > 0 ? txtTransitHours.Value.ToString() : transithours.Value);

            Data.Setting title = db.Settings.Where(s => s.Key == "app_title").FirstOrDefault();
            title.Value = txtTitle.Text;

            Data.Setting closetwidth = db.Settings.Where(s => s.Key == "closets_width").FirstOrDefault();
            closetwidth.Value = (txtClosetsWidth.Value > 0 ? (txtClosetsWidth.Value).ToString() : "70");

            Data.Setting infotimeout = db.Settings.Where(s => s.Key == "info_timeout").FirstOrDefault();
            infotimeout.Value = (txtInfoTimeout.Value > 0 ? (txtInfoTimeout.Value).ToString() : "30");

            Data.Setting guestfinger = db.Settings.Where(s => s.Key == "guest_finger_id").FirstOrDefault();
            guestfinger.Value = (txtGuestFinger.Value > 0 ? (txtGuestFinger.Value).ToString() : "0");

            db.SubmitChanges();

            Domain.Dynamics.Refresh();
            Main.Home.TransitList.UpdatePassages();
            Main.Home.CheckupExtenders();
            Main.Home.LoadTitle();
            Main.Home.ResizeClosets();
            Main.Home.ShowMessage("تنظیمات با موفقیت ذخیره شد", 10);
            this.Close();
        }