Exemple #1
0
        public async Task <ActionResult> LancaPlanilhaPost(ImportacaoPlanilhaAtividadesViewModel planmodel)
        {
            CarregaTipos();
            CarregaProjetos();
            CarregaUsuarios();

            if (ModelState.IsValid && planmodel != null && planmodel.Itens.Count > 0)
            {
                try
                {
                    ImportaPlanilhaApplication app = new ImportaPlanilhaApplication(this.db);
                    int linhas = await app.LancarAsync(planmodel);

                    MensagemParaUsuarioViewModel.MensagemSucesso(string.Format("Planilha importada com sucesso! {0} linhas da planilha importadas.", linhas), TempData);
                    return(View("Index"));
                }
                catch (Exception err)
                {
                    MensagemParaUsuarioViewModel.MensagemErro(err.Message, TempData, ModelState);
                    LogServices.LogarException(err);
                }
            }



            return(View(planmodel));
        }
Exemple #2
0
        public static bool isWeeklyNewspaper(string htmlText)
        {
            try
            {
                // if containts the word ejenedelnik we need this
                var parser = new HtmlParser();
                var node   = parser.Parse(htmlText);
                var finder = new FindTagsVisitor(tag => tag.Name == "h1" && tag.Attributes.ContainsKey("class") && tag.Attributes.ContainsValue("title"));
                node.AcceptVisitor(finder);
                var   titleNode = (Majestic13.HtmlNode.Text)finder.Result[0].Children[0];
                var   title     = titleNode.Value;
                Regex regEx     = new Regex(@"(Еженедельник \""Аргументы и Факты\"" №)");
                Match m         = regEx.Match(title);

                if (m.Success)
                {
                    LogServices.WriteProgressLog("it is weekly ");
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                LogServices.WriteProgressLog("исключение");
                return(false);
            }
        }
Exemple #3
0
 /// <summary>
 /// Must inject the IRemoteCallService to resolve calls and TWO configuration objects: one for the server, and one for general
 /// configuration of any RemoteCall service.
 /// </summary>
 /// <param name="remoteService"></param>
 /// <param name="config"></param>
 /// <param name="generalConfig"></param>
 public HttpRemoteCallServer(IRemoteCallService remoteService, HttpRemoteCallServerConfig config, GeneralRemoteCallConfig generalConfig)
 {
     Logger             = LogServices.CreateLoggerFromDefault(GetType());
     this.config        = config;
     this.generalConfig = generalConfig;
     this.remoteService = remoteService;
 }
Exemple #4
0
 public static List <string> extractLinks(string htmlNewspaperText)
 {
     try
     {
         var links      = new List <string>();
         var parser     = new HtmlParser();
         var node       = parser.Parse(htmlNewspaperText);
         var areaFinder = new FindTagsVisitor(tag => tag.Name == "h2" && tag.Attributes.ContainsKey("class") && tag.Attributes.ContainsValue("data_title mbottom10"));
         node.AcceptVisitor(areaFinder);
         var linksarea = areaFinder.Result;
         foreach (Majestic13.HtmlNode.Tag tag in linksarea)
         {
             var linkFinder = new FindTagsVisitor(t => t.Name == "a" && t.Attributes.ContainsKey("href"));
             tag.AcceptVisitor(linkFinder);
             var link = linkFinder.Result[0].Attributes.Values.FirstOrDefault();
             links.Add(link.ToString());
         }
         LogServices.WriteProgressLog("extracted links");
         return(links);
     }
     catch (Exception)
     {
         return(null);
     }
 }
Exemple #5
0
        public ActionResult _Details(int id)
        {
            var log   = LogServices.GetLogById(id);
            var model = Mapper.Map <LogEntity, LogDetailsModel>(log);

            return(PartialView(model));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            var usuario = Session["UsuarioLogueado"] as Usuario;
            if (usuario.Tipo != UsuarioTipo.WebMaster.ToString())
                Response.Redirect("Login.aspx");
            var logsServices = new LogServices();
             _log = logsServices.Get();
            var hashServices = new HashService();
            foreach (var log in _log)
            {
                var hash = hashServices.Hash(log.Tipo + log.Fecha + log.Email + log.Descripcion);
                if (hash != log.Digito)
                    log.Corrompido = true;
            }
            GridView.DataSource = _log;
            GridView.DataBind();

            var comprasServices = new ComprasServices();
            var compras = comprasServices.GetPedidos();
            foreach (var compa in compras)
            {
                var hash = hashServices.Hash(compa.UsuarioId.ToString() +  compa.PicadaId.ToString() + compa.Fecha.Date.ToString());
                if (hash != compa.Digito)
                    compa.Corrompido = true;
            }
            GdvCompras.DataSource = compras;
            GdvCompras.DataBind();
        }
Exemple #7
0
        public async Task <JsonResult> ObterRecursos(int id)
        {
            try
            {
                ProjectNode noh = await db.ProjectNodes
                                  .Include(x => x.UsuariosDesteNode)
                                  .Where(x => x.Id == id)
                                  .SingleOrDefaultAsync();

                return(Json(new
                {
                    Sucesso = true,
                    Mensagem = "",
                    Selecionados = noh.UsuariosDesteNode.Select(x => x.Id).ToList <int>().ToArray()
                }, JsonRequestBehavior.AllowGet));
            }
            catch (Exception err)
            {
                LogServices.LogarException(err);
                return(Json(new
                {
                    Sucesso = false,
                    Mensagem = err.Message,
                    Selecionados = new int[] { }
                }, JsonRequestBehavior.AllowGet));
            }
        }
        /// <summary>
        /// sobrecarrega AuthorizeCore e diz se o usuário pode acessar ou não
        /// </summary>
        /// <param name="httpContext">HttpContextBase - contexto da chamada</param>
        /// <returns>bool - true se o usuário estiver autorizado</returns>
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            if ((httpContext.Handler != null) && (httpContext.Handler is MvcHandler))
            {
                bool podeAcessar = false;
                using (TPAContext db = new TPAContext())
                {
                    ControleAcesso c = new ControleAcesso(db);

                    try
                    {
                        var    routeData  = ((MvcHandler)httpContext.Handler).RequestContext.RouteData;
                        string actionName = routeData.Values["action"].ToString();

                        string controllerName = routeData.Values["controller"].ToString();

                        podeAcessar = c.PodeAcessar(controllerName, actionName);
                    }
                    catch (Exception err)
                    {
                        LogServices.LogarException(err);
                    }
                }
                return(podeAcessar);
            }
            else
            {
                return(base.AuthorizeCore(httpContext));
            }
        }
