Пример #1
0
        // GET: Acoes
        public ActionResult IndexAcao()
        {
            List <AcaoViewModel> listaAcoes = new List <AcaoViewModel>();

            try
            {
                List <ApplicationUser> listaUsrSist = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>().Users.Where(u => u.Ativo == true).OrderBy(u => u.UserName).ToList();

                using (AppServiceAcoesUsuarios appServAcoesUsuarios = new AppServiceAcoesUsuarios(this.UfwCartNew, this.IdCtaAcessoSist))
                {
                    IEnumerable <Acao> listaTodasAcoes = appServAcoesUsuarios.UfwCartNew.Repositories.GenericRepository <Acao>().Get().OrderBy(a => a.DescricaoMedio).ToList();

                    AddListaAcao(appServAcoesUsuarios, listaUsrSist, listaTodasAcoes.Where(a => a.SeqAcesso == null).ToList(), listaAcoes);
                    AddListaAcao(appServAcoesUsuarios, listaUsrSist, listaTodasAcoes.Where(a => a.SeqAcesso != null).ToList(), listaAcoes);
                    //listAcessos = Mapper.Map<IEnumerable<DtoAcesso>, IEnumerable<ACESSOViewModel>>(null);
                }

                ViewBag.listaUsuarios = new SelectList(listaUsrSist, "Id", "Nome");
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
            }

            return(View(listaAcoes));
        }
Пример #2
0
        public JsonResult GetListaModelosDocx(long?IdTipoAto)
        {
            bool   resp   = false;
            string mesage = string.Empty;
            List <DtoModeloDocxList> lista = new List <DtoModeloDocxList>();

            try
            {
                using (var appService = new AppServiceModelosDoc(this.UfwCartNew, this.IdCtaAcessoSist))
                {
                    lista  = appService.GetListaModelosDocx(IdTipoAto).ToList();
                    resp   = true;
                    mesage = "Dados retornados con sucesso";
                }
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                mesage = "Falha ao obter dados! " + "[" + ex.Message + "]";
            }

            var resultado = new
            {
                resposta         = resp,
                msg              = mesage,
                ListaModelosDocx = lista
            };

            return(Json(resultado));
        }
Пример #3
0
        public ActionResult EditarAto(long?Id)
        {
            try
            {
                if (Id.HasValue)
                {
                    Ato Ato = this.UfwCartNew.Repositories.GenericRepository <Ato>().GetById(Id);
                    if (Ato == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                    }
                    //else if (Ato.Bloqueado == true)
                    //{
                    //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Não é possível editar um ato já bloqueado.");
                    //}
                    AtoViewModel atoViewModel = new AtoViewModel()
                    {
                        Id = Id,
                        NumSequenciaAto = Ato.NumSequenciaAto
                    };

                    return(View(atoViewModel));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                }
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                return(RedirectToAction("InternalServerError", "Adm", new { excecao = ex }));
            }
        }
Пример #4
0
        // read from pack
        public LocFile Decode(Stream stream)
        {
            LocFile file = new LocFile();

            //file.Name = Path.GetFileName (packedFile.FullPath);
            using (BinaryReader reader = new BinaryReader(stream)) {
                if (reader.ReadInt16() != -257)
                {
                    throw new FileLoadException("Illegal loc file: doesn't have a byte order mark");
                }
                byte[] buffer = reader.ReadBytes(3);
                if (((buffer [0] != 0x4c) || (buffer [1] != 0x4f)) || (buffer [2] != 0x43))
                {
                    throw new FileLoadException("Illegal loc file: doesn't have LOC string");
                }
                reader.ReadByte();
                if (reader.ReadInt32() != 1)
                {
                    throw new FileLoadException("Illegal loc file: File version isn't '1'");
                }
                int numEntries = reader.ReadInt32();
                // file.entries = new List<LocEntry> ();
                for (int i = 0; i < numEntries; i++)
                {
                    string tag       = IOFunctions.ReadCAString(reader);
                    string localised = IOFunctions.ReadCAString(reader);
                    bool   tooltip   = reader.ReadBoolean();
                    file.Entries.Add(new LocEntry(tag, localised, tooltip));
                }
                reader.Close();
            }
            return(file);
        }
