protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador")) { Response.Redirect("\\Views\\SGA\\Inicio.aspx", false); } Mensagem = "Alteração de informações da especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); if (Request.QueryString["Id"] != null) { ObjEspec.Id = Convert.ToInt32(Request.QueryString["Id"]); ObjEspec = new ManterEspecialidade(ObjEspec).ConsultaEspecialidadeById(); Espec.Value = ObjEspec.NomeEspec; DetalhesEspec.Value = ObjEspec.DescEspec; } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } } }
//best extension method to use public static void PersistException(this Exception error) { if (error.IsNullOrEmpty()) { return; } //if those are not null, I can persist ya. DbManager dbManager = DependencyInjector.Get <DbManager>(); LogException parentException = new LogException() { Message = error.Message, StackTrace = error.StackTrace, CreateDate = DateTime.Now }; dbManager.LogExceptions.Add(parentException); dbManager.SaveChanges(); if (!error.InnerException.IsNullOrEmpty()) { LogException childException = new LogException() { ParentLogExceptionID = parentException.LogExceptionID, Message = error.InnerException.Message, StackTrace = error.InnerException.StackTrace, CreateDate = DateTime.Now }; dbManager.LogExceptions.Add(childException); dbManager.SaveChanges(); } }
protected void AlterarButton_Click(object sender, EventArgs e) { try { if (Request.QueryString["Id"] != null) { ObjEspec.Id = Convert.ToInt32(Request.QueryString["Id"]); ObjEspec.NomeEspec = Espec.Value; ObjEspec.DescEspec = DetalhesEspec.Value; if (new ManterEspecialidade(ObjEspec).AlteraEspecialidade()) { Mensagem = "Especialidade alterada com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível alterar a especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
private void CreateServiceFromInputData() { Service.name = TextBoxName.Text; Service.description = TextBoxDescription.Text; Service.slogan = TextBoxSlogan.Text; Service.typeService = TextBoxTypeService.Text; Service.workingHours = TextBoxWorkingHours.Text; string maximunCost = TextBoxMaximumCost.Text; try { if (!String.IsNullOrEmpty(maximunCost)) { Service.maximumCost = float.Parse(maximunCost, CultureInfo.InvariantCulture.NumberFormat); } string minimalCost = TextBoxMinimalCost.Text; if (!String.IsNullOrEmpty(minimalCost)) { Service.minimalCost = float.Parse(minimalCost, CultureInfo.InvariantCulture.NumberFormat); } } catch (FormatException formatException) { TelegramBot.SendToTelegram(formatException); LogException.Log(this, formatException); } Service.idMemberATE = Login.tokenAccount.idMemberATE; if (ComboBoxCity.SelectedItem != null) { string optionCity = ((ComboBoxItem)ComboBoxCity.SelectedItem).Content.ToString(); citySelection = cities.Find(City => City.name.Equals(optionCity)); Service.idCity = citySelection.idCity; } }
private void GenerateReport() { try { string filename = Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..\\..\\PresentationLogicLayer\\Utils\\report.xlsx")); DateTime date = DateTime.Now; var excelApp = new Excel.Application(); excelApp.Visible = false; excelApp.Workbooks.Add(filename); Excel._Worksheet workSheet = (Excel.Worksheet)excelApp.ActiveSheet; workSheet.Cells[3, "F"] = date.ToString("dd,MM,yyyy"); workSheet.Cells[5, "D"] = serviceTemplate.Name; workSheet.Cells[8, "B"] = serviceTemplate.NumRequest; workSheet.Cells[8, "C"] = serviceTemplate.NumAccepted; workSheet.Cells[8, "D"] = serviceTemplate.NumRejected; workSheet.Cells[8, "E"] = serviceTemplate.NumCancelled; workSheet.Cells[8, "F"] = serviceTemplate.NumFinished; int total = serviceTemplate.NumRequest + serviceTemplate.NumAccepted + serviceTemplate.NumRejected + serviceTemplate.NumCancelled + serviceTemplate.NumFinished; workSheet.Cells[13, "C"] = total; workSheet.SaveAs(TextBoxSavingPath.Text); excelApp.Workbooks.Close(); MessageBox.Show("El reporte se genero exitosamente.", "Generación exitosa", MessageBoxButton.OK, MessageBoxImage.Exclamation); }catch (Exception exception) { MessageBox.Show("No se pudo generar el reporte. Intente más tarde", "Error", MessageBoxButton.OK, MessageBoxImage.Error); TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador")) { Response.Redirect("\\Views\\SGA\\Inicio.aspx", false); } if (!Page.IsPostBack) { Mensagem = "Consulta relacionamento entre usuário e especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } foreach (var ObjAT in new ManterUsuario(ObjUsrRela).ConsultaUsuarioEspecialidade()) { ListaUsrRegiao.Add(ObjAT); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
protected void CadastrarButton_Click(object sender, EventArgs e) { try { Especialidade ObjEspec = FactoryEspecialidade.GetNew(); ObjEspec.NomeEspec = Espec.Value; ObjEspec.DescEspec = DetalhesEspec.Value; if (new ManterEspecialidade(ObjEspec).CadastraEspecialidade()) { Mensagem = "Especialidade cadastrada com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível cadastrar a especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
public async Task Invoke(HttpContext httpContext) { try { await _next(httpContext); } catch (Exception ex) { LogException exception = ExceptionHelper.LogException.ShowDebugInfo(ex); HttpClient httpClient = new HttpClient(); httpClient.BaseAddress = new Uri("http://localhost:62388"); Task <HttpResponseMessage> httpResponse = httpClient.PostAsJsonAsync("/api/MQService/InsertLog", new LogRequest { ProjectCode = 1, ProjectPassword = "******", LogInfo = exception.ToString() }); if (!httpResponse.Result.IsSuccessStatusCode) { } httpContext.Response.StatusCode = 500; } }
protected void Page_Load(object sender, EventArgs e) { try { if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador")) { Response.Redirect("\\Views\\SGA\\Inicio.aspx", false); } if (!Request.QueryString["Chamado"].Equals("") && !Request.QueryString["TecnicoAntigo"].Equals("") && !Request.QueryString["TecnicoNovo"].Equals("")) { ObjAtend.IdChamado = Convert.ToInt32(Request.QueryString["Chamado"]); ObjAtend.IdTecnico = Convert.ToInt32(Request.QueryString["TecnicoNovo"]); ObjNotificacao.IdOrigem = 0; ObjNotificacao.IdDest = Convert.ToInt32(Request.QueryString["TecnicoNovo"]); ObjNotificacao.IdMensagem = 11; ObjNotificacao.IdTipo = 4; new ManterNotificacao(ObjNotificacao).NotificaUsuariosSistem(); if (new ManterAtendimento(ObjAtend).AlterarTecnicoAtendimento()) { Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjAtend.IdChamado + "&Troca=true", false); } } } catch (Exception Ex) { LogException.InsereLogBd(Ex); } }
protected void Recusar_Click(object sender, EventArgs e) { try { RecusarClick = true; if (!RecusarMotivo.Value.Equals("")) { ObjAtend.MotivoRecusa = RecusarMotivo.Value; if (new ManterAtendimento(ObjAtend, ObjChamado).RecusaAtendimentoChamado()) { Response.Redirect("\\Views\\SGA\\VChamado\\ConsultaChamado.aspx?IdChamado=" + ObjChamado.Id + "&Mensagem=Recusado", false); } else { Mensagem = "Ocorreu um problema ao recusar o atendimento deste chamado."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } else { Mensagem = "Justifique o motivo de recusar o atendimento deste chamado."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
private void DeleteResource(string route) { RestClient client = new RestClient(urlBase); client.Timeout = -1; string urlResource = "resources/" + route; var request = new RestRequest(urlResource, Method.DELETE); foreach (RestResponseCookie cookie in Login.cookies) { request.AddCookie(cookie.Name, cookie.Value); } request.AddHeader("Token", Login.tokenAccount.token); System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); }; try { IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK) { var responseOk = JsonConvert.DeserializeObject <dynamic>(response.Content); MessageBox.Show("El recurso se elimino exitosamente", "Eliminación exitosa", MessageBoxButton.OK, MessageBoxImage.Information); } else { Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content); MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception exception) { TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); MessageBox.Show("No se pudo eliminar el recurso.Intente más tarde", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (!Session["perfil"].Equals("Gestor") && !Session["perfil"].Equals("Administrador")) { Response.Redirect("\\Views\\SGA\\Inicio.aspx", false); } Mensagem = "Relacionamento entre serviço e especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); DropDownListServ.DataSource = new ManterServico().ConsultaServicos(); DropDownListServ.DataTextField = "NomeServ"; DropDownListServ.DataValueField = "Id"; DropDownListServ.Items.Insert(0, new ListItem("Selecione o serviço", "0")); DropDownListEspec.DataSource = new ManterEspecialidade().ConsultaEspecialidades(); DropDownListEspec.DataTextField = "NomeEspec"; DropDownListEspec.DataValueField = "Id"; DropDownListEspec.Items.Insert(0, new ListItem("Selecione a especialidade", "0")); } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } } }
private void RegisterResource() { RestClient client = new RestClient(urlBase); client.Timeout = -1; var request = new RestRequest("resources", Method.POST); request.AddParameter("isMainResource", resource.isMainResource); request.AddParameter("name", resource.name); request.AddParameter("idService", resource.idService); request.AddParameter("idMemberATE", resource.idMemberATE); request.AddFile("resourceFile", RouteImage); request.AddHeader("Content-Type", "multipart/form-data"); System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); }; try { IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK) { var responseOk = JsonConvert.DeserializeObject <dynamic>(response.Content); } else { Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content); TelegramBot.SendToTelegram(responseError.error); } } catch (Exception exception) { TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); } }
public UserConfirmation List() { UserConfirmation userConfirmation = new UserConfirmation(); ContactInformationEntities Contact_entity = new ContactInformationEntities(); try { userConfirmation.ContactsList = new List <User>(); Mapper.CreateMap <ContactDetail, User>(); var result = Contact_entity.ContactDetails.Where(x => x.Status == true).ToList(); foreach (var temp in result) { User user = Mapper.Map <ContactDetail, User>(temp); userConfirmation.ContactsList.Add(user); } userConfirmation.StatusCode = HttpStatusCode.OK; userConfirmation.Message = "Retrived Successfully"; return(userConfirmation); } catch (Exception ex) { LogException.Write("Exception occured in Business solution", ex); return(new UserConfirmation { StatusCode = HttpStatusCode.ServiceUnavailable, Message = ex.Message }); } }
public bool VerifyPasswordHash(string password, string storedHash) { if (password == null) { LogException.Write("Argument Exception: Password is required"); throw new ArgumentNullException("password"); } if (string.IsNullOrWhiteSpace(password)) { LogException.Write("Argument Exception: Password cannot be empty or whitespace only string."); throw new ArgumentException("Value cannot be empty or whitespace only string.", "password"); } string passwordHash; CreatePasswordHash(password, out passwordHash); if (storedHash != passwordHash) { return(false); } return(true); }
public async Task <User> PutUser(int Id, User user) { if (Id != user.Id) { LogException.Write("Argument Execption: Invalid User"); throw new ArgumentException("Invalid User"); } _context.Entry(user).State = EntityState.Modified; try { var _user = GetByID(Id); await _context.SaveChangesAsync(); return(_user); } catch (DbUpdateConcurrencyException) { if (!UserExists(Id)) { LogException.Write("User doesn't exist"); throw new ArgumentException("User doesn't exist"); } else { throw; } } }
private void UnlockButtonClicked(object sender, RoutedEventArgs routedEventArgs) { MessageBoxResult messageBoxResult = MessageBox.Show("¿Seguro que desea desbloquear el servicio?", "Confirmación", MessageBoxButton.YesNo, MessageBoxImage.Question); if (messageBoxResult == MessageBoxResult.Yes) { RestClient client = new RestClient(urlBase); client.Timeout = -1; string urlService = "services/" + Service.idService; var request = new RestRequest(urlService, Method.PATCH); request.AddHeader("Content-type", "application/json"); foreach (RestResponseCookie cookie in Login.cookies) { request.AddCookie(cookie.Name, cookie.Value); } Models.ServiceStatus status = new Models.ServiceStatus(); status.serviceStatus = "1"; var json = JsonConvert.SerializeObject(status); request.AddHeader("Token", Login.tokenAccount.token); request.AddParameter("application/json", json, ParameterType.RequestBody); System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); }; try { IRestResponse response = client.Execute(request); if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK) { status = JsonConvert.DeserializeObject <Models.ServiceStatus>(response.Content); MessageBox.Show("El servicio se desbloqueo exitosamente", "Desbloqueo Exitoso", MessageBoxButton.OK, MessageBoxImage.Information); GetAccount(); SendEmail(); Service = new Models.Service(); ServiceConsultation serviceConsultation = new ServiceConsultation(); serviceConsultation.Show(); Close(); } else { Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content); MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error); if (response.StatusCode == System.Net.HttpStatusCode.Forbidden || response.StatusCode == System.Net.HttpStatusCode.Unauthorized || response.StatusCode == System.Net.HttpStatusCode.RequestTimeout) { Login login = new Login(); login.Show(); Close(); } } } catch (Exception exception) { MessageBox.Show("No se pudo obtener información de la base de datos. Intente más tarde", "Error", MessageBoxButton.OK, MessageBoxImage.Error); TelegramBot.SendToTelegram(exception); LogException.Log(this, exception); ServiceConsultation serviceConsultation = new ServiceConsultation(); serviceConsultation.Show(); Close(); } } }
private void AcceptButtonClicked(object sender, RoutedEventArgs routedEvent) { if (ValidateConfirmationPassword()) { if (MemberATEValidator.BeValidPassword(PasswordBoxNewPassword.Password)) { PasswordBoxComfirmationPassword.BorderBrush = Brushes.Green; PasswordBoxNewPassword.BorderBrush = Brushes.Green; try { accountRecover = new Models.AccountRecover(); accountRecover.email = TextBoxEmail.Text; accountRecover.password = Security.Encrypt(PasswordBoxNewPassword.Password); accountRecover.code = int.Parse(TextBoxCodeConfirmation.Text); ChangePassword(); } catch (FormatException formatException) { TelegramBot.SendToTelegram(formatException); LogException.Log(this, formatException); MessageBox.Show("Ingresa un código válido", "Código inválido", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { PasswordBoxComfirmationPassword.BorderBrush = Brushes.Red; PasswordBoxNewPassword.BorderBrush = Brushes.Red; MessageBox.Show("Por favor ingrese una contraseña válida", "Constraseña incorrecto", MessageBoxButton.OK, MessageBoxImage.Warning); } } else { MessageBox.Show("La contraseña y la confirmación deben ser la misma", "Constraseña incorrecto", MessageBoxButton.OK, MessageBoxImage.Warning); } }
public async Task <ActionResult <User> > PostUser(User user) { string password = user.Password; string passwordHash; _authDal.CreatePasswordHash(password, out passwordHash); user.Password = passwordHash; try { var _user = await _authDal.CreatUser(user, passwordHash); return(Ok(_user)); } catch (ArgumentException ex) { LogException.Write("Argument Execption:" + ex.Message); return(BadRequest(new { message = ex.Message })); } }
public UserConfirmation Edit(int id, bool status) { ContactInformationEntities Contact_entity = new ContactInformationEntities(); try { var contact = Contact_entity.ContactDetails.SingleOrDefault(b => b.Id == id); if (contact != null) { contact.Status = status; contact.Updated_date = DateTime.Now; Contact_entity.SaveChanges(); return(new UserConfirmation { StatusCode = HttpStatusCode.OK, Message = "Updated successfully" }); } else { return(new UserConfirmation { StatusCode = HttpStatusCode.NotFound, Message = "Record not found" }); } } catch (Exception ex) { LogException.Write("Exception occured in Business solution", ex); return(new UserConfirmation { StatusCode = HttpStatusCode.ServiceUnavailable, Message = ex.Message }); } }
internal void WriteLog(LogType logType, string source, Exception exception, string message, string userName) { var logEntry = new LogEntry { LogType = Convert.ToInt32(logType), HostName = Environment.MachineName, Source = source, Message = message, UserName = userName, LogTime = DateTime.Now }; if (exception != null) { var logException = new LogException { LogEntry = logEntry, ExceptionDetail = exception.ToString() }; _context.LogExceptions.Add(logException); } _context.LogEntries.Add(logEntry); _context.SaveChanges(); }
public UserConfirmation Add(User userModel) { try { using (var contactInformationEntities = new ContactInformationEntities()) { ContactDetail contact = new ContactDetail(); contact.FirstName = userModel.FirstName; contact.LastName = userModel.LastName; contact.Email = userModel.Email; contact.Phone = userModel.Phone; contact.Status = true; contact.Created_date = DateTime.Now; contact.Updated_date = null; contactInformationEntities.ContactDetails.Add(contact); contactInformationEntities.SaveChanges(); } } catch (Exception ex) { LogException.Write("Exception occured in Business solution", ex); return(new UserConfirmation { StatusCode = HttpStatusCode.ServiceUnavailable, Message = ex.Message }); } return(new UserConfirmation { StatusCode = HttpStatusCode.OK, Message = "Inserted successfully" }); }
protected void CadastrarButton_Click(object sender, EventArgs e) { try { RegiaoAtendimento ObjRegiao = FactoryRegiao.GetNew(); ObjRegiao.Regiao = Regiao.Value; ObjRegiao.Cidade = Cidade.Value; ObjRegiao.Estado = Estado.Value; if (new ManterRegiaoAtendimento(ObjRegiao).CadastraRegiaoAtendimento()) { Mensagem = "Região de atendimento cadastrada com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível cadastrar a região de atendimento."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
protected void AlterarButton_Click(object sender, EventArgs e) { try { if (Request.QueryString["Id"] != null) { ObjUsuario.Id = Convert.ToInt32(Request.QueryString["Id"]); ObjUsuario.Nome = Nome.Value; ObjUsuario.Endereco = Endereco.Value; ObjUsuario.Telefone = Telefone.Value; ObjUsuario.Complemento = Complemento.Value; ObjUsuario.Cep = CEP.Value; if (new ManterUsuario(ObjUsuario).AlteraUsuario()) { Mensagem = "Usuário alterado com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível alterar o usuário"; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
protected void CadastrarButton_Click(object sender, EventArgs e) { try { Empresa ObjEmpresa = FactoryEmpresa.GetNew(); ObjEmpresa.NomeEmpresa = Empresa.Value; ObjEmpresa.Endereco = Endereco.Value; ObjEmpresa.Complemento = Complemento.Value; ObjEmpresa.Cep = CEP.Value; ObjEmpresa.Telefone = Telefone.Value; if (new ManterEmpresa(ObjEmpresa).CadastraEmpresa()) { Mensagem = "Empresa cadastrada com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível cadastrar a especialidade."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
public DataSet GetTablesWithParameter(string spName, params string[] parameter) { DataSet ds = null; int Length = parameter.Length / 2; SqlParameter[] tableParameter = new SqlParameter[Length + 1]; try { for (int counter = 0; counter < Length; counter++) { tableParameter[counter] = new SqlParameter(parameter[counter], parameter[counter + Length]); } ds = SqlHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, tableParameter); } catch (Exception ex) { LogException.WriteToTable(ex); } if (ds.Tables.Count > 0) { return(ds); } else { return(null); } }
protected void BotaoEntrar_Click(object sender, EventArgs e) { try { if (!TxtLogin.Text.Equals("") && !TxtSenha.Text.Equals("")) { if (ManterLogin.Logar(TxtLogin.Text, TxtSenha.Text)) { ObjUsuario = FactoryUsuario.GetNew(TipoUsuario.Usuario); ObjUsuario.Login = TxtLogin.Text; TxtLogin.Visible = true; ObjUsuario = new ManterUsuario(ObjUsuario).GetUsuarioEmpresa(); Session["usuario"] = TxtLogin.Text; InfoGlobal.GlobalIdEmpresa = ObjUsuario.IdEmpresa; FormsAuthentication.RedirectFromLoginPage(TxtLogin.Text, true); Response.Redirect("\\Views\\SGA\\Inicio.aspx", false); } else { MsgLabel.Text = "Login ou senha inválidos."; } } else { MsgLabel.Text = "Login ou senha não preenchidos."; } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
protected void RelacionarButton_Click(object sender, EventArgs e) { try { if (DropDownListEspec.SelectedIndex > 0 && DropDownListServ.SelectedIndex > 0) { ObjEspec.Id = Convert.ToInt32(DropDownListEspec.SelectedValue); ObjServ.Id = Convert.ToInt32(DropDownListServ.SelectedValue); if (new ManterEspecialidade(ObjEspec, ObjServ).RelacionaEspecServ()) { Mensagem = "Especialidade e serviço relacionados com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível relacionar a especialidade e o serviço"; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } else { Mensagem = "Selecione as opções."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
// GET: Home public ActionResult Index() { try { LogException.TrackInfo("Department Project"); throw new Exception("Department Issue"); if (Items.Count == 0) { Items.Add(new Department { DepartId = 1, DepartCode = "D01", DepartName = "Accounts" }); Items.Add(new Department { DepartId = 2, DepartCode = "D02", DepartName = "Research & Development" }); Items.Add(new Department { DepartId = 3, DepartCode = "D03", DepartName = "Management" }); Items.Add(new Department { DepartId = 4, DepartCode = "D04", DepartName = "HR" }); Items.Add(new Department { DepartId = 5, DepartCode = "D05", DepartName = "Admin" }); } return(View(Items.ToList())); } catch (Exception ex) { LogException.TrackException(ex); throw; } }
protected void AlterarButton_Click(object sender, EventArgs e) { try { if (Request.QueryString["Id"] != null && DropDownListTpServico.SelectedIndex > 0) { ObjServico.Id = Convert.ToInt32(Request.QueryString["Id"]); ObjServico.IdTipo = Convert.ToInt32(DropDownListTpServico.SelectedValue); ObjServico.NomeServ = Nome.Value; ObjServico.DescServ = DescServ.Value; ObjServico.Sla = Convert.ToDouble(SLA.Value); if (new ManterServico(ObjServico).AlteraServico()) { Mensagem = "Serviço modificado com sucesso."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } else { Mensagem = "Não foi possível modificar o serviço."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } else { Mensagem = "Selecione todas as opções."; ScriptManager.RegisterStartupScript(this, GetType(), "CallMyFunction", "Alerta('" + Mensagem + "')", true); } } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
public static void RegisterForUnhandledExceptions(string applicationId, string osVersion, LogException exceptionLogger) { if (_registered) { throw new InvalidOperationException("Exception Dialog is already registered."); } _applicationIdStatic = applicationId; _osVersionStatic = osVersion; _exceptionLogger = exceptionLogger; Application.ThreadException += ShowErrorDialog; _registered = true; }