Ejemplo n.º 1
0
        public List <CategoryDropdownlist> SelectDropdownData()
        {
            List <CategoryDropdownlist> list;

            CategoryDAO.SelectSimpleData(out list);
            return(list);
        }
Ejemplo n.º 2
0
        //
        // GET: /Product/
        public ActionResult Index(string metatitle, int id, int page = 1, int pageSize = 4)
        {
            var category = new CategoryDAO().ViewDetail(id);

            ViewBag.Category = category;

            var totalRecord = 0;
            var model       = new ProductDAO().GetAllProductByCategoryID(id, ref totalRecord, page, pageSize);

            ViewBag.Total = totalRecord; // tổng số sản phẩm
            ViewBag.Page  = page;        // số trang hiện tại

            int maxPage   = 5;           // tổng số trang có thể thấy
            int totalPage = 0;

            totalPage         = (int)Math.Ceiling((double)(totalRecord / pageSize));
            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;

            ViewBag.First    = 1;
            ViewBag.Last     = totalPage;
            ViewBag.Next     = page + 1;
            ViewBag.Previous = page - 1;

            TempData["Title"] = metatitle.ToUpper();
            return(View(model));
        }
        // GET: CarManufacturerClient
        public ActionResult Index(int id)
        {
            var listHX = new CarManufacturerDAO().ListOf();

            ViewBag.HX = listHX;

            var listTL = new CategoryDAO().ListOf();

            ViewBag.TL = listTL;

            var listPK = new CylinderCapacityDAO().ListOf();

            ViewBag.PK = listPK;

            var listCL = new ColorDAO().ListOf();

            ViewBag.CL = listCL;

            var listNews = new NewsDAO().ListAll();

            ViewBag.New = listNews;

            var listNewPr = new ProductDAO().ListNewPro();

            ViewBag.Product = listNewPr;

            var listAllPr = new ProductDAO().ListByIDCar(id);

            ViewBag.ALLPro = listAllPr;

            return(View());
        }
Ejemplo n.º 4
0
        public PartialViewResult Category()
        {
            ViewBag.DanhMuc = new CategoryProductDAO().ListCategoryProduct();
            var model = new CategoryDAO().ListAllCatogory();

            return(PartialView(model));
        }
Ejemplo n.º 5
0
        public ActionResult <List <Category> > Index()
        {
            CategoryDAO     dao           = new CategoryDAO(_db);
            List <Category> allCategories = dao.GetAll();

            return(allCategories);
        }
Ejemplo n.º 6
0
        private static bool Operation1()
        {
            var biz = new CategoryDAO(ConfigHelper.GetConnString("test"));
            try
            {
                TransactionOptions option = new TransactionOptions();
                option.IsolationLevel = IsolationLevel.ReadUncommitted;
                using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, option))
                {

                    Category cate = new Category();
                    cate.Code = "test3";
                    cate.DbName = "test3";

                    int id = biz.InsertWithId(cate);

                    cate.Code = "test4";//"TCPKData_NingX";
                    cate.DbName = "test4";
                    biz.Insert(cate);
                    scope.Complete();
                }
                return true;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                return false;
            }
        }
        public ActionResult UpdateCategory(Category model)
        {
            var dao = new CategoryDAO();

            if (ModelState.IsValid)
            {
                UserLogin modifiedby = (UserLogin)Session["USER_SESSION"];
                model.ModifiedBy = modifiedby.UserName;
                string metatitle = CastString.Cast(model.Name);
                model.MetaTitle = metatitle;
                bool result = dao.UpdateCategory(model);
                if (result)
                {
                    return(RedirectToAction("Index", "Category"));
                }
                else
                {
                    ModelState.AddModelError("UpdateCategoryError", "Chưa cập nhật được ");
                }
            }
            else
            {
                ModelState.AddModelError("UpdateCategoryError", "Thông tin không hợp lệ");
            }
            return(View(model));
        }
Ejemplo n.º 8
0
        public ActionResult Create()
        {
            var listCategory = new CategoryDAO().GetListAll();

            ViewBag.ListCategory = listCategory;
            return(View());
        }