Exemple #9
0
        /// <summary>
        /// adiciona os campos de log de auditoria no registro sendo salvo
        /// conforme entrada de blog https://benjii.me/2014/03/track-created-and-modified-fields-automatically-with-entity-framework-code-first/
        /// </summary>
        private void AddTimestamps()
        {
            try
            {
                var entries = ChangeTracker.Entries().Where(x => x.Entity is TPAEntity && (x.State == EntityState.Added || x.State == EntityState.Modified));

                var currentUsername = !string.IsNullOrEmpty(System.Web.HttpContext.Current?.User?.Identity?.Name)
                    ? HttpContext.Current.User.Identity.Name
                    : "Anonymous";

                foreach (var entry in entries)
                {
                    if (entry.State == EntityState.Added)
                    {
                        ((TPAEntity)entry.Entity).MomentoInclusao = DateTime.Now;
                        ((TPAEntity)entry.Entity).UsuarioInclusao = currentUsername;
                    }

                    ((TPAEntity)entry.Entity).MomentoEdicao = DateTime.Now;
                    ((TPAEntity)entry.Entity).UsuarioEdicao = currentUsername;
                }
            }
            catch (Exception auditEx)
            {
                LogServices.LogarException(auditEx);
            }
        }
        /// <summary>
        /// copia para a ExcelWorksheet os dados de GetRelatorio_Consolidado_Projeto_Funcionario_Dia
        /// </summary>
        /// <param name="dtIni">DateTime - data inicial</param>
        /// <param name="dtFin">DateTime - data final</param>
        /// <param name="ws">ExcelWorksheet - worksheet do pacote epplus para onde vão os dados</param>
        private void ConstroiRelatorio_Consolidado_Projeto_Funcionario_Dia(DateTime dtIni, DateTime dtFin, ExcelWorksheet ws)
        {
            var dados = this.GetRelatorio_Consolidado_Projeto_Funcionario_Dia(dtIni, dtFin);

            int linha = 6;

            ws.Column(1).Style.Numberformat.Format = "dd/MM/yyyy";
            ws.Column(6).Style.Numberformat.Format = "[hh]:mm";

            foreach (var d in dados)
            {
                try
                {
                    ws.Cells[linha, 1].Value = d.Dia;
                    ws.Cells[linha, 2].Value = d.Funcionario;
                    ws.Cells[linha, 3].Value = d.Cliente;
                    ws.Cells[linha, 4].Value = d.Area;
                    ws.Cells[linha, 5].Value = d.Projeto;
                    ws.Cells[linha, 6].Value = d.HorasTimeSpan;

                    linha++;
                }
                catch (Exception err)
                {
                    LogServices.LogarException(err);
                }
            }
        }
        /// <summary>
        /// copia para a ExcelWorksheet os dados de GetRelatorio_Analitico
        /// </summary>
        /// <param name="dtIni">DateTime - data inicial</param>
        /// <param name="dtFin">DateTime - data final</param>
        /// <param name="ws">ExcelWorksheet - worksheet do pacote epplus para onde vão os dados</param>
        private void ConstroiRelatorio_Analitico(DateTime dtIni, DateTime dtFin, ExcelWorksheet ws)
        {
            var dados = this.GetRelatorio_Analitico(dtIni, dtFin);

            int linha = 6;

            foreach (var d in dados)
            {
                try
                {
                    ws.Cells[linha, 1].Value  = d.Inicio.Date;
                    ws.Cells[linha, 2].Value  = d.Funcionario;
                    ws.Cells[linha, 3].Value  = d.Tipo_Atividade;
                    ws.Cells[linha, 4].Value  = d.Observacao;
                    ws.Cells[linha, 5].Value  = d.Inicio;
                    ws.Cells[linha, 6].Value  = d.Fim;
                    ws.Cells[linha, 7].Value  = d.Horas;
                    ws.Cells[linha, 8].Value  = d.Administrativo;
                    ws.Cells[linha, 9].Value  = d.Cliente_Raiz;
                    ws.Cells[linha, 10].Value = d.Cliente;
                    ws.Cells[linha, 11].Value = d.Area;
                    ws.Cells[linha, 12].Value = d.Projeto;
                    ws.Cells[linha, 13].Value = d.Entregaveis;
                    ws.Cells[linha, 14].Value = d.Etapas;

                    linha++;
                }
                catch (Exception err)
                {
                    LogServices.LogarException(err);
                }
            }
        }
