void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Messages = ((eBuy.View.ACTMessages)(target)); return; case 2: this.lblColor = ((System.Windows.Controls.Label)(target)); return; case 3: this.imgSucess = ((System.Windows.Controls.Image)(target)); return; case 4: this.imgError = ((System.Windows.Controls.Image)(target)); return; case 5: this.imgInformation = ((System.Windows.Controls.Image)(target)); return; case 6: this.btnOK = ((System.Windows.Controls.Button)(target)); #line 64 "..\..\..\View\ACTMessages.xaml" this.btnOK.Click += new System.Windows.RoutedEventHandler(this.btnOK_Click); #line default #line hidden return; case 7: this.lblTitle = ((System.Windows.Controls.Label)(target)); return; case 8: this.lblMessage = ((System.Windows.Controls.Label)(target)); return; case 9: this.img1 = ((System.Windows.Controls.Image)(target)); return; case 10: this.img2 = ((System.Windows.Controls.Image)(target)); return; case 11: this.img3 = ((System.Windows.Controls.Image)(target)); return; case 12: this.img4 = ((System.Windows.Controls.Image)(target)); return; } this._contentLoaded = true; }
private void btnRegister_Click(object sender, RoutedEventArgs e) { if (i == 1) { if (rdbComprado.IsChecked == true) { product.BuyingDate = "0000-00-00 00:00:00"; Model.DAO.DAOProduct d = new Model.DAO.DAOProduct(); if (d.Registration(product, user)) { product = d.Selection(txtProduct.Text.ToString()); ACTBuyingDate date = new ACTBuyingDate(product); date.ShowDialog(); Model.DAO.DAOUser uDAO = new Model.DAO.DAOUser(); user = uDAO.CreditSpent(user, product.Price); user = uDAO.TotalCredit(user); user = uDAO.Update(user); ACTMessages message = new ACTMessages(user, "eBuy", "Produto registrado com sucesso.", 1); message.ShowDialog(); this.Close(); } else { ACTMessages message = new ACTMessages(user, "eBuy", "Algo errado aconteceu. Por favor, tente novamente mais tarde.", 3); message.ShowDialog(); } } else { product.BuyingDate = "0000-00-00 00:00:00"; Model.DAO.DAOProduct d = new Model.DAO.DAOProduct(); if (d.Registration(product, user)) { ACTMessages message = new ACTMessages(user, "eBuy", "Produto registrado com sucesso.", 1); message.ShowDialog(); this.Close(); } else { ACTMessages message = new ACTMessages(user, "eBuy", "Algo errado aconteceu. Por favor, tente novamente mais tarde.", 3); message.ShowDialog(); } } } else { if (rdbComprado.IsChecked == true) { ACTBuyingDate date = new ACTBuyingDate(product); date.ShowDialog(); Model.DAO.DAOProduct dPRO = new Model.DAO.DAOProduct(); if (dPRO.Update(product, user)) { Model.DAO.DAOUser uDAO = new Model.DAO.DAOUser(); user = uDAO.CreditSpent(user, product.Price); user = uDAO.TotalCredit(user); user = uDAO.Update(user); ACTMessages message = new ACTMessages(user, "eBuy", "Produto atualizado com sucesso.", 1); message.ShowDialog(); this.Close(); } else { ACTMessages message = new ACTMessages(user, "eBuy", "Algo errado aconteceu. Por favor, tente novamente mais tarde.", 3); message.ShowDialog(); } } else { Model.DAO.DAOProduct dPRO = new Model.DAO.DAOProduct(); if (dPRO.Update(product, user)) { ACTMessages message = new ACTMessages(user, "eBuy", "Produto atualizado com sucesso.", 1); message.ShowDialog(); this.Close(); } else { ACTMessages message = new ACTMessages(user, "eBuy", "Algo errado aconteceu. Por favor, tente novamente mais tarde.", 3); message.ShowDialog(); } } } }