コード例 #1
0
        public bool Find(int staffID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@StaffID", StaffID);
            DB.Execute("sproc_tblStaffData_FilterByStaffID");
            if (DB.Count == 1)
            {
                mStaffID    = Convert.ToString(DB.DataTable.Rows[0]["StaffID"]);
                mFirstName  = Convert.ToString(DB.DataTable.Rows[0]["FirstName"]);
                mLastName   = Convert.ToString(DB.DataTable.Rows[0]["LastName"]);
                mDepartment = Convert.ToString(DB.DataTable.Rows[0]["Department"]);
                mJoinDate   = Convert.ToDateTime(DB.DataTable.Rows[0]["JoinDate"]);
                mActive     = Convert.ToBoolean(DB.DataTable.Rows[0]["Active"]);
            }
            else
            {
                return(false);
            }

            //always return true
            return(true);
        }
コード例 #2
0
        public bool Find(int SupplierID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@SupplierID", SupplierID);
            DB.Execute("sproc_tblSupplier_FilterBySupplierID");
            if (DB.Count == 1)
            {
                mSupplierID   = Convert.ToInt32(DB.DataTable.Rows[0]["SupplierID"]);
                mCompanyName  = Convert.ToString(DB.DataTable.Rows[0]["CompanyName"]);
                mProduct      = Convert.ToString(DB.DataTable.Rows[0]["Product"]);
                mPhoneNumber  = Convert.ToString(DB.DataTable.Rows[0]["PhoneNumber"]);
                mEmailAddress = Convert.ToString(DB.DataTable.Rows[0]["EmailAddress"]);
                mAddress      = Convert.ToString(DB.DataTable.Rows[0]["Address"]);
                mPostCode     = Convert.ToString(DB.DataTable.Rows[0]["PostCode"]);
                return(true);
            }

            else
            {
                return(false);
            }
        }
コード例 #3
0
        public bool Find(int orderID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("OrderID", orderID);

            DB.Execute("sproc_tblOrder_FilterByOrderId"); //filter ID to find what we need

            if (DB.Count == 1)                            //if its found then get all other variables converted
            {
                mOrderID      = Convert.ToInt32(DB.DataTable.Rows[0]["orderID"]);
                mGameTitle    = Convert.ToString(DB.DataTable.Rows[0]["gameTitle"]);
                mTotalPrice   = Convert.ToDecimal(DB.DataTable.Rows[0]["totalPrice"]);
                mDeliveryDate = Convert.ToDateTime(DB.DataTable.Rows[0]["deliveryDate"]);
                mShipment     = Convert.ToBoolean(DB.DataTable.Rows[0]["shipment"]);

                return(true);
            }
            else //else return that ID was not found
            {
                return(false);
            }
        }
