Exemplo n.º 1
0
        public void GetTest()
        {
            DocModelProvider provider = new DocModelProvider(env.ConnectorSgbd);
            DocModel         model    = provider.GetDocModel(1);

            Assert.IsNotNull(model);
        }
Exemplo n.º 2
0
        /*
         * public void testeSQLite(string Comand)
         * {
         *  IBanco SQLiteBanco;
         *  try
         *  {
         *      SQLiteBanco = new FacBanco().CriarBanco("SQLite");
         *      foreach (AtivModel item in MontaRetornoSQLite(SQLiteBanco.ExecutaSelect(Comand)))
         *      {
         *          Console.WriteLine(item.CodAtiv);
         *          Console.WriteLine(item.Descricao);
         *      }
         *
         *  }
         *  catch (Exception)
         *  {
         *      throw;
         *  }
         * }
         */

        List <DocModel> MontaRetornoSQLite(DataSet data)
        {
            List <DocModel> retorno;
            DocModel        objAux;

            try
            {
                retorno = new List <DocModel>();

                for (int i = 0; i < data.Tables[0].Rows.Count; i++)
                {
                    objAux            = new DocModel();
                    objAux.Id         = Convert.ToInt32(data.Tables[0].Rows[i]["Id"]);
                    objAux.Nome       = data.Tables[0].Rows[i]["Nome"].ToString();
                    objAux.Senha      = data.Tables[0].Rows[i]["Senha"].ToString();
                    objAux.TempoXP    = Convert.ToInt32(data.Tables[0].Rows[i]["TempoXP"]);
                    objAux.Titulo     = data.Tables[0].Rows[i]["Titulo"].ToString();
                    objAux.Usuario    = data.Tables[0].Rows[i]["Usuario"].ToString();
                    objAux.UserStatus = data.Tables[0].Rows[i]["UserStatus"].ToString();
                    objAux.Cargo      = data.Tables[0].Rows[i]["Cargo"].ToString();
                    retorno.Add(objAux);
                    objAux = null;
                }
                return(retorno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 3
0
 public void insert(DocModel p_obj)
 {
     try
     {
         Comando = "insert into tbDocente" +
                   "(Nome, " +
                   "Titulo, " +
                   "TempoXP, " +
                   "Usuario," +
                   " Cargo, " +
                   " UserStatus, " +
                   "Senha) " +
                   "values (" +
                   "'" + p_obj.Nome + "'," +
                   "'" + p_obj.Titulo + "'," +
                   "" + p_obj.TempoXP + "," +
                   "'" + p_obj.Usuario + "'," +
                   "'" + p_obj.Cargo + "'," +
                   "'" + p_obj.UserStatus + "', " +
                   "'" + p_obj.Senha + "')";
         objDados.ExecutaComando(Comando);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
 public frmADM(DocModel p_obj)
 {
     InitializeComponent();
     this.docModel = p_obj;
     CtrlAtiv      = new AtividadeController();
     CtrlDoc       = new DocenteController();
 }
Exemplo n.º 5
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            DocModel    objLogin;
            DocenteView tela;
            frmADM      telaADM;

            try
            {
                objLogin         = new DocModel();
                objLogin.Usuario = txtLogin.Text;
                objLogin.Senha   = txtSenha.Text;
                objLogin         = CtrlDocente.ConsultarDocente(objLogin).First();

                if (objLogin.UserStatus == "DOC")
                {
                    Visible = false;
                    tela    = new DocenteView(objLogin);
                    tela.ShowDialog();
                    tela    = null;
                    Visible = true;
                }
                else
                {
                    Visible = false;
                    telaADM = new frmADM(objLogin);
                    telaADM.ShowDialog();
                    telaADM = null;
                    Visible = true;
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Usuário ou senha incorretos");
            }
        }
Exemplo n.º 6
0
        public void EditElement(string title, string type, string ElementId,
                                List <string> updatedItems)

        {
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
            DocModel doc     = SerialisationService.GetDoc(title, type);
            Element  element = doc.GetElementByGuid(Guid.Parse(ElementId));

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < updatedItems.Count - 1; i++)
            {
                sb.Append(updatedItems[i]);
            }
            sb.Append(updatedItems[updatedItems.Count - 1]);

            int pos = doc.Elements.IndexOf(element);

            doc.Elements.Remove(element);
            element.Content = sb.ToString();
            doc.Elements.Insert(pos, element);
            UpdateDoc(doc);
            HttpContext.Current.Response.End();
        }
Exemplo n.º 7
0
        public ActionResult DownloadZip(string type, string[] SN)
        {
            string        zipPath         = Server.MapPath("~/Upload//zip//" + type);
            string        downloadUrl     = string.Empty;
            List <string> zipFileNamePath = new List <string>();

            if (type == "img")
            {
                List <Rio_Pic> Pic = new PicModel().getZipPic(SN);
                foreach (var item in Pic)
                {
                    zipFileNamePath.Add(Server.MapPath(item.PicPath) + item.PicName);
                }
            }
            else if (type == "doc")
            {
                List <Rio_Doc> Doc = DocModel.getZipDoc(SN);
                foreach (var item in Doc)
                {
                    zipFileNamePath.Add(Server.MapPath(item.DocPath) + item.DocName);
                }
            }

            downloadUrl = App_Code.Zip.AddZip(zipFileNamePath, zipPath);

            return(Content("/Upload/zip/" + type + "/" + downloadUrl));
        }
Exemplo n.º 8
0
        //
        // GET: /DocumentModels/
        public ActionResult Get(string id)
        {
            DocModel        docModel = DocModelProvider.GetDocModel(int.Parse(id));
            DocModelApiPoco retour   = new DocModelApiPoco(docModel);

            return(Json(retour, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 9
0
        private void Pesquisar()
        {
            DocModel aux;

            aux = new DocModel();
            if (txtID.Text != "" && txtNome.Text != "")
            {
                aux.Id   = Convert.ToInt32(txtID.Text);
                aux.Nome = txtNome.Text;
            }
            else if (txtID.Text != "")
            {
                aux.Id = Convert.ToInt32(txtID.Text);
            }
            else if (txtNome.Text != "")
            {
                aux.Nome = txtNome.Text;
            }
            else
            {
                ListaDoc = CtrlDocente.ConsultarTodos();
                MontaGrid();;
                return;
            }
            ListaDoc = CtrlDocente.ConsultarDocente(aux);
            MontaGrid();
        }
Exemplo n.º 10
0
        public void ElementDelete(string title, string type, string ElementId)
        {
            DocModel doc     = SerialisationService.GetDoc(title, type);
            Element  element = doc.GetElementByGuid(Guid.Parse(ElementId));

            doc.Elements.Remove(element);
            UpdateDoc(doc);
        }
        /// <summary>
        /// Get all pdf for user
        /// </summary>
        /// <param name="doc"></param>
        /// <returns></returns>
        private async Task <List <PdfModel> > GetPdf(DocModel doc)
        {
            List <PdfModel> listPdfModel = await _streamservice.GetPdfFile(doc);

            IsLoading    = false;
            ShowPanelImg = true;
            return(listPdfModel);
        }
Exemplo n.º 12
0
        public ActionResult DocHome()
        {
            session = new SessionHelper();
            DocModel objDocModel = new DocModel();

            objDocModel.doc = objDocManager.getDocs(Convert.ToInt64(session.UserSession.PIN), Convert.ToInt64(session.UserSession.UserId));
            return(View(objDocModel));
        }
Exemplo n.º 13
0
 public static void SerialiseDoc(DocModel doc)
 {
     // will overwrite existing xml
     System.IO.StreamWriter file = new System.IO.StreamWriter(Constants.XMLFolderPath + doc.Title + "-" + doc.Type + ".xml");
     System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(doc.GetType());
     x.Serialize(file, doc);
     file.Close();
 }
Exemplo n.º 14
0
        public ActionResult RioDocView(int?page)
        {
            int            pageNumber = page ?? 1;
            string         ID         = string.Empty;
            string         title      = "DocView";
            string         mode       = "V";
            bool           isUser     = false;
            List <Rio_Doc> data       = new List <Rio_Doc>();
            ClassNameModel cn         = ClassNameModel.getClassName("doc");

            if (Request.QueryString.Get("m") != null)
            {
                if (Request.QueryString.Get("m").Equals("E"))
                {
                    title = "DocEdit";
                    mode  = "E";
                }
            }

            ViewBag.title = title;

            if (Session["UserID"] != null)
            {
                ID   = Session["UserID"].ToString();
                data = DocModel.getUserAllDocByID(ID);
            }

            if (Request.QueryString.Get("vid") != null)
            {
                ID   = Request.QueryString.Get("vid").ToString();
                data = DocModel.getUserDocEnableListByID(ID);
            }

            if (Session["UserID"] != null && Request.QueryString.Get("vid") != null)
            {
                if (Session["UserID"].ToString().Equals(Request.QueryString.Get("vid")))
                {
                    ID     = Session["UserID"].ToString();
                    data   = DocModel.getUserAllDocByID(ID);
                    isUser = true;
                }
            }

            if (Session["UserID"] == null && Request.QueryString.Get("vid") == null)
            {
                return(RedirectToAction("Login", "Rio_Account", null));
            }

            ViewBag.mode      = mode;
            ViewBag.vid       = ID;
            ViewBag.isUser    = isUser;
            ViewBag.className = cn;

            var pageNumeber = page ?? 1;
            var pageData    = data.ToPagedList(pageNumeber, 24);

            return(View(pageData));
        }
Exemplo n.º 15
0
 public DocenteView(DocModel docModel)
 {
     InitializeComponent();
     Width       = 1391;
     Height      = 730;
     CtrlDoc     = new DocenteController();
     CtrlAtiv    = new AtividadeController();
     this.objDOC = docModel;
 }
Exemplo n.º 16
0
        public static void WriteHtml(string title, string type)
        {
            DocModel     doc    = SerialisationService.GetDoc(title, type);
            string       html   = MakeHtml(doc);
            StreamWriter writer = new StreamWriter(Constants.HTMLFolderPath + doc.Title + "-" + doc.Type + ".html");

            writer.Write(html);
            writer.Close();
        }
Exemplo n.º 17
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public TargetFramework(ITypeMapResolver resolver, AssemblyClassLoader assemblyClassLoader, DocModel xmlModel, Action <string> missingParamTypeReport, bool importAsStubs, bool importPublicOnly, IEnumerable <string> excludedPackages)
 {
     this.missingParamTypeReport = missingParamTypeReport;
     this.importAsStubs          = importAsStubs;
     this.importPublicOnly       = importPublicOnly;
     XmlModel              = xmlModel;
     typeNameMap           = new TypeNameMap(resolver, assemblyClassLoader);
     this.excludedPackages = new HashSet <string>(excludedPackages);
 }
Exemplo n.º 18
0
        public List <DocModel> Select(DocModel p_obj)
        {
            List <DocModel> retorno;

            try
            {
                retorno = new List <DocModel>();
                Comando = "Select * From tbDocente";

                if (p_obj.Id != 0)
                {
                    Comando = Comando + " where id = " + p_obj.Id;
                }

                if (p_obj.Usuario != "")
                {
                    if (Comando.IndexOf("where") == -1)
                    {
                        Comando = Comando + " where Usuario =  '" + p_obj.Usuario + "' ";
                    }
                    else
                    {
                        Comando = Comando + " and Usuario = '" + p_obj.Usuario + "' ";
                    }
                }
                if (p_obj.Senha != "")
                {
                    if (Comando.IndexOf("where") == -1)
                    {
                        Comando = Comando + " where Senha =  '" + p_obj.Senha + "' ";
                    }
                    else
                    {
                        Comando = Comando + " and Senha = '" + p_obj.Senha + "' ";
                    }
                }

                if (p_obj.Nome != "")
                {
                    if (Comando.IndexOf("where") == -1)
                    {
                        Comando = Comando + " where Nome =  '" + p_obj.Nome + "' ";
                    }
                    else
                    {
                        Comando = Comando + " and Nome = '" + p_obj.Nome + "' ";
                    }
                }

                retorno = MontaRetorno(objDados.ExecutaSelect(Comando));
                return(retorno);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Create Dot42.dll
        /// </summary>
        private static void CreateFrameworkAssembly(JarFile jf, DocModel xmlModel, SourceProperties sourceProperties, string folder)
        {
            // Initialize all
            MappedTypeBuilder.Initialize(CompositionContainer);

            // Create java type wrappers
            var module      = new NetModule(AttributeConstants.Dot42Scope);
            var classLoader = new AssemblyClassLoader(null);
            var target      = new TargetFramework(null, classLoader, xmlModel, LogMissingParamNamesType, true, false, Enumerable.Empty <string>());

            List <TypeBuilder> typeBuilders;

            using (Profiler.Profile(x => Console.WriteLine("{0:####} ms for Create()", x.TotalMilliseconds)))
            {
                var classTypeBuilders = jf.ClassNames.SelectMany(n => StandardTypeBuilder.Create(jf.LoadClass(n), target));
                var customTypeBuilder = CompositionContainer.GetExportedValues <ICustomTypeBuilder>()
                                        .OrderBy(x => x.CustomTypeName)
                                        .Select(x => x.AsTypeBuilder());

                typeBuilders = classTypeBuilders.Concat(customTypeBuilder)
                               .OrderBy(x => x.Priority)
                               .ToList();



                typeBuilders.ForEach(x => x.CreateType(null, module, target));
            }

            // Create JavaRef attribute
            //JavaRefAttributeBuilder.Build(asm.MainModule);

            // Implement and finalize types
            using (Profiler.Profile(x => Console.WriteLine("{0:####} ms for Implement()", x.TotalMilliseconds)))
            {
                JarImporter.Implement(typeBuilders, target);
            }

            // Save
            using (Profiler.Profile(x => Console.WriteLine("{0:####} ms for Generate()", x.TotalMilliseconds)))
            {
                CodeGenerator.Generate(folder, module.Types, new List <NetCustomAttribute>(), target, new FrameworkCodeGeneratorContext(), target);
            }

            // Create layout.xml
            var doc = new XDocument(new XElement("layout"));

            typeBuilders.ForEach(x => x.FillLayoutXml(jf, doc.Root));
            doc.Save(Path.Combine(folder, "layout.xml"));

            // create dot42.typemap
            doc = new XDocument(new XElement("typemap"));
            typeBuilders.ForEach(x => x.FillTypemapXml(jf, doc.Root));
            doc.Save(Path.Combine(folder, "dot42.typemap"));
            //using (var s = new FileStream(Path.Combine(folder, "dot42.typemap"), FileMode.Create))
            //    CompressedXml.WriteTo(doc, s, Encoding.UTF8);
        }
Exemplo n.º 20
0
 public void InserirDocente(DocModel p_obj)
 {
     try
     {
         objRepo.insert(p_obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 21
0
 public void AtualizarDocente(DocModel p_obj)
 {
     try
     {
         objRepo.Update(p_obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 22
0
 public void RemoverDocente(DocModel p_obj)
 {
     try
     {
         objRepo.Remove(p_obj);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 23
0
        public ActionResult DoReject(DocModel docModel)
        {
            GetBll(docModel.DocType).Reject(docModel.Id, ApproveManager.Reject(docModel.Status), GetCurrentUserName(), docModel.Remark);

            var window = this.GetCmp <Window>("windowFormPanelDocApprove");

            window.Hide();

            Refresh();
            return(this.Direct());
        }
Exemplo n.º 24
0
 public List <DocModel> ConsultarDocente(DocModel p_obj)
 {
     try
     {
         return(objRepo.Select(p_obj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 25
0
        public void CreateTest()
        {
            DocModelProvider provider = new DocModelProvider(env.ConnectorSgbd);
            DocModel         model    = provider.CreateModel(new DataInvoice.SOLUTIONS.GENERAL.ACCOUNT.Account {
                IDAccount = 1
            },
                                                             new DataInvoice.SOLUTIONS.INVOICES.CAMPAIGN.Campaign {
                IDCampaign = 1
            }, "Model Test 1");

            Assert.IsNotNull(model);
        }
Exemplo n.º 26
0
 public void Remove(DocModel p_obj)
 {
     try
     {
         Comando = "delete from tbDocente where id = " + p_obj.Id;
         objDados.ExecutaComando(Comando);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 27
0
        public async Task <DocModel> GetDocByPathAsync(string Path)
        {
            DocModel docModel = null;
            var      a        = await File.ReadAllTextAsync(Path);

            docModel            = new DocModel();
            docModel.Id         = 4;
            docModel.DocName    = "log.txt";
            docModel.DocPath    = @"D:\log.txt";
            docModel.DocContent = a;
            //var b = await File.ReadAllTextAsync(@"D:\log.doc"); //buxing

            return(docModel);
        }
Exemplo n.º 28
0
        public void DocCreate(string name, string type)
        {
            DocModel doc = SerialisationService.GetDoc(name, type);

            if (doc == null)
            {
                DocModel NewDoc = new DocModel(name, type);
                SerialisationService.SerialiseDoc(NewDoc);
            }
            else
            {
                throw new Exception("Document : " + name + "-" + type + " already exists - not created.");
            }
        }
Exemplo n.º 29
0
        public ActionResult LoadDocToEdit(string PageName)
        {
            DocModel doc = new DocModel();

            doc.StandardFormat = true;
            doc.Title          = "doc_title";
            doc.Type           = "Contents";


            Element el1 = new Element();

            el1.Content = "content of el1";


            el1.Type = "Text";

            Element el2 = new Element();

            el2.Content = "content of el2";


            el2.Type = "Text";

            Element sub1 = new Element();

            sub1.Content = "sub1 content";
            sub1.Type    = "UL";
            sub1.Content = "s1item1,s1item2,s1item3";


            Element sub2 = new Element();

            sub1.Content = "sub2 content";
            sub1.Type    = "OL";
            sub1.Content = "s2item1,s2item2,s2item3";

            el1.SubElements.Add(sub1);
            el1.SubElements.Add(sub2);

            doc.Elements.Add(el1);
            doc.Elements.Add(el2);
            //doc.elements


            HtmlWriter.MakeHtml(doc);



            return(View(doc));
        }
Exemplo n.º 30
0
        public void ElementEdit(string title, string type, string elementId, string updatedContent)
        {
            HttpContext.Current.Response.ClearHeaders();
            HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*");
            DocModel document = SerialisationService.GetDoc(title, type);
            Element  element  = document.GetElementByGuid(Guid.Parse(elementId));
            int      pos      = document.Elements.IndexOf(element);

            document.Elements.Remove(element);
            element.Content = updatedContent;
            document.Elements.Insert(pos, element);
            UpdateDoc(document);
            HttpContext.Current.Response.End();
        }
Exemplo n.º 31
0
 /// <summary>
 /// Resolve this reference into an XmlClass.
 /// </summary>
 public IDocResolvedTypeRef Resolve(DocModel model)
 {
     if (!string.IsNullOrEmpty(refId))
     {
         DocClass @class;
         if (model.TryGetClassById(refId, out @class))
             return @class;
     }
     if (!string.IsNullOrEmpty(name))
     {
         return ResolveByName(model, name);
     }
     return null;
 }
Exemplo n.º 32
0
        /// <summary>
        /// Try to resolve a name into an XmlClass.
        /// </summary>
        private static IDocResolvedTypeRef ResolveByName(DocModel model, string name)
        {
            if (name.EndsWith("[]"))
            {
                var compType = ResolveByName(model, name.Substring(0, name.Length - 2));
                return (compType != null) ? new DocArrayType(compType) : null;
            }

            DocClass @class;
            if (model.TryGetClassByName(name, out @class))
                return @class;

            var primitiveType = DocPrimitiveType.Find(name);
            if (primitiveType != null)
                return primitiveType;

            return null;
        }
Exemplo n.º 33
0
 /// <summary>
 /// Link references.
 /// </summary>
 internal virtual void Link(DocModel model)
 {
     // override me
 }