Пример #5
0
 public AtlasFile Decode(Stream file)
 {
     using (BinaryReader reader = new BinaryReader(file)) {
         if (reader.ReadInt32() != 1)
         {
             throw new FileLoadException("Illegal atlas file: Does not start with '1'");
         }
         reader.ReadBytes(4);
         int       numEntries = reader.ReadInt32();
         AtlasFile result     = new AtlasFile();
         for (int i = 0; i < numEntries; i++)
         {
             AtlasObject item = new AtlasObject {
                 Container1 = IOFunctions.ReadZeroTerminatedUnicode(reader),
                 Container2 = IOFunctions.ReadZeroTerminatedUnicode(reader),
                 X1         = reader.ReadSingle(),
                 Y1         = reader.ReadSingle(),
                 X2         = reader.ReadSingle(),
                 Y2         = reader.ReadSingle(),
                 X3         = reader.ReadSingle(),
                 Y3         = reader.ReadSingle()
             };
             result.add(item);
         }
         return(result);
     }
 }
Пример #6
0
        public FileResult DownloadFile([Bind(Include = "Id, Ip")] DadosPostModeloDocxDownload dadosPost)
        {
            string fileName = "modelo_" + dadosPost.Id.ToString() + ".docx";
            string filePath = Server.MapPath($"~/App_Data/Arquivos/Modelos/modelo_{dadosPost.Id}.docx");

            try
            {
                string ipAddress = dadosPost.Ip;
                if (string.IsNullOrEmpty(ipAddress))
                {
                    var host = Dns.GetHostEntry(Dns.GetHostName());
                    foreach (var ip in host.AddressList)
                    {
                        if (ip.AddressFamily == AddressFamily.InterNetwork)
                        {
                            ipAddress = ip.ToString();
                        }
                    }
                }

                byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);

                //Cadastro de LOG
                CadastrarLogDownload(ipAddress, dadosPost.Id);

                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                return(null);
            }
        }
Пример #7
0
        public GroupformationFile Decode(Stream stream)
        {
            List <Groupformation> formations;

            using (BinaryReader reader = new BinaryReader(stream)) {
                uint formationCount = reader.ReadUInt32();
                formations = new List <Groupformation>((int)formationCount);
                for (int j = 0; j < formationCount; j++)
                {
                    Groupformation formation = new Groupformation();
                    formation.Name     = IOFunctions.ReadCAString(reader);
                    formation.Priority = reader.ReadSingle();
                    formation.Purpose  = reader.ReadUInt32();
                    // Console.WriteLine("reading formation {0}, purpose {1}", formation.Name, formation.Purpose);
                    formation.Minima   = ReadList <Minimum>(reader, ReadMinimum);
                    formation.Factions = ReadList <string>(reader, IOFunctions.ReadCAString);
                    formation.Lines    = ReadList <Line>(reader, ReadLine);
                    formations.Add(formation);
                }
            }
            GroupformationFile formationFile = new GroupformationFile {
                Formations = formations
            };

            return(formationFile);
        }
Пример #8
0
        public JsonResult GetTextoWordDocModelo(long IdModeloDoc)
        {
            bool          resp    = false;
            StringBuilder texto   = new StringBuilder();
            string        message = string.Empty;

            try
            {
                string serverPath = Server.MapPath("~");

                using (AppServiceAtos appServ = new AppServiceAtos(this.UfwCartNew, this.IdCtaAcessoSist))
                {
                    texto = appServ.GetTextoWordDocModelo(IdModeloDoc, serverPath);
                }

                resp = true;
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                message = "Falha GetTextoWordDocModelo[" + ex.Message + "]";
            }

            var resultado = new
            {
                resposta  = resp,
                msg       = message,
                TextoHtml = texto.ToString()
            };

            return(Json(resultado));
        }
Пример #9
0
        public bool ExisteAto(string NumMatricula)
        {
            try
            {
                //string filePath = Server.MapPath($"~/App_Data/Arquivos/Atos/{NumMatricula}.docx");
                //using (FileStream fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
                //{

                //}
                Response.StatusCode = 200;
                return(true);
            }
            catch (FileNotFoundException ex)
            {
                Response.StatusCode = 200;
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                return(false);
            }
            catch (Exception ex)
            {
                Response.StatusCode = 500;
                Console.Write(ex);
                return(false);
            }
        }
