Ejemplo n.º 1
0
        // 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);
        }
Ejemplo n.º 2
0
 private void Location_Reset(AuctionLocation al)
 {
     dataCxt = new DataCxt {
         aItem = dataCxt.aItem, aLocation = al
     };
     this.DataContext = dataCxt;
     Location_ResetLbl();
 }
Ejemplo n.º 3
0
 public void ClickLocation_Copy(object sender, RoutedEventArgs e)
 {
     if (auctionLocation != null)
     {
         auctionLocationCopy = new AuctionLocation(auctionLocation);
         Location_Reset(new AuctionLocation());
     }
 }
Ejemplo n.º 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;
 }
Ejemplo n.º 5
0
 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);
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 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);
 }
Ejemplo n.º 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());
        }
Ejemplo n.º 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;
            }
        }
Ejemplo n.º 11
0
 public void clearCopyItem()
 {
     auctionItemCopy     = null;
     auctionLocationCopy = null;
     controlFunctions.searchEvent();
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 13
0
 public static int updateAuctionLocation(AuctionLocation al)
 {
     return(updateRecord("location", columns, values(al), " WHERE locationId=" + al.locationId));
 }
Ejemplo n.º 14
0
 public static int insertAuctionLocation(AuctionLocation al)
 {
     return(insertRecord("location", columns, values(al)));
 }
Ejemplo n.º 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 });
 }
Ejemplo n.º 16
0
 public AuctionLocation(AuctionLocation al)
 {
     setAuctionLocation(al);
 }