Ejemplo n.º 9
0
        public ActionResult Register(Account account, string Password_Retype)
        {
            AccountDAO accountDao = new AccountDAO();

            if (Password_Retype.Equals(account.Password))
            {
                bool result = accountDao.AddNewAccount(account);
                if (result == true)
                {
                    this.Session.Clear();
                    this.Session.Add("username", account.Username);
                    this.Session.Add("role", account.Role);
                    return(RedirectToAction("Home", "HomePage"));
                }
                TempData["register-error"] = "Tài khoản đã được sử dụng";
            }
            else
            {
                TempData["register-error"] = "Mật khẩu không giống nhau";
            }
            FilmDAO       fiDao    = new FilmDAO();
            CategoryDAO   cDao     = new CategoryDAO();
            RegisterModel register = new RegisterModel
            {
                Account      = account,
                TopFilm      = fiDao.GetTopFilm(5),
                NewFilm      = fiDao.GetTopNewestFilm(5),
                ListCategory = cDao.GetAllCategory(),
            };

            return(View(register));
        }
Ejemplo n.º 10
0
        public ActionResult Category(String namecategory)
        {
            CategoryDAO categoryDao = new CategoryDAO();
            var         b           = categoryDao.Add(namecategory);
            var         categorys   = categoryDao.List();


            Messenger messenger = new Messenger();

            if (b == 1)
            {
                messenger.Code = 1;
                messenger.Mss  = "Thêm mới thành công";
            }
            else
            {
                messenger.Code = 0;
                messenger.Mss  = "Thêm mới thất bại";
            }

            ViewBag.Mss        = messenger;
            ViewBag.Categories = categorys;


            return(View());
        }
Ejemplo n.º 11
0
        public Boolean EditCategory(int id, String name)
        {
            CategoryDAO categoryDao = new CategoryDAO();
            var         b           = categoryDao.Edit(id, name);

            return(b);
        }
Ejemplo n.º 12
0
        public async Task GetCate_Success()
        {
            // get MOCK
            var mapper = MapperMock.Get();
            // initial mock data
            var dbContext = _fixture.Context;

            dbContext.TypeProducts.Add(new TypeProduct {
                Name = "Product Type"
            });
            var category = new Category {
                Name = "Product Category", TypeProductId = 1
            };

            dbContext.Categories.Add(category);
            await dbContext.SaveChangesAsync();

            // create dependency
            var cateDao     = new CategoryDAO(dbContext);
            var cateService = new CategoryService(cateDao, mapper);
            // test
            var result = cateService.GetList(1);

            Assert.NotEmpty(result);
        }
Ejemplo n.º 13
0
 public ActionResult PostPanel()
 {
     ViewBag.Categories = CategoryDAO.CategoryList();
     ViewBag.Users      = UserDAO.UserList();
     ViewBag.Posts      = PostDAO.PostList();
     return(View(PostDAO.PostList()));
 }
Ejemplo n.º 14
0
        public ActionResult Create(Post post, int?Category)
        {
            ViewBag.Category = new SelectList(CategoryDAO.CategoryList(), "CategoryId", "Name");
            post.Category    = CategoryDAO.FindId(Category);
            post.Status      = 0;
            post.Date        = DateTime.Now;
            post.User        = UserDAO.FindId(Sessao.user.UserId);

            if (Category != null)
            {
                if (PostDAO.CreatePost(post))
                {
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError("", "Já existe um post com o titulo " + post.Title);
                    return(View(post));
                }
            }
            else
            {
                ModelState.AddModelError("", "Por favor, selecione uma categoria!");
                return(View(post));
            }
        }
Ejemplo n.º 15
0
        public ActionResult Edit(Category catEdited)
        {
            Category catOriginal = CategoryDAO.FindId(catEdited.CategoryId);

            catOriginal.Name   = catEdited.Name;
            catOriginal.Date   = DateTime.Now;
            catOriginal.Status = catEdited.Status;

            if (ModelState.IsValid)
            {
                if (CategoryDAO.EditCategory(catOriginal))
                {
                    return(RedirectToAction("CategoryPanel", "Category"));
                }
                else
                {
                    ModelState.AddModelError("", "Não é possivel editar uma categoria com um nome já existente");
                    return(View(catOriginal));
                }
            }
            else
            {
                return(View(catOriginal));
            }
        }
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            Category c = new Category();

            c.Name = txtName.Text.Trim();
            CategoryDAO.Insert(c);
        }