Пример #10
0
 public override void Encode(BinaryWriter writer)
 {
     writer.Write(Value.Length > 0);
     if (Value.Length > 0)
     {
         IOFunctions.WriteCAString(writer, Value.Trim(), stringEncoding);
     }
 }
        private void ModManagerForm_Shown(object sender, EventArgs e)
        {
            // try to use saved path to Empire: Total War
            etwPath = Properties.Settings.Default.EmpireTotalWarPath;

            if (String.IsNullOrEmpty(etwPath) ||
                !Directory.Exists(etwPath))
            {
                // try to detect folder automatically
                etwPath = IOFunctions.GetEmpireTotalWarDirectory();

                if (String.IsNullOrEmpty(etwPath) ||
                    !Directory.Exists(etwPath))
                {
                    // make user find the path to Empire.exe (or quit the app)
                    while (findETWPathFolderBrowserDialog.ShowDialog() == DialogResult.OK)
                    {
                        if (File.Exists(Path.Combine(findETWPathFolderBrowserDialog.SelectedPath, "Empire.exe")))
                        {
                            etwPath = findETWPathFolderBrowserDialog.SelectedPath;
                            break;
                        }
                        MessageBox.Show("Empire.exe not found in that directory, please try again.", "Invalid directory", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }

                    if (String.IsNullOrEmpty(etwPath))
                    {
                        MessageBox.Show("Can't resolve path to Empire.exe; will quit now!", "No valid path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        Close();
                        return;
                    }
                }
            }

            etwDataPath = Path.Combine(etwPath, "data");

            // save detected or user-selected path
            Properties.Settings.Default.EmpireTotalWarPath = etwPath;
            Properties.Settings.Default.Save();

            refreshHelpLabel();

            // enumerate profiles
            foreach (string profileFilepath in Directory.GetFiles(scriptPath, "profile.*.txt"))
            {
                profilesComboBox.Items.Add(Regex.Match(profileFilepath, @"profile\.(.+)\.txt").Groups[1].ToString());
            }

            if (profilesComboBox.Items.Contains("last used mods"))
            {
                profilesComboBox.SelectedIndex = profilesComboBox.Items.IndexOf("last used mods");
            }
            else
            {
                fillModListView(null);
            }
        }
Пример #12
0
        public void rm_should_delete_all_subdirectories_without_throwing()
        {
            Execute("copyViews");
            var fileInfo = new FileInfo("copy_Views/Shared/Error.aspx");

            fileInfo.Exists.ShouldBeTrue();
            fileInfo.Attributes = FileAttributes.ReadOnly;
            IOFunctions.rm("copy_Views");
            new DirectoryInfo(@"copy_Views/Shared").Exists.ShouldEqual(false);
        }
        private static MeshTextureObject ReadMTO(BinaryReader reader)
        {
            MeshTextureObject obj3 = new MeshTextureObject {
                Mesh    = IOFunctions.ReadZeroTerminatedUnicode(reader),
                Texture = IOFunctions.ReadZeroTerminatedUnicode(reader),
                Bool1   = reader.ReadBoolean(),
                Bool2   = reader.ReadBoolean()
            };

            return(obj3);
        }
Пример #14
0
 public MainWindow() : base(Gtk.WindowType.Toplevel)
 {
     Build();
     elitistRadioButton.Active = true;
     MasterModel.AmIntratPeFormaDeParametrii      = false;
     MasterModel.AmIntratPeFormaDeParametriiBpred = false;
     MasterModel.AmIntratPeFormaDeParametriiCache = false;
     image6.File = "soo.PNG";
     this.Focus  = button1;
     IOFunctions.ClearFiles("./", "ta.log*");
     IOFunctions.ClearFiles("vex/configurations/", "*cfg");
 }
Пример #15
0
        public JsonResult GetTextoAto(InfAtoViewModel dadosAtoViewModel)
        {
            bool   resp    = false;
            string message = string.Empty;
            string texto   = string.Empty;

            try
            {
                if (dadosAtoViewModel.IdModeloDoc == 0)
                {
                    throw new NullReferenceException("Modelo de documento não definido!");
                }

                string serverPath = Server.MapPath("~");

                using (AppServiceAtos appServiceAtos = new AppServiceAtos(this.UfwCartNew, this.IdCtaAcessoSist))
                {
                    DtoInfAto dtoInfAto = new DtoInfAto
                    {
                        IdAto           = dadosAtoViewModel.IdAto,
                        IdCtaAcessoSist = this.IdCtaAcessoSist,
                        IdTipoAto       = dadosAtoViewModel.IdTipoAto,
                        IdLivro         = dadosAtoViewModel.IdLivro,
                        IdPrenotacao    = dadosAtoViewModel.IdPrenotacao,
                        IdModeloDoc     = dadosAtoViewModel.IdModeloDoc,
                        NumMatricula    = dadosAtoViewModel.NumMatricula,
                        ServerPath      = serverPath,
                        ListIdsPessoas  = dadosAtoViewModel.ListIdsPessoas
                    };

                    texto = appServiceAtos.GetTextoAto(dtoInfAto).ToString();
                }

                resp = true;
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);

                resp    = false;
                message = "Falha, GetTextoAto [" + ex.Message + "]";
            }

            var resultado = new
            {
                resposta  = resp,
                msg       = message,
                TextoHtml = texto
            };

            return(Json(resultado));
        }
Пример #16
0
        public JsonResult GetDadosPorPrenotacao(long IdPrenotacao)
        {
            bool     resp    = false;
            string   message = string.Empty;
            DateTime?dataReg = null;

            List <DtoDadosImovel> listaDtoDadosImovel = new List <DtoDadosImovel>();

            try
            {
                using (AppServiceAtos appServAtos = new AppServiceAtos(this.UfwCartNew, this.IdCtaAcessoSist))
                {
                    dataReg             = appServAtos.DataRegPrenotacao(IdPrenotacao);
                    listaDtoDadosImovel = appServAtos.GetListImoveisPrenotacao(IdPrenotacao).ToList();

                    if (listaDtoDadosImovel != null)
                    {
                        if (listaDtoDadosImovel.Count() > 0)
                        {
                            message = ":) Dados retornados con sucesso.";
                            resp    = true;
                        }
                        else
                        {
                            message = "Número de Prenotação e/ou matrículas não encontradas na base de dados!";
                        }
                    }
                    else
                    {
                        message = "Número de Prenotação Inválido!";
                    }
                }
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                message = "Falha ao obter dados! " + "[" + ex.Message + "]";
            }

            var resultado = new
            {
                resposta          = resp,
                msg               = message,
                DataRegPrenotacao = dataReg.HasValue? dataReg.Value.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture) :"",
                listaDtoDadosImovel
            };

            return(Json(resultado));
        }
