//点击添加按钮 private void btnAdd_Click(object sender, EventArgs e) { if (txtContent.Text == "" || txtStartTime.Text == "" || cmbCategory.Text == "" || cmbHour.Text == "" || cmbMinute.Text == "") { MessageBox.Show("都不能为空哦!"); } else { //1.获取开始时间,学习内容,结束时间 DateTime st = Convert.ToDateTime(txtStartTime.Text); string ct = txtContent.Text; string ca = cmbCategory.Text; DateTime ot = Convert.ToDateTime(cmbHour.Text + ":" + cmbMinute.Text); //2.计算总时长 TimeSpan ts = ot - st; int sum = Convert.ToInt32(ts.TotalMinutes); //3.将数据写入到数据库中 DAL.DAO dao = new DAL.DAO(); int result = dao.Insert(st, ct, ca, ot, sum); if (result != 0) { MessageBox.Show("执行成功!", "温馨提示"); } } }
private void newData() { dao = new DAL.DAO(selection); dao.Read(); p1Label.Update(dao.Players[0].ToMenuString()); p2Label.Update(dao.Players[1].ToMenuString()); p3Label.Update(dao.Players[2].ToMenuString()); p4Label.Update(dao.Players[3].ToMenuString()); }
public PartySelection(Texture2D backGround, Texture2D buttonTexture, SpriteFont font) { selection = 1; this.backGround = backGround; dao = new DAL.DAO(selection); dao.Read(); p1Label = new Label("p1", font, dao.Players[0].ToMenuString(), 50, 200, 300, 50); p2Label = new Label("p2", font, dao.Players[1].ToMenuString(), 50, 250, 300, 50); p3Label = new Label("p3", font, dao.Players[2].ToMenuString(), 50, 300, 300, 50); p4Label = new Label("p4", font, dao.Players[3].ToMenuString(), 50, 350, 300, 50); p1Button = new Button(buttonTexture, 50, 100, "Party 1", 120, 40); p2Button = new Button(buttonTexture, 200, 100, "Party 2", 120, 40); p3Button = new Button(buttonTexture, 350, 100, "Party 3", 120, 40); p4Button = new Button(buttonTexture, 500, 100, "Party 4", 120, 40); okButton = new Button(buttonTexture, 650, 150, "Confirm", 120, 40); menuButton = new Button(buttonTexture, 650, 300, "Menu", 120, 40); allButtons = new List <Button>() { p1Button, p2Button, p3Button, p4Button, okButton, menuButton }; }
public Shop(CharacterClassLibrary.Party party, DAL.DAO dao, Texture2D backGround, Texture2D buttonTexture, SpriteFont font) { this.backGround = backGround; this.party = party; shop = new ShopClassLibrary.Shop(party, dao); offerLabel = new Label("offerLabel", font, "", 440, 40, 300, 300); exceptionLabel = new Label("exceptionLabel", font, "", 320, 240, 400, 30); moneyLabel = new Label("moneyLabel", font, "Your money: " + shop.Party.Money, 20, 350, 150, 30); currentLabel = new Label("currentLabel", font, "", 200, 40, 300, 300); okButton = new Button(buttonTexture, 700, 340, "Go for it!", 80, 30); menuButton = new Button(buttonTexture, 700, 400, "Menu", 80, 30); player1Button = new Button(buttonTexture, 20, 50, party.Players[0].Name, 100, 30); player2Button = new Button(buttonTexture, 20, 130, party.Players[1].Name, 100, 30); player3Button = new Button(buttonTexture, 20, 210, party.Players[2].Name, 100, 30); player4Button = new Button(buttonTexture, 20, 290, party.Players[3].Name, 100, 30); helmetButton = new Button(buttonTexture, 20, 400, "Helmet", 60, 30); chestButton = new Button(buttonTexture, 100, 400, "Chest", 60, 30); handButton = new Button(buttonTexture, 180, 400, "Hands", 60, 30); legButton = new Button(buttonTexture, 260, 400, "Legs", 60, 30); feetButton = new Button(buttonTexture, 340, 400, "Feet", 60, 30); allButtons = new List <Button>() { okButton, menuButton, player1Button, player2Button, player3Button, player4Button, helmetButton, chestButton, handButton, legButton, feetButton }; playerButtons = new List <Button>() { player1Button, player2Button, player3Button, player4Button }; placeButtons = new List <Button>() { helmetButton, chestButton, handButton, legButton, feetButton }; }
public NewParty(Texture2D backGround, Texture2D buttonTexture, SpriteFont font) { selectedParty = 1; selectedClass = 0; dao = new DAL.DAO(selectedParty); dao.Read(); this.backGround = backGround; protectorButton = new Button(buttonTexture, 30, 30, "Protector", 100, 40); templarButton = new Button(buttonTexture, 30, 80, "Templar", 100, 40); warriorButton = new Button(buttonTexture, 30, 130, "Warrior", 100, 40); mageButton = new Button(buttonTexture, 30, 180, "Mage", 100, 40); shamanButton = new Button(buttonTexture, 30, 230, "Shaman", 100, 40); rogueButton = new Button(buttonTexture, 30, 280, "Rogue", 100, 40); bloodButton = new Button(buttonTexture, 30, 330, "Blood Priest", 100, 40); fairyButton = new Button(buttonTexture, 30, 380, "Fairy", 100, 40); p1Button = new Button(buttonTexture, 300, 15, "Party 1", 100, 40); p2Button = new Button(buttonTexture, 420, 15, "Party 2", 100, 40); p3Button = new Button(buttonTexture, 540, 15, "Party 3", 100, 40); p4Button = new Button(buttonTexture, 660, 15, "Party 4", 100, 40); cancelButton = new Button(buttonTexture, 680, 250, "Clear", 100, 40); okButton = new Button(buttonTexture, 680, 300, "Next", 100, 40); finishButton = new Button(buttonTexture, 680, 350, "Done", 100, 40); menuButton = new Button(buttonTexture, 680, 400, "Main Menu", 100, 40); allButtons = new List <Button>() { protectorButton, templarButton, warriorButton, mageButton, shamanButton, rogueButton, bloodButton, fairyButton, p1Button, p2Button, p3Button, p4Button, cancelButton, okButton, finishButton, menuButton }; partyLabel = new Label("party", font, "", 200, 130, 400, 200); infoLabel = new Label("info", font, "Enter name: ", 200, 400, 100, 50); nameBox = new TextBox(font, 290, 400, 150, 50); party = new CharacterClassLibrary.Party(); }