Ejemplo n.º 17
0
        public ActionResult Product()
        {
            var pubSession = PubDAO.Search(UserSession.ReturnPubId(null));

            if (pubSession == null)
            {
                return(RedirectToAction("Logout", "User"));
            }
            ViewBags(pubSession);
            ViewBag.ProductList = ProductDAO.ReturnList(pubSession.Id);
            ViewBag.Categories  = new MultiSelectList(CategoryDAO.ReturnList(), "Id", "Name");
            try
            {
                var product = (Product)System.Web.HttpContext.Current.Session["product"];
                if (product != null)
                {
                    ViewBag.Alter = "Yes";
                    return(View(product));
                }
            }
            catch (Exception ex) { ModelState.AddModelError("", $"Error - {ex.Message}"); }

            ViewBag.Alter = "No";
            return(View());
        }
Ejemplo n.º 18
0
        // lay ra duoc nhom nuoc
        public void LoadCategory()
        {
            List <Category> categories = CategoryDAO.GetCategory();

            cbChooseType.DataSource    = categories;
            cbChooseType.DisplayMember = "Name";
        }
Ejemplo n.º 19
0
 private void setActions()
 {
     //Botón para volver
     closeAction1.Visible    = true;
     closeAction1.Activated += (sender, e) => close();
     //Botón añadir
     addAction.Activated += (sender, e) => {
         CategoryWindow categoryWindow = new CategoryWindow(new Category(), this);
         categoryWindow.Show();
         categoryWindow.Destroyed += (innerSender, innerE) => fillTree();
     };
     //Botón editar
     editAction.Activated += (sender, e) => {
         Category       selected       = (Category)TreeViewHelper.GetSelected(tvCategories);
         CategoryWindow categoryWindow = new CategoryWindow(selected, this);
         categoryWindow.Destroyed += (innerSender, innerE) => fillTree();
     };
     //Botón eliminar
     removeAction.Activated += (sender, e) => {
         Category selected = (Category)TreeViewHelper.GetSelected(tvCategories);
         CategoryDAO.Delete(selected);
         fillTree();
     };
     //Botón refrescar
     refreshAction.Activated += (sender, e) => fillTree();
     //Doble click en una fila
     tvCategories.RowActivated += (o, args) => {
         Category       selected       = (Category)TreeViewHelper.GetSelected(tvCategories);
         CategoryWindow categoryWindow = new CategoryWindow(selected, this);
         categoryWindow.Destroyed += (innerSender, innerE) => fillTree();
     };
     //Ha cambiado la fila seleccionada
     tvCategories.Selection.Changed += (sender, e) => refreshActions();
 }
Ejemplo n.º 20
0
        public ActionResult Category(long id, int pageIndex = 1, int pageSize = 1)
        {
            var category = new CategoryDAO().ViewDetail(id);

            ViewBag.Category = category;
            // tổng số dòng
            int totalRecords = 0;
            var model        = new ProductDAO().lstByCategoryId(id, ref totalRecords, pageIndex, pageSize);

            ViewBag.Total = totalRecords;
            ViewBag.Page  = pageIndex;

            //chỉ cho tối đa 5 trang thôi
            int maxPage = 5;
            // tổng số trang, mỗi trang có tối đa 2 dònng.
            // làm tròn lại
            int totalPage = (int)Math.Ceiling((double)(totalRecords / pageSize));

            ViewBag.TotalPage = totalPage;
            ViewBag.MaxPage   = maxPage;
            ViewBag.First     = 1;
            ViewBag.Last      = totalPage;
            ViewBag.Next      = pageIndex + 1;
            ViewBag.Prev      = pageIndex - 1;


            return(View(model));
        }
