public bool Delete(string empresaid, tb_pt_linea BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtLinea_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@lineaid", SqlDbType.Char, 2).Value = BE.lineaid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        public bool Delete_dbf(string empresaid, tb_pt_linea BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               " UPDATE LINEA001 SET LI001STAT = ? " +
               " WHERE  LI001IDLI = ? ";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    {
                        cmd.CommandType = System.Data.CommandType.Text;
                        cmd.Parameters.Add("@LI001STAT", OleDbType.Decimal).Value = 9;
                        cmd.Parameters.Add("@LI001IDLI", OleDbType.Char, 3).Value = BE.lineaidold.ToString();
                    }
                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
 public bool Delete(string empresaid, tb_pt_linea BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }
 public DataSet GetAll(string empresaid, tb_pt_linea BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtLinea_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@lineaid", SqlDbType.Char, 2).Value = BE.lineaid;
                 cmd.Parameters.Add("@lineaname", SqlDbType.VarChar, 20).Value = BE.lineaname;
                 cmd.Parameters.Add("@lineadescort", SqlDbType.Char, 10).Value = BE.lineadescort;
                 cmd.Parameters.Add("@lineaidold", SqlDbType.Char, 3).Value = BE.lineaidold;
                 cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
        private void Delete()
        {
            try
            {
                if (lineaid.Text.Trim().Length != 2)
                {
                    MessageBox.Show("Falta Codigo linea !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_pt_lineaBL();
                    var BE = new tb_pt_linea();
                    BE.lineaid = lineaid.Text.Trim().PadLeft(2, '0');

                    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_Tablalinea();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
    // LINEAS
    private void data_gridLinea()
    {
        tb_pt_lineaBL BL = new tb_pt_lineaBL();
        tb_pt_linea BE = new tb_pt_linea();
        DataTable dt = new DataTable();

        switch (cmb_lineas.SelectedValue)
        {
            case "01":
                BE.lineaid = txt_buscar3.Text.Trim().ToUpper();
                break;
            case "02":
                BE.lineaname = txt_buscar3.Text.Trim().ToUpper();
                break;
            default:
                //**
                break;
        }
        try
        {
            //Eliminar Columnas Actuales(Opcional):
            dgb_linea.Columns.Clear();
            dgb_linea.Width = 535;
            //Objeto Columna:
            CommandField image;
            //Crear Columna:
            image = new CommandField();
            image.ButtonType = ButtonType.Image;
            image.SelectImageUrl = "~/Images/go-search.png";
            image.ShowSelectButton = true;
            image.ItemStyle.Width = 10;
            image.ItemStyle.Wrap = true;
            dgb_linea.Columns.Add(image);

            BoundField LINEAID;
            LINEAID = new BoundField();
            LINEAID.DataField = "lineaid";
            LINEAID.HeaderText = "CODIGO";
            LINEAID.ItemStyle.Width = 50;
            dgb_linea.Columns.Add(LINEAID);

            BoundField LINEANAME;
            LINEANAME = new BoundField();
            LINEANAME.DataField = "lineaname";
            LINEANAME.HeaderText = "LINEA";
            LINEANAME.ItemStyle.Width = 250;
            dgb_linea.Columns.Add(LINEANAME);

            dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                dgb_linea.DataSource = dt;
                dgb_linea.DataBind();
                dgb_linea.Visible = true;
            }
        }
        catch (Exception ex)
        {
            throw ex;// ClientMessage(ex.Message);
        }
    }
        private void Valida_Linea(String xcod)
        {
            var BE2 = new tb_pt_linea();
            var BL2 = new tb_pt_lineaBL();
            var dt2 = new DataTable();
            BE2.lineaid = xcod.Trim();
            dt2 = BL2.GetAll(EmpresaID, BE2).Tables[0];
            if (dt2.Rows.Count > 0)
            {
                if (dt2.Rows[0]["lineadescort"].ToString().Trim() != string.Empty)
                {
                    _xlineadescort = dt2.Rows[0]["lineadescort"].ToString();
                }
                else
                {
                    _xlineadescort = dt2.Rows[0]["lineaname"].ToString();
                }

                lineaid.Text = dt2.Rows[0]["lineaid"].ToString();
                lineaname.Text = dt2.Rows[0]["lineaname"].ToString();
                _xlineaidold = dt2.Rows[0]["lineaidold"].ToString();
            }
            else
            {
                _xlineadescort = string.Empty;
                lineaid.Text = string.Empty;
                lineaname.Text = string.Empty;
                _xlineaidold = string.Empty;
            }
        }
 public bool Insert_dbf(string empresaid, tb_pt_linea BE)
 {
     return tablaDA.Insert_dbf(empresaid, BE);
 }
        public DataSet GetAll_CODdbf(string empresaid, tb_pt_linea BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               "SELECT MAX(LI001IDLI) AS lineaidold  FROM  LINEA001;";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    DataSet ds = new DataSet();
                    {
                        cmd.CommandType = System.Data.CommandType.Text;
                    }
                    try
                    {
                        cnx.Open();
                        using (OleDbDataAdapter da = new OleDbDataAdapter(cmd))
                        {
                            da.Fill(ds);
                        }
                        return ds;
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
Esempio n. 10
0
        private void Update_dbf()
        {
            try
            {
                if (lineaidold.Text.Trim().Length != 3)
                {
                    MessageBox.Show("Falta Codigo_DBF Linea !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (lineaname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese Nombre de Línea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_pt_lineaBL();
                        var BE = new tb_pt_linea();

                        BE.lineaname = lineaname.Text.ToUpper().ToUpper().Trim();
                        BE.lineaidold = lineaidold.Text.ToUpper().Trim();
                        BE.usuar = VariablesPublicas.Usuar.Trim();

                        if (BL.Update_dbf(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 (lineaid.Text.Trim().Length != 2)
                {
                    MessageBox.Show("Falta Codigo linea !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (lineaname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese nombre de línea", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_pt_lineaBL();
                        var BE = new tb_pt_linea();

                        BE.lineaid = lineaid.Text.Trim().PadLeft(2, '0');
                        BE.lineaname = lineaname.Text.ToUpper().ToUpper();
                        BE.lineaidold = lineaidold.Text.ToUpper();
                        BE.lineadescort = lineadescort.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 GetAll_CODdbf()
 {
     var BL = new tb_pt_lineaBL();
     var BE = new tb_pt_linea();
     var dt = new DataTable();
     dt = BL.GetAll_CODdbf(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         var num = Convert.ToInt32(dt.Rows[0]["lineaidold"].ToString());
         lineaidold.Text = (num + 1).ToString().PadLeft(3, '0');
     }
     else
     {
         lineaidold.Text = string.Empty;
     }
 }
Esempio n. 13
0
        private void form_cargar_datos(String posicion)
        {
            try
            {
                var BL = new tb_pt_lineaBL();
                var BE = new tb_pt_linea();
                var dt = new DataTable();
                if (lineaid.Text.Trim().Length > 0)
                {
                    BE.lineaid = lineaid.Text.Trim().PadLeft(2, '0');
                }
                BE.posicion = posicion.Trim();

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

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

                    lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim();
                    lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim();
                    lineaidold.Text = dt.Rows[0]["lineaidold"].ToString().Trim();
                    lineadescort.Text = dt.Rows[0]["lineadescort"].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. 14
0
        private void Delete_dbf()
        {
            try
            {
                if (lineaidold.Text.Trim().Length != 3)
                {
                    MessageBox.Show("Falta Codigo_DBF Linea !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_pt_lineaBL();
                    var BE = new tb_pt_linea();

                    BE.lineaname = lineaname.Text.ToUpper().ToUpper();
                    BE.lineaidold = lineaidold.Text.ToUpper();
                    BE.usuar = VariablesPublicas.Usuar.Trim();

                    if (BL.Delete_dbf(EmpresaID, BE))
                    {
                        SEGURIDAD_LOG("E");
                        MessageBox.Show("Dato Anulado Correctamente !!!", "Confirmación", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        NIVEL_FORMS();
                        form_bloqueado(false);
                        data_Tablalinea();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public DataSet GetAll_CODdbf(string empresaid, tb_pt_linea BE)
 {
     return tablaDA.GetAll_CODdbf(empresaid, BE);
 }
 public DataSet GetAll_paginacion(string empresaid, tb_pt_linea BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
        public bool Insert_dbf(string empresaid, tb_pt_linea BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               "INSERT INTO LINEA001 (LI001STAT ,LI001IDLI ,LI001NAME ,LI001USID ,LI001FEAC ,ENSQL " +
                                    " )" +
               " VALUES (?, ?, ?, ?, ?, ? " +
                        ")";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.Parameters.Add("@LI001STAT ", OleDbType.Decimal).Value = 1;
                    cmd.Parameters.Add("@LI001IDLI ", OleDbType.Char, 32).Value = BE.lineaidold.ToString();
                    cmd.Parameters.Add("@LI001NAME ", OleDbType.Char, 10).Value = BE.lineaname.ToString();
                    cmd.Parameters.Add("@LI001USID ", OleDbType.Char, 3).Value = BE.usuar.ToString();
                    cmd.Parameters.Add("@LI001FEAC ", OleDbType.Date).Value = DateTime.Today.ToShortDateString();
                    cmd.Parameters.Add("@ENSQL ", OleDbType.Boolean).Value = 0;

                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
 public bool Update_dbf(string empresaid, tb_pt_linea BE)
 {
     return tablaDA.Update_dbf(empresaid, BE);
 }
        public bool Update(string empresaid, tb_pt_linea BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbPtLinea_UPDATE", cnx))
                {

                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@lineaid", SqlDbType.Char, 2).Value = BE.lineaid;
                        cmd.Parameters.Add("@lineaname", SqlDbType.VarChar, 20).Value = BE.lineaname;
                        cmd.Parameters.Add("@lineadescort", SqlDbType.Char, 10).Value = BE.lineadescort;
                        cmd.Parameters.Add("@lineaidold", SqlDbType.Char, 3).Value = BE.lineaidold;
                        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);
                    }
                }
            }
        }
        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;
                }
            }
        }
        public bool Update_dbf(string empresaid, tb_pt_linea BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               " UPDATE LINEA001 SET LI001NAME = ? " +
               " WHERE  LI001IDLI = ? ";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    {
                        cmd.CommandType = System.Data.CommandType.Text;
                        cmd.Parameters.Add("@LI001NAME", OleDbType.VarChar, 10).Value = BE.lineaname.ToString();
                        cmd.Parameters.Add("@LI001IDLI", OleDbType.VarChar, 3).Value = BE.lineaidold.ToString();
                        //cmd.Parameters.Add("@LI001USID ", OleDbType.Char, 3).Value = BE.usuar.ToString();
                        //.Parameters.Add("@LI001FEAC ", OleDbType.Date).Value = DateTime.Today.ToShortDateString();
                    }
                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
 void CargarCmbLinea()
 {
     tb_pt_lineaBL BL = new tb_pt_lineaBL();
     tb_pt_linea BE = new tb_pt_linea();
     DataTable dt = new DataTable();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         cmb_linea01.DataSource = dt;
         cmb_linea01.ValueMember = "lineaid";
         cmb_linea01.DisplayMember = "lineaname";
         cmb_linea01.SelectedIndex = -1;
     }
 }
Esempio n. 23
0
        private void data_Tablalinea()
        {
            try
            {
                if (Tablalinea.Rows.Count > 0)
                {
                    Tablalinea.Rows.Clear();
                }
                var BL = new tb_pt_lineaBL();
                var BE = new tb_pt_linea();

                BE.lineaname = txt_criterio.Text.Trim().ToUpper();

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