Exemplo n.º 1
0
        public ActionResult GetTram(string Id)
        {
            var listTram = new List <DMTRAM>();

            var dataListTram = db.DMTUYENCHITIETTRAMs.Where(x => x.IDTUYEN == db.DMTUYENs.FirstOrDefault(y => y.IDTUYEN == Id).MATUYEN).ToList();
            var tram         = db.DMTRAMs.ToList();

            foreach (var item in dataListTram)
            {
                var listT = new DMTRAM();
                listT.MATRAM  = item.MATRAM;
                listT.TENTRAM = db.DMTRAMs.FirstOrDefault(x => x.MATRAM == item.MATRAM).TENTRAM;
                listT.LatLng  = db.DMTRAMs.FirstOrDefault(x => x.MATRAM == item.MATRAM).LatLng;
                listTram.Add(listT);
            }

            var dataAll = new AllModel
            {
                TblDMTUYEN             = db.DMTUYENs.FirstOrDefault(x => x.IDTUYEN == Id),
                ListDMTUYENCHITIETTRAM = db.DMTUYENCHITIETTRAMs.Where(x => x.IDTUYEN == db.DMTUYENs.FirstOrDefault(y => y.IDTUYEN == Id).MATUYEN).ToList(),
                ListDMTRAM             = listTram
            };

            return(Json(new { result = dataAll }));
        }
Exemplo n.º 2
0
        public virtual ActionResult Index()
        {
            var model = new AllModel();

            var ListUser      = RESTHelper.Get <ResultModel <List <UsersModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllUser"]);
            var ListCatalogue = RESTHelper.Get <ResultModel <List <CatalogueModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllCatalague"]);
            var ListInvoice   = RESTHelper.Get <ResultModel <List <InvoiceModel> > >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GetAllInvoice"]);

            ViewBag.NoInvoice = RESTHelper.Get <ResultModel <string> >(ConfigurationManager.AppSettings["HostAPIURL"] + ConfigurationManager.AppSettings["GenerateNoInvoice"]);
            if (ListCatalogue != null)
            {
                model.ListCatalogues = ListCatalogue.Value;
            }
            if (ListInvoice != null)
            {
                model.ListInvoices = ListInvoice.Value;
            }
            if (ListUser != null)
            {
                model.ListUsers = ListUser.Value;
            }
            if (TempData.ContainsKey("StatusMessage"))
            {
                ViewBag.Message = TempData["StatusMessage"];
            }

            return(View(model));
        }
Exemplo n.º 3
0
        // GET: DmHoaDon/Edit/5
        public ActionResult Edit(int id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            var dataTaiXe = db.DMXEs.ToList();

            dataTaiXe.Insert(0, new DMXE {
                MAXE = "", SOXE = "Chọn số xe"
            });

            DMHOADON dMHOADON = db.DMHOADONs.Find(id);

            if (dMHOADON == null)
            {
                return(HttpNotFound());
            }
            var model = new AllModel
            {
                ListDmXe = dataTaiXe,
                DmHoaDon = dMHOADON
            };

            return(View(model));
        }
Exemplo n.º 4
0
        public ActionResult UserMain(int?p)
        {
            dbDemoDataContext db       = new dbDemoDataContext();
            tCustomer         customer = (new dbDemoDataContext()).tCustomer.FirstOrDefault(m => m.fId == p);

            customer = Session[CDictionary.LOGIN_USER] as tCustomer;
            Timer timer = new Timer(5000);

            timer.AutoReset = true;
            timer.Enabled   = true;
            if (customer != null)
            {
                ViewBag.Id      = customer.fId.ToString() + ".jpg";
                ViewBag.Name    = customer.fName;
                ViewBag.Phone   = customer.fPhone;
                ViewBag.Email   = customer.fEmail;
                ViewBag.Address = customer.fAddress;
                AllModel all = new AllModel();
                return(View(all));
            }
            else
            {
                return(RedirectToAction("../Home/Index"));
            }
        }
Exemplo n.º 5
0
        // GET: DmXe/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DMXE dMXE = db.DMXEs.Find(id);

            if (dMXE == null)
            {
                return(HttpNotFound());
            }
            var dataTaiXe = db.DMTAIXEs.ToList();

            dataTaiXe.Insert(0, new DMTAIXE {
                MATAIXE = "", TENTAIXE = "Chọn tài xế"
            });
            var model = new AllModel
            {
                DmXe        = dMXE,
                ListDmTaiXe = dataTaiXe
            };

            return(View(model));
        }