Ejemplo n.º 21
0
 public HomeController()
 {
     _categoryDAO            = new CategoryDAO();
     _employeeDAO            = new EmployeeDAO();
     _roleDAO                = new RoleDAO();
     _notificationChannelDAO = new NotificationChannelDAO();
 }
Ejemplo n.º 22
0
        public ActionResult CreateCategory(Category c)
        {
            CategoryDAO categoryDAO = new CategoryDAO();

            categoryDAO.Create(c);
            return(RedirectToAction("GetAllCategory"));
        }
Ejemplo n.º 23
0
        public ActionResult DeleteCategoryById(int id)
        {
            CategoryDAO categoryDAO = new CategoryDAO();

            categoryDAO.Delete(id);
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 24
0
        // GET: Backend/MemberShipSetting
        public ActionResult List(long SiteID, long MenuID)
        {
            ViewBag.SiteID      = SiteID;
            ViewBag.MenuID      = MenuID;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID);

            List <CategoryModels> identity_items = CategoryDAO.GetItems(IdentityType);

            if (identity_items != null && identity_items.Count() > 0)
            {
                ViewBag.ListIdentity = identity_items;
            }
            else
            {
                //20181025 nina 身分沒有資料時,新增一般會員
                CategoryModels category = new CategoryModels()
                {
                    Type           = IdentityType,
                    Title          = "一般會員",
                    ShowStatus     = true,
                    MemberSession  = (int)MemberSession.限制,
                    PresetIdentity = (int)PresetIdentity.一般會員
                };
                CategoryDAO.SetItem(category);
                ViewBag.ListIdentity = CategoryDAO.GetItems(IdentityType);
            }

            List <CategoryModels> favority_items = CategoryDAO.GetItems(FavorityType);

            ViewBag.ListFavoity = favority_items;
            return(View());
        }
Ejemplo n.º 25
0
        public ActionResult Edit(long SiteID, long MenuID, CategoryModels model)
        {
            if (!string.IsNullOrWhiteSpace(model.Image))
            {
                WorkV3.Models.ResourceImagesModels imgModel = JsonConvert.DeserializeObject <WorkV3.Models.ResourceImagesModels>(model.Image);
                if (imgModel.ID == 0)
                { // 新上傳的圖片
                    HttpPostedFileBase postedFile = Request.Files["fImage"];
                    if (postedFile == null || postedFile.ContentLength == 0)
                    {
                        model.Image = string.Empty;
                    }
                    else
                    {
                        model.Image = Golbal.UpdFileInfo.SaveFilesByMenuID(postedFile, SiteID, MenuID);
                    }
                }
                else
                {
                    model.Image = imgModel.Img;
                }
            }

            if (model.PresetIdentity == (int)PresetIdentity.一般會員)
            {
                model.MemberSession = (int)MemberSession.限制;
            }

            ViewBag.SiteID      = SiteID;
            ViewBag.MenuID      = MenuID;
            ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID);
            CategoryDAO.SetItem(model);
            ViewBag.Exit = true;
            return(View(model));
        }
        public ActionResult Update(int id)
        {
            var cate = new CategoryDAO().GetCategoryByID(id);

            SetViewBag(cate.parentID);
            return(View(cate));
        }
Ejemplo n.º 27
0
 public ActionResult FavorityEdit(long SiteID, long MenuID, CategoryModels model, HttpPostedFileBase fIcon, string fIconBase64)
 {
     ViewBag.SiteID      = SiteID;
     ViewBag.MenuID      = MenuID;
     ViewBag.UploadVPath = UpdFileInfo.GetVPathByMenuID(SiteID, MenuID);
     if (string.IsNullOrEmpty(model.Icon))
     {
         model.Icon = string.Empty;
     }
     else
     {
         ImageModel imgModel = JsonConvert.DeserializeObject <ImageModel>(model.Icon);
         if (imgModel.ID == 0)
         {
             if (fIcon == null || fIcon.ContentLength == 0)
             {
                 model.Icon = string.Empty;
             }
             else
             {
                 string fileName = Golbal.UpdFileInfo.SaveFilesByMenuID(fIcon, SiteID, MenuID, fIconBase64);
                 imgModel.ID  = 1;
                 imgModel.Img = fileName;
                 model.Icon   = JsonConvert.SerializeObject(imgModel);
             }
         }
     }
     CategoryDAO.SetItem(model);
     ViewBag.Exit = true;
     return(View(model));
 }
Ejemplo n.º 28
0
        // GET: Admin/Category
        public ActionResult Index(int page = 1, int pagesize = 5)
        {
            var accDao = new CategoryDAO();
            var model  = accDao.ListCategoryAll(page, pagesize);

            return(View(model));
        }
Ejemplo n.º 29
0
        private void txtID_TextChanged_1(object sender, EventArgs e)
        {
            if (dtgvDrinks.SelectedCells.Count > 0)
            {
                int id = (int)dtgvDrinks.SelectedCells[0].OwningRow.Cells["IDCategory"].Value;

                Category category = CategoryDAO.GetCategoryByID(id);

                cboType.SelectedItem = category;

                int index = -1;
                int i     = 0;
                foreach (Category item in cboType.Items)
                {
                    if (item.ID == category.ID)
                    {
                        index = i;
                        break;
                    }
                    i++;
                }

                cboType.SelectedIndex = index;
            }
        }
Ejemplo n.º 30
0
        public ActionResult Setting(long siteId, long menuId)
        {
            ViewBag.Menu = MenusDAO.GetInfo(siteId, menuId);

            IEnumerable <ArticleTypesModels> types = ArticleTypesDAO.GetIssueItems(menuId);

            ViewBag.Types = types;

            //ViewBag.ListCards = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article").Where(c => c.ID != menuId);
            ViewBag.ListCards    = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListCards2   = WorkV3.Models.DataAccess.MenusDAO.GetListCards("Article"); // shan 20180102 依 CC 要求修改為本單元亦列入, 且預設勾選
            ViewBag.ListIdentity = CategoryDAO.GetIssueItems(IdentityType);

            ViewBag.SiteID    = siteId;
            ViewBag.MenuID    = menuId;
            ViewBag.UploadUrl = WorkV3.Golbal.UpdFileInfo.GetVPathByMenuID(siteId, menuId).TrimEnd('/') + "/";

            ViewBag.MemberRegSet = MemberShipRegSetDAO.GetItem(siteId);

            List <WorkV3.ViewModels.CommentType> ReplyItemList = WorkV3.ViewModels.CommentTypeLibs.GetCommitTypeList();

            ViewBag.ReplyItemList = ReplyItemList;

            WorkV3.Models.ArticleSettingModels item = WorkV3.Models.DataAccess.ArticleSettingDAO.GetItem(menuId);
            if (item.Types == "all")
            {
                item.Types = string.Join(",", types.Select(t => t.ID));
            }

            return(View(item));
        }
Ejemplo n.º 31
0
        public ActionResult DeleteCategory(String id)
        {
            CategoryDAO categoryDao = new CategoryDAO();
            var         b           = categoryDao.Delete(Convert.ToInt32(id));

            return(Content(b.ToString()));
        }
Ejemplo n.º 32
0
 public void BeforeEachTest()
 {
     //create DAOs
     items = new ItemDAO();
     users = new UserDAO();
     comments = new CommentDAO();
     categories = new CategoryDAO();
 }
Ejemplo n.º 33
0
        protected void btExcluir_OnClick(object sender, EventArgs e)
        {
            CategoryDAO objSave = new CategoryDAO(IdUserSession);
            string sError = string.Empty;
            List<Category> listCategoria;
            BuscarItensSelecionado(out listCategoria);

            foreach (Category pCategoria in listCategoria)
            {
                objSave.Delete(pCategoria.Id, out sError);
                if (TrataMsgPrincipal(sError))
                    return;
            }

            btPesquisar_Onclick(sender, e);
        }