コード例 #4
0
        public bool Find(Int32 productNo)
        {
            //create instance of class
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductNo", ProductNo);
            DB.Execute("sproc_tblStock_FilterByProductNo");
            if (DB.Count == 1)
            {
                mProductNo       = Convert.ToInt32(DB.DataTable.Rows[0]["ProductNo"]);
                mQuantityOrdered = Convert.ToInt32(DB.DataTable.Rows[0]["QuantityOrdered"]);
                mQuantityInStock = Convert.ToInt32(DB.DataTable.Rows[0]["QuantityInStock"]);
                mPrice           = Convert.ToDouble(DB.DataTable.Rows[0]["Price"]);
                mDate            = Convert.ToDateTime(DB.DataTable.Rows[0]["Date"]);
                mProductName     = Convert.ToString(DB.DataTable.Rows[0]["ProductName"]);
                //always return true
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #5
0
        // public find method
        public bool Find(int CustomerID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@CustomerID", CustomerID);
            DB.Execute("sproc_tblCustomer_FilterByCustomerID");
            if (DB.Count == 1)
            {
                // copy data
                mCustomerID   = Convert.ToInt32(DB.DataTable.Rows[0]["CustomerID"]);
                mName         = Convert.ToString(DB.DataTable.Rows[0]["Name"]);
                mPhoneNo      = Convert.ToString(DB.DataTable.Rows[0]["PhoneNo"]);
                mAddress      = Convert.ToString(DB.DataTable.Rows[0]["Address"]);
                mTown         = Convert.ToString(DB.DataTable.Rows[0]["Town"]);
                mPostCode     = Convert.ToString(DB.DataTable.Rows[0]["PostCode"]);
                mEmailAddress = Convert.ToString(DB.DataTable.Rows[0]["EmailAddress"]);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #6
0
        public bool Find(int ProductId)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductId", ProductId);
            DB.Execute("sproc_tblStocks_FilterByProductId");

            if (DB.Count == 1)
            {
                mProductId          = Convert.ToInt32(DB.DataTable.Rows[0]["ProductId"]);
                mProductName        = Convert.ToString(DB.DataTable.Rows[0]["ProductName"]);
                mProductDescription = Convert.ToString(DB.DataTable.Rows[0]["ProductDescription"]);
                mInStock            = Convert.ToInt32(DB.DataTable.Rows[0]["InStock"]);
                mLastRestockDate    = Convert.ToDateTime(DB.DataTable.Rows[0]["LastRestockDate"]);
                mStockVariants      = Convert.ToInt32(DB.DataTable.Rows[0]["StockVariants"]);
                mPrice = Convert.ToDecimal(DB.DataTable.Rows[0]["Price"]);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #7
0
        public bool Find(int customerID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@CustomerID", CustomerID);

            DB.Execute("sproc_tblCustomer_FilterByCustomerID");

            if (DB.Count == 1)
            {
                mCustomerID          = Convert.ToInt32(DB.DataTable.Rows[0]["CustomerID"]);
                mCustomerDOB         = Convert.ToDateTime(DB.DataTable.Rows[0]["CustomerDOB"]);
                mCustomerPhoneNumber = Convert.ToInt32(DB.DataTable.Rows[0]["CustomerPhoneNo"]);
                mCustomerFullName    = Convert.ToString(DB.DataTable.Rows[0]["CustomerFullName"]);
                mEmailSubscription   = Convert.ToBoolean(DB.DataTable.Rows[0]["EmailSubscription"]);
                return(true);
            }

            else
            {
                return(false);
            }
        }
コード例 #8
0
        public bool Find(Int32 CalcID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@CalcID", CalcID);
            DB.Execute("sproc_tblCalorieCalc_FilterByCalcID");
            if (DB.Count == 1)
            {
                //copy the data from the db to the private data members
                mCalcID   = Convert.ToInt32(DB.DataTable.Rows[0]["CalcID"]);
                mWeight   = Convert.ToString(DB.DataTable.Rows[0]["Weight"]);
                mExLvl    = Convert.ToString(DB.DataTable.Rows[0]["ExLvl"]);
                mGoalType = Convert.ToString(DB.DataTable.Rows[0]["GoalType"]);

                return(true);
            }
            //if no record was found
            else
            {
                //indicate a problem by returning false
                return(false);
            }
        }
コード例 #9
0
        //find method
        public bool Find(Int32 ReviewerID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ReviewerID", mReviewID);
            DB.Execute("sproc_tblReview_FilterByReviewID");
            if (DB.Count == 1)
            {
                //copy the data from the db to the private data members
                mReviewID    = Convert.ToInt32(DB.DataTable.Rows[0]["ReviewID"]);
                mUsername    = Convert.ToString(DB.DataTable.Rows[0]["Username"]);
                mDescription = Convert.ToString(DB.DataTable.Rows[0]["Description"]);
                mRating      = Convert.ToInt32(DB.DataTable.Rows[0]["Rating"]);
                mRevDate     = Convert.ToString(DB.DataTable.Rows[0]["RevDate"]);
                mSystemName  = Convert.ToString(DB.DataTable.Rows[0]["SystemName"]);
                return(true);
            }
            //if no record found
            else
            {
                return(false);
            }
        }
コード例 #10
0
        //public property for find the Customer ID
        public bool find(int CustomerID)
        {
            //create an instance of the data connection
            clsDataConnection DB = new clsDataConnection();

            //add the parameter for the customer ID to search for
            DB.AddParameter("@CustomerID", CustomerID);
            //execute the stored procedure
            DB.Execute("sproc_tblOrder_FilterByCustomerID");

            //if one record if dound (there should be either one or zero!)
            if (DB.Count == 1)
            {
                //copy the data from the database to the private data members
                mCustomerID      = Convert.ToInt32(DB.DataTable.Rows[0]["CustomerID"]);
                mOrderID         = Convert.ToString(DB.DataTable.Rows[0]["OrderID"]);
                mDateAdded       = Convert.ToDateTime(DB.DataTable.Rows[0]["DateAdded"]);
                mOrderTotalPrice = Convert.ToString(DB.DataTable.Rows[0]["OrderTotalPrice"]);
                mActive          = Convert.ToBoolean(DB.DataTable.Rows[0]["Active"]);
                mSearchProduct   = Convert.ToString(DB.DataTable.Rows[0]["SearchProduct"]);
                mCardName        = Convert.ToString(DB.DataTable.Rows[0]["CardName"]);
                mCardNumber      = Convert.ToString(DB.DataTable.Rows[0]["CardNumber"]);
                mSecurityCode    = Convert.ToString(DB.DataTable.Rows[0]["SecurityCode"]);
                mExpirationDate  = Convert.ToDateTime(DB.DataTable.Rows[0]["ExpirationDate"]);
                mAddress         = Convert.ToString(DB.DataTable.Rows[0]["Address"]);
                mCity            = Convert.ToString(DB.DataTable.Rows[0]["City"]);
                mPostCode        = Convert.ToString(DB.DataTable.Rows[0]["PostCode"]);
                //return that everything worked OK
                return(true);
            }
            //if no record found
            else
            {
                //return false indicating a problem
                return(false);
            }
        }
コード例 #11
0
        public void Update()
        {
            //adds a new record in to the database depending on the values of mThisBooking
            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            //set the parameters for the stored procedure
            DB.AddParameter("@ContractNo", mThisContract.ContractNo);
            DB.AddParameter("@CustomerNo", mThisContract.CustomerNo);
            DB.AddParameter("@PhoneID", mThisContract.PhoneID);
            DB.AddParameter("@ContractType", mThisContract.ContractType);
            DB.AddParameter("@StartDateOfContract", mThisContract.StartDateOfContract);
            DB.AddParameter("@EndDateOfContract", mThisContract.EndDateOfContract);

            //execute the query returning primary key of new record
            DB.Execute("sproc_tblContract_Insert");
        }
コード例 #12
0
        public int Add(string someEmail, string someFirstName, string someLastName, string somePostcode, string someTelephone, string someTitle)
        {
            //adds a new record to the database based on the values of thisTutor
            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            //DB.AddParameter("@OrderNo", mThisOrder.OrderNo);
            DB.AddParameter("@Email", someEmail);
            DB.AddParameter("@FirstName", someFirstName);
            DB.AddParameter("@LastName", someLastName);
            DB.AddParameter("@Postcode", somePostcode);
            DB.AddParameter("@Telephone", someTelephone);
            DB.AddParameter("@Title", someTitle);
            //DB.AddParameter("@AccountNo", someAccountNo);
            //execute the query returning the primary key value
            return(DB.Execute("sproc_tblCustomer_Insert"));
        }
コード例 #13
0
        public int Add()
        {
            //adds a new record to the database based on the values of mThisAddress

            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            DB.AddParameter("@CustomerName", mThisCustomer.CustomerName);
            DB.AddParameter("@CustomerEmail", mThisCustomer.CustomerEmail);
            DB.AddParameter("@CustomerPassword", mThisCustomer.CustomerPassword);
            DB.AddParameter("@CustomerCardNumber", mThisCustomer.CustomerCardNumber);
            DB.AddParameter("@CustomerCreationDate", mThisCustomer.CustomerCreationDate);
            DB.AddParameter("@CustomerAccountStatus", mThisCustomer.CustomerAccountStatus);

            //execute the query returning the primary key value
            return(DB.Execute("sproc_tblCustomer_Insert"));
        }
コード例 #14
0
        public bool Find(Int32 ProductID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductID", ProductID);

            DB.Execute("sproc_tblPCProducts_FilterByProductID");

            if (DB.Count == 1)
            {
                mProductID = Convert.ToInt32(DB.DataTable.Rows[0]["ProductID"]);
                mName      = Convert.ToString(DB.DataTable.Rows[0]["Name"]);
                mCategory  = Convert.ToString(DB.DataTable.Rows[0]["Category"]);
                mPrice     = Convert.ToInt32(DB.DataTable.Rows[0]["Price"]);
                mSupplier  = Convert.ToString(DB.DataTable.Rows[0]["Supplier"]);


                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #15
0
        public bool Find(int StaffID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@StaffID", StaffID);
            DB.Execute("sproc_tblStaff_FilterByStaffID");

            //if a record is found
            if (DB.Count == 1)
            {
                mStaffID      = Convert.ToInt32(DB.DataTable.Rows[0]["StaffID"]);
                mStaffName    = Convert.ToString(DB.DataTable.Rows[0]["StaffName"]);
                mStaffAddress = Convert.ToString(DB.DataTable.Rows[0]["StaffAddress"]);
                mStartDate    = Convert.ToDateTime(DB.DataTable.Rows[0]["StaffStartDate"]);
                mSalary       = Convert.ToDouble(DB.DataTable.Rows[0]["StaffSalary"]);
                mManager      = Convert.ToBoolean(DB.DataTable.Rows[0]["StaffManager"]);
                return(true);
            }
            //if no record is found
            else
            {
                return(false);
            }
        }
コード例 #16
0
        public bool Find(int ProductID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductID", ProductID);

            DB.Execute("sproc_tblSupply_FilterByProductID");

            if (DB.Count == 1)
            {
                mProductID    = Convert.ToInt32(DB.DataTable.Rows[0]["ProductID"]);
                mDeliveryDate = Convert.ToDateTime(DB.DataTable.Rows[0]["DeliveryDate"]);
                mPrice        = Convert.ToDouble(DB.DataTable.Rows[0]["Price"]);
                mName         = Convert.ToString(DB.DataTable.Rows[0]["Name"]);
                mInStock      = Convert.ToBoolean(DB.DataTable.Rows[0]["InStock"]);
                mQuantity     = Convert.ToInt32(DB.DataTable.Rows[0]["Quantity"]);
                return(true);
            }

            else
            {
                return(false);
            }
        }
コード例 #17
0
ファイル: clsOrder.cs プロジェクト: p2528618/EarlyBirdsCo
        public bool Find(int OrderNum)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@OrderNum", OrderNum);
            DB.Execute("sproc_tblOrder_FilterByOrderNum");

            if (DB.Count == 1)
            {
                mOrderNum         = Convert.ToInt32(DB.DataTable.Rows[0]["OrderNum"]);
                mCustomerNum      = Convert.ToInt32(DB.DataTable.Rows[0]["CustomerNum"]);
                mItemNum          = Convert.ToInt32(DB.DataTable.Rows[0]["ItemNum"]);
                mDateFinalised    = Convert.ToDateTime(DB.DataTable.Rows[0]["DateFinalised"]);
                mStandaloneOrSet  = Convert.ToString(DB.DataTable.Rows[0]["StandaloneOrSet"]);
                mQuantity         = Convert.ToInt32(DB.DataTable.Rows[0]["Quantity"]);
                mTotalPrice       = Convert.ToDouble(DB.DataTable.Rows[0]["TotalPrice"]);
                mReadyForShipping = Convert.ToBoolean(DB.DataTable.Rows[0]["ReadyForShipping"]);
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #18
0
ファイル: clsCompany.cs プロジェクト: charliepreece95/CMS
        public Boolean Find(Int32 CompanyID)
        {
            //re-set the connection to the database
            MyDB = new clsDataConnection();
            //pass the parameter to the stored procedure
            MyDB.AddParameter("@CompanyID", CompanyID);
            //execute the stored procedure
            MyDB.Execute("Sproc_tblCompany_FilterByCompanyID");

            //check to see if we found anything 
            if (MyDB.Count == 1)
            {
                //set the private data members with the data from the database
                //private Int32 CompanyID
                companyID = Convert.ToInt32(MyDB.DataTable.Rows[0]["CompanyID"]);
                //private string CompanyName
                companyName = Convert.ToString(MyDB.DataTable.Rows[0]["CompanyName"]);
                //private string Address
                address = Convert.ToString(MyDB.DataTable.Rows[0]["Address"]);
                //private string PostCode
                postcode = Convert.ToString(MyDB.DataTable.Rows[0]["PostCode"]);
                //private Int32 TeleNum
                teleNum = Convert.ToDouble(MyDB.DataTable.Rows[0]["TeleNum"]);
                //private string Email
                email = Convert.ToString(MyDB.DataTable.Rows[0]["Email"]);
                //private string Desc
                desc = Convert.ToString(MyDB.DataTable.Rows[0]["Desc"]);
                //return success
                return true;
            }
            else //CompanyID was invalid
            {
                //return that there was a problem
                return false;
            }            
        }
コード例 #19
0
ファイル: clsStock.cs プロジェクト: Ayaanhsnn/Skeleton
        public bool Find(int StockNo)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@StockNo", StockNo);
            DB.Execute("sproc_tblStock_FilterByStockNo");

            if (DB.Count == 1)
            {
                mStockNo          = Convert.ToInt32(DB.DataTable.Rows[0]["StockNo"]);
                mOrderNo          = Convert.ToInt32(DB.DataTable.Rows[0]["OrderNo"]);
                mStockDescription = Convert.ToString(DB.DataTable.Rows[0]["StockDescription"]);
                mDatePurchased    = Convert.ToDateTime(DB.DataTable.Rows[0]["DatePurchased"]);
                mAvailability     = Convert.ToBoolean(DB.DataTable.Rows[0]["Availability"]);
                mQuantity         = Convert.ToInt32(DB.DataTable.Rows[0]["Quantity"]);


                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #20
0
        public bool Find(int productNo)
        {
            //create instance of class
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductNo", ProductNo);
            DB.Execute("sproc_tblQuality_FilterByProductNo");
            if (DB.Count == 1)
            {
                mProductNo   = Convert.ToInt32(DB.DataTable.Rows[0]["ProductNo"]);
                mDate        = Convert.ToDateTime(DB.DataTable.Rows[0]["Date"]);
                mStaffID     = Convert.ToInt32(DB.DataTable.Rows[0]["StaffID"]);
                mBatchNo     = Convert.ToInt32(DB.DataTable.Rows[0]["BatchNo"]);
                mGrade       = Convert.ToChar(DB.DataTable.Rows[0]["Grade"]);
                mDefective   = Convert.ToBoolean(DB.DataTable.Rows[0]["Defective"]);
                mProductName = Convert.ToString(DB.DataTable.Rows[0]["ProductName"]);
                //always return true
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #21
0
        void PopulateArray(clsDataConnection DB)
        {
            Int32 Index         = 0;
            Int32 RecordCount   = 0;
            Int32 SearchOrderId = 0;



            RecordCount = DB.Count;
            mOrdersList = new List <clsOrders>();
            //While there are records
            while (Index < RecordCount)
            {
                //Create a blank order
                clsOrders Orders = new clsOrders();

                //Read in fields from current record and assign to tblOrder object attributes
                Orders.OrderId          = Convert.ToInt32(DB.DataTable.Rows[Index]["OrderId"]);
                SearchOrderId           = Convert.ToInt32(DB.DataTable.Rows[Index]["OrderId"]);
                Orders.DispatchedStatus = Convert.ToBoolean(DB.DataTable.Rows[Index]["DispatchedStatus"]);
                Orders.DeliveryAddress  = Convert.ToString(DB.DataTable.Rows[Index]["DeliveryAddress"]);
                Orders.OrderDate        = Convert.ToDateTime(DB.DataTable.Rows[Index]["OrderDate"]);

                clsDataConnection DBO = new clsDataConnection();
                DBO.AddParameter("@OrderId", SearchOrderId);
                DBO.Execute("sproc_tblOrderline_Filter_By_OrderId");
                Orders.ItemId      = Convert.ToInt32(DBO.DataTable.Rows[0]["ItemId"]);
                Orders.Quantity    = Convert.ToInt32(DBO.DataTable.Rows[0]["Quantity"]);
                Orders.ProductCode = Convert.ToString(DBO.DataTable.Rows[0]["ProductCode"]);
                Orders.UnitPrice   = Convert.ToDouble(DBO.DataTable.Rows[0]["UnitPrice"]);

                mOrdersList.Add(Orders);

                Index++;
            }
        }
コード例 #22
0
        public bool Find(int ProductID)
        {
            clsDataConnection DB = new clsDataConnection();

            DB.AddParameter("@ProductID", ProductID);
            DB.Execute("sproc_tblStockManagement_FilterByProductID");
            if (DB.Count == 1)
            {
                //set the private data members to the test data value
                mProductID   = Convert.ToInt32(DB.DataTable.Rows[0]["ProductID"]);
                mBookName    = Convert.ToString(DB.DataTable.Rows[0]["BookName"]);
                mAuthorName  = Convert.ToString(DB.DataTable.Rows[0]["AuthorName"]);
                mAvailable   = Convert.ToBoolean(DB.DataTable.Rows[0]["Available"]);
                mPrice       = Convert.ToDouble(DB.DataTable.Rows[0]["Price"]);
                mPublishDate = Convert.ToDateTime(DB.DataTable.Rows[0]["PublishDate"]);
                //always return true
                return(true);
                //throw new NotImplementedException();
            }
            else
            {
                return(false);
            }
        }
コード例 #23
0
        public int Add()
        {
            //add new record basedon values of mThisItem
            //connect to database
            clsDataConnection DB = new clsDataConnection();

            //set parameters for the stored procedure
            DB.AddParameter("@ItemName", mThisItem.ItemName);
            DB.AddParameter("@Price", mThisItem.Price);
            DB.AddParameter("@Material", mThisItem.Material);
            if (mThisItem.LastPurchased == null)
            {
                DB.AddParameter("@LastPurchased", DBNull.Value);
            }
            else
            {
                DB.AddParameter("@LastPurchased", mThisItem.LastPurchased);
            }
            DB.AddParameter("@Quantity", mThisItem.Quantity);
            DB.AddParameter("@InStock", mThisItem.InStock);
            //execute query returning primary key
            return(DB.Execute("sproc_tblStock_Insert"));
        }
コード例 #24
0
        public void Update()
        {
            //connect to database
            clsDataConnection DB = new clsDataConnection();

            //set parameters
            DB.AddParameter("@ShippingId", mThisShipment.ShippingId);
            DB.AddParameter("@ShippingType", mThisShipment.ShippingType);
            DB.AddParameter("@Price", mThisShipment.Price);
            if (mThisShipment.DateOfDispatch == null)
            {
                DB.AddParameter("@DateOfDispatch", DBNull.Value);
            }
            else
            {
                DB.AddParameter("@DateOfDispatch", mThisShipment.DateOfDispatch);
            }
            DB.AddParameter("@Dispatched", mThisShipment.Dispatched);
            //execute stored procedure
            DB.Execute("sproc_tblShipping_Update");
        }
コード例 #25
0
        void PopulateArray(clsDataConnection DB)
        {
            int Index       = 0;
            int RecordCount = 0;

            RecordCount   = DB.Count;
            mProductsList = new List <clsStock>();

            while (Index < RecordCount)
            {
                clsStock AProduct = new clsStock();

                DB.AddParameter("@ProductId", mThisProduct.ProductId);
                DB.AddParameter("@ProductName", mThisProduct.ProductName);
                DB.AddParameter("@ReleaseDate", mThisProduct.ReleaseDate);
                DB.AddParameter("@Price", mThisProduct.Price);
                DB.AddParameter("@InStock", mThisProduct.InStock);
                DB.AddParameter("@ProductDescription", mThisProduct.ProductDescription);

                mProductsList.Add(AProduct);
                Index++;
            }
        }
コード例 #26
0
        public void Update()
        {
            //update an existing record based on the values of thisAddress
            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            DB.AddParameter("StaffNo", mThisStaff.StaffNo);
            DB.AddParameter("FirstName", mThisStaff.FirstName);
            DB.AddParameter("Surname", mThisStaff.Surname);
            DB.AddParameter("Sex", mThisStaff.Sex);
            DB.AddParameter("DOB", mThisStaff.DOB);
            DB.AddParameter("Address1", mThisStaff.Address1);
            DB.AddParameter("Address2", mThisStaff.Address2);
            DB.AddParameter("Address3", mThisStaff.Address3);
            DB.AddParameter("PostCode", mThisStaff.PostCode);
            DB.AddParameter("Email", mThisStaff.Email);
            DB.AddParameter("Phone", mThisStaff.Phone);
            //execute the stored procedure
            DB.Execute("sproc_tblStaff_Update");
        }
コード例 #27
0
        public void Update()
        {
            //update an existing record based on the values of thisPerson
            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            DB.AddParameter("PersonID", mThisPerson.PersonID);
            DB.AddParameter("FirstName", mThisPerson.FirstName);
            DB.AddParameter("LastName", mThisPerson.LastName);
            DB.AddParameter("Address", mThisPerson.Address);
            DB.AddParameter("TeleNo", mThisPerson.TeleNo);
            DB.AddParameter("Email", mThisPerson.Email);
            DB.AddParameter("DoB", mThisPerson.DoB);
            DB.AddParameter("Postcode", mThisPerson.Postcode);
            DB.AddParameter("Town", mThisPerson.Town);
            DB.AddParameter("Country", mThisPerson.Country);
            DB.AddParameter("Username", mThisPerson.Username);
            //execute the stored procedure
            DB.Execute("sproc_tblPerson_Update");
        }
コード例 #28
0
        public void Update()
        {
            //update an existing record based on the values of thiscustomer
            //connect to the database
            clsDataConnection DB = new clsDataConnection();

            //set the parameters for the stored procedure
            DB.AddParameter("@CustomerId", mThisCustomer.customerid);
            DB.AddParameter("@UserName", mThisCustomer.username);
            DB.AddParameter("@Password", mThisCustomer.password);
            DB.AddParameter("@AddressCityName", mThisCustomer.cityname);
            DB.AddParameter("@AddressName", mThisCustomer.addressName);
            DB.AddParameter("@AddressPostCode", mThisCustomer.postcode);
            DB.AddParameter("@AddressStreetName", mThisCustomer.streetname);
            DB.AddParameter("@CardNumber", mThisCustomer.cardnumber);
            DB.AddParameter("@EmailAddress", mThisCustomer.emailaddress);
            DB.AddParameter("@ExpiryDate", mThisCustomer.expirydate);
            DB.AddParameter("@FirstName", mThisCustomer.firstname);
            DB.AddParameter("@LastName", mThisCustomer.lastname);
            DB.AddParameter("@MobileNumber", mThisCustomer.mobilenumber);
            DB.AddParameter("@SecurityCode", mThisCustomer.secruitycode);
            //execute the stored procedure
            DB.Execute("sproc_Customer_Update");
        }
コード例 #29
0
        //{
        //    //var for the index
        //    Int32 Index = 0;
        //    //var to store the record count
        //    Int32 RecordCount = 0;
        //    //object for data connection
        //    clsDataConnection DB = new clsDataConnection();
        //    //executre the stored procedure
        //    DB.Execute("sproc_Customer_SelectAll");
        //    //get the count of the records
        //    RecordCount = DB.Count;
        //    //while there are records to process
        //    while (Index < RecordCount)
        //    {
        //        //create a blank address
        //        clsCustomerDetails AnCustomer = new clsCustomerDetails();
        //        //read in the fields from the current record
        //        AnCustomer.customerid = Convert.ToInt32(DB.DataTable.Rows[Index]["CustomerId"]);
        //        AnCustomer.username = Convert.ToString(DB.DataTable.Rows[Index]["UserName"]);
        //        AnCustomer.password = Convert.ToString(DB.DataTable.Rows[Index]["Password"]);
        //        AnCustomer.firstname = Convert.ToString(DB.DataTable.Rows[Index]["FirstName"]);
        //        AnCustomer.lastname = Convert.ToString(DB.DataTable.Rows[Index]["LastName"]);
        //        AnCustomer.emailaddress = Convert.ToString(DB.DataTable.Rows[Index]["EmailAddress"]);
        //        AnCustomer.mobilenumber = Convert.ToString(DB.DataTable.Rows[Index]["MobileNumber"]);
        //        AnCustomer.cardnumber = Convert.ToString(DB.DataTable.Rows[Index]["CardNumber"]);
        //        AnCustomer.secruitycode = Convert.ToString(DB.DataTable.Rows[Index]["SecurityCode"]);
        //        AnCustomer.expirydate = Convert.ToDateTime(DB.DataTable.Rows[Index]["ExpiryDate"]);
        //        AnCustomer.addressName = Convert.ToString(DB.DataTable.Rows[Index]["AddressName"]);
        //        AnCustomer.streetname = Convert.ToString(DB.DataTable.Rows[Index]["AddressStreetName"]);
        //        AnCustomer.cityname = Convert.ToString(DB.DataTable.Rows[Index]["AddressCityName"]);
        //        AnCustomer.postcode = Convert.ToString(DB.DataTable.Rows[Index]["AddressPostCode"]);
        //        //add the record to the provate data member
        //        mCustomerList.Add(AnCustomer);
        //        //point at the next record
        //        Index++;
        //    }
        //}

        public int Add()
        {
            clsDataConnection DB = new clsDataConnection();
            {
                DB.AddParameter("@UserName", mThisCustomer.username);
                DB.AddParameter("@Password", mThisCustomer.password);
                DB.AddParameter("@AddressCityName", mThisCustomer.cityname);
                DB.AddParameter("@AddressName", mThisCustomer.addressName);
                DB.AddParameter("@AddressPostCode", mThisCustomer.postcode);
                DB.AddParameter("@AddressStreetName", mThisCustomer.streetname);
                DB.AddParameter("@CardNumber", mThisCustomer.cardnumber);
                DB.AddParameter("@EmailAddress", mThisCustomer.emailaddress);
                DB.AddParameter("@ExpiryDate", mThisCustomer.expirydate);
                DB.AddParameter("@FirstName", mThisCustomer.firstname);
                DB.AddParameter("@LastName", mThisCustomer.lastname);
                DB.AddParameter("@MobileNumber", mThisCustomer.mobilenumber);
                DB.AddParameter("@SecurityCode", mThisCustomer.secruitycode);

                return(DB.Execute("sproc_Customer_Add"));
            }
        }
コード例 #30
0
        // this method is to test any staff login credentials off the database of every user
        public Boolean TestLogin(string UserName, string Password)
        {
            // add the parameters to use for this function
            MyDatabase.AddParameter("@UserName", UserName);
            MyDatabase.AddParameter("@Password", Password);

            // execute the stsored procedure
            MyDatabase.Execute("sproc_tblStaff_Login");

            // if a record is found
            if (MyDatabase.Count == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }