示例#1
0
        public DataAccessSearch.ItemImage GetApprovedImageUrl()
        {
            context = new AddisTowerDataContext();
            DataAccessSearch.Sparepart motorcycle = GetApprovedSparepart();
            var selectedMotor = from p in context.ItemImages
                                where p.MotorOrSpareId == motorcycle.Id
                                select p;

            return(selectedMotor.First());
        }
示例#2
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();
            }
        }
示例#3
0
        public void UpdateSparepart(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.Spareparts
                                    where p.Id == Id
                                    select p;

            DataAccessSearch.Sparepart sparepart = selectedSparepart.First();
            sparepart.Number      = Number;
            sparepart.Name        = Name;
            sparepart.Model       = Model;
            sparepart.Approve     = Approve;
            sparepart.Description = Description;
            sparepart.Quantity    = Quantity;

            context.SubmitChanges();
        }
示例#4
0
        public void InsertNewSparepart(Guid CategoryId, string Number, string Name, string Model, bool Approve, string Description, double Quantity)
        {
            context = new AddisTowerDataContext();
            if (Approve)
            {
                UnApproveSelected();
            }
            var sparePartEntity = new DataAccessSearch.Sparepart
            {
                Approve     = Approve,
                CategoryId  = CategoryId,
                Description = Description,
                Id          = Guid.NewGuid(),
                Model       = Model,
                Name        = Name,
                Number      = Number,
                Quantity    = Quantity
            };

            context.Spareparts.InsertOnSubmit(sparePartEntity);
            context.SubmitChanges();
        }
 partial void DeleteSparepart(Sparepart instance);
 partial void UpdateSparepart(Sparepart instance);
 partial void InsertSparepart(Sparepart instance);