Ejemplo n.º 34
0
        protected void btGravar_OnClick(object sender, EventArgs e)
        {
            string sError = string.Empty;
            CategoryDAO objSave = new CategoryDAO(IdUserSession);
            Category objCategoria = new Category();

            objCategoria.Id = int.Parse(hfIdCategoriaSelecionada.Value);
            objCategoria.Description = ptxtDescricao.Text;
            objCategoria.IsBlock = (pddlStatus.SelectedItem.Value.Equals("0") ? false : true);
            objCategoria.User = new UserDAO().FindByPK(IdUserSession, out sError);

            if (TrataMsgPopup(sError))
                return;

            objSave.Save(objCategoria, out sError);
            if (TrataMsgPopup(sError))
                return;

            popup_GestaoDeCategoria.Hide();
            btPesquisar_Onclick(sender, e);
            LimparPopup();
        }
Ejemplo n.º 35
0
 public CategoryBUS()
 {
     cateDao = new CategoryDAO();
 }
Ejemplo n.º 36
0
        /// <summary> Create test data for our domain model.
        /// 
        /// </summary>
        /// <throws>  Exception </throws>
        protected internal virtual void InitData()
        {
            CreateDatabase();

            // Prepare DAOS
            CategoryDAO catDAO = new CategoryDAO();
            UserDAO userDAO = new UserDAO();
            ItemDAO itemDAO = new ItemDAO();
            CommentDAO commentDAO = new CommentDAO();

            // Categories
            cars = new Category("Cars");
            carsLuxury = new Category("Luxury Cars");
            cars.AddChildCategory(carsLuxury);
            carsSUV = new Category("SUVs");
            cars.AddChildCategory(carsSUV);
            catDAO.MakePersistent(cars);

            // Users
            u1 = new User("Christian", "Bauer", "turin", "abc123", "*****@*****.**");
            u1.HomeAddress = new Address("Foo", "12345", "Bar");
            u1.IsAdmin = true;
            u2 = new User("Gavin", "King", "gavin", "abc123", "*****@*****.**");
            u2.HomeAddress = new Address("Foo", "12345", "Bar");
            u3 = new User("Max", "Andersen", "max", "abc123", "*****@*****.**");
            u3.HomeAddress = new Address("Foo", "12345", "Bar");
            userDAO.MakePersistent(u1);
            userDAO.MakePersistent(u2);
            userDAO.MakePersistent(u3);

            // BillingDetails
            BillingDetails ccOne = new CreditCard(
                "Christian  Bauer", u1, "1234567890",
                CreditCardType.MasterCard, "10", "2005");
            BillingDetails accOne = new BankAccount(
                "Christian Bauer", u1, "234234234234",
                "FooBar Rich Bank", "foobar123foobaz");
            u1.AddBillingDetails(ccOne);
            u1.AddBillingDetails(accOne);

            // Items
            DateTime tempAux = DateTime.Now;
            DateTime tempAux2 = DateTime.Now.AddDays(3);// inThreeDays
            auctionOne = new Item("Item One",
                                  "An item in the carsLuxury category.",
                                  u2,
                                  new MonetaryAmount(1.99, "USD"),
                                  new MonetaryAmount(50.33, "USD"),
                                  tempAux, tempAux2);
            auctionOne.SetPendingForApproval();
            auctionOne.Approve(u1);
            itemDAO.MakePersistent(auctionOne);
            new CategorizedItem(u1.Username, carsLuxury, auctionOne);

            DateTime tempAux3 = DateTime.Now;
            DateTime tempAux4 = DateTime.Now.AddDays(5); // inFiveDays
            auctionTwo = new Item("Item Two",
                                  "Another item in the carsLuxury category.",
                                  u2,
                                  new MonetaryAmount(2.22, "USD"),
                                  new MonetaryAmount(100.88, "USD"),
                                  tempAux3, tempAux4);
            itemDAO.MakePersistent(auctionTwo);
            new CategorizedItem(u1.Username, carsLuxury, auctionTwo);

            DateTime tempAux5 = DateTime.Now;
            DateTime tempAux6 = DateTime.Now.AddDays(3);// inThreeDays
            auctionThree = new Item("Item Three",
                                    "Don't drive SUVs.",
                                    u2,
                                    new MonetaryAmount(3.11, "USD"),
                                    new MonetaryAmount(300.55, "USD"),
                                    tempAux5, tempAux6);
            itemDAO.MakePersistent(auctionThree);
            new CategorizedItem(u1.Username, carsSUV, auctionThree);

            DateTime tempAux7 = DateTime.Now;
            DateTime tempAux8 = DateTime.Now.AddDays(7);// nextWeek
            auctionFour = new Item("Item Four",
                                   "Really, not even luxury SUVs.",
                                   u1,
                                   new MonetaryAmount(4.55, "USD"),
                                   new MonetaryAmount(40.99, "USD"),
                                   tempAux7, tempAux8);
            itemDAO.MakePersistent(auctionFour);
            new CategorizedItem(u1.Username, carsLuxury, auctionFour);
            new CategorizedItem(u1.Username, carsSUV, auctionFour);

            // Bids
            Model.Bid bidOne1 = new Model.Bid(new MonetaryAmount(12.12, "USD"), auctionOne, u3);
            Model.Bid bidOne2 = new Model.Bid(new MonetaryAmount(13.13, "USD"), auctionOne, u1);
            Model.Bid bidOne3 = new Model.Bid(new MonetaryAmount(14.14, "USD"), auctionOne, u3);

            auctionOne.AddBid(bidOne1);
            auctionOne.AddBid(bidOne2);
            auctionOne.AddBid(bidOne3);

            // Successful Bid
            auctionOne.SuccessfulBid = bidOne3;

            // Comments
            Comment commentOne = new Comment(Rating.Excellent, "This is Excellent.", u3, auctionOne);
            Comment commentTwo = new Comment(Rating.Low, "This is very Low.", u1, auctionThree);
            commentDAO.MakePersistent(commentOne);
            commentDAO.MakePersistent(commentTwo);

            NHibernateHelper.CommitTransaction();
            NHibernateHelper.CloseSession();
        }