Exemple #12
0
        public ActionResult ListLog(string id = "")
        {
            if (!IsLogged())
            {
                return(BackToLogin());
            }
            LogServices      service   = new LogServices();
            List <LogModels> lstResult = service.SelectRows(new M_Log()
            {
                loglevel = id
            });
            StringBuilder result = new StringBuilder();
            StringBuilder lstRow = new StringBuilder();

            if (lstResult.Count > 0)
            {
                int i = 1;
                foreach (var item in lstResult)
                {
                    lstRow.Append(PrepareDataJsonForListLog(item));
                    i++;
                }
                if (lstRow.Length > 0)
                {
                    lstRow.Remove(lstRow.Length - 1, 1);
                }
            }
            result.Append("{");
            result.Append("\"isHeader\":\"" + "111" + "\",");
            result.Append("\"Pages\":\"" + "212" + "\",");
            result.Append("\"data\":[" + lstRow.ToString() + "]");
            result.Append("}");
            return(Json(result.ToString(), JsonRequestBehavior.AllowGet));
        }
Exemple #13
0
 private void BindData()
 {
     gvLogs.DataSource = dataSource = LogServices.GetLogList(
         ddlEnvironment.SelectedItem.ToString(),
         ddlType.SelectedItem.ToString(),
         txtMessage.Text, dtPickerFrom.Value, dtPickerTo.Value);
 }
        private async void BtnEnviarPedido_Click(object sender, EventArgs e)
        {
            try
            {
                AbrirLoad(TextosLoad.EnviandoPedidos);

                LogServices.LogEmissaoClass <List <EmitirPedidoItemDto> >(auth, "Enviar Pedido", "List<EmitirPedidoItemDto>", emitirPedidoList);

                var emissao = new PluginService(auth);

                var ret = await emissao.EmissaoDePedidoAsync(emitirPedidoList);

                //LogServices.LogEmissaoClass<EmitirPedidoRespDto>(auth, "Pedido Enviado", "List<EmitirPedidoItemDto>", ret);

                //MessageBox.Show(ret.E_MESSAGE);
            }
            catch (Exception ex)
            {
                LogServices.LogEmissaoClass <Exception>(auth, "erro", "retorno emissao de pedido", ex);
                MessageBox.Show(ex.Message);
            }
            finally
            {
                FecharLoad("OvAbaConfiguracao");
            }
        }
 /// <summary>
 /// Must inject the IRemoteCallService for creating calls and the configuration for communication
 /// </summary>
 /// <param name="remoteService"></param>
 /// <param name="config"></param>
 public HttpRemoteCallClient(IRemoteCallService remoteService, HttpRemoteCallClientConfig config)
 {
     Logger             = LogServices.CreateLoggerFromDefault(GetType());
     this.remoteService = remoteService;
     this.config        = config;
     client             = new HttpClient();
     client.Timeout     = config.CommunicationTimeout;
 }
Exemple #16
0
        private LogEntity NotificationEmailSent(EditionEntity edition, NotificationType notificationType, DateTime notificationDate)
        {
            var logs = LogServices.GetLogsByEdition(edition.EditionId, EntityType.Email.ToString(), notificationType.ToString(), notificationDate);

            logs = ExtractSentNotificationEmailLogs(logs);

            return(logs.Any() ? logs.OrderByDescending(x => x.CreatedOn).First() : null);
        }
Exemple #17
0
        public async Task <ActionResult> Delete(int id)
        {
            MensagemParaUsuarioViewModel result = new MensagemParaUsuarioViewModel();
            ProjectNode prj = await db.ProjectNodes.FindAsync(id);

            if (prj != null)
            {
                try
                {
                    if (prj.Filhos != null && prj.Filhos.Count > 0)
                    {
                        result.Sucesso  = false;
                        result.Mensagem = "Não se pode excluir um nó de projeto com dependentes. Exclua os itens primeiro.";
                        result.Titulo   = "Erro ao excluir nó de projeto";
                    }
                    else if (prj.Atividades != null && prj.Atividades.Count > 0)
                    {
                        result.Sucesso  = false;
                        result.Mensagem = "Este nó de projeto não pode ser excluído porque tem atividades lançadas para ele.";
                        result.Titulo   = "Erro ao excluir nó de projeto";
                    }
                    else
                    {
                        prj.UsuariosDesteNode.Clear();
                        db.ProjectNodes.Remove(prj);
                        await db.SaveChangesAsync();

                        result.Sucesso  = true;
                        result.Mensagem = "Item excluído com sucesso.";
                        result.Titulo   = "exclusão de item do projeto";
                    }
                }
                catch (Exception err)
                {
                    LogServices.LogarException(err);
                    result.Sucesso  = false;
                    result.Mensagem = err.Message;
                    if (err.InnerException != null)
                    {
                        result.Mensagem += "\r\n" + err.InnerException.Message;
                        if (err.InnerException.InnerException != null)
                        {
                            result.Mensagem += "\r\n" + err.InnerException.InnerException.Message;
                        }
                    }
                    result.Titulo = "Erro ao excluir nó de projeto";
                }
            }
            else
            {
                result.Sucesso  = false;
                result.Mensagem = "Não foi selecionado nenhum nó de projeto para exclusão.";
                result.Titulo   = "Erro ao excluir nó de projeto";
            }

            return(Json(result));
        }
 public SimpleService()
 {
     bindRedirector = new SimpleBinder()
     {
         BoundService = this
     };
     Logger    = LogServices.CreateLoggerFromDefault(this.GetType());
     uiHandler = new Handler();
 }
Exemple #19
0
 /// <summary>
 /// intercepta todos os eventos de salvar assíncronos.
 /// validações genéricas devem ser todos aqui
 /// logs genéricos devem ser todos aqui
 /// restrições de segurança genéricos (baseados em database)  devem ser todos aqui
 /// </summary>
 /// <returns></returns>
 public override async Task <int> SaveChangesAsync()
 {
     try
     {
         AddTimestamps();
         return(await base.SaveChangesAsync());
     }
     catch (Exception err)
     {
         LogServices.LogarException(err);
         throw;
     }
 }