Exemplo n.º 6
0
        public ActionResult EditManyAttribute(AllModel allModel)
        {
            var branchId = 0;

            try
            {
                branchId = allModel.factor[0].BranchId;
                foreach (var factor in allModel.factor)
                {
                    var fc = db.Factors.Find(factor.Id);
                    fc.FactorName = factor.FactorName;
                    fc.Weight     = factor.Weight;
                }
                foreach (var criteria in allModel.criteria)
                {
                    var cr = db.Criterias.Find(criteria.Id);
                    cr.CriteriaName = criteria.CriteriaName;
                    cr.Weight       = criteria.Weight;
                }
                foreach (var attribute in allModel.attribute)
                {
                    var at = db.Attributes.Find(attribute.Id);
                    at.AttributeName = attribute.AttributeName;
                    at.Weight        = attribute.Weight;
                }
                db.SaveChanges();
                return(RedirectToAction("Edit", "Branch", new { branchId = branchId }));
            } catch (Exception ex)
            {
                return(View());
            }
        }
        public ActionResult Create(AllModel model)
        {
            try
            {
                if (model.tblVocabularyArray != null)
                {
                    foreach (var item in model.tblVocabularyArray)
                    {
                        var check = db.vocabularies.FirstOrDefault(x => x.code == item.code);
                        if (check == null)
                        {
                            db.vocabularies.Add(item);
                        }
                    }
                }



                db.SaveChanges();
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
            }
            return(RedirectToAction("Index"));
        }
Exemplo n.º 8
0
        public ActionResult EditCriteria(int branchId, int factorId, int criteriaId)
        {
            var model   = new AllModel();
            var factors = from factor in db.Factors
                          where factor.FactorId.Equals(factorId)
                          select factor;

            foreach (var fa in factors)
            {
                model.factor.Add(fa);
            }

            var criterias = from criteria in db.Criterias
                            where criteria.CriteriaId.Equals(criteriaId)
                            select criteria;

            foreach (var criteria in criterias)
            {
                model.criteria.Add(criteria);
            }
            var attributes = from attribute in db.Attributes
                             where attribute.CriteriaId.Equals(criteriaId)
                             select attribute;

            foreach (var attribute in attributes)
            {
                model.attribute.Add(attribute);
            }
            return(View(model));
        }
Exemplo n.º 9
0
        public ActionResult PartialViewFactor(int id = 0)
        {
            var model    = new AllModel();
            var branchId = (from branch in db.Branchs
                            where branch.BranchId == id
                            select branch.BranchId).FirstOrDefault();

            var factors = db.Factors.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight);

            foreach (var fa in factors)
            {
                model.factor.Add(fa);
            }

            var criterias = db.Criterias.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight);

            foreach (var criteria in criterias)
            {
                model.criteria.Add(criteria);
            }
            var attributes = db.Attributes.Where(x => x.BranchId == id).OrderByDescending(x => x.Weight);

            foreach (var attribute in attributes)
            {
                model.attribute.Add(attribute);
            }


            return(PartialView("PartialViewFactor", model));
        }
Exemplo n.º 10
0
        public ActionResult CreateProduct(AllModel model, HttpPostedFileBase[] files)
        {
            if (ModelState.IsValid)
            {
                var _tblProduct = new tblProduct();

                _tblProduct = model.TblProduct;
                _tblProduct.CreateDateProducts = DateTime.Now;
                db.tblProducts.Add(_tblProduct);
                db.SaveChanges();
                if (files != null && files.Length > 0)
                {
                    for (int i = 0; i < files.Length; i++)
                    {
                        if (files[i] != null)
                        {
                            byte[] binaryData;
                            binaryData = new Byte[files[i].InputStream.Length];
                            long bytesRead = files[i].InputStream.Read(binaryData, 0, (int)files[i].InputStream.Length);
                            files[i].InputStream.Close();
                            string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length);
                            SaveImg(new PictureModel {
                                nameImg = files[i].FileName, idProducts = model.TblProduct.IdProducts, isactive = 1, index = i, cfile = base64String
                            });
                        }
                    }
                }
                return(RedirectToAction("IndexProduct"));
            }

            return(View(model.TblProduct));
        }
