private void amountInCafe_button_Click(object sender, EventArgs e) { var text = positionsName_comboBox.SelectedItem.ToString(); var cafeName = cafes_comboBox.SelectedValue.ToString(); var metaService = new WcfMetaServiceClient(); var cafeId = metaService.GetAll().First(db => db.Name.Equals(cafeName)).Id; metaService.Close(); amountInCafe_textBox.Text = service.GetPositionAmount(text, cafeId).ToString(); }
public main_Form() { InitializeComponent(); service = new WcfMetaServiceClient(); databases = service.GetAll().ToList(); this.databases_dataGrid.SelectionChanged += new System.EventHandler(this.databases_dataGrid_SelectionChanged); databases_dataGrid.DataSource = databases.Where(db => db.DatabaseInfo.Contains("cafe")).ToList(); service.Close(); }
private void LoadCafesCombobox() { var metaService = new WcfMetaServiceClient(); var databases = metaService.GetAll().Where(db => db.DatabaseInfo.Contains("cafe")).Select(db => db.Name).ToList(); cafes_comboBox.DataSource = databases; int index = 0; positionsName_comboBox.SelectedIndex = index; positionsName_comboBox.DisplayMember = databases[index]; metaService.Close(); }
private void send_button_Click(object sender, EventArgs e) { var text = positionsName_comboBox.SelectedItem.ToString(); var amount = Int32.Parse(positionsAmount_textBox.Text); var cost = Double.Parse(positionsCost_textBox.Text); var cafeName = cafes_comboBox.SelectedValue.ToString(); var metaService = new WcfMetaServiceClient(); var cafeId = metaService.GetAll().First(db => db.Name.Equals(cafeName)).Id; metaService.Close(); service.SendPositions(dbId, cafeId, text, amount, cost); LoadGrid(); }
static void Main(string[] args) { WcfMetaServiceClient cl1 = new WcfMetaServiceClient(); Console.WriteLine(cl1.GetData1(45)); IEnumerable <DataBaseModel> dbs = cl1.GetAll(); dbs = null; dbs = cl1.GetAll(); cl1.Close(); WcfPositionServiceClient cl2 = new WcfPositionServiceClient(); Console.WriteLine(cl2.GetData2(88)); IEnumerable <PositionModel> pos = cl2.GetAll(2); cl2.Create(new PositionModel() { Name = "brbr", Amount = 10, Cost = 5.2 }, 2); cl2.Create(new PositionModel() { Name = "ruru", Amount = 100, Cost = 2.8 }, 2); pos = cl2.GetAll(2); PositionModel found = pos.First(); found.Amount = 99; found.Cost = 3.9; cl2.Update(found, 2); pos = cl2.GetAll(2); cl2.Delete(found.Id, 2); pos = cl2.GetAll(2); cl2.Close(); Console.ReadKey(); }
private void main_Form_FormClosing(object sender, FormClosingEventArgs e) { service.Close(); }