public override void BeforeDelete(ref ComunicacaoViewModel value, ICrudContext <ComunicacaoViewModel> model, FormCollection collection) { #region Excluir arquivos if (value.arq_imagem_300x200 != "default_300x200.png") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_300x200); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } if (value.arq_imagem_100x100 != "default_100x100.jpg") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_100x100); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } if (value.arq_imagem_400x300 != "default_400x300.jpg") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_400x300); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } #endregion }
public override void OnCreateError(ref AtendimentoViewModel value, ICrudContext <AtendimentoViewModel> model, FormCollection collection) { AtendimentoModel atendimentoModel = new AtendimentoModel(); value = atendimentoModel.Create(value); value.mensagemResposta = collection["mensagemResposta"]; }
public override void BeforeEdit(ref UsuarioRepository value, ICrudContext <UsuarioRepository> model, FormCollection collection) { if (String.IsNullOrEmpty(value.senha)) { UsuarioRepository temp = model.getObject(value); value.senha = temp.senha; } }
public override void BeforeCreate(ref ChamadoViewModel value, ICrudContext <ChamadoViewModel> model, FormCollection collection) { ChamadoViewModel repository = new ChamadoModel().Create(); value.chamadoStatusId = repository.chamadoStatusId; value.situacao = repository.situacao; value.associadoId = repository.associadoId; value.dt_chamado = repository.dt_chamado; value.nome_associado = repository.nome_associado; }
public override void BeforeDelete(ref DocInternoViewModel value, ICrudContext <DocInternoViewModel> model, FormCollection collection) { #region Excluir arquivo var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Admin_Data"])), value.arquivo); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } #endregion }
public override void BeforeCreate(ref AssociadoDocumentoViewModel value, ICrudContext <AssociadoDocumentoViewModel> model, FormCollection collection) { if (this.Request.Files.Count > 0 && this.Request.Files[0].FileName.Trim() != "") { value.nomeArquivoOriginal = Request.Files[0].FileName.Trim(); } else { value.nomeArquivoOriginal = value.nomeArquivoOriginal + ".htm"; } }
public override void BeforeCreate(ref MedicoViewModel value, ICrudContext <MedicoViewModel> model, FormCollection collection) { if (collection["dt_nascimento"] != "") { value.dt_nascimento = DateTime.Parse(collection["dt_nascimento"].Substring(6, 4) + "-" + collection["dt_nascimento"].Substring(3, 2) + "-" + collection["dt_nascimento"].Substring(0, 2)); } if (collection["dt_admin_sindicato"] != "") { value.dt_admin_sindicato = DateTime.Parse(collection["dt_admin_sindicato"].Substring(6, 4) + "-" + collection["dt_admin_sindicato"].Substring(3, 2) + "-" + collection["dt_admin_sindicato"].Substring(0, 2)); } }
public override void OnCreateError(ref MedicoViewModel value, ICrudContext <MedicoViewModel> model, FormCollection collection) { value.nome_correio = collection["nome_correio1"] ?? ""; value.nome_cidade = collection["nome_cidade1"] ?? ""; value.nome_cidadeCom = collection["nome_cidadeCom1"] ?? ""; value.descricao_areaAtuacao1 = collection["descricao_areaAtuacao11"] ?? ""; value.descricao_areaAtuacao2 = collection["descricao_areaAtuacao21"] ?? ""; value.descricao_areaAtuacao3 = collection["descricao_areaAtuacao31"] ?? ""; value.nome_especialidade1 = collection["descricao_especialidade11"] ?? ""; value.nome_especialidade2 = collection["descricao_especialidade21"] ?? ""; value.nome_especialidade3 = collection["descricao_especialidade31"] ?? ""; }
//public override void OnCreateError(ref CredorViewModel value, ICrudContext<CredorViewModel> model, FormCollection collection) //{ // value.nome_correio = collection["nome_correio1"] ?? ""; //} #endregion #region BeforeCreate public override void BeforeCreate(ref CredorViewModel value, ICrudContext <CredorViewModel> model, FormCollection collection) { if (value.ind_tipo_pessoa == "PF") { if (collection["dt_nascimento"] != "") { value.dt_nascimento = DateTime.Parse(collection["dt_nascimento"].Substring(6, 4) + "-" + collection["dt_nascimento"].Substring(3, 2) + "-" + collection["dt_nascimento"].Substring(0, 2)); } } else { value.sexo = null; value.dt_nascimento = null; } }
public override void BeforeCreate(ref AtendimentoViewModel value, ICrudContext <AtendimentoViewModel> model, FormCollection collection) { if (value.fluxo == "2") { value.chamado = new ChamadoViewModel() { chamadoId = value.chamadoId, situacao = collection ["situacao"].ToString().Contains("true") ? "F" : "A", chamadoStatusId = int.Parse(collection["chamado.chamadoStatusId"]) }; } if (this.Request.Files.Count > 0 && this.Request.Files[0].FileName.Trim() != "") { value.anexo.nomeArquivoOriginal = Request.Files[0].FileName.Trim(); } }
public override void BeforeEdit(ref DocInternoViewModel value, ICrudContext <DocInternoViewModel> model, FormCollection collection) { var arquivo = value.arquivo; // arquivo original BeforeCreate(ref value, model, collection); #region Excluir arquivo if (this.Request.Files.Count > 0 && this.Request.Files[0].FileName.Trim() != "" && value.mensagem.Code == 0) { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Admin_Data"])), arquivo); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } #endregion }
public override void BeforeCreate(ref DocInternoViewModel value, ICrudContext <DocInternoViewModel> model, FormCollection collection) { #region upload dos arquivo if (this.Request.Files.Count > 0 && this.Request.Files[0].FileName.Trim() != "") // arquivo PDF { value.mensagem = new Validate() { Code = 0, Message = MensagemPadrao.Message(0).ToString() }; #region verifica o tamanho do arquivo if (this.Request.Files[0].ContentLength > int.Parse(System.Configuration.ConfigurationManager.AppSettings["tam_arquivo"])) // 1 mb { value.mensagem.Code = 51; value.mensagem.Field = "arquivo"; value.mensagem.Message = MensagemPadrao.Message(51, System.Configuration.ConfigurationManager.AppSettings["tam_arquivo"]).ToString(); value.mensagem.MessageBase = "O tamanho do arquivo deve ser menor que " + Convert.ToString((int.Parse(System.Configuration.ConfigurationManager.AppSettings["tam_arquivo"]) / 1024) / 1000) + " mb"; Error(value.mensagem.Message); return; } #endregion #region Verifica o formato do arquivo System.IO.FileInfo f = new FileInfo(Request.Files[0].FileName); if (!(".png|.jpg|.bmp|.gif|.jpeg|.pdf|.docx|.doc|.zip|.rar").Contains(f.Extension.ToLower())) { value.mensagem.Code = 52; value.mensagem.Field = "arquivo"; value.mensagem.Message = MensagemPadrao.Message(52, ".png|.jpg|.bmp|.gif|.jpeg|.pdf|.docx|.doc|.zip|.rar").ToString(); value.mensagem.MessageBase = "Formato de arquivo inválido"; Error(value.mensagem.Message); return; } #endregion #region Enviar o arquivo value.arquivo = String.Format("{0}" + f.Extension, Guid.NewGuid().ToString()); var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Admin_Data"])), value.arquivo); this.Request.Files[0].SaveAs(filePath); #endregion } #endregion }
public override void BeforeEdit(ref ComunicacaoViewModel value, ICrudContext <ComunicacaoViewModel> model, FormCollection collection) { value.dt_comunicacao = DateTime.Now; #region Excluir arquivos if (value.arq_imagem_300x200 != "default_300x200.png" && this.Request.Files[0].FileName.Trim() != "") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_300x200); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } if (value.arq_imagem_100x100 != "default_100x100.jpg" && this.Request.Files[1].FileName.Trim() != "") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_100x100); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } if (value.arq_imagem_400x300 != "default_400x300.jpg" && this.Request.Files[2].FileName.Trim() != "") { var filePath = Path.Combine(Server.MapPath(Url.Content(System.Configuration.ConfigurationManager.AppSettings["Comunicados"])), value.arq_imagem_400x300); System.IO.FileInfo f = new FileInfo(filePath); if (f.Exists) { f.Delete(); } } #endregion BeforeCreate(ref value, model, collection); }
public override void OnDeleteError(ref MedicoViewModel value, ICrudContext <MedicoViewModel> model, FormCollection collection) { OnEditError(ref value, model, collection); }
public override void OnEditError(ref MedicoViewModel value, ICrudContext <MedicoViewModel> model, FormCollection collection) { value.nome_usuario = collection["nome_usuario1"] ?? ""; OnCreateError(ref value, model, collection); }
public override void BeforeEdit(ref MedicoViewModel value, ICrudContext <MedicoViewModel> model, FormCollection collection) { BeforeCreate(ref value, model, collection); }
public EmpresaCommandStore(ICrudContext crudContext) { _crudContext = crudContext; }
public EmpresaQueryStore(ICrudContext crudContext) { _crudContext = crudContext; }
public FornecedorCommandStore(ICrudContext crudContext) { _crudContext = crudContext; }
public FornecedorQueryStore(ICrudContext crudContext) { _crudContext = crudContext; }