Пример #1
0
        public ActionResult UserProfile(tbl_User users, string cSharp, string Java, string Ruby)
        {
            users.IsInterestedIncSharp = (cSharp == "true") ? true : false;
            users.IsInterestedInJava   = (Java == "true") ? true : false;
            users.IsInterestedInRuby   = (Ruby == "true") ? true : false;

            if (users.UserImageFile != null)
            {
                string filename  = Path.GetFileNameWithoutExtension(users.UserImageFile.FileName);
                string extension = Path.GetExtension(users.UserImageFile.FileName);
                filename        = filename + DateTime.Now.ToString("yymmssff") + extension;
                users.ImagePath = "~/Images/" + filename;

                //save file in folder
                filename = Path.Combine(Server.MapPath("~/Images/"), filename);
                users.UserImageFile.SaveAs(filename);
            }
            if (users.ImagePath == "/Images/no-image-available.png")
            {
                users.ImagePath = null;
            }
            db.Entry(users).State = System.Data.Entity.EntityState.Modified;
            db.SaveChanges();

            var usrupdated = db.tbl_User.Find(users.UserId);

            //return RedirectToAction("UserList");
            return(RedirectToAction("UserProfile", new { id = users.UserId }));
        }
Пример #2
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Regions.Any())
            {
                return;
            }
            context.Regions.AddRange(new List <Region> {
                new Region
                {
                    NameArea = "Khác",
                    FeeShip  = 14900
                },
                new Region
                {
                    NameArea = "Miền Nam",
                    FeeShip  = 11900
                },
                new Region
                {
                    NameArea = "Miền Trung",
                    FeeShip  = 16900
                },
                new Region
                {
                    NameArea = "Miền Bắc",
                    FeeShip  = 21900
                }
            });

            context.SaveChanges();
        }
Пример #3
0
        public ActionResult Register(tbl_User users)
        {
            WebAppDBContext db = new WebAppDBContext();

            db.tbl_User.Add(users);
            db.SaveChanges();
            return(RedirectToAction("UserList"));
        }
Пример #4
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Accounts.Any())
            {
                return;
            }
            context.Accounts.AddRange(new List <Account> {
                new Account
                {
                    UID        = "lengothienan",
                    PW         = "041f7b834b36b8d4f10e5a62b978550e",
                    Status     = "On",
                    Address    = "Tôn Thất Thuyết,Quận 4,TP.HCM ",
                    Email      = "*****@*****.**",
                    DateActive = DateTime.Now.ToString()
                },
                new Account
                {
                    UID        = "huynhquangvinh",
                    PW         = "36be7ec11d8c564863178836579c646f",
                    Status     = "On",
                    Address    = "Trần Hưng Đạo, Quận 5, TP.HCM",
                    Email      = "*****@*****.**",
                    DateActive = DateTime.Now.ToString()
                },
                new Account
                {
                    UID        = "nguyenngochoangbaotran",
                    PW         = "4d8712e0063b99712e9d52da5c008625",
                    Status     = "On",
                    Address    = "Quận 8, TP.HCM",
                    Email      = "*****@*****.**",
                    DateActive = DateTime.Now.ToString()
                },
                new Account
                {
                    UID        = "nguyenhoanganh",
                    PW         = "9b155c23d8a25b006221a052227dd7f9",
                    Status     = "On",
                    Address    = "Quận 6, TP.HCM",
                    Email      = "*****@*****.**",
                    DateActive = DateTime.Now.ToString()
                },
                new Account
                {
                    UID        = "nguyenthaivan",
                    PW         = "e57f603b2942355c52f9f8af585e7f25",
                    Status     = "On",
                    Address    = "An Dương Vương, Quận 5, TP.HCM",
                    Email      = "*****@*****.**",
                    DateActive = DateTime.Now.ToString()
                }
            });

            context.SaveChanges();
        }
Пример #5
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Admins.Any())
            {
                return;
            }
            context.Admins.AddRange(new List <Admin> {
                new Admin
                {
                    UID        = "lengothienan_ad",
                    PW         = "041f7b834b36b8d4f10e5a62b978550e",
                    Permission = "ADMIN",
                    DateActive = DateTime.Now.ToString(),
                    Status     = "On"
                },
                new Admin
                {
                    UID        = "huynhquangvinh_ad",
                    PW         = "36be7ec11d8c564863178836579c646f",
                    Permission = "MANAGER",
                    DateActive = DateTime.Now.ToString(),
                    Status     = "On"
                },
                new Admin
                {
                    UID        = "nguyenngochoangbaotran_ad",
                    PW         = "4d8712e0063b99712e9d52da5c008625",
                    Permission = "SALESTAFF",
                    DateActive = DateTime.Now.ToString(),
                    Status     = "On"
                },
                new Admin
                {
                    UID        = "nguyenhoanganh_ad",
                    PW         = "9b155c23d8a25b006221a052227dd7f9",
                    Permission = "SALESTAFF",
                    DateActive = DateTime.Now.ToString(),
                    Status     = "On"
                },
                new Admin
                {
                    UID        = "nguyenthaivan_ad",
                    PW         = "e57f603b2942355c52f9f8af585e7f25",
                    Permission = "STOCKSTAFF",
                    DateActive = DateTime.Now.ToString(),
                    Status     = "On"
                }
            });

            context.SaveChanges();
        }
