Esempio n. 1
0
 public ModelBLL(ModelDAL Model)
 {           // we can populate the class with values from the Data access layer
     ModelID           = Model.ModelID;
     ModelName         = Model.ModelName;
     FactionID         = Model.FactionID;
     FactionName       = Model.FactionName;
     ModelType         = Model.ModelType;
     PointCost         = Model.PointCost;
     FullCrewPointCost = Model.FullCrewPointCost;
     AttachesToModelID = Model.AttachesToModelID;
     FieldAllowence    = Model.FieldAllowence;
     Speed             = Model.Speed;
     MAT        = Model.MAT;
     RAT        = Model.RAT;
     DEF        = Model.DEF;
     ARM        = Model.ARM;
     RangedRNG1 = Model.RangedRNG1;
     RangedRNG2 = Model.RangedRNG2;
     ROF1       = Model.ROF1;
     ROF2       = Model.ROF2;
     AOE1       = Model.AOE1;
     AOE2       = Model.AOE2;
     RangedPOW1 = Model.RangedPOW1;
     RangedPOW2 = Model.RangedPOW2;
     MeleeRNG1  = Model.MeleeRNG1;
     MeleeRNG2  = Model.MeleeRNG2;
     MeleePOW1  = Model.MeleePOW1;
     MeleePOW2  = Model.MeleePOW2;
 }
        protected void ddMake_SelectedIndexChanged(object sender, EventArgs e)
        {
            btnSearch.Enabled = true;
            ddModel.Items.Clear();
            ddModel.Items.Add(new ListItem("--Select Model--", ""));

            ddModel.AppendDataBoundItems = true;
            ModelDAL     modelDAL = new ModelDAL();
            List <Model> models;

            if (ddMake.SelectedItem.Value != null)
            {
                models = modelDAL.GetModel(Convert.ToInt16(ddMake.SelectedItem.Value));  //to check the value

                ddModel.DataSource     = models;
                ddModel.DataTextField  = "Name";
                ddModel.DataValueField = "Id";
                ddModel.DataBind();
                if (ddModel.Items.Count > 1)
                {
                    ddModel.Enabled = true;
                }
                else
                {
                    ddModel.Enabled = false;
                }
            }
        }
Esempio n. 3
0
        public ModelDAL ToDAL()
        {           //Makest it easy to pass values back to the data access layer
            ModelDAL ReturnValue = new ModelDAL();

            ReturnValue.AttachesToModelID = AttachesToModelID;
            ReturnValue.ModelID           = ModelID;
            ReturnValue.ModelName         = ModelName;
            ReturnValue.FactionID         = FactionID;
            ReturnValue.FactionName       = FactionName;
            ReturnValue.ModelType         = ModelType;
            ReturnValue.PointCost         = PointCost;
            ReturnValue.FullCrewPointCost = FullCrewPointCost;
            ReturnValue.FieldAllowence    = FieldAllowence;
            ReturnValue.Speed             = Speed;
            ReturnValue.MAT        = MAT;
            ReturnValue.RAT        = RAT;
            ReturnValue.DEF        = DEF;
            ReturnValue.ARM        = ARM;
            ReturnValue.RangedRNG1 = RangedRNG1;
            ReturnValue.RangedRNG2 = RangedRNG2;
            ReturnValue.ROF1       = ROF1;
            ReturnValue.ROF2       = ROF2;
            ReturnValue.AOE1       = AOE1;
            ReturnValue.AOE2       = AOE2;
            ReturnValue.RangedPOW1 = RangedPOW1;
            ReturnValue.RangedPOW2 = RangedPOW2;
            ReturnValue.MeleeRNG1  = MeleeRNG1;
            ReturnValue.MeleeRNG2  = MeleeRNG2;
            ReturnValue.MeleePOW1  = MeleePOW1;
            ReturnValue.MeleePOW2  = MeleePOW2;
            return(ReturnValue);
        }
Esempio n. 4
0
        public ActionResult ProductDetail(Guid id)
        {
            VMProductDetail vmProduct = new VMProductDetail();
            Product         product   = ProductDAL.Get(x => x.ProductID == id);

            product.ViewCount++;
            ProductDAL.Update(product);

            ProductModel pmodel = ModelDAL.Get(x => x.ModelID == product.ModelID);

            vmProduct.ProductList = pmodel.Products;
            vmProduct.Product     = product;

            vmProduct.CampaignList = product.Campaigns.Where(x => x.EndingDate > DateTime.Now && x.StartedDate < DateTime.Now).ToList();

            Guid cid = product.ProductModel.Category.SCategory.CategoryID;
            ICollection <Category> subCategoryList = new HashSet <Category>();

            GetSubCategory(cid, ref subCategoryList);

            ICollection <ProductModel> SubModelList = new HashSet <ProductModel>();

            foreach (var cat in subCategoryList)
            {
                foreach (var model in cat.ProductModels)
                {
                    SubModelList.Add(model);
                }
            }
            vmProduct.SubModelList = SubModelList;
            return(View(vmProduct));
        }
Esempio n. 5
0
        public void ModelUpdate(ModelBLL ModelToEdit)
        {
            ModelDAL Model = new ModelDAL();

            Model = ModelToEdit.ToDAL();
            _context.ModelUpdate(Model);
        }
Esempio n. 6
0
        public int ModelCreate(ModelBLL InputModel)
        {
            ModelDAL Model = new ModelDAL();

            Model = InputModel.ToDAL();
            return(_context.ModelCreate(Model));
        }
Esempio n. 7
0
        public ModelBLL ModelFindByID(int ModelID)
        {        //finding a model by it's ID
            ModelBLL ReturnValue = null;
            ModelDAL item        = _context.ModelFindByID(ModelID);

            if (item != null)
            {
                ReturnValue = new ModelBLL(item);
            }
            return(ReturnValue);
        }
Esempio n. 8
0
        // GET api/values



        public IEnumerable <Book> Get()
        {
            //return ModelDAL.GetBooks().ToList();


            return(ModelDAL.GetBooks().Tables[0].AsEnumerable()
                   .Select(dataRow => new Book
            {
                Bookid = dataRow.Field <int>("Bookid"),
                Title = dataRow.Field <string>("Title"),
                Authors = dataRow.Field <string>("Authors"),
                Price = dataRow.Field <int>("Price"),
                Publishers = dataRow.Field <string>("Publisher"),
            }).ToList());
        }