Ejemplo n.º 37
0
        private void CarregarGrid(string sWhere = "")
        {
            string sError;
            CategoryDAO objCategoriaDAO = new CategoryDAO(IdUserSession);
            List<Category> listCategoria = new List<Category>();
            listCategoria = objCategoriaDAO.FindByWhere(sWhere, out sError);
            gvCategoria.DataSource = listCategoria;
            if (listCategoria.Count == 0)
            {
                DataTable dtEmpty = new DataTable();
                dtEmpty.Columns.Add("Id");
                dtEmpty.Columns.Add("Description");
                dtEmpty.Columns.Add("IsBlock");
                dtEmpty.Columns.Add("Status");

                DataRow dr = dtEmpty.NewRow();
                dr["Id"] = "";
                dr["Description"] = "";
                dr["IsBlock"] = "";
                dr["Status"] = "";
                dtEmpty.Rows.Add(dr);
                gvCategoria.DataSource = dtEmpty;
            }

            if (TrataMsgPrincipal(sError))
                return;

            gvCategoria.DataBind();
            upGrid.Update();

            Session["Grid_gvCategoria"] = gvCategoria.DataSource;
        }
Ejemplo n.º 38
0
        private void CarregarCategoria()
        {
            string sResult;
            CategoryDAO objCategoriaDAO = new CategoryDAO(IdUserSession);
            ddlCategoria.DataTextField = "Description";
            ddlCategoria.DataValueField = "Id";
            ddlCategoria.DataSource = objCategoriaDAO.FindByWhere("BLOQUEADO = 0 ORDER BY DESCRICAO", out sResult);
            ddlCategoria.DataBind();
            ddlCategoria.Items.Add(new ListItem("[Todas]", ""));
            ddlCategoria.SelectedValue = "";

            pddlCategoria.DataTextField = "Description";
            pddlCategoria.DataValueField = "Id";
            pddlCategoria.DataSource = ddlCategoria.DataSource;
            pddlCategoria.DataBind();
        }
Ejemplo n.º 39
0
 public CategoryManager()
 {
     cdao = new CategoryDAO();
 }