Exemplo n.º 11
0
        public ActionResult Search(string search)
        {
            //trả về kết quả khi tìm kiếm được
            var tacgia = db.TacGias.Where(x => x.TenTacGia.Contains(search));
            var album  = db.Albums.Include(s => s.TacGia).Where(x => x.TenAlbum.Contains(search));

            AllModel allModel = new AllModel
            {
                TacGias = tacgia.ToList(),
                Albums  = album.ToList(),
            };

            //khi chưa nhập từ khóa mà nhấn search => trả về danh sách rỗng
            var tacgianull = db.TacGias.Where(x => x.TacGiaID < 0);
            var albumnull  = db.Albums.Include(s => s.TacGia).Where(x => x.AlbumID < 0);

            AllModel allModelnull = new AllModel
            {
                TacGias = tacgianull.ToList(),
                Albums  = albumnull.ToList(),
            };

            ViewBag.Title = search;
            if (search == "")
            {
                return(View(allModelnull));
            }
            else
            {
                ViewBag.countTacgia = tacgia.Count();
                ViewBag.countAlbum  = album.Count();
                ViewBag.SumCount    = tacgia.Count() + album.Count();
                return(View(allModel));
            }
        }
Exemplo n.º 12
0
        public ActionResult Edit(AllModel model, HttpPostedFileBase[] inputfile)
        {
            if (model.tblProductArray != null)
            {
                foreach (var item in model.tblProductArray)
                {
                    var tem = db.items.Find(item.ARTNO);
                    tem.WEBPRICE = model.tblitem.WEBPRICE;

                    tem.CATEGORYNO       = model.tblitem.CATEGORYNO;
                    tem.ARTNAME          = item.ARTNAME;
                    tem.GROUPNO          = model.tblitem.GROUPNO;
                    tem.INFO             = item.INFO;
                    tem.IsBestSeller     = model.tblitem.IsBestSeller;
                    tem.WEBPRICE         = item.WEBPRICE;
                    tem.EXPORTABLE       = model.tblitem.EXPORTABLE;
                    tem.STOCKITEM        = model.tblitem.STOCKITEM;
                    tem.SPECIALOFFER     = model.tblitem.SPECIALOFFER;
                    tem.AUTHORIZABLE     = model.tblitem.AUTHORIZABLE;
                    tem.RESTRICTED       = model.tblitem.RESTRICTED;
                    tem.NOTPOST          = model.tblitem.NOTPOST;
                    tem.NOTADDPOSTAGEFEE = model.tblitem.NOTADDPOSTAGEFEE;
                    tem.WIDTH            = model.tblitem.WIDTH;
                    tem.WEIGHT           = model.tblitem.WEIGHT;
                    tem.HEIGHT           = model.tblitem.HEIGHT;
                    tem.LEN = model.tblitem.LEN;


                    db.Entry(tem).State = EntityState.Modified;
                    if (inputfile != null)
                    {
                        for (int i = 0; i < inputfile.Length; i++)
                        {
                            if (inputfile[i] != null)
                            {
                                string path = "";
                                path = Path.Combine(Server.MapPath("/Content/ProductImage"), Path.GetFileName(inputfile[i].FileName));
                                var picId = db.artlinks.OrderByDescending(x => x.LINENO).FirstOrDefault();
                                inputfile[i].SaveAs(path);
                                var tblPic = new artlink
                                {
                                    LINENO     = picId.LINENO + 1,
                                    ARTNO      = item.ARTNO,
                                    LASTCHANGE = DateTime.Now,
                                    CREATED    = DateTime.Now,
                                    LINK       = inputfile[i].FileName
                                };
                                db.artlinks.Add(tblPic);
                            }
                        }
                    }
                }
            }

            db.SaveChanges();


            return(RedirectToAction("Index"));
        }
Exemplo n.º 13
0
 public ActionResult Edit(AllModel model, HttpPostedFileBase[] files)
 {
     if (ModelState.IsValid)
     {
         db.Entry(model.tblStock).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(model.tblStock));
 }
