public IEnumerable <IComponentModel> GetAll()
        {
            List <CompModel> componentModelList = new List <CompModel>();

            using (MySqlConnection connection = new MySqlConnection(_connString))
            {
                try
                {
                    string queryString = "SELECT * FROM sql_latch_tests1.components";
                    connection.Open();
                    using (MySqlCommand command = new MySqlCommand(queryString, connection))
                        using (MySqlDataReader reader = command.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                CompModel model = new CompModel();
                                model.ComponentID = Int32.Parse(reader["component_id"].ToString());
                                model.Status      = (bool)reader["status"];
                                model.Type        = reader["type"].ToString();
                                componentModelList.Add(model);
                            }
                        }
                }
                catch (MySqlException ex)
                {
                    throw new Exception(ex.Message.ToString(), ex);
                }
                finally { connection.Close(); }
            }
            return(componentModelList);
        }
예제 #2
0
        public AnimatedComponent(CompModel model, AnimationManager animationManager, int drawOrder = 0, Camera2D camera = null) : base(camera)
        {
            LoadOutherComps();

            Position = model.position;

            _Constructor(drawOrder);

            this.animationManager = animationManager;
            Game.Components.Add(this);
        }
예제 #3
0
        // Introducing changes to db data
        private void BtnSubmitChanges_Click(object sender, EventArgs e)
        {
            try
            {
                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value == null)
                    {
                        return;
                    }

                    switch (currentView)
                    {
                    case View.Component:
                        CompModel componentModel = new CompModel();
                        componentModel.ComponentID = Convert.ToInt32(row.Cells[0].Value);
                        componentModel.Type        = row.Cells[1].Value.ToString();
                        componentModel.Status      = Convert.ToBoolean(row.Cells[2].Value);
                        componentRepository.Update(componentModel);
                        break;

                    case View.Latch:
                        LatchModel latchModel = new LatchModel();
                        latchModel.LatchID     = Convert.ToInt32(row.Cells[0].Value);
                        latchModel.Type        = row.Cells[1].Value.ToString();
                        latchModel.ComponentID = Convert.ToInt32(row.Cells[2].Value);
                        latchRepository.Update(latchModel);
                        break;

                    case View.Test:
                        TestModel testModel = new TestModel();
                        testModel.TestID    = Convert.ToInt32(row.Cells[0].Value);
                        testModel.LatchID   = Convert.ToInt32(row.Cells[1].Value);
                        testModel.EndTime   = Convert.ToDateTime(row.Cells[2].Value);
                        testModel.Date      = Convert.ToDateTime(row.Cells[3].Value);
                        testModel.Status    = Convert.ToBoolean(row.Cells[4].Value);
                        testModel.Cycles    = Convert.ToInt32(row.Cells[5].Value);
                        testModel.VideoLink = row.Cells[6].Value.ToString().Replace("\\", "\\\\");
                        testModel.Comments  = row.Cells[7].Value.ToString();
                        testRepository.Update(testModel);
                        break;

                    default:
                        break;
                    }
                }
            }
            catch (Exception ex) { MessageBox.Show(ex.Message); }

            ViewDataFromTable(currentView);   // Refresh the data grid view
        }
예제 #4
0
 public LevelModel(Rectangle bounds, List <BlockModel> blocks, List <BlockModel> deathPoints, List <TextPointModel> textPoints, List <MusicPointModel> musicPoints, List <PoetryModel> poetryPoints, List <GravityModel> gravityPoints, List <BlockModel> finalPoints, BackgroundModel background, CompModel camera, CompModel hero)
 {
     this.bounds        = bounds;
     this.blocks        = blocks;
     this.deathPoints   = deathPoints;
     this.textPoints    = textPoints;
     this.musicPoints   = musicPoints;
     this.poetryPoints  = poetryPoints;
     this.gravityPoints = gravityPoints;
     this.finalPoints   = finalPoints;
     this.background    = background;
     this.hero          = hero;
     this.camera        = camera;
 }
예제 #5
0
        public Hero(CompModel model, World world, GravityManager gravityManager) : base(world, LoadAnimation(), (int)GameDrawOrder.Person)
        {
            var width  = ConvertUnits.ToSimUnits(Frame.Width);
            var height = ConvertUnits.ToSimUnits(Frame.Height);
            var x      = ConvertUnits.ToSimUnits(model.position.X);
            var y      = ConvertUnits.ToSimUnits(model.position.Y);

            Body               = BodyFactory.CreateRectangle(world, width, height, 1f, new Vector2(x, y), 0f, BodyType.Dynamic);
            Body.Mass          = 1f;
            Body.UserData      = this;
            Body.FixedRotation = true;

            Camera = CamManager.Instance.LevelCamera;

            Mechanic     = new MechanicControler(this, World, gravityManager);
            StateManager = new StateManager(this, world);

            Body.CollidesWith        = Collide.Instance.HeroWith;
            Body.CollisionCategories = Collide.Instance.HeroGroup;
        }
예제 #6
0
        private void SendEmailView_Load(object sender, EventArgs e)
        {
            this.toMailTextEdit.Text = this.ToEmailId;
            using (var db = new KontoContext())
            {
                Comp = db.Companies.Find(KontoGlobals.CompanyId);
                var _id = (int)this.VoucherType;
                var vch = db.VoucherTypes.Find(_id);

                if (vch == null)
                {
                    return;
                }
                termsRichEditControl.HtmlText = vch.EmailBody;
                subjectTextEdit.Text          = vch.EmailSub;
                ccMailTextEdit.Text           = vch.OtherEmail;
            }

            if (this.ReportDoc != null)
            {
                this.FileName = string.Format(@"{0}.pdf", DateTime.Now.Ticks);
                GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport PdfExport1 = new GrapeCity.ActiveReports.Export.Pdf.Section.PdfExport();
                PdfExport1.Export(this.ReportDoc, "Mailfile\\" + this.FileName);
                atch1ButtonEdit.Text = "Mailfile\\" + this.FileName;
                //System.IO.DirectoryInfo outputDirectory = new System.IO.DirectoryInfo("ExportPDF");
                //outputDirectory.Create();

                //// Provide settings for your rendering output.
                //GrapeCity.ActiveReports.Export.Pdf.Page.Settings pdfSetting = new GrapeCity.ActiveReports.Export.Pdf.Page.Settings();
                //GrapeCity.ActiveReports.Extensibility.Rendering.ISettings setting = pdfSetting;

                ////Set the rendering extension and render the report.
                //GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension pdfRenderingExtension = new GrapeCity.ActiveReports.Export.Pdf.Page.PdfRenderingExtension();
                //GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider outputProvider = new GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name));
                //ReportDoc.Render(pdfRenderingExtension, outputProvider, pdfSetting);
            }
        }