// Inserts Auction Location
        // And Returns the Selected Index
        public int submitLocation(AuctionLocation auctionLocation, int auctionLocationSelectedIndex)
        {
            int executeQueryRowCount = -1;

            if (auctionLocation.locationId < 1)
            {
                auctionLocationSelectedIndex = 0;
                executeQueryRowCount         = AuctionLocationTableData.insertAuctionLocation(auctionLocation);
                if (executeQueryRowCount > 0)
                {
                    auctionLocations.Insert(auctionLocationSelectedIndex, auctionLocation);
                }
            }
            else
            {
                executeQueryRowCount = AuctionLocationTableData.updateAuctionLocation(auctionLocation);
                if (executeQueryRowCount > 0)
                {
                    auctionLocations.Insert(auctionLocationSelectedIndex, auctionLocation);
                    auctionLocations.RemoveAt(auctionLocationSelectedIndex + 1);
                }
            }
            if (executeQueryRowCount < 1)
            {
                return(-1);
            }

            searchEvent();
            return(auctionLocationSelectedIndex + 1);
        }
Exemple #2
0
 private void Location_Reset(AuctionLocation al)
 {
     dataCxt = new DataCxt {
         aItem = dataCxt.aItem, aLocation = al
     };
     this.DataContext = dataCxt;
     Location_ResetLbl();
 }
Exemple #3
0
 public void ClickLocation_Copy(object sender, RoutedEventArgs e)
 {
     if (auctionLocation != null)
     {
         auctionLocationCopy = new AuctionLocation(auctionLocation);
         Location_Reset(new AuctionLocation());
     }
 }
Exemple #4
0
 public AddEvent(AuctionItem ai, AuctionLocation al, MainWindow mw)
 {
     auctionItemCopy     = ai;
     auctionLocationCopy = al;
     mainWindow          = mw;
     InitializeComponent();
     txtNewEvent_ItemName.Text = ai == null?"Item Not Copied":ai.itemName;
     txtNewEvent_Location.Text = al == null ? "Location Not Copied":al.locationName;
 }
 public AuctionEvent(DataRow row)
 {
     eventId         = row.Field <int>("eventId");
     eventName       = row.Field <string>("eventName");
     eventTime       = row.Field <string>("eventTime");
     registrationFee = row.Field <int>("registrationFee");
     buyer           = row.Field <string>("buyer");
     conducted       = row.Field <bool>("conducted");
     auctionItem     = new AuctionItem(row);
     auctionLocation = new AuctionLocation(row);
 }
 public AuctionEvent setAuctionEvent(AuctionEvent ae)
 {
     eventId         = ae.eventId;
     eventName       = ae.eventName;
     eventTime       = ae.eventTime;
     registrationFee = ae.registrationFee;
     buyer           = ae.buyer;
     conducted       = ae.conducted;
     auctionItem     = new AuctionItem(ae.auctionItem);
     auctionLocation = new AuctionLocation(ae.auctionLocation);
     return(this);
 }
        public void searchLocation(AuctionLocation al)
        {
            string queryItems = " ORDER BY locationId DESC LIMIT 20 ";

            auctionLocations.Clear();
            ObservableCollection <AuctionLocation> als;

            als = new ObservableCollection <AuctionLocation>(AuctionLocationTableData.getAuctionLocations(al, queryItems));
            foreach (AuctionLocation alTemp in als)
            {
                auctionLocations.Add(alTemp);
            }
            Console.WriteLine(auctionLocations.Count);
        }
 public AuctionLocation setAuctionLocation(AuctionLocation al)
 {
     locationId    = al.locationId;
     locationName  = al.locationName;
     address       = al.address;
     availability  = al.availability;
     place         = al.place;
     zipcode       = al.zipcode;
     capacity      = al.capacity;
     contactPerson = al.contactPerson;
     phone         = al.phone;
     email         = al.email;
     //deleteFlag = al.deleteFlag;
     contact         = (blank(phone) ? "" : phone + ", ") + (blank(email) ? "" : email);
     addressComplete = address + "\n" + zipcode;
     return(this);
 }
