/// <summary>
        ///    Insere ou Altera os dados do NotificacaoOcorrencia no Banco
        /// </summary>
        /// <param name="notOcor">Dados da Notificacao Ocorrencia</param>
        /// <param name="usu_id">Id do Usuário Logado</param>
        /// <param name="ip">IP do Usuário Logado</param>
        /// <returns>int</returns>
        public int NotificacaoOcorrencia_Salvar(Notificacao_Ocorrencia notOcor, int usu_id, string ip)
        {
            try
            {
                using (SqlConnection con = new SqlConnection(strConn))
                {
                    con.Open();
                    SqlCommand com = new SqlCommand();
                    if (notOcor.noc_id > 0)
                    {
                        com.CommandText = "STP_UPD_NOTIFICACAO_OCORRENCIA";
                    }
                    else
                    {
                        com.CommandText = "STP_INS_NOTIFICACAO_OCORRENCIA";
                    }

                    com.Connection  = con;
                    com.CommandType = CommandType.StoredProcedure;
                    com.Parameters.Clear();

                    System.Data.SqlClient.SqlParameter p_return = new System.Data.SqlClient.SqlParameter();
                    p_return.Direction = System.Data.ParameterDirection.ReturnValue;
                    com.Parameters.Add(p_return);
                    com.Parameters[0].Size = 32000;

                    if (notOcor.noc_id > 0)
                    {
                        com.Parameters.AddWithValue("@noc_id", notOcor.noc_id);
                    }

                    com.Parameters.AddWithValue("@ord_id", notOcor.ord_id);
                    com.Parameters.AddWithValue("@data_notificacao", notOcor.data_notificacao == null ? " " : notOcor.data_notificacao);
                    com.Parameters.AddWithValue("@responsavel_notificacao", notOcor.responsavel_notificacao == null ? " " : notOcor.responsavel_notificacao);
                    com.Parameters.AddWithValue("@descricao_ocorrencia", notOcor.descricao_ocorrencia == null ? " " : notOcor.descricao_ocorrencia);
                    com.Parameters.AddWithValue("@solicitante", notOcor.solicitante == null ? " " : notOcor.solicitante);
                    com.Parameters.AddWithValue("@solicitante_data", notOcor.solicitante_data == null ? " " : notOcor.solicitante_data);
                    com.Parameters.AddWithValue("@responsavel_recebimento", notOcor.responsavel_recebimento == null ? " " :  notOcor.responsavel_recebimento);
                    com.Parameters.AddWithValue("@responsavel_recebimento_data", notOcor.responsavel_recebimento_data == null ? " " : notOcor.responsavel_recebimento_data);

                    com.Parameters.AddWithValue("@usu_id", usu_id);
                    com.Parameters.AddWithValue("@ip", ip);

                    com.ExecuteScalar();
                    return(Convert.ToInt32(p_return.Value));
                }
            }
            catch (Exception ex)
            {
                int id = 0;
                new LogSistemaDAO().InserirLogErro(new LogErro(ex, this.GetType().Name, new StackTrace().GetFrame(0).GetMethod().Name), out id);
                throw new Exception(ex.Message);
            }
        }
        /// <summary>
        ///  Insere ou Altera os dados da Notificacao Ocorrencia
        /// </summary>
        /// <param name="notOcor">Dados da Notificacao Ocorrencia</param>
        /// <returns>int</returns>
        public int NotificacaoOcorrencia_Salvar(Notificacao_Ocorrencia notOcor)
        {
            Usuario paramUsuario = (Usuario)System.Web.HttpContext.Current.Session["Usuario"];

            return(new NotificacaoOcorrenciaDAO().NotificacaoOcorrencia_Salvar(notOcor, paramUsuario.usu_id, paramUsuario.usu_ip));
        }
Exemple #3
0
 /// <summary>
 ///  Altera ou Insere Notificacao Ocorrencia
 /// </summary>
 /// <param name="notOcor">Dados da Notificacao Ocorrencia</param>
 /// <returns>JsonResult</returns>
 public JsonResult NotificacaoOcorrencia_Salvar(Notificacao_Ocorrencia notOcor)
 {
     return(Json(new NotificacaoOcorrenciaBLL().NotificacaoOcorrencia_Salvar(notOcor), JsonRequestBehavior.AllowGet));
 }