public object GetVrsteHomologacijeBySertificate(DataSourceLoadOptions loadOptions)
        {
            var vrsteHomologacije = new List <VrsteHomologacijeModel>();

            try
            {
                GlavnaMasterModel glavnaMaster = GlavnaDAO.GetMasterObjectByUvoznikId(HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik").Uvoznik.AutoID);
                HttpContext.Session.SetInt32("GlavnaMasterID", glavnaMaster.AutoID);
                vrsteHomologacije = VrsteHomologacijeDAO.GetAllVrsteHomologacijeFromGlavna(Convert.ToInt32(HttpContext.Session.GetInt32("GlavnaMasterID")));
            }
            catch
            {
            }

            return(DataSourceLoader.Load(vrsteHomologacije, loadOptions));
        }
예제 #2
0
        //public IActionResult FileSystem(FileSystemCommand command, string arguments)
        //{
        //    //var config = new FileSystemConfiguration
        //    //{
        //    //    Request = Request,
        //    //    FileSystemProvider = new DefaultFileProvider(CreateGlavnaMasterFolder()),
        //    //    //AllowCopy = true,
        //    //    //AllowCreate = true,
        //    //    //AllowMove = true,
        //    //    AllowRemove = true,
        //    //    AllowRename = true,
        //    //    AllowUpload = true
        //    //};
        //    dynamic jsonObject = JObject.Parse(arguments);
        //    int? parentid = jsonObject.destinationId;
        //    if (parentid != null)
        //        if (GlavnaDAO.CheckRASGlavna(parentid, HttpContext.Session.GetObjectFromJson<KorisnikModel>("LogovaniKorisnik").Uvoznik.AutoID))
        //        {
        //            if (command == FileSystemCommand.UploadChunk)
        //            {
        //                return BadRequest("Ne možete uploadovati dokumente za trenutni status predmeta!");
        //            }
        //        }
        //    //var processor = new FileSystemCommandProcessor(config);
        //    //var result = processor.Execute(command, arguments);
        //    return Ok(result.GetClientCommandResult());
        //}

        //[HttpPost]
        //public ActionResult UploadFile()
        //{
        //    var myFile = Request.Files["myFile"];
        //    var targetLocation = Server.MapPath("~/Content/Files/");
        //    var uniqueFileName = string.Format("{0}_{1}{2}",
        //        Path.GetFileNameWithoutExtension(myFile.FileName),
        //        Request["key"],
        //        Path.GetExtension(myFile.FileName));

        //    try
        //    {
        //        var path = Path.Combine(targetLocation, uniqueFileName);
        //        myFile.SaveAs(path);
        //        Session["currentFilePath"] = path;
        //    }
        //    catch
        //    {
        //        Response.StatusCode = 400;
        //    }

        //    return new EmptyResult();
        //}

        //public ActionResult Edit()
        //{
        //    if (KorisnikModel.LogovanKorisnik.Uvoznik.AutoID == 0)
        //    {
        //        return View("~/Views/Login/Index.cshtml");
        //    }

        //    if (KorisnikModel.LogovanKorisnik.Uvoznik.AutoID == 0)
        //    {
        //        return View("~/Views/Login/Index.cshtml");
        //    }

        //    ViewBagModel viewBag = new ViewBagModel();
        //    GlavnaMasterModel glavnaMaster = GlavnaDAO.GetMasterObjectById(GlavnaMasterAutoID);
        //    viewBag.GlavnaMaster = glavnaMaster;
        //    ViewBag.Message = "Obračun računa se vrši 1-og u mjesecu za unešene zahtjeve iz prethodnog mjeseca.";
        //    return View("Create", viewBag);
        //}


        public ActionResult Edit()
        {
            ViewBagModel viewBag = new ViewBagModel();

            //ViewBag.Message = "Obračun računa se vrši 1-og u mjesecu za unešene zahtjeve iz prethodnog mjeseca.";
            try
            {
                if (HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik") == null)
                {
                    return(View("~/Views/Login/Index.cshtml"));
                }
                GlavnaMasterModel glavnaMaster = GlavnaDAO.GetMasterObjectByUvoznikId(HttpContext.Session.GetObjectFromJson <KorisnikModel>("LogovaniKorisnik").Uvoznik.AutoID);
                viewBag.GlavnaMaster = glavnaMaster;
                HttpContext.Session.SetInt32("GlavnaMasterID", glavnaMaster.AutoID);
                //HttpContext.Session.SetString("ApprovalFilePath", Path.Combine(IocContainer.Configuration["DocumentsPath"], glavnaMaster.DatumKreiranjaUTC.Year.ToString(), GetMonth(glavnaMaster.DatumKreiranjaUTC), glavna.GlavnaMaster.AutoID.ToString(), glavna.AutoID.ToString()));
            } catch (Exception e)
            {
                return(View("Create"));
            }
            return(View("Create", viewBag));
        }