Example #1
0
        public List <DataAccessSearch.Sparepart> PopulateAllSparepart()
        {
            context = new AddisTowerDataContext();
            var list = from p in context.Spareparts
                       select p;

            return(list.ToList());
        }
        public List <DataAccessSearch.MotorcycleCategory> PopulateAllMotorcycleCategoy()
        {
            context = new AddisTowerDataContext();
            var list = from p in context.MotorcycleCategories
                       select p;

            return(list.ToList());
        }
        public DataAccessSearch.Motorcycle GetApprovedMotor()
        {
            context = new AddisTowerDataContext();
            var approvedMotor = from p in context.Motorcycles
                                where p.Approve == true
                                select p;

            return(approvedMotor.First());
        }
        public List <DataAccessSearch.Motorcycle> PopulateAllMotorcycleByCategoryId(Guid CategoryId)
        {
            context = new AddisTowerDataContext();
            var list = from p in context.Motorcycles
                       where p.CategoryId == CategoryId
                       select p;

            return(list.ToList());
        }
Example #5
0
        public DataAccessSearch.Sparepart GetApprovedSparepart()
        {
            context = new AddisTowerDataContext();
            var approvedSpare = from p in context.Spareparts
                                where p.Approve == true
                                select p;

            return(approvedSpare.First());
        }
Example #6
0
        public List <DataAccessSearch.Sparepart> PopulateAllSparepartByCategoryId(Guid CategoryId)
        {
            context = new AddisTowerDataContext();
            var list = from p in context.Spareparts
                       where p.CategoryId == CategoryId
                       select p;

            return(list.ToList());
        }
        public DataAccessSearch.ItemImage GetApprovedImageUrl()
        {
            context = new AddisTowerDataContext();
            DataAccessSearch.Motorcycle motorcycle = GetApprovedMotor();
            var selectedMotor = from p in context.ItemImages
                                where p.MotorOrSpareId == motorcycle.Id
                                select p;

            return(selectedMotor.First());
        }
 public void InsertMotorcycleCategory(string Name, string Remark)
 {
     DataAccessSearch.MotorcycleCategory motorcycleCategory = new DataAccessSearch.MotorcycleCategory
     {
         Id     = Guid.NewGuid(),
         Name   = Name,
         Remark = Remark
     };
     context = new AddisTowerDataContext();
     context.MotorcycleCategories.InsertOnSubmit(motorcycleCategory);
     context.SubmitChanges();
 }
Example #9
0
        public void InsertSparepartCategory(string Name, string Remark)
        {
            context = new AddisTowerDataContext();
            var sparepartCategoryEntity = new DataAccessSearch.SparepartCategory
            {
                Id     = Guid.NewGuid(),
                Name   = Name,
                Remark = Remark
            };

            context.SparepartCategories.InsertOnSubmit(sparepartCategoryEntity);
            context.SubmitChanges();
        }
        public void UpdateMotorcycle(Guid Id, string Number, string Name, string Model, bool Approve, string Description, double Quantity)
        {
            context = new AddisTowerDataContext();
            if (Approve)
            {
                UnApproveSelected();
            }
            var selectedSparepart = from p in context.Motorcycles
                                    where p.Id == Id
                                    select p;

            DataAccessSearch.Motorcycle motorcycle = selectedSparepart.First();
            motorcycle.Number      = Number;
            motorcycle.Name        = Name;
            motorcycle.Model       = Model;
            motorcycle.Approve     = Approve;
            motorcycle.Description = Description;
            motorcycle.Quantity    = Quantity;

            context.SubmitChanges();
        }
        public void InsertNewMotorcycle(Guid CategoryId, string Number, string Name, string Model, bool Approve, string Description, double Quantity)
        {
            context = new AddisTowerDataContext();
            if (Approve)
            {
                UnApproveSelected();
            }
            var motorCycleEntity = new DataAccessSearch.Motorcycle
            {
                Approve     = Approve,
                CategoryId  = CategoryId,
                Description = Description,
                Id          = Guid.NewGuid(),
                Model       = Model,
                Name        = Name,
                Number      = Number,
                Quantity    = Quantity
            };

            context.Motorcycles.InsertOnSubmit(motorCycleEntity);
            context.SubmitChanges();
        }
 public void SaveImage(DataAccessSearch.ItemImage itemImageEntity)
 {
     context = new AddisTowerDataContext();
     context.ItemImages.InsertOnSubmit(itemImageEntity);
     context.SubmitChanges();
 }