Пример #17
0
    //public static string SavePicture(FileUpload FU, string GemHer, int Str, string NytFilNavn )
    public static string SavePicture(HttpPostedFile FU, string GemHer, int Str, string NytFilNavn)
    {
        // Eks. GemmesHer går fra eks. /gfx/big til C:\Marianne\asp.net\_CSHARP\Soda-Marianne\gfx/big
        string extension = Path.GetExtension(FU.FileName).ToLower(); //.jpg

        if (extension == ".jpg" || extension == ".jpeg" || extension == ".gif" || extension == ".png")
        {
            try
            {
                String TempImage;
                String NytImage;

                // TEMPIMAGE - arbejdsfilen - prefikses med _temp_, gemmes i mappen hvor det færdige billede skal gemmes, og bliver gjort til streamin for nye billede
                TempImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, GemHer) + "_temp_" + NytFilNavn;
                FU.SaveAs(TempImage);
                StreamReader StreamIn = new StreamReader(TempImage);
                // NYTIMAGE - måske flere placeringer - måske flere størrelser
                NytImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, GemHer) + NytFilNavn;
                StreamWriter StreamOut = new StreamWriter(NytImage);
                imageResize.ResizeImage(Str, StreamIn.BaseStream, StreamOut.BaseStream);
                // LUK streams og slet TEMP-billede
                StreamOut.Close();
                StreamIn.Close();

                //for at sætte flere billeder af det samme billede som StreamOut men bare i et anden støresle gør:

                //Ny resize
                //StreamReader streamIn2 = new StreamReader(TempImage);
                //StreamWriter streamOut2 = new StreamWriter(NytImage);
                //Resizer til bredde 100px
                //imageResize.ResizeImage(100, streamIn2.BaseStream, streamOut2.BaseStream);

                //streamIn2.Close();
                //streamOut2.Close();
                //------------------------------------------------------------------------------------------------

                IOFunctions.DeleteFile(TempImage);
            }
            catch (Exception)
            {
                throw;
            }
        }
        else
        {
            NytFilNavn = "fotopaavej.jpg";
        }
        return(NytFilNavn);
    }
