Пример #1
0
 public Int32 CheckUser(clsLogin user)
 {
     //add the parameters
     db.AddParameter("@UserName", user.UserName);
     db.AddParameter("@Password", user.Password);
     //execute the stored procedure
     return(db.Execute("sproc_tblUsers_SelectAll"));
 }
Пример #2
0
 public Int32 InsertDevice(clsDevice device)
 {
     //add the parameters
     db.AddParameter("@Manufacture", device.Manufacture);
     db.AddParameter("@Model", device.Model);
     //execute the stored procedure returning the primary key value of the new record
     return(db.Execute("sproc_tblDevice_Insert"));
 }
Пример #3
0
 public Int32 InsertSupplier(clsSupplier supplier)
 {
     //add the parameters
     db.AddParameter("@SupplierName", supplier.Name);
     db.AddParameter("@Address", supplier.Address);
     db.AddParameter("@Town", supplier.Town);
     db.AddParameter("@Postcode", supplier.Postcode);
     db.AddParameter("@ContactName", supplier.ContactName);
     db.AddParameter("@ContactNumber", supplier.ContactNumber);
     //execute the stored procedure returning the primary key value of the new record
     return(db.Execute("sproc_tblSupplier_Insert"));
 }
Пример #4
0
 public Int32 InsertProductRecord(clsProductRecord productRecord)
 {
     //add the parameters
     db.AddParameter("@SerialNo_IMEI", productRecord.SerialNo_IMEI);
     db.AddParameter("@SupplierId", productRecord.SupplierId);
     db.AddParameter("@DeviceId", productRecord.DeviceId);
     db.AddParameter("@Price", productRecord.Price);
     db.AddParameter("@DateBought", productRecord.DateBought);
     db.AddParameter("@Description", productRecord.Description);
     //db.AddParameter("@Status", productRecord.Status);
     db.AddParameter("@Returned", productRecord.Returned);
     //execute the stored procedure returning the primary key value of the new record
     return(db.Execute("sproc_tblProductRecord_Insert"));
 }
Пример #5
0
        public List <clsSaleSearchSP> SearchList(string SN)
        {
            //create an array list of type lstDevices
            List <clsSaleSearchSP> lstSaleSearch = new List <clsSaleSearchSP>();
            //var to store the count of records
            Int32 RecordCount;
            //var to store the index for the loop
            Int32 Index = 0;

            //add the parameters
            db.AddParameter("@SN", SN);
            //execute the stored procedure
            db.Execute("SaleSearchProcedure");

            RecordCount = db.Count;
            //keep looking till all records are processed
            while (Index < RecordCount)
            {
                //create a blank device
                clsSaleSearchSP SaleSearch = new clsSaleSearchSP();
                //copy the data from the table to the RAM
                SaleSearch.ID         = Convert.ToInt32(db.DataTable.Rows[Index]["ProductId"]);
                SaleSearch.SN         = Convert.ToString(db.DataTable.Rows[Index]["SerialNo_IMEI"]);
                SaleSearch.Model      = Convert.ToString(db.DataTable.Rows[Index]["Model"]);
                SaleSearch.Price      = Convert.ToDouble(db.DataTable.Rows[Index]["Price"]);
                SaleSearch.Returned   = Convert.ToBoolean(db.DataTable.Rows[Index]["Returned"]);
                SaleSearch.DateBought = Convert.ToDateTime(db.DataTable.Rows[Index]["DateBought"]);
                //add the blank page to the array list
                lstSaleSearch.Add(SaleSearch);
                //increase the index
                Index++;
            }
            //return the list as the return value of the function
            return(lstSaleSearch);
        }
Пример #6
0
 public Int32 InsertRepair(clsRepair repair)
 {
     //add the parameters
     db.AddParameter("@CustomerName", repair.CustomerName);
     db.AddParameter("@CustomerPhoneNo", repair.CustomerPhoneNo);
     db.AddParameter("@Date", repair.Date);
     db.AddParameter("@PhoneModel", repair.PhoneModel);
     db.AddParameter("@SerialNo_IMEI", repair.SerialNo_IMEI);
     db.AddParameter("@Fault", repair.Fault);
     db.AddParameter("@Password", repair.Password);
     db.AddParameter("@Cost", repair.Cost);
     db.AddParameter("@Deposit", repair.Deposit);
     db.AddParameter("@Balance", repair.Balance);
     db.AddParameter("@CollectionDate", repair.CollectionDate);
     db.AddParameter("@Comment", repair.Comment);
     //execute the stored procedure returning the primary key value of the new record
     return(db.Execute("sproc_tblRepair_Insert"));
 }
Пример #7
0
        public int AddSaleLine(Int32 SaleID, Int32 ProductID, double Price, string Notes)
        {
            clsDBConnection db = new clsDBConnection();

            //add the parameters
            db.AddParameter("@saleID", SaleID);
            //add the parameters
            db.AddParameter("@productID", ProductID);
            //add the parameters
            db.AddParameter("@price", Price);
            //add the parameters
            db.AddParameter("@notes", Notes);
            //execute the stored procedure
            int Result = db.Execute("AddSaleLineProcedure");


            return(Result);
        }
Пример #8
0
        public int AddSale(DateTime Date, string PaymentMethod, double TotalAmount)
        {
            //add the parameters
            db.AddParameter("@date", Date.ToString("yyyyMMdd"));
            //add the parameters
            db.AddParameter("@paymentmethod", PaymentMethod);
            //add the parameters
            db.AddParameter("@TotalAmount", TotalAmount);
            //execute the stored procedure
            db.Execute("AddSaleProcedure");
            int PK    = 0;
            int Index = 0;

            while (Index < db.Count)
            {
                //copy the data from the table to the RAM
                PK = Convert.ToInt32(db.DataTable.Rows[Index]["SaleId"]);

                Index++;
            }
            //return the Primary Key as the return value of the function
            return(PK);
        }