public DataSet GetAll_paginacion(string empresaid, tb_pt_modelo BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtModelo_SEARCH_paginacion", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@modeloid", SqlDbType.Char, 4).Value = BE.modeloid;
                 cmd.Parameters.Add("@posicion", SqlDbType.Char, 10).Value = BE.posicion;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
 public bool Delete(string empresaid, tb_pt_modelo BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtModelo_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@modeloid", SqlDbType.Char, 4).Value = BE.modeloid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        private void btn_editar_Click(object sender, EventArgs e)
        {
            if (XNIVEL == "0" || XNIVEL == "1")
            {
                ssModo = "EDIT";
                form_bloqueado(true);
                articname.Focus();

                btn_cancelar.Enabled = true;
                btn_grabar.Enabled = true;
                btn_foto.Enabled = true;
                btnVer.Enabled = true;

                var BE = new tb_pt_marca();
                var BL = new tb_pt_marcaBL();
                var dt = new DataTable();
                BE.marcaid = marcaid.Text.Trim();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    _xmarcadescort = row["marcadescort"].ToString();
                }

                var BE2 = new tb_pt_linea();
                var BL2 = new tb_pt_lineaBL();
                var dt2 = new DataTable();
                BE2.lineaid = lineaid.Text.Trim();
                dt2 = BL2.GetAll(EmpresaID, BE2).Tables[0];
                foreach (DataRow row in dt2.Rows)
                {
                    _xlineadescort = row["lineadescort"].ToString();
                }

                var BE3 = new tb_pt_modelo();
                var BL3 = new tb_pt_modeloBL();
                var dt3 = new DataTable();
                BE3.modeloid = modeloid.Text.Trim();
                dt3 = BL3.GetAll(EmpresaID, BE3).Tables[0];
                foreach (DataRow row in dt3.Rows)
                {
                    _xmodelodescort = row["modelodescort"].ToString();
                }

                if (XNIVEL == "1")
                {
                    bloqueo_paneles(false);
                    pnl_01.Enabled = true;
                    pnl_03.Enabled = true;
                }
                else
                {
                    bloqueo_paneles(true);
                    pnl_02.Enabled = false;
                    pnl_05.Enabled = false;
                    pnl_06.Enabled = false;
                    pnl_03.Enabled = true;
                }
            }
        }
        private void Valida_Modelo(String xcod)
        {
            var BE3 = new tb_pt_modelo();
            var BL3 = new tb_pt_modeloBL();
            var dt3 = new DataTable();
            BE3.modeloid = xcod.Trim();
            dt3 = BL3.GetAll(EmpresaID, BE3).Tables[0];
            if (dt3.Rows.Count > 0)
            {
                if (dt3.Rows[0]["modelodescort"].ToString().Trim() != string.Empty)
                {
                    _xmodelodescort = dt3.Rows[0]["modelodescort"].ToString();
                }
                else
                {
                    _xmodelodescort = dt3.Rows[0]["modeloname"].ToString();
                }

                modeloid.Text = dt3.Rows[0]["modeloid"].ToString();
                modeloname.Text = dt3.Rows[0]["modeloname"].ToString();
            }
            else
            {
                _xmodelodescort = string.Empty;
                modeloid.Text = string.Empty;
                modeloname.Text = string.Empty;
            }
        }
 public bool Update(string empresaid, tb_pt_modelo BE)
 {
     return tablaDA.Update(empresaid, BE);
 }
 public bool Insert(string empresaid, tb_pt_modelo BE)
 {
     return tablaDA.Insert(empresaid, BE);
 }
 public DataSet GetAll_paginacion(string empresaid, tb_pt_modelo BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
 public bool Delete(string empresaid, tb_pt_modelo BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }
        public bool Insert(string empresaid, tb_pt_modelo BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbPtModelo_INSERT", cnx))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@modeloid", SqlDbType.Char, 4).Value = BE.modeloid;
                    cmd.Parameters.Add("@modeloname", SqlDbType.VarChar, 30).Value = BE.modeloname;
                    cmd.Parameters.Add("@modelodescort", SqlDbType.Char, 10).Value = BE.modelodescort;
                    cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;

                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
Esempio n. 10
0
        private void Update()
        {
            try
            {
                if (modeloid.Text.Trim().Length != 4)
                {
                    MessageBox.Show("Falta Codigo Modelo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else if (modeloname.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Ingrese Nombre de Modelo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_pt_modeloBL BL = new tb_pt_modeloBL();
                    tb_pt_modelo BE = new tb_pt_modelo();

                    BE.modeloid = modeloid.Text.Trim().PadLeft(4, '0');
                    BE.modeloname = modeloname.Text.ToUpper();
                    BE.modelodescort = modelodescort.Text.ToUpper();
                    BE.usuar = VariablesPublicas.Usuar.Trim();

                    if (BL.Update(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("M");
                        MessageBox.Show("Datos Modificado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 11
0
        private void Insert()
        {
            try
            {
                if (modeloname.Text.Trim().Length == 0)
                {
                    MessageBox.Show("Ingrese nombre de Modelo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_pt_modeloBL BL = new tb_pt_modeloBL();
                    tb_pt_modelo BE = new tb_pt_modelo();

                    BE.modeloid = modeloid.Text.Trim().PadLeft(4, '0');
                    BE.modeloname = modeloname.Text.ToUpper().ToUpper();
                    BE.modelodescort = modelodescort.Text.ToUpper();
                    BE.usuar = VariablesPublicas.Usuar.Trim();

                    if (BL.Insert(EmpresaID, BE))
                    {
                        MessageBox.Show("Datos Grabados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        procesado = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 12
0
        private void form_cargar_datos(String posicion)
        {
            try
            {
                tb_pt_modeloBL BL = new tb_pt_modeloBL();
                tb_pt_modelo BE = new tb_pt_modelo();
                DataTable dt = new DataTable();

                if (modeloid.Text.Trim().Length > 0)
                {
                    BE.modeloid = modeloid.Text.Trim().PadLeft(4, '0');
                }
                BE.posicion = posicion.Trim();

                dt = BL.GetAll_paginacion(EmpresaID, BE).Tables[0];

                if (dt.Rows.Count > 0)
                {
                    limpiar_documento();
                    ssModo = "EDIT";

                    modeloid.Text = dt.Rows[0]["modeloid"].ToString().Trim();
                    modeloname.Text = dt.Rows[0]["modeloname"].ToString().Trim();
                    modelodescort.Text = dt.Rows[0]["modelodescort"].ToString().Trim();

                    btn_editar.Enabled = true;
                    btn_eliminar.Enabled = true;
                    btn_excel.Enabled = true;

                    btn_primero.Enabled = true;
                    btn_anterior.Enabled = true;
                    btn_siguiente.Enabled = true;
                    btn_ultimo.Enabled = true;

                    btn_log.Enabled = true;
                    btn_salir.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 13
0
        private void Delete()
        {
            try
            {
                if (modeloid.Text.Trim().Length != 4)
                {
                    MessageBox.Show("Falta Codigo Modelo !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_pt_modeloBL BL = new tb_pt_modeloBL();
                    tb_pt_modelo BE = new tb_pt_modelo();
                    //BE.moduloid = modulo;
                    BE.modeloid = modeloid.Text.Trim().PadLeft(4, '0');
                    //BE.modeloname = modeloname.Text.ToUpper();
                    //BE.modeloidold = modeloidold.Text;
                    //BE.usuar = VariablesPublicas.Usuar.Trim();

                    if (BL.Delete(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");
                        MessageBox.Show("Datos Eliminados Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NIVEL_FORMS();
                        form_bloqueado(false);
                        data_Tablamodelo();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Esempio n. 14
0
        private void data_Tablamodelo()
        {
            try
            {
                if (Tablamodelo.Rows.Count > 0)
                    Tablamodelo.Rows.Clear();
                tb_pt_modeloBL BL = new tb_pt_modeloBL();
                tb_pt_modelo BE = new tb_pt_modelo();

                //BE.moduloid = modulo;
                BE.modeloname = txt_criterio.Text.Trim().ToUpper();

                Tablamodelo = BL.GetAll(EmpresaID, BE).Tables[0];
                if (Tablamodelo.Rows.Count > 0)
                {
                    btn_excel.Enabled = true;
                    gridmodelo.DataSource = Tablamodelo;
                    gridmodelo.Rows[0].Selected = false;
                    gridmodelo.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }