protected virtual void OnBtnAddItemClicked(object sender, System.EventArgs e) { SqlOperations sqlop = new SqlOperations(); sqlop.AddItem(DataAccess.Instance.SelectedLocation.LocationName, DataAccess.Instance.SelectedContainer.ContainerName, tbox_item.Text, System.DateTime.Now); RetrieveItems(); tbox_item.Text = string.Empty; }
protected virtual void OnBtnRemoveItemClicked(object sender, System.EventArgs e) { SqlOperations sqlop = new SqlOperations(); sqlop.RemoveSelectedItem(DataAccess.Instance.SelectedItem); RetrieveItems(); DataAccess.Instance.SelectedItem = null; }
void RetrieveItems() { try{ DataAccess.Instance.ListaItems.Clear(); SqlOperations sqlop = new SqlOperations(); sqlop.ReadItemsByContainer(DataAccess.Instance.SelectedLocation.LocationName, DataAccess.Instance.SelectedContainer.ContainerName); } catch (Exception ex) { } }
void RetrieveContainers() { try{ DataAccess.Instance.ListaContainers.Clear(); SqlOperations sqlop = new SqlOperations(); sqlop.ReadContainersOfLocation(DataAccess.Instance.SelectedLocation.LocationName); } catch (Exception ex) { } }
void ReadAllLocations() { try { DataAccess.Instance.ListaLocations.Clear(); SqlOperations sqlop = new SqlOperations(); sqlop.ReadAllLocations(); } catch (Exception ex) { } }
void Search() { DataAccess.Instance.ListaContainers.Clear(); DataAccess.Instance.ListaItems.Clear(); DataAccess.Instance.ListaLocations.Clear(); if (tbox_Search.Text.Equals(string.Empty)) { ReadAllLocations(); } else { SqlOperations sqlop = new SqlOperations(); sqlop.Search(tbox_Search.Text); } }
protected virtual void OnBtnAddLocationClicked(object sender, System.EventArgs e) { string LocationtoAdd = tbox_Location.Text; SqlOperations sqlop = new SqlOperations(); int ret = sqlop.ChekIfExistLocation(LocationtoAdd); if (ret > 0) { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "The location already exist"); md.Run(); md.Destroy(); } else { ret = sqlop.AddLocation(LocationtoAdd, System.DateTime.Now); } ReadAllLocations(); tbox_Location.Text = string.Empty; }
protected virtual void OnBtnRemoveContainerClicked(object sender, System.EventArgs e) { MessageDialog md = new MessageDialog(this, DialogFlags.DestroyWithParent, MessageType.Question, ButtonsType.YesNo, "WARNING: All Items in containers will be deleted! Are you sure?"); ResponseType result = (ResponseType)md.Run(); if (result == ResponseType.Yes) { SqlOperations sqlop = new SqlOperations(); sqlop.RemoveAllContainerItems(DataAccess.Instance.SelectedContainer); sqlop.RemoveSelectedContainer(DataAccess.Instance.SelectedContainer); RetrieveItems(); RetrieveContainers(); DataAccess.Instance.SelectedContainer = null; DataAccess.Instance.SelectedItem = null; } md.Destroy(); }
protected virtual void OnBtnAddContainerClicked(object sender, System.EventArgs e) { if (DataAccess.Instance.SelectedLocation.Equals(string.Empty)) { return; } string ContainertoAdd = tbox_container.Text; SqlOperations sqlop = new SqlOperations(); int ret = sqlop.ChekIfExistContainer(DataAccess.Instance.SelectedLocation.LocationName, ContainertoAdd); if (ret > 0) { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "The location already exist"); md.Run(); md.Destroy(); } else { ret = sqlop.AddContainer(DataAccess.Instance.SelectedLocation.LocationName, ContainertoAdd, System.DateTime.Now); } RetrieveContainers(); tbox_container.Text = string.Empty; }