Exemple #20
0
 /// <summary>
 /// intercepta todos os eventos de salvar.
 /// validações genéricas devem ser todos aqui
 /// logs genéricos devem ser todos aqui
 /// restrições de segurança genéricos (baseados em database)  devem ser todos aqui
 /// </summary>
 /// <returns></returns>
 public override int SaveChanges()
 {
     try
     {
         AddTimestamps();
         return(base.SaveChanges());
     }
     catch (Exception err)
     {
         LogServices.LogarException(err);
         throw;
     }
 }
Exemple #21
0
        /// <summary>
        /// não deveria ser usado esse método caso você esteja tentando usar custom errors ou http errors, porque sempre vai cair aqui
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Application_Error(object sender, EventArgs e)
        {
            Exception err = Server.GetLastError();

            if (err != null)
            {
                LogServices.LogarException(err);
                if ((HttpContext.Current != null) && (HttpContext.Current.Session != null))
                {
                    HttpContext.Current.Session.Add("UltimoErro", err);
                }
            }
        }
        public UnitTestBase(string name = null)
        {
            if (name == null)
            {
                name = this.GetType().Name;
            }

            TestName = name;

            Log4NetExtensions.SetupDebugLogger($"Unit_{name}");
            Log4NetExtensions.SetLog4NetAsDefaultLogger();
            Logger = LogServices.CreateLoggerFromDefault(name);
        }
Exemple #23
0
        public Service1()
        {
            InitializeComponent();

            //The logger initialization only needs to be performed ONCE during runtime, so put it at the beginning of an executable or something. You
            //don't need to perform this per-class
            Log4NetExtensions.SetupDebugLogger("TestService");
            Log4NetExtensions.SetLog4NetAsDefaultLogger();

            //THIS needs to be performed per-class in order to get a logger that acts as a proxy to the default logger you setup earlier. Updating the default
            //logger will automatically update all proxy loggers, so don't worry about the order.
            Logger = LogServices.CreateLoggerFromDefault(this.GetType());
        }
        /// <summary>
        /// Evia o alerta de lançamento em atraso para todos os usuários
        /// </summary>
        /// <param name="email">boolean - se vai receber por e-mail ou não</param>
        /// <param name="sms">boolean - se vai receber por sms ou não</param>
        /// <param name="telegram">boolean - se vai receber por telegram ou não</param>
        /// <returns></returns>
        public virtual void EnviarTodosOsAlertas(bool email = true, bool sms = false)
        {
            var modelo = this.GetUsuariosComAtrasoNoEnvio();

            if ((modelo == null) || (modelo.Count == 0))
            {
                throw new Exception("O usuário não foi encontrado");
            }


            bool   erro      = false;
            string mensagens = "";

            foreach (var x in modelo)
            {
                try
                {
                    if (email)
                    {
                        MailServices.Enviar(x.Usuario.EmailPreferencial, "Faz tempo que você não lança suas atividades", string.Format("Detectamos que faz {0} dias que você não lança suas atividades. Por favor lance hoje.", x.DiasUteisSemLancar));
                    }
                }
                catch (Exception err)
                {
                    erro       = true;
                    mensagens += "Ocorreu um erro ao enviar o alerta via e-mail para " + x.Usuario.Login + ": " + err.Message + "<br/>\r\n";
                    LogServices.LogarException(err);
                }

                string smsResult = "";
                try
                {
                    if (sms && x.Usuario.Funcionario != null && !string.IsNullOrWhiteSpace(x.Usuario.Funcionario.Celular))
                    {
                        smsResult = SMSServices.Enviar(x.Usuario.Funcionario.Celular, x.Usuario.FuncionarioNomeOuLogin, "Faz tempo que você não lança suas atividades", string.Format("Detectamos que faz {0} dias que você não lança suas atividades. Por favor lance hoje.", x.DiasUteisSemLancar));
                        LogServices.Logar(smsResult);
                    }
                }
                catch (Exception err)
                {
                    erro       = true;
                    mensagens += "Ocorreu um erro ao enviar o alerta via sms para " + x.Usuario.Login + ": " + err.Message + "<br/>\r\n";
                    LogServices.LogarException(err);
                }
            }

            if (erro)
            {
                throw new Exception("Erros ocorridos: " + mensagens);
            }
        }