Exemplo n.º 14
0
        public ActionResult CreateGroup(AllModel model, HttpPostedFileBase[] inputfile)
        {
            if (model.tblGroupArray != null)
            {
                var groupF = new artgrp();

                groupF.METAGROUPNO  = model.tblGroup.METAGROUPNO;
                groupF.IsActive     = model.tblGroup.IsActive;
                groupF.CREATED      = DateTime.Now;
                groupF.LASTCHANGE   = DateTime.Now;
                groupF.EXPORTABLE   = "T";
                groupF.CodeLanguage = model.tblGroupArray[0].CodeLanguage.ToLower();
                groupF.GROUPCODE    = model.tblGroupArray[0].GROUPCODE;
                groupF.GROUPNAME    = model.tblGroupArray[0].GROUPNAME;
                db.artgrps.Add(groupF);
                db.SaveChanges();
                var updategroupF = db.artgrps.Find(groupF.GROUPNO);
                updategroupF.IdCurrentItem   = groupF.GROUPNO;
                db.Entry(updategroupF).State = EntityState.Modified;
                db.SaveChanges();
                foreach (var item in model.tblGroupArray.Skip(1).ToList())
                {
                    item.METAGROUPNO   = model.tblGroup.METAGROUPNO;
                    item.IsActive      = model.tblGroup.IsActive;
                    item.CREATED       = DateTime.Now;
                    item.LASTCHANGE    = DateTime.Now;
                    item.EXPORTABLE    = "T";
                    item.IdCurrentItem = groupF.IdCurrentItem;
                    db.artgrps.Add(item);
                }
                db.SaveChanges();
                if (inputfile != null)
                {
                    for (int i = 0; i < inputfile.Length; i++)
                    {
                        if (inputfile[i] != null)
                        {
                            var fname = "" + "." +
                                        inputfile[i].FileName.Split('.').Last();
                            string path = Server.MapPath("~/Content/MetagroupImage");
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            path = Path.Combine(path + "/", fname);
                            inputfile[i].SaveAs(path);
                        }
                    }
                }
            }



            return(RedirectToAction("IndexGroup"));
        }
Exemplo n.º 15
0
        // GET: LoTrinhChoXe/Create
        public ActionResult Create()
        {
            var all = new AllModel
            {
                ListDmXe    = db.DMXEs.ToList(),
                ListDMTUYEN = db.DMTUYENs.ToList(),
                ListDmTaiXe = db.DMTAIXEs.ToList(),
            };

            return(View(all));
        }