Пример #6
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Sales.Any())
            {
                return;
            }
            context.Sales.AddRange(new List <Sale> {
                new Sale
                {
                    phantram = "90"
                },
                new Sale
                {
                    phantram = "80"
                },
                new Sale
                {
                    phantram = "70"
                },
                new Sale
                {
                    phantram = "60"
                },
                new Sale
                {
                    phantram = "50"
                },
                new Sale
                {
                    phantram = "40"
                },
                new Sale
                {
                    phantram = "30"
                },
                new Sale
                {
                    phantram = "20"
                },
                new Sale
                {
                    phantram = "10"
                },
                new Sale
                {
                    phantram = "0"
                },
            });

            context.SaveChanges();
        }
Пример #7
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Functions.Any())
            {
                return;
            }
            context.Functions.AddRange(new List <Function> {
                new Function
                {
                    Name       = "Product Management",
                    NameMethod = "ProductManagement"
                },
                new Function
                {
                    Name       = "Brand Management",
                    NameMethod = "ProductTypeManagement"
                },
                new Function
                {
                    Name       = "Inventory Management",
                    NameMethod = "TheFirstInventoryManagement"
                },
                new Function
                {
                    Name       = "Order Management",
                    NameMethod = "TheFirstStatus"
                },
                new Function
                {
                    Name       = "Account Management",
                    NameMethod = "UserManagement"
                },
                new Function
                {
                    Name       = "Shipping Fee Management",
                    NameMethod = "ShippingFeeManagement"
                },
                new Function
                {
                    Name       = "Statistical",
                    NameMethod = "Turnover"
                }
            });

            context.SaveChanges();
        }
Пример #8
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Authorizations.Any())
            {
                return;
            }
            context.Authorizations.AddRange(new List <Authorization> {
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 1
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 2
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 3
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 4
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 5
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 6
                },
                new Authorization
                {
                    IDAdmin = 4,
                    IDCN    = 7
                }
            });

            context.SaveChanges();
        }
Пример #9
0
        public ActionResult Create(tbl_Category category)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    db.tbl_Category.Add(category);
                    db.SaveChanges();

                    TempData["msg"] = "Category added successfully";

                    return(RedirectToAction("Create"));
                }
                else
                {
                    return(View());
                }
            }
            catch (Exception ex)
            {
                TempData["msg"] = "Category added failed" + ex.Message;
                return(RedirectToAction("Create"));
            }
        }
Пример #10
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.ProductTypes.Any())
            {
                return;
            }
            context.ProductTypes.AddRange(new List <ProductType> {
                new ProductType
                {
                    Name   = "Nike",
                    Filter = "nike"
                },
                new ProductType
                {
                    Name   = "ASICS",
                    Filter = "asics"
                },
                new ProductType
                {
                    Name   = "Adidas",
                    Filter = "adidas"
                },
                new ProductType
                {
                    Name   = "New Balance",
                    Filter = "newbalance"
                },
                new ProductType
                {
                    Name   = "Skechers",
                    Filter = "skechers"
                },
                new ProductType
                {
                    Name   = "Fila",
                    Filter = "fila"
                },
                new ProductType
                {
                    Name   = "Bata",
                    Filter = "bata"
                },
                new ProductType
                {
                    Name   = "Burberry",
                    Filter = "burberry"
                },
                new ProductType
                {
                    Name   = "VF Corporation",
                    Filter = "vfcorporation"
                },
                new ProductType
                {
                    Name   = "PUMA",
                    Filter = "puma"
                }
            });

            context.SaveChanges();
        }
Пример #11
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Provinces.Any())
            {
                return;
            }
            context.Provinces.AddRange(new List <Province> {
                new Province
                {
                    NameProvince = "Cần Thơ",
                    IdReion      = 4
                },
                new Province
                {
                    NameProvince = "Hồ Chí Minh",
                    IdReion      = 3
                },
                new Province
                {
                    NameProvince = "Huế",
                    IdReion      = 2
                },
                new Province
                {
                    NameProvince = "Hà Nội",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Vĩnh Phúc",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Bắc Ninh",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Hải Dương",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Hưng Yên",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Hà Nam",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Hòa Bình",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Phú Thọ",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Thái Nguyên",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Bắc Giang",
                    IdReion      = 1
                },
                new Province
                {
                    NameProvince = "Quảng Ngãi",
                    IdReion      = 2
                },
                new Province
                {
                    NameProvince = "KomTum",
                    IdReion      = 2
                },
            });

            context.SaveChanges();
        }