Пример #18
0
 /*
  * Writes the given header to the given writer.
  */
 public static void WriteHeader(BinaryWriter writer, DBFileHeader header)
 {
     if (header.GUID != "")
     {
         writer.Write(GUID_MARKER);
         IOFunctions.WriteCAString(writer, header.GUID, Encoding.Unicode);
     }
     if (header.Version != 0)
     {
         writer.Write(VERSION_MARKER);
         writer.Write(header.Version);
     }
     writer.Write((byte)1);
     writer.Write(header.EntryCount);
 }
Пример #19
0
        public override void Decode(BinaryReader reader)
        {
            string result = "";
            byte   b      = reader.ReadByte();

            if (b == 1)
            {
                result         = IOFunctions.ReadCAString(reader, stringEncoding);
                readLengthZero = result.Length == 0;
            }
            else if (b != 0)
            {
                throw new InvalidDataException(string.Format("- invalid - ({0:x2})", b));
            }
            Value = result;
        }
Пример #20
0
 public void Encode(Stream encodeTo, GroupformationFile file)
 {
     Console.WriteLine("encoding formation file");
     using (BinaryWriter writer = new BinaryWriter(encodeTo)) {
         writer.Write((uint)file.Formations.Count);
         foreach (Groupformation formation in file.Formations)
         {
             IOFunctions.WriteCAString(writer, formation.Name);
             writer.Write(formation.Priority);
             writer.Write((uint)formation.Purpose);
             WriteList(writer, formation.Minima, WriteMinimum);
             WriteList(writer, formation.Factions, IOFunctions.WriteCAString);
             WriteList(writer, formation.Lines, WriteLine);
             ///////
         }
     }
 }
Пример #21
0
 // write to stream
 public void Encode(Stream stream, LocFile file)
 {
     using (var writer = new BinaryWriter(stream)) {
         writer.Write((short)(-257));
         writer.Write("LOC".ToCharArray());
         writer.Write((byte)0);
         writer.Write(1);
         writer.Write(file.NumEntries);
         for (int i = 0; i < file.NumEntries; i++)
         {
             IOFunctions.WriteCAString(writer, file.Entries [i].Tag);
             IOFunctions.WriteCAString(writer, file.Entries [i].Localised);
             writer.Write(file.Entries [i].Tooltip);
         }
         writer.Flush();
     }
 }
Пример #22
0
        public PFHeader(BinaryReader reader)
        {
            Version  = new string(reader.ReadChars(4));
            ByteMask = reader.ReadInt32();

            ReferenceFileCount = reader.ReadInt32();
            var pack_file_index_size = reader.ReadInt32();

            FileCount = reader.ReadInt32();
            var packed_file_index_size = reader.ReadInt32();

            var headerOffset = 24;

            if (Version == "PFH0")
            {
                _buffer = new byte[0];
            }
            else if (Version == "PFH2" || Version == "PFH3")
            {
                _buffer = reader.ReadBytes(32 - headerOffset);
            }
            else if (Version == "PFH4" || Version == "PFH5")
            {
                if ((ByteMask & HAS_EXTENDED_HEADER) != 0)
                {
                    _buffer = reader.ReadBytes(48 - headerOffset);
                }
                else
                {
                    _buffer = reader.ReadBytes(28 - headerOffset);  // 4 bytes for timestamp
                }
            }
            else if (Version == "PFH6")
            {
                _buffer = reader.ReadBytes(308 - headerOffset);
            }

            for (int i = 0; i < ReferenceFileCount; i++)
            {
                _dependantFiles.Add(IOFunctions.TheadUnsafeReadZeroTerminatedAscii(reader));
            }

            HasAdditionalInfo = (ByteMask & HAS_INDEX_WITH_TIMESTAMPS) != 0;
            DataStart         = headerOffset + _buffer.Length + pack_file_index_size + packed_file_index_size;
        }
Пример #23
0
        /// <summary>
        /// Pega o arquivo DOCX do ATO
        /// </summary>
        /// <param name="dadosPost">Dados do post</param>
        /// <returns>Download do arquivo DOCX</returns>
        public FileResult DownloadFileCompleto([Bind(Include = "Id")] long?Id)
        {
            string fileName = Id.ToString();
            string filePath = Server.MapPath($"~/App_Data/Arquivos/Atos/{Id}.docx");

            try
            {
                byte[] fileBytes = System.IO.File.ReadAllBytes(filePath);
                Response.StatusCode = 200;
                return(File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName));
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                Response.StatusCode = 500;
                return(null);
            }
        }
