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();
 }
        public void UnApproveSelected()
        {
            var selectedApproved = from p in context.Motorcycles
                                   where p.Approve == true
                                   select p;

            if (!selectedApproved.Equals(null))
            {
                DataAccessSearch.Motorcycle motorcycle = selectedApproved.First();
                motorcycle.Approve = false;
                context.SubmitChanges();
            }
        }
Exemple #3
0
        public void UnApproveSelected()
        {
            var selectedApproved = from p in context.Spareparts
                                   where p.Approve == true
                                   select p;

            if (!selectedApproved.Equals(null))
            {
                DataAccessSearch.Sparepart sparepart = selectedApproved.First();
                sparepart.Approve = false;
                context.SubmitChanges();
            }
        }
Exemple #4
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();
 }