Exemple #9
0
        public static IList <AuctionLocation> getAuctionLocations(AuctionLocation al, string querySuffix)
        {
            string queryFormatted = "SELECT * FROM location ";

            string[] columns = { "capacity", "locationName", "address", "availability", "place", "contactPerson" };
            object[] vals    = { al.capacity, al.locationName, al.address, al.availability, al.place, al.contactPerson };
            int      count   = -1;

            vals[++count] = (al.capacity == -1) ? null : vals[count];
            vals[++count] = blank(al.locationName) ? null : "%" + vals[count] + "%";
            vals[++count] = blank(al.address) ? null : "%" + vals[count] + "%";
            vals[++count] = blank(al.availability) ? null : "%" + vals[count] + "%";
            vals[++count] = blank(al.place) ? null : "%" + vals[count] + "%";
            vals[++count] = blank(al.contactPerson) ? null : "%" + vals[count] + "%";
            DataTable dataTable = getData(queryFormatted, columns, vals, querySuffix);

            return(dataTable.AsEnumerable().Select(row => new AuctionLocation(row)).ToList());
        }
Exemple #10
0
        public void ClickLocation_Submit(object sender, RoutedEventArgs e)
        {
            Location_ResetLbl();
            AuctionLocation aLocation = dataCxt.aLocation;

            if (aLocation == null)
            {
                lblLocation_ValueNotDefined.Visibility = Visibility.Visible;
                return;
            }
            // No Change In Values
            if (auctionLocation != null && aLocation.toString().Equals(auctionLocation.toString()))
            {
                lblLocation_NoChangeInValue.Visibility = Visibility.Visible;
                return;
            }
            // Mandatory Values Check
            if (!aLocation.mandatoryCheck())
            {
                lblLocation_DefineMandatoryValues.Visibility = Visibility.Visible;
                return;
            }
            // Insert/Update Values
            int selectedIndex = controlFunctions.submitLocation(aLocation, auctionLocationSelectedIndex);

            if (selectedIndex > 0)
            {
                Location_Reset(new AuctionLocation());
                lbxItem_Grid.SelectedIndex     = selectedIndex - 1;
                lblLocation_Success.Visibility = Visibility.Visible;
            }
            else if (selectedIndex > -1)
            {
                lblLocation_ValueNotUpdatedError.Visibility = Visibility.Visible;
            }
            else
            {
                lblLocation_Error.Visibility = Visibility.Visible;
            }
        }
Exemple #11
0
 public void clearCopyItem()
 {
     auctionItemCopy     = null;
     auctionLocationCopy = null;
     controlFunctions.searchEvent();
 }
Exemple #12
0
        /* *************************** CODE RELATED TO AUCTION LOCATION *************************** */

        public void DblClickLocation_Grid(object sender, MouseEventArgs e)
        {
            auctionLocation = (AuctionLocation)lbxLocation_Grid.SelectedItem;
            auctionLocationSelectedIndex = lbxLocation_Grid.SelectedIndex;
            Location_Reset(new AuctionLocation(auctionLocation));
        }
Exemple #13
0
 public static int updateAuctionLocation(AuctionLocation al)
 {
     return(updateRecord("location", columns, values(al), " WHERE locationId=" + al.locationId));
 }
Exemple #14
0
 public static int insertAuctionLocation(AuctionLocation al)
 {
     return(insertRecord("location", columns, values(al)));
 }
Exemple #15
0
 private static object[] values(AuctionLocation al)
 {
     return(new object[] { al.locationName, al.address, al.availability, al.place, al.zipcode, al.capacity, al.contactPerson, al.phone, al.email });
 }
 public AuctionLocation(AuctionLocation al)
 {
     setAuctionLocation(al);
 }