Пример #24
0
        public static DBFileHeader readHeader(BinaryReader reader)
        {
            byte   index      = reader.ReadByte();
            int    version    = 0;
            string guid       = "";
            bool   hasMarker  = false;
            uint   entryCount = 0;

            try {
                if (index != 1)
                {
                    // I don't think those can actually occur more than once per file
                    while (index == 0xFC || index == 0xFD)
                    {
                        var bytes = new List <byte>(4);
                        bytes.Add(index);
                        bytes.AddRange(reader.ReadBytes(3));
                        UInt32 marker = BitConverter.ToUInt32(bytes.ToArray(), 0);
                        if (marker == GUID_MARKER)
                        {
                            guid  = IOFunctions.ReadCAString(reader, Encoding.Unicode);
                            index = reader.ReadByte();
                        }
                        else if (marker == VERSION_MARKER)
                        {
                            hasMarker = true;
                            version   = reader.ReadInt32();
                            index     = reader.ReadByte();
                            // break;
                        }
                        else
                        {
                            throw new DBFileNotSupportedException(string.Format("could not interpret {0}", marker));
                        }
                    }
                }
                entryCount = reader.ReadUInt32();
            } catch {
            }
            DBFileHeader header = new DBFileHeader(guid, version, entryCount, hasMarker);

            return(header);
        }
        private static UnitVariantObject ReadObject(BinaryReader reader)
        {
            string modelName = IOFunctions.ReadZeroTerminatedUnicode(reader);

            // ignore index
            reader.ReadUInt32();
            uint num2    = reader.ReadUInt32();
            uint entries = reader.ReadUInt32();

            // ignore mesh start
            reader.ReadUInt32();
            UnitVariantObject item = new UnitVariantObject {
                ModelPart        = modelName,
                Num2             = num2,
                StoredEntryCount = entries
            };

            return(item);
        }
Пример #26
0
        public ActionResult BloquearAto(long?Id)
        {
            try
            {
                if (Id.HasValue)
                {
                    Ato Ato = this.UfwCartNew.Repositories.GenericRepository <Ato>().GetById(Id);
                    if (Ato == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.NotFound));
                    }
                    //else if (Ato.Bloqueado == true)
                    //{
                    //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest, "Não é possível bloquear um ato já bloqueado");
                    //}
                    AtoListViewModel atoViewModel = new AtoListViewModel
                    {
                        Id    = Ato.Id,
                        Ativo = Ato.Ativo,
                        //NumSequencia = Ato.NumSequencia,
                        Codigo        = "",
                        DataAlteracao = Ato.DataAlteracao,
                        DataCadastro  = Ato.DataCadastro,
                        //NomeArquivo = Ato.NomeArquivo,
                        NumMatricula = Ato.NumMatricula,
                        IdPrenotacao = Ato.IdPrenotacao
                    };

                    return(View(atoViewModel));
                }
                else
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                return(RedirectToAction("InternalServerError", "Adm", new { excecao = ex }));
            }
        }
Пример #27
0
 public void Encode(Stream stream, AtlasFile toEncode)
 {
     using (BinaryWriter writer = new BinaryWriter(stream)) {
         writer.Write((uint)1);
         writer.Write((uint)0);
         int numEntries = toEncode.Entries.Count;
         writer.Write(numEntries);
         for (int i = 0; i < numEntries; i++)
         {
             IOFunctions.WriteZeroTerminatedUnicode(writer, toEncode.Entries[i].Container1);
             IOFunctions.WriteZeroTerminatedUnicode(writer, toEncode.Entries[i].Container2);
             writer.Write(toEncode.Entries[i].X1);
             writer.Write(toEncode.Entries[i].Y1);
             writer.Write(toEncode.Entries[i].X2);
             writer.Write(toEncode.Entries[i].Y2);
             writer.Write(toEncode.Entries[i].X3);
             writer.Write(toEncode.Entries[i].Y3);
         }
     }
 }
