//Justin Pennington 2/14/15 /// <summary> /// Adds new lists object /// </summary> /// <param name="newLists">Object holding new listing data</param> /// <returns> /// rowsAffected /// </returns> public static int AddLists(Lists newLists) { //Connect to Database var conn = DatabaseConnection.GetDatabaseConnection(); var cmdText = "spInsertListsItem"; var cmd = new SqlCommand(cmdText, conn); var rowsAffected = 0; //Set up Parameters for the Stored Procedures cmd.Parameters.AddWithValue("@SupplierID", newLists.SupplierID); cmd.Parameters.AddWithValue("@ItemListID", newLists.ItemListID); cmd.Parameters.AddWithValue("@DateListed", newLists.DateListed); try { conn.Open(); rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new ApplicationException("Concurrency Violation"); } } catch (Exception) { throw; } finally { conn.Close(); } return rowsAffected; }
//Justin Pennington 2/14/15 /// <summary> /// Marks passed Lists as inactive /// </summary> /// <param name="inLists">List to be deactivated</param> /// <returns> /// rowsAffected /// </returns> public static int DeleteLists(Lists inLists) { //make connection to Database var conn = DatabaseConnection.GetDatabaseConnection(); var cmdText = "spDeleteLists"; var cmd = new SqlCommand(cmdText, conn); var rowsAffected = 0; //set up parameters for the stored Procedure cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@original_SupplierID", inLists.SupplierID); cmd.Parameters.AddWithValue("@original_ItemListID", inLists.ItemListID); cmd.Parameters.AddWithValue("@original_DateListed", inLists.DateListed); try { conn.Open(); rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new ApplicationException("Concurrency Violation"); } } catch (Exception) { throw; } finally { conn.Close(); } return rowsAffected; // needs to be rows affected }
public void visit(TaskList list) { DataClassesDataContext local = new DataClassesDataContext(); Lists newList = new Lists(); newList.Title = list.Name; /*newList.Description = list.description; newList.CreationDate = DateTime.Now;*/ }
public IStaticList makeContext(string title, string description, IUser owner) { DataClassesDataContext dc = dbProvider.Database; Lists dbList = new Lists(); dbList.Title = title; dbList.Description = description; dbList.Owner = dbProvider.IdManager.GetId(owner); dc.Lists.InsertOnSubmit(dbList); dc.SubmitChanges(); return new DBStaticList(dbList, dbProvider); }
//makes the form edit a current lists item, and will select the old values in the form //created by will fritz 2/11/15 public void isEdit(Lists oldLists) { _isEdit = true; _oldLists = oldLists; for (int x = 0; x < _suppliers.Count; x++) { if (oldLists.SupplierID == _suppliers[x].SupplierID) { cboSelectSupplier.SelectedIndex = x; } } for (int x = 0; x < _itemListings.Count; x++) { if (oldLists.ItemListID == _itemListings[x].ItemListID) { lvList.SelectedIndex = x; } } }
public Lists.Statuses.Result[] Statuses(Lists.Statuses.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Statuses.Command, Lists.Statuses.Result[]>(command); }
public Lists.Ownerships.Result[] Ownerships(Lists.Ownerships.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Ownerships.Command, Lists.Ownerships.Result[]>(command); }
public Lists.Members.Result[] Members(Lists.Members.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Members.Command, Lists.Members.Result[]>(command); }
public Lists.List.Result[] List(Lists.List.Command command) { return _ApiEndpoints._Client.GetResult<Lists.List.Command, Lists.List.Result[]>(command); }
public Lists.Destroy.Result[] Destroy(Lists.Destroy.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Destroy.Command, Lists.Destroy.Result[]>(command); }
public Lists.Create.Result[] Create(Lists.Create.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Create.Command, Lists.Create.Result[]>(command); }
internal void LoadByModel(Lists.GalleriesList list, int model) { PopulateList(list, this.GetDataByModel(model)); }
//check if listings and supplier has been selected and creates new lists item if _isEdit = false and vise versa //created by will fritz 2/11/15 private void btnSubmit_Click(object sender, RoutedEventArgs e) { try { ItemListing itemListing = (ItemListing)lvList.SelectedItems[0]; Supplier supplier = (Supplier)cboSelectSupplier.SelectedItem; Lists newLists = new Lists(); newLists.ItemListID = itemListing.ItemListID; newLists.SupplierID = supplier.SupplierID; newLists.DateListed = new DateTime(); if (_isEdit == false) { _prodMang.AddLists(newLists); } else { _prodMang.EditLists(_oldLists, newLists); } //opens old window and closes this one if (ListsView.Instance == null) { var listsWin = new ListsView(); listsWin.Show(); } else { var listsWin = ListsView.Instance; listsWin.BringIntoView(); listsWin.Show(); listsWin.FillList(); System.Media.SystemSounds.Asterisk.Play(); } this.Close(); } catch (Exception) { lblError.Content = "You Must Select a ItemListing and a Supplier Or there was an error with the database"; } }
public Lists.Show.Result Show(Lists.Show.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Show.Command, Lists.Show.Result>(command); }
public Lists.Subscribers_Show.Result[] Subscribers_Show(Lists.Subscribers_Show.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Subscribers_Show.Command, Lists.Subscribers_Show.Result[]>(command); }
//Justin Pennington 2/14/15 /// <summary> /// Updates database information and compares old information with current database values /// to ensure that the database has not been modified in the meantime /// </summary> /// <param name="oldList">Old values to ensure data has not been modified</param> /// <param name="newList">New values to be written to database</param> /// <returns> /// rowsAffected /// </returns> public static int UpdateLists(Lists oldList, Lists newList) { //connect to Database var conn = DatabaseConnection.GetDatabaseConnection(); var cmdText = "spUpdateLists"; var cmd = new SqlCommand(cmdText, conn); var rowsAffected = 0; // set command type to stored procedure and add parameters cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@SupplierID", newList.SupplierID); cmd.Parameters.AddWithValue("@ItemListID", newList.ItemListID); cmd.Parameters.AddWithValue("@DateListed", newList.DateListed); cmd.Parameters.AddWithValue("@original_SupplierID", oldList.SupplierID); cmd.Parameters.AddWithValue("@original_ItemListID", oldList.ItemListID); cmd.Parameters.AddWithValue("@original_DateListed", oldList.DateListed); try { conn.Open(); rowsAffected = cmd.ExecuteNonQuery(); if (rowsAffected == 0) { throw new ApplicationException("Concurrency Violation"); } } catch (Exception) { throw; } finally { conn.Close(); } return rowsAffected; // needs to be rows affected }
//Justin Pennington 2/14/15 /// <summary> /// Returns a list of all listings /// </summary> /// <returns> /// myLists /// </returns> public static List<Lists> GetListsList() { var myLists = new List<Lists>(); // set up the database call var conn = DatabaseConnection.GetDatabaseConnection(); string cmdText = "spSelectAllLists"; var cmd = new SqlCommand(cmdText, conn); try { conn.Open(); var reader = cmd.ExecuteReader(); if (reader.HasRows == true) { while (reader.Read()) { var currentList = new Lists(); currentList.SupplierID = reader.GetInt32(0); currentList.ItemListID = reader.GetInt32(1); currentList.DateListed = (DateTime)reader.GetValue(3); myLists.Add(currentList); } } else { var ax = new ApplicationException("Data not found!"); throw ax; } } catch (Exception) { throw; } finally { conn.Close(); } return myLists; }
//Justin Pennington 2/14/15 /// <summary> /// Returns a list of listing objects based on the parameters sent with the method call /// </summary> /// <param name="inSupplierID">Object holding SupplierID</param> /// <param name="inItemListID">Object holding ItemListID</param> /// <returns> /// theLists /// </returns> public static Lists GetLists(string inSupplierID, string inItemListID) { var theLists = new Lists(); // set up the database call var conn = DatabaseConnection.GetDatabaseConnection(); string cmdText = "spSelectLists"; var cmd = new SqlCommand(cmdText, conn); cmd.Parameters.AddWithValue("@SupplierID", inSupplierID); cmd.Parameters.AddWithValue("@ItemListID", inItemListID); //Put retrieved data into objects try { conn.Open(); var reader = cmd.ExecuteReader(); if (reader.HasRows == true) { theLists.SupplierID = reader.GetInt32(0); theLists.ItemListID = reader.GetInt32(1); theLists.DateListed = (DateTime)reader.GetValue(3); } else { var ax = new ApplicationException("Data not found!"); throw ax; } } catch (Exception) { throw; } finally { conn.Close(); } return theLists; }
/// <summary> /// Initialize the List Web Service /// </summary> private void InitialiseListWebserviceProperties() { _listWS = new Lists(GetHostName()); //_listWS = new Lists.Lists(); _listWS.PreAuthenticate = true; _listWS.Credentials = _sharepointCredentitals; if (!_originalSiteUrl.EndsWith("/")) { _originalSiteUrl = _originalSiteUrl + "/"; } _listWS.Url = _originalSiteUrl + "_vti_bin/lists.asmx"; }
public Lists.Subscribers_Create.Result Subscribers_Create(Lists.Subscribers_Create.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Subscribers_Create.Command, Lists.Subscribers_Create.Result>(command); }
public Lists.Subscriptions.Result[] Subscriptions(Lists.Subscriptions.Command command) { return _ApiEndpoints._Client.GetResult<Lists.Subscriptions.Command, Lists.Subscriptions.Result[]>(command); }
private IStaticList createDBStaticList(Lists list, IDictionary<int, ISingleTask> taskMap) { DataClassesDataContext db = dbProvider.Database; IStaticList stl = new DBStaticList(list, dbProvider); // attetion User codé en dur foreach (Lists_Tasks tl in db.Lists_Tasks.Where(x => x.List_id == list.Id && x.Owner == list.Owner)) { stl.AddTask(taskMap[tl.Task_id]); } return stl; }
/// <summary> /// Updates a old file with a new file. /// </summary> /// <param name="OldFile">The old file.</param> /// <param name="NewFile">The new file.</param> public static Lists.FilesFoundList.File UpdateFile(Lists.FilesFoundList.File OldFile, Lists.FilesFoundList.File NewFile) { List<int> peerToAdd = new List<int>(); for (int i = 0; i < NewFile.ListPeers.Count; i++) { if (OldFile.GetPeerByIP(NewFile.ListPeers[i].IP) == null) { peerToAdd.Add(i); } } for (int n = 0; n < peerToAdd.Count; n++) { OldFile.AddPeer(NewFile.ListPeers[peerToAdd[n]]); } return OldFile; }
internal void GetByMovie(int movie, Lists.PosterList posterList) { //Open connection if (dh.OpenConnection() == true) { string q = "SELECT ROWID,Movie,URL,Path, Width,Height FROM Posters p\n"; q += "Where p.Movie = " + movie; //Create Command SQLiteCommand cmd = new SQLiteCommand(q, dh.connection); //Create a data reader and Execute the command SQLiteDataReader dataReader = cmd.ExecuteReader(); posterList.Clear(); while (dataReader.Read()) { Poster poster = new Poster(); if (dh.HasColumn(dataReader, "ROWID")) poster.ID = Convert.ToInt32(dataReader["ROWID"]); if (dh.HasColumn(dataReader, "Movie")) poster.Movie = Convert.ToInt32(dataReader["Movie"]); if (dh.HasColumn(dataReader, "URL")) poster.URL = dataReader["URL"].ToString(); if (dh.HasColumn(dataReader, "Path")) poster.Path = dataReader["Path"].ToString(); if (dh.HasColumn(dataReader, "Width")) poster.Width = Convert.ToInt32(dataReader["Width"]); if (dh.HasColumn(dataReader, "Height")) poster.Height = Convert.ToInt32(dataReader["Height"]); poster.RecordExists = true; posterList.Add(poster); } //close Data Reader dataReader.Close(); //close Connection dh.CloseConnection(); } }