Exemplo n.º 1
0
        /// <summary>
        /// AtualizaRtuEdit
        /// </summary>
        /// <param name="model"></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 ReparoTpu_Salvar(TpuDtoModel model, int usu_id, string ip)
        {
            using (SqlConnection con = new SqlConnection(new Conexao().strConn))
            {
                try
                {
                    if (model.rtu_fonte_txt == null)
                    {
                        model.rtu_fonte_txt = "";
                    }
                    con.Open();
                    SqlCommand com = new SqlCommand();
                    com.CommandText = "STP_UPD_REPARO_TPU";

                    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;
                    com.Parameters.AddWithValue("@rpt_id", model.rpt_id);
                    com.Parameters.AddWithValue("@fon_id", model.fon_id);
                    com.Parameters.AddWithValue("@rtu_fonte_txt", model.rtu_fonte_txt.ToString());
                    com.Parameters.AddWithValue("@rtu_codigo_tpu", model.rtu_codigo_tpu);

                    com.Parameters.AddWithValue("@rtu_preco_unitario", model.rtu_preco_unitario);
                    com.Parameters.AddWithValue("@rtu_data_base", model.rtu_data_base);
                    com.Parameters.AddWithValue("@rtu_id", model.rtu_id);

                    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);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Editar
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ActionResult ReparoTpu_Salvar(TpuDtoModel model)
 {
     return(Json(new ReparoBLL().ReparoTpu_Salvar(model), JsonRequestBehavior.AllowGet));
 }
Exemplo n.º 3
0
        /// <summary>
        ///  Salva REPARO TPU
        /// </summary>
        /// <param name="model">Dados a serem inseridos</param>
        /// <returns>int</returns>
        public int ReparoTpu_Salvar(TpuDtoModel model)
        {
            Usuario paramUsuario = (Usuario)System.Web.HttpContext.Current.Session["Usuario"];

            return(new ReparoTpuDAO().ReparoTpu_Salvar(model, paramUsuario.usu_id, paramUsuario.usu_ip));
        }