Exemplo n.º 16
0
        public ActionResult Edit(AllModel allModel)
        {
            try
            {
                // TODO: Add update logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Exemplo n.º 17
0
        public ActionResult AccountInfo(AllModel model)
        {
            var user = db.users.Find(model.tblUser.Id);

            if (user != null)
            {
                ViewBag.Notification = 0;
                user.updatedate      = DateTime.Now;
                user.display         = model.tblUser.display;
                user.email           = model.tblUser.email;
                db.Entry(user).State = EntityState.Modified;
                db.SaveChanges();
                var userdata = db.userdatas.Find(model.tblUserData.Id);
                if (userdata != null)
                {
                    userdata.firstname         = model.tblUserData.firstname;
                    userdata.lasname           = model.tblUserData.lasname;
                    userdata.contact_email     = model.tblUserData.contact_email;
                    userdata.contact_phone     = model.tblUserData.contact_phone;
                    userdata.company_name      = model.tblUserData.company_name;
                    userdata.delivery_name     = model.tblUserData.delivery_name;
                    userdata.delivery_email    = model.tblUserData.delivery_email;
                    userdata.delivery_phone    = model.tblUserData.delivery_phone;
                    userdata.delivery_address1 = model.tblUserData.delivery_address1;
                    userdata.delivery_address2 = model.tblUserData.delivery_address2;
                    userdata.delivery_suburb   = model.tblUserData.delivery_suburb;
                    userdata.delivery_postcode = model.tblUserData.delivery_postcode;
                    userdata.delivery_state    = model.tblUserData.delivery_state;
                    userdata.delivery_contry   = model.tblUserData.delivery_contry;
                    userdata.billing_name      = model.tblUserData.billing_name;
                    userdata.billing_email     = model.tblUserData.billing_email;
                    userdata.billing_phone     = model.tblUserData.billing_phone;
                    userdata.billing_address1  = model.tblUserData.billing_address1;
                    userdata.billing_address2  = model.tblUserData.billing_address2;
                    userdata.billing_suburb    = model.tblUserData.billing_suburb;
                    userdata.billing_poscode   = model.tblUserData.billing_poscode;
                    userdata.billing_state     = model.tblUserData.billing_state;
                    userdata.billing_country   = model.tblUserData.billing_country;
                    db.Entry(userdata).State   = EntityState.Modified;
                    db.SaveChanges();
                    ViewBag.Notification = 1;
                }
                else
                {
                    ViewBag.Notification = 0;
                }
            }

            return(View(model));
        }
Exemplo n.º 18
0
        private void DeleteModel(GroupCharacterViewModel model)
        {
            if (model == null) return;
            if (MessageBoxWPF.Show("Вы действительно хотите удалить параметр ?", StringProject.MessageCaption, MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.No)
                return;

            bool flag = repository.DeleteGroupCharacter(model.GetModel);
            if (!flag)
            {
                MessageBoxWPF.Show(StringProject.ErrorDelRecort, StringProject.ErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            AllModel.Remove(model);
        }
Exemplo n.º 19
0
        public ActionResult Create(AllModel model, HttpPostedFileBase[] inputfile)
        {
            if (model.tblStoreArray != null)
            {
                var storeF = new store
                {
                    CodeLanguage = model.tblStoreArray[0].CodeLanguage.ToLower(),
                    Name         = model.tblStoreArray[0].Name,
                    Location     = model.tblStoreArray[0].Location,
                    Description  = model.tblStoreArray[0].Description
                };
                db.stores.Add(storeF);
                db.SaveChanges();
                var updateItem = db.stores.Find(storeF.Id);
                updateItem.IdCurrentItem   = storeF.Id;
                db.Entry(updateItem).State = EntityState.Modified;
                db.SaveChanges();
                foreach (var item in model.tblStoreArray.Skip(1).ToList())
                {
                    var tblStore = new store
                    {
                        CodeLanguage  = item.CodeLanguage.ToLower(),
                        IdCurrentItem = storeF.IdCurrentItem,
                        Name          = item.Name,
                        Location      = item.Location,
                        Description   = item.Description,
                    };

                    db.stores.Add(tblStore);
                }

                if (inputfile != null)
                {
                    for (int i = 0; i < inputfile.Length; i++)
                    {
                        if (inputfile[i] != null)
                        {
                            string path = "";
                            path = Path.Combine(Server.MapPath("/Content/ProductImage"), Path.GetFileName(inputfile[i].FileName));
                            inputfile[i].SaveAs(path);
                            updateItem.UrlImage = "/Content/ProductImage/" + inputfile[i].FileName;
                        }
                    }
                }
                db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Exemplo n.º 20
0
        public ActionResult EditProduct(AllModel model, HttpPostedFileBase[] files, int[] imgId)
        {
            var tblProduct = db.tblProducts.Find(model.TblProduct.IdProducts);

            tblProduct.CodeProducts           = model.TblProduct.CodeProducts;
            tblProduct.IdCategoryProducts     = model.TblProduct.IdCategoryProducts;
            tblProduct.IdCompany              = model.TblProduct.IdCompany;
            tblProduct.DescriptionProducts    = model.TblProduct.DescriptionProducts;
            tblProduct.DescriptionProducts_en = model.TblProduct.DescriptionProducts_en;
            tblProduct.ShortDesProducts       = model.TblProduct.ShortDesProducts;
            tblProduct.ShortDesProducts_en    = model.TblProduct.ShortDesProducts_en;
            tblProduct.IdTypeProducts         = model.TblProduct.IdTypeProducts;
            tblProduct.NameProducts           = model.TblProduct.NameProducts;
            tblProduct.NameProducts_en        = model.TblProduct.NameProducts_en;
            tblProduct.StatusProducts         = model.TblProduct.StatusProducts;
            tblProduct.ModifiDateProducts     = DateTime.Now;
            db.Entry(tblProduct).State        = EntityState.Modified;
            db.SaveChanges();


            if (files != null && files.Length > 0)
            {
                if (imgId != null && imgId.Length > 0)
                {
                    var listPic = db.tblPictures.Where(T => T.ProductsId == model.TblProduct.IdProducts && !imgId.Contains(T.PictureId)).ToList();
                    foreach (var pic in listPic)
                    {
                        db.Entry(pic).State = EntityState.Deleted;
                    }
                }
                for (int i = 0; i < files.Length; i++)
                {
                    if (files[i] != null)
                    {
                        byte[] binaryData;
                        binaryData = new Byte[files[i].InputStream.Length];
                        long bytesRead = files[i].InputStream.Read(binaryData, 0, (int)files[i].InputStream.Length);
                        files[i].InputStream.Close();
                        string base64String = System.Convert.ToBase64String(binaryData, 0, binaryData.Length);
                        SaveImg(new PictureModel {
                            nameImg = files[i].FileName, idProducts = model.TblProduct.IdProducts, isactive = 1, index = i, cfile = base64String
                        });
                    }
                }
            }

            db.SaveChanges();
            return(RedirectToAction("IndexProduct"));
        }
Exemplo n.º 21
0
        public ActionResult EditCategory(int id)
        {
            var listMenu = db.tblMenus.ToList();

            listMenu.Insert(0, new tblMenu {
                IdMenu = 0, NameMenu = "Chọn menu"
            });
            var data = new AllModel
            {
                TblMenu  = db.tblMenus.FirstOrDefault(x => x.IdMenu == id),
                ListMenu = listMenu
            };

            return(View(data));
        }
Exemplo n.º 22
0
        // GET: DmXe/Create
        public ActionResult Create()
        {
            var dataTaiXe = db.DMTAIXEs.ToList();

            dataTaiXe.Insert(0, new DMTAIXE {
                MATAIXE = "", TENTAIXE = "Chọn tài xế"
            });
            var model = new AllModel
            {
                DmXe        = new DMXE(),
                ListDmTaiXe = dataTaiXe
            };

            return(View(model));
        }
Exemplo n.º 23
0
        public ActionResult CreateCategory()
        {
            var listMenu = db.tblMenus.ToList();

            listMenu.Insert(0, new tblMenu {
                IdMenu = 0, NameMenu = "Chọn menu"
            });
            var data = new AllModel
            {
                TblMenu  = new tblMenu(),
                ListMenu = listMenu
            };

            return(View(data));
        }
Exemplo n.º 24
0
        public ActionResult CreateMetaGroup(AllModel model, HttpPostedFileBase[] inputfile)
        {
            if (model.tblMetaGroupArray != null)
            {
                var matagroup = new metagrup();
                matagroup.PARENTNO      = model.tblMetaGroup.PARENTNO;
                matagroup.IsActive      = model.tblMetaGroup.IsActive;
                matagroup.CREATED       = DateTime.Now;
                matagroup.METAGROUPNAME = model.tblMetaGroupArray[0].METAGROUPNAME;
                matagroup.METAGROUPCODE = model.tblMetaGroupArray[0].METAGROUPCODE;
                matagroup.CodeLanguage  = "english";
                db.metagrups.Add(matagroup);
                db.SaveChanges();
                var updatematagroup = db.metagrups.Find(matagroup.METAGROUPNO);
                updatematagroup.IdCurrentItem   = matagroup.METAGROUPNO;
                db.Entry(updatematagroup).State = EntityState.Modified;
                db.SaveChanges();
                foreach (var item in model.tblMetaGroupArray.Skip(1).ToList())
                {
                    item.PARENTNO      = model.tblMetaGroup.PARENTNO;
                    item.IsActive      = model.tblMetaGroup.IsActive;
                    item.CREATED       = DateTime.Now;
                    item.IdCurrentItem = updatematagroup.IdCurrentItem;
                    db.metagrups.Add(item);
                }
                db.SaveChanges();
                if (inputfile != null)
                {
                    for (int i = 0; i < inputfile.Length; i++)
                    {
                        if (inputfile[i] != null)
                        {
                            var fname = matagroup.IdCurrentItem + "." +
                                        inputfile[i].FileName.Split('.').Last();
                            string path = Server.MapPath("~/Content/MetagroupImage");
                            if (!Directory.Exists(path))
                            {
                                Directory.CreateDirectory(path);
                            }
                            path = Path.Combine(path + "/", fname);
                            inputfile[i].SaveAs(path);
                        }
                    }
                }
            }

            return(RedirectToAction("IndexMetaGroup"));
        }
Exemplo n.º 25
0
        private void AddModel()
        {
            GroupCharacter model = new GroupCharacter();
            AddGroupCharacterView view = new AddGroupCharacterView(true, model, repository) { ShowInTaskbar = false };
            view.ShowDialog();

            if (view.DialogResult != true) return;

            model.Id = repository.AddGroupCharacter(model);
            if (model.Id == 0)
            {
                MessageBoxWPF.Show(StringProject.ErrorAddRecort, StringProject.ErrorCaption, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            AllModel.Add(new GroupCharacterViewModel(model));
        }
Exemplo n.º 26
0
        // GET: WebCoin/Edit/5
        public ActionResult EditProduct(int?id)
        {
            var listMenu = db.tblMenus.ToList();

            listMenu.Insert(0, new tblMenu {
                IdMenu = 0, NameMenu = "Chọn menu"
            });
            var data = new AllModel
            {
                TblProduct  = db.tblProducts.FirstOrDefault(x => x.IdProducts == id),
                ListMenu    = listMenu,
                ListPicture = db.tblPictures.Where(x => x.ProductsId == id).ToList()
            };

            return(View(data));
        }
Exemplo n.º 27
0
        public ActionResult Edit(AllModel lOtrinhchoxe)
        {
            var tblLotrinh = new LOTRINHCHOXE();

            tblLotrinh.CAM       = lOtrinhchoxe.Cam == "0" ? false :true;
            tblLotrinh.KICHHOAT  = lOtrinhchoxe.KichHoat == "0" ? false : true;
            tblLotrinh.IDTUYEN   = lOtrinhchoxe.TblLoTrinhXe.IDTUYEN;
            tblLotrinh.MATAIXE   = lOtrinhchoxe.TblLoTrinhXe.MATAIXE;
            tblLotrinh.MAXE      = lOtrinhchoxe.TblLoTrinhXe.MAXE;
            tblLotrinh.IDLOTRINH = lOtrinhchoxe.TblLoTrinhXe.IDLOTRINH;


            db.Entry(tblLotrinh).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 28
0
        // GET: DmHoaDon/Create
        public ActionResult Create()
        {
            var dataTaiXe = db.DMXEs.ToList();

            dataTaiXe.Insert(0, new DMXE {
                MAXE = "", SOXE = "Chọn số xe"
            });
            var model = new AllModel
            {
                ListDmXe = dataTaiXe,
                DmHoaDon = new DMHOADON {
                    IDHOADON = 0
                }
            };

            return(View(model));
        }
Exemplo n.º 29
0
        public ActionResult ApiCreateProduct(AllModel model)
        {
            var _tblProduct = new tblProduct();

            _tblProduct = model.TblProduct;
            _tblProduct.CreateDateProducts = DateTime.Now;
            db.tblProducts.Add(_tblProduct);
            db.SaveChanges();
            var    webClient    = new WebClient();
            var    imageBytes   = webClient.DownloadData(model.UrlImg);
            string base64String = System.Convert.ToBase64String(imageBytes, 0, imageBytes.Length);

            SaveImg(new PictureModel {
                nameImg = "", idProducts = model.TblProduct.IdProducts, isactive = 1, index = 1, cfile = base64String
            });
            return(Json(model.TblProduct));
        }
Exemplo n.º 30
0
        public ActionResult EditCategory(AllModel model)
        {
            var dataMenu = db.tblMenus.Find(model.TblMenu.IdMenu);

            dataMenu.NameMenu        = model.TblMenu.NameMenu;
            dataMenu.NameMenu_en     = model.TblMenu.NameMenu_en;
            dataMenu.IdCompany       = model.TblMenu.IdCompany;
            dataMenu.IsCategoryMenu  = model.TblMenu.IsCategoryMenu;
            dataMenu.IsParent        = model.TblMenu.IsParent;
            dataMenu.ShowHomeMenu    = model.TblMenu.ShowHomeMenu;
            dataMenu.StatusMenu      = model.TblMenu.StatusMenu;
            dataMenu.LinkMenu        = model.TblMenu.LinkMenu;
            dataMenu.IdParentMenu    = model.TblMenu.IdParentMenu;
            db.Entry(dataMenu).State = EntityState.Modified;
            db.SaveChanges();
            return(RedirectToAction("IndexCategory"));
        }