Exemple #1
0
        void LoadList(object param)
        {
            if (param != null && param is String)
            {
                var db = new AddContext();
                switch (param.ToString())
                {
                case "Armor":
                    break;

                case "Weapons":
                    var view = new Views.ItemList();
                    var vm   = new ViewModel.ListViewModel();
                    vm.Items = new ObservableCollection <dynamic> {
                        db.Weapons
                    };
                    view.DataContext = view;
                    object dataContext = (Application.Current.MainWindow as MainWindow)?.DataContext;
                    MainWindowViewModel mainWindowViewModel = (dataContext as MainWindowViewModel);
                    mainWindowViewModel.CurrentView = view;

                    break;

                default:
                    break;
                }
            }
        }
Exemple #2
0
 public String Update(ViewModel.ListViewModel ListView)
 {
     try {
         ListView.TypeCopy = ListView.TypeCopy.Replace(" ", "");
         ExponentPortalEntities db = new ExponentPortalEntities();
         int    TypeId             = Util.GetTypeId(ListView.TypeCopy);
         string BinaryCode         = Util.DecToBin(TypeId);
         //checking for upadation or new record creation
         if (ListView.Id == 0)
         {
             if (!exLogic.User.hasAccess("lOOKUP.CREATE"))
             {
                 return(Util.jsonStat("error", "Access Denied"));
             }
             string SQL = "INSERT INTO LUP_DRONE(\n" +
                          "  Type,\n" +
                          "  Code,\n" +
                          "  TypeId,\n" +
                          "  BinaryCode,\n" +
                          "  Name,\n" +
                          "  CreatedBy,\n" +
                          "  CreatedOn,\n" +
                          "  IsActive\n" +
                          ") VALUES(\n" +
                          "  '" + ListView.TypeCopy + "',\n" +
                          "  '" + ListView.Code + "',\n" +
                          "  " + TypeId + ",\n" +
                          "  '" + BinaryCode + "',\n" +
                          "  '" + ListView.Name + "',\n" +
                          "  " + Util.getLoginUserID() + ",\n" +
                          "  GETDATE(),\n" +
                          "  'True'" +
                          ")";
             int ListId = Util.InsertSQL(SQL);
             return(JSonData(ListView));
         }
         else
         {
             if (!exLogic.User.hasAccess("lOOKUP.EDIT"))
             {
                 return(Util.jsonStat("error", "Access Denied"));
             }
             string SQL = "UPDATE LUP_DRONE SET\n" +
                          "  Type='" + ListView.TypeCopy + "',\n" +
                          "  Code='" + ListView.Code + "',\n" +
                          "  Name='" + ListView.Name + "',\n" +
                          "  ModifiedBy=" + Util.getLoginUserID() + ",\n" +
                          "  ModifiedOn=GETDATE()\n" +
                          "where\n" +
                          "  Id=" + ListView.Id;
             int ListId = Util.doSQL(SQL);
             return(JSonData(ListView));
         }
         // return RedirectToAction("Listnames");
     } catch (Exception ex) {
         return(Util.jsonStat("error", ex.Message));
     }
 }
Exemple #3
0
        // GET: List/Create
        public ActionResult Create()
        {
            if (!exLogic.User.hasAccess("lOOKUP.CREATE"))
            {
                return(RedirectToAction("NoAccess", "Home"));
            }
            var viewModel = new ViewModel.ListViewModel {
                Typelist = Util.LUPTypeList()
            };

            return(View(viewModel));
        }
Exemple #4
0
        public PartialViewResult ListNames(ViewModel.ListViewModel list, String TypeName)
        {
            ExponentPortalEntities db = new ExponentPortalEntities();
            var result = from r in db.LUP_Drone
                         where r.Type == TypeName & (bool)r.IsActive
                         orderby r.Name
                         select r;

            list.NameList = result;
            list.TypeCopy = TypeName;
            return(PartialView("LookupDetails", list));
        }
Exemple #5
0
        private String JSonData(ViewModel.ListViewModel ListView)
        {
            StringBuilder JSON = new StringBuilder();

            JSON.Append("{");
            JSON.AppendLine("\"status\": \"ok\",");
            JSON.AppendLine("\"id\": \"" + ListView.Id.ToString() + "\",");
            JSON.AppendLine("\"code\": \"" + ListView.Code.ToString() + "\",");
            JSON.AppendLine("\"name\": \"" + ListView.Name.ToString() + "\"");
            JSON.Append("}");
            return(JSON.ToString());
        }
        public ActionResult Add(int music_id)
        {
            var list = from p in db.List
                       select p;
            var music          = db.Music1.Find(music_id);
            var pictureinalbum = new ViewModel.ListViewModel
            {
                List2 = list,
                Music = music,
            };

            return(View(pictureinalbum));
        }