Пример #28
0
        protected void btnSend_Click(object sender, EventArgs e)
        {
            objNews._id = Convert.ToInt32(Request.QueryString["ret"]);
            dt          = objNews.GetNewsByfldID();

            string imagename;


            if ((chbImg.Checked || fuImage.HasFile) && !string.IsNullOrEmpty(dt.Rows[0]["fldImage"].ToString()))
            {
                IOFunctions.DeleteFile(Server.MapPath("../Img/News/") + dt.Rows[0]["fldImage"]);
                imagename = ""; // 图像名称在数据库中将默认删除
            }

            else
            {
                imagename = dt.Rows[0]["fldImage"].ToString();
            }

            if (fuImage.HasFile)
            {
                imagename = PictureSave.SavePicture(fuImage.PostedFile, "Img/News/", 580);
            }
            objNews._image   = imagename;
            objNews._title   = txtTitle.Text;
            objNews._text    = txtText.Text;
            objNews._preview = txtPreview.Text;
            objNews._typeid  = Convert.ToInt32(ddlNewsType.SelectedValue);

            int antalnewsopdateret = objNews.EditNews();

            if (antalnewsopdateret > 0)
            {
                litResult.Text = "<h4>这条新闻已经更新!</h4>";
            }
            else
            {
                litResult.Text = "<h4>更新错误!</h4>";
            }
        }
Пример #29
0
        public ActionResult EditarModelo(ModeloDocxViewModel modeloDocxViewModel)
        {
            try
            {
                List <TipoAtoList> listaTipoAto = this.UfwCartNew.Repositories.RepositoryTipoAto.ListaTipoAtos(null).ToList();
                ViewBag.listaTipoAto = listaTipoAto; // new SelectList(listaTipoAto, "Id", "Descricao");

                if (ModelState.IsValid)
                {
                    // Fazendo Upload do arquivo
                    using (var appService = new AppServiceModelosDoc(this.UfwCartNew, this.IdCtaAcessoSist))
                    {
                        appService.EditarModelo(new DtoModeloDoc()
                        {
                            Id = modeloDocxViewModel.Id,
                            IdCtaAcessoSist        = this.IdCtaAcessoSist,
                            IdTipoAto              = modeloDocxViewModel.IdTipoAto,
                            CaminhoEArquivo        = modeloDocxViewModel.CaminhoEArquivo, // Path.Combine(Server.MapPath("~/App_Data/Arquivos/Modelos/"), NovoId.ToString() + ".docx"),
                            ArquivoDocxModelo      = modeloDocxViewModel.ArquivoDocxModelo,
                            DescricaoModelo        = modeloDocxViewModel.DescricaoModelo,
                            IpLocal                = modeloDocxViewModel.IpLocal,
                            UsuarioSistOperacional = System.Security.Principal.WindowsIdentity.GetCurrent().Name,
                            Ativo = modeloDocxViewModel.Ativo
                        }, UsuarioAtual.Id);
                    }

                    //UploadArquivo(arquivoModeloDocxViewModel);

                    //ViewBag.resultado = "Arquivo salvo com sucesso!";
                    return(RedirectToActionPermanent(nameof(IndexModelo)));
                }
                return(View(modeloDocxViewModel));
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);
                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }
        }
Пример #30
0
        // GET: Modelo/Novo
        public ActionResult NovoModelo()
        {
            try
            {
                List <TipoAtoList> listaTipoAto = this.UfwCartNew.Repositories.RepositoryTipoAto.ListaTipoAtos(null).ToList();
                ViewBag.listaTipoAto = listaTipoAto; // new SelectList(listaTipoAto, "Id", "Descricao");

                ModeloDocxViewModel model = new ModeloDocxViewModel();
                model.IdCtaAcessoSist   = this.IdCtaAcessoSist;
                model.IdUsuarioCadastro = this.UsuarioAtual.Id;
                model.DescricaoTipoAto  = "";

                return(View(model));
            }
            catch (Exception ex)
            {
                TypeInfo t = this.GetType().GetTypeInfo();
                IOFunctions.GerarLogErro(t, ex);

                return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
            }
        }
Пример #31
0
 protected internal virtual void loadBuiltInFunctions()
 {
     // load the engine relate functions like declaring rules, templates, etc
     RuleEngineFunctions rulefs = new RuleEngineFunctions();
     functionGroups.Add(rulefs);
     rulefs.loadFunctions(this);
     // load boolean functions
     BooleanFunctions boolfs = new BooleanFunctions();
     functionGroups.Add(boolfs);
     boolfs.loadFunctions(this);
     // load IO functions
     IOFunctions iofs = new IOFunctions();
     functionGroups.Add(iofs);
     iofs.loadFunctions(this);
     // load math functions
     MathFunctions mathfs = new MathFunctions();
     functionGroups.Add(mathfs);
     mathfs.loadFunctions(this);
     declareFunction(new IfFunction());
     functionGroups.Add(deffunctions);
 }