Пример #12
0
 public void Add(T entity)
 {
     context.Set <T>().Add(entity);
     context.SaveChanges();
 }
Пример #13
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Wards.Any())
            {
                return;
            }
            context.Wards.AddRange(new List <Ward> {
                new Ward
                {
                    NameWard   = "Quận 1",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 2",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 3",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 4",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 5",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 6",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 7",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 8",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 9",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 10",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 11",
                    IdProvince = 13
                },
                new Ward
                {
                    NameWard   = "Quận 12",
                    IdProvince = 13
                },
            });

            context.SaveChanges();
        }
Пример #14
0
        public static void Initialize(WebAppDBContext context)
        {
            context.Database.EnsureCreated();

            if (context.Products.Any())
            {
                return;
            }
            context.Products.AddRange(new List <Product> {
                new Product
                {
                    Name    = "Nike Air Max 90",
                    Cost    = "4390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-1.jpg",
                    Amount  = "3",
                    IDKM    = 3,
                    Size    = "40",
                    IDLSP   = 1
                },
                new Product
                {
                    Name    = "Nike Air Force 1",
                    Cost    = "5129000",
                    Descrip = "This is so beautiful",
                    Image   = "product-2.jpg",
                    Amount  = "2",
                    IDKM    = 2,
                    Size    = "41",
                    IDLSP   = 2
                },
                new Product
                {
                    Name    = "Nike SF AF1",
                    Cost    = "3320000",
                    Descrip = "This is so beautiful",
                    Image   = "product-3.jpg",
                    Amount  = "1",
                    IDKM    = 1,
                    Size    = "42",
                    IDLSP   = 3
                },
                new Product
                {
                    Name    = "Adidas Uptempo",
                    Cost    = "5212000",
                    Descrip = "This is so beautiful",
                    Image   = "product-4.jpg",
                    Amount  = "3",
                    IDKM    = 4,
                    Size    = "39",
                    IDLSP   = 4
                },
                new Product
                {
                    Name    = "Nike Jordan 1",
                    Cost    = "4390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-5.jpg",
                    Amount  = "5",
                    IDKM    = 1,
                    Size    = "42",
                    IDLSP   = 5
                },
                new Product
                {
                    Name    = "Nike Uptempo Subasa",
                    Cost    = "7290000",
                    Descrip = "This is so beautiful",
                    Image   = "product-6.jpg",
                    Amount  = "1",
                    IDKM    = 3,
                    Size    = "41",
                    IDLSP   = 6
                },
                new Product
                {
                    Name    = "Adidas VaporMax ACE",
                    Cost    = "2618000",
                    Descrip = "This is so beautiful",
                    Image   = "product-7.jpg",
                    Amount  = "2",
                    IDKM    = 3,
                    Size    = "39",
                    IDLSP   = 7
                },
                new Product
                {
                    Name    = "Nike Cortez",
                    Cost    = "2290000",
                    Descrip = "This is so beautiful",
                    Image   = "product-8.jpg",
                    Amount  = "40",
                    IDKM    = 1,
                    Size    = "41",
                    IDLSP   = 8
                },
                new Product
                {
                    Name    = "Asics Gel Saga",
                    Cost    = "4390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-9.jpg",
                    Amount  = "3",
                    IDKM    = 2,
                    Size    = "40",
                    IDLSP   = 9
                },
                new Product
                {
                    Name    = "Asics Gel Rocket",
                    Cost    = "2390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-10.jpg",
                    Amount  = "3",
                    IDKM    = 2,
                    Size    = "38",
                    IDLSP   = 10
                },
                new Product
                {
                    Name    = "Fw Women Tartheredge",
                    Cost    = "3390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-1.jpg",
                    Amount  = "3",
                    IDKM    = 2,
                    Size    = "40",
                    IDLSP   = 5
                },
                new Product
                {
                    Name    = "Fw Men Tartheredge",
                    Cost    = "1390000",
                    Descrip = "This is so beautiful",
                    Image   = "product-10.jpg",
                    Amount  = "2",
                    IDKM    = 2,
                    Size    = "38",
                    IDLSP   = 4
                },
                new Product
                {
                    Name    = "Asics Lyte V",
                    Cost    = "3990000",
                    Descrip = "This is so beautiful",
                    Image   = "product-4.jpg",
                    Amount  = "1",
                    IDKM    = 4,
                    Size    = "39",
                    IDLSP   = 1
                }, new Product
                {
                    Name    = "Nike Jordan V",
                    Cost    = "7890000",
                    Descrip = "This is so beautiful",
                    Image   = "product-10.jpg",
                    Amount  = "8",
                    IDKM    = 3,
                    Size    = "41",
                    IDLSP   = 1
                },
            });

            context.SaveChanges();
        }