Exemple #25
0
        /// <summary>
        /// Проверка работает сервис
        /// </summary>
        /// <param name="id_service"></param>
        /// <param name="dt"></param>
        /// <param name="period"></param>
        /// <returns></returns>
        public bool IsRunServices(int id_service, DateTime dt, int period)
        {
            try
            {
                DateTime    start = dt.AddSeconds(-1 * period);
                LogServices log   = GetLogServices().Where(s => s.service == id_service & s.start >= start & s.start <= dt).FirstOrDefault();

                return(log != null ? true : false);
            }
            catch (Exception e)
            {
                e.SaveErrorMethod(String.Format("IsRunServices(id_service={0}, dt={1}, stop={2})", id_service, dt, period), blog);
                return(false);
            }
        }
Exemple #26
0
        /// <summary>
        /// Вернуть код последнего выполнения сервиса
        /// </summary>
        /// <param name="id_service"></param>
        /// <param name="dt"></param>
        /// <param name="period"></param>
        /// <returns></returns>
        public int?GetCodeReturnServices(int id_service, DateTime dt, int period)
        {
            try
            {
                DateTime    start = dt.AddSeconds(-1 * period);
                LogServices log   = GetLogServices().Where(s => s.service == id_service & s.start >= start & s.start <= dt).OrderByDescending(s => s.id).FirstOrDefault();

                return(log != null ? log.code_return : null);
            }
            catch (Exception e)
            {
                e.SaveErrorMethod(String.Format("GetCodeReturnServices(id_service={0}, dt={1}, stop={2})", id_service, dt, period), blog);
                return(null);
            }
        }
Exemple #27
0
        public static string getQAContent(string htmlText)
        {
            var content = "";
            var parser  = new HtmlParser();
            var node    = parser.Parse(htmlText);
            var finder  = new FindTagsVisitor(tag => tag.Name == "div" && tag.Attributes.ContainsKey("class") &&
                                              tag.Attributes.ContainsValue("vo_o_text"));

            node.AcceptVisitor(finder);
            var contextTag = finder.Result[0];

            content = RequestServices.ContinueUntilOnlyTextLeft(contextTag, content);
            LogServices.WriteProgressLog("Fetched content of article ");
            return(content);
        }
 public GenericTrayItem()
 {
     Logger               = LogServices.CreateLoggerFromDefault(GetType());
     TrayItem             = new NotifyIcon();
     TrayItem.MouseClick += (s, e) =>
     {
         if (e.Button == MouseButtons.Left)
         {
             ShowForm();
         }
     };
     TrayItem.BalloonTipClicked += (s, e) =>
     {
         ShowForm();
     };
 }
Exemple #29
0
        public ActionResult _DeleteLog(int id)
        {
            var log = LogServices.GetLogById(id);

            if (log == null)
            {
                return(Json(new { success = false, message = "Log not found." }, JsonRequestBehavior.AllowGet));
            }

            var deleted = LogServices.DeleteLog(id);

            if (deleted)
            {
                return(Json(new { success = true, message = "Log has been deleted." }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = false, message = "Log could not be deleted." }, JsonRequestBehavior.AllowGet));
        }
Exemple #30
0
 /// <summary>
 /// método estático independente com context próprio para ser executado em jobs
 /// </summary>
 public static void AtualizaAcoesCopiandoDoAssembly()
 {
     try
     {
         Type tipo = Type.GetType("TPA.Presentation.Controllers.TPAController, TPA.Presentation");
         using (TPAContext db = new TPAContext())
         {
             AcaoServices g = new AcaoServices(db);
             g.ImportarDoAssembly(tipo);
             g.AtualizaAdmin();
         }
     }
     catch (Exception err)
     {
         LogServices.LogarException(err);
     }
 }
Exemple #31
0
        public void 同时创建两个对象_同一数据库内()
        {
            LogServices Logbll = new LogServices();

            UserEntity model = new UserEntity();
            model.UserName = "******" + rd.Next(100, 10000);
            model.Num = rd.Next(100, 10000);
            model.PostTime = DateTime.Now;
            ubll.Insert(model);

            LogEntity log = new LogEntity();
            log.UserName1 = "Name" + rd.Next(100, 10000);
            log.Num1 = rd.Next(100, 10000);
            log.PostTime1 = DateTime.Now;
            Logbll.Insert(log);

            model.UserName = "******" + rd.Next(100, 10000);
            model.Num = rd.Next(100, 10000);
            model.PostTime = DateTime.Now;
            ubll.Insert(model);
        }