コード例 #1
0
 public bool Delete(string empresaid, tb_pt_marca BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtMarca_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@marcaid", SqlDbType.Char, 2).Value = BE.marcaid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #2
0
        public bool Delete_dbf(string empresaid, tb_pt_marca BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               " UPDATE MARCA001 SET MC001STAT = ? " +
               " WHERE  MC001IDMC = ? ";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    {
                        cmd.CommandType = System.Data.CommandType.Text;
                        cmd.Parameters.Add("@MC001STAT", OleDbType.Decimal).Value = 9;
                        //cmd.Parameters.Add("@MC001NAME", OleDbType.Char, 20).Value = BE.marcaname.ToString();
                        cmd.Parameters.Add("@MC001IDMC", OleDbType.Char, 2).Value = BE.marcaidold.ToString();
                        //cmd.Parameters.Add("@ENSQL", OleDbType.Boolean).Value = 1;
                    }
                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                }
            }
        }
コード例 #3
0
 private void GetAll_CODdbf()
 {
     var BL = new tb_pt_marcaBL();
     var BE = new tb_pt_marca();
     var dt = new DataTable();
     dt = BL.GetAll_CODdbf(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         var num = Convert.ToInt32(dt.Rows[0]["marcaidold"].ToString());
         marcaidold.Text = (num + 1).ToString();
     }
     else
     {
         marcaidold.Text = string.Empty;
     }
 }
コード例 #4
0
        private void form_cargar_datos(String posicion)
        {
            try
            {
                var BL = new tb_pt_marcaBL();
                var BE = new tb_pt_marca();
                var dt = new DataTable();

                if (marcaid.Text.Trim().Length > 0)
                {
                    BE.marcaid = marcaid.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";

                    marcaid.Text = dt.Rows[0]["marcaid"].ToString().Trim();
                    marcaname.Text = dt.Rows[0]["marcaname"].ToString().Trim();
                    marcaidold.Text = dt.Rows[0]["marcaidold"].ToString().Trim();
                    marcadescort.Text = dt.Rows[0]["marcadescort"].ToString().Trim();
                    if (Convert.ToBoolean(dt.Rows[0]["marcapropia"].ToString()) == null)
                    {
                        chkmarcapropia.Checked = false;
                    }
                    else
                    {
                        chkmarcapropia.Checked = Convert.ToBoolean(dt.Rows[0]["marcapropia"].ToString());
                    }

                    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);
            }
        }
コード例 #5
0
        private void Delete_dbf()
        {
            try
            {
                if (marcaidold.Text.Trim().Length != 2)
                {
                    MessageBox.Show("Falta Codigo Marcaid!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    var BL = new tb_pt_marcaBL();
                    var BE = new tb_pt_marca();

                    BE.marcaidold = marcaidold.Text;

                    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_Tablamarca();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
 public DataSet GetAll_CODdbf(string empresaid, tb_pt_marca BE)
 {
     return tablaDA.GetAll_CODdbf(empresaid, BE);
 }
コード例 #7
0
    // MARCAS
    private void data_gridMarca()
    {
        tb_pt_marcaBL BL = new tb_pt_marcaBL();
        tb_pt_marca BE = new tb_pt_marca();
        DataTable dt = new DataTable();

        switch (cmb_marca.SelectedValue)
        {
            case "01":
                BE.marcaid = txt_buscar2.Text.Trim().ToUpper();
                break;
            case "02":
                BE.marcaname = txt_buscar2.Text.Trim().ToUpper();
                break;
            default:
                //**
                break;
        }
        try
        {
            //Eliminar Columnas Actuales(Opcional):
            dgb_marca.Columns.Clear();
            dgb_marca.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_marca.Columns.Add(image);

            BoundField MARCAID;
            MARCAID = new BoundField();
            MARCAID.DataField = "marcaid";
            MARCAID.HeaderText = "CODIGO";
            MARCAID.ItemStyle.Width = 50;
            dgb_marca.Columns.Add(MARCAID);

            BoundField MARCANAME;
            MARCANAME = new BoundField();
            MARCANAME.DataField = "marcaname";
            MARCANAME.HeaderText = "MARCA";
            MARCANAME.ItemStyle.Width = 250;
            dgb_marca.Columns.Add(MARCANAME);

            dt = BL.GetAll(Session["ssEmpresaID"].ToString(), BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                dgb_marca.DataSource = dt;
                dgb_marca.DataBind();
                dgb_marca.Visible = true;
            }
        }
        catch (Exception ex)
        {
            throw ex;// ClientMessage(ex.Message);
        }
    }
コード例 #8
0
        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;
                }
            }
        }
コード例 #9
0
        private void Valida_Marca(String xcod)
        {
            var BE = new tb_pt_marca();
            var BL = new tb_pt_marcaBL();
            var dt = new DataTable();
            BE.marcaid = xcod.Trim();
            dt = BL.GetAll(EmpresaID, BE).Tables[0];
            if (dt.Rows.Count > 0)
            {
                marcaid.Text = dt.Rows[0]["marcaid"].ToString();
                marcaname.Text = dt.Rows[0]["marcaname"].ToString();

                if (dt.Rows[0]["marcadescort"].ToString().Trim() == string.Empty)
                {
                    _xmarcadescort = dt.Rows[0]["marcaname"].ToString();
                }
                else
                {
                    _xmarcadescort = dt.Rows[0]["marcadescort"].ToString();
                }
            }
            else
            {
                _xmarcadescort = string.Empty;
                marcaid.Text = string.Empty;
                marcaname.Text = string.Empty;
            }
        }
コード例 #10
0
        public bool Insert_dbf(string empresaid, tb_pt_marca BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               "INSERT INTO MARCA001 (MC001STAT ,MC001IDMC ,MC001NAME ,ENSQL " +
                                    " )" +
               " VALUES (?, ?, ?, ? " +
                        ")";

                using (OleDbCommand cmd = new OleDbCommand(commandString, cnx))
                {
                    cmd.CommandType = System.Data.CommandType.Text;
                    cmd.Parameters.Add("@MC001STAT ", OleDbType.Decimal).Value = 1;
                    cmd.Parameters.Add("@MC001IDMC ", OleDbType.Char, 2).Value = BE.marcaidold.ToString();
                    cmd.Parameters.Add("@MC001NAME ", OleDbType.VarChar, 20).Value = BE.marcaname.ToString();
                    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);
                    }
                }
            }
        }
コード例 #11
0
        public DataSet GetAll_CODdbf(string empresaid, tb_pt_marca BE)
        {
            Conex_FoxDA cone = new Conex_FoxDA();
            using (OleDbConnection cnx = new OleDbConnection(cone.AdmConexion()))
            {
                String commandString =
               "SELECT MAX(MC001IDMC) AS marcaidold  FROM  MARCA001;";

                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);
                    }
                }
            }
        }
コード例 #12
0
 public bool Update_dbf(string empresaid, tb_pt_marca BE)
 {
     return tablaDA.Update_dbf(empresaid, BE);
 }
コード例 #13
0
 public bool Insert_dbf(string empresaid, tb_pt_marca BE)
 {
     return tablaDA.Insert_dbf(empresaid, BE);
 }
コード例 #14
0
 public DataSet GetAll_paginacion(string empresaid, tb_pt_marca BE)
 {
     return tablaDA.GetAll_paginacion(empresaid, BE);
 }
コード例 #15
0
        private void Update()
        {
            try
            {
                if (marcaid.Text.Trim().Length != 2)
                {
                    MessageBox.Show("Falta Codigo Marca !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (marcaname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese nombre de Marca", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_pt_marcaBL();
                        var BE = new tb_pt_marca();

                        BE.marcaid = marcaid.Text.Trim().PadLeft(2, '0');
                        BE.sigla = txtsigla.Text.Trim();
                        BE.marcaname = marcaname.Text.ToUpper();
                        BE.marcaidold = marcaidold.Text;
                        BE.marcadescort = marcadescort.Text.ToUpper();
                        BE.marcapropia = chkmarcapropia.Checked;
                        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);
            }
        }
コード例 #16
0
        private void Update_dbf()
        {
            try
            {
                if (marcaid.Text.Trim().Length != 2)
                {
                    MessageBox.Show("Falta Codigo Marca !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    if (marcaname.Text.Trim().Length == 0)
                    {
                        MessageBox.Show("Ingrese Nombre de Marca", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    else
                    {
                        var BL = new tb_pt_marcaBL();
                        var BE = new tb_pt_marca();
                        BE.marcaname = marcaname.Text.ToUpper();
                        BE.marcaidold = marcaidold.Text;

                        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);
            }
        }
コード例 #17
0
        public bool Update(string empresaid, tb_pt_marca BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbPtMarca_UPDATE", cnx))
                {

                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@marcaid", SqlDbType.Char, 2).Value = BE.marcaid;
                        cmd.Parameters.Add("@sigla", SqlDbType.Char, 2).Value = BE.sigla;
                        cmd.Parameters.Add("@marcaname", SqlDbType.VarChar, 20).Value = BE.marcaname;
                        cmd.Parameters.Add("@marcadescort", SqlDbType.VarChar, 10).Value = BE.marcadescort;
                        cmd.Parameters.Add("@marcaidold", SqlDbType.Char, 3).Value = BE.marcaidold;
                        cmd.Parameters.Add("@marcapropia", SqlDbType.Bit).Value = BE.marcapropia;
                        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);
                    }
                }
            }
        }
コード例 #18
0
 private void Valida_Marca(String xcod)
 {
     var BE = new tb_pt_marca();
     var BL = new tb_pt_marcaBL();
     var dt = new DataTable();
     BE.marcaid = xcod.Trim();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         foreach (DataRow row in dt.Rows)
         {
             if (row["marcadescort"].ToString().Trim() != string.Empty)
             {
                 _xmarcadescort = row["marcadescort"].ToString();
             }
             else
             {
                 _xmarcadescort = row["marcaname"].ToString();
             }
             marcaid.Text = row["marcaid"].ToString();
             marcaname.Text = row["marcaname"].ToString();
             _xmarcaidold = row["marcaidold"].ToString();
         }
     }
     else
     {
         _xmarcadescort = string.Empty;
         marcaid.Text = string.Empty;
         marcaname.Text = string.Empty;
         _xmarcaidold = string.Empty;
     }
 }
コード例 #19
0
 public DataSet GetAll(string empresaid, tb_pt_marca BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbPtMarca_SEARCH", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@marcaid", SqlDbType.Char, 2).Value = BE.marcaid;
                 cmd.Parameters.Add("@marcaname", SqlDbType.VarChar, 20).Value = BE.marcaname;
                 cmd.Parameters.Add("@marcadescort", SqlDbType.VarChar, 10).Value = BE.marcadescort;
                 cmd.Parameters.Add("@marcaidold", SqlDbType.Char, 3).Value = BE.marcaidold;
                 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);
             }
         }
     }
 }
コード例 #20
0
        private void ValidaMarca()
        {
            if (marcaid.Text.Trim().Length > 0)
            {
                tb_pt_marcaBL BL = new tb_pt_marcaBL();
                tb_pt_marca BE = new tb_pt_marca();
                DataTable dt = new DataTable();

                BE.marcaid = marcaid.Text.Trim().PadLeft(2, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    marcaid.Text = dt.Rows[0]["marcaid"].ToString().Trim();
                    marcaname.Text = dt.Rows[0]["marcaname"].ToString().Trim();
                }
                else
                {
                    marcaid.Text = "";
                    marcaname.Text = "";
                }
            }
            else
            {
                marcaid.Text = "";
                marcaname.Text = "";
            }
        }
コード例 #21
0
        private void data_Tablamarca()
        {
            try
            {
                if (Tablamarca.Rows.Count > 0)
                {
                    Tablamarca.Rows.Clear();
                }
                var BL = new tb_pt_marcaBL();
                var BE = new tb_pt_marca();

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

                Tablamarca = BL.GetAll(EmpresaID, BE).Tables[0];

                if (Tablamarca.Rows.Count > 0)
                {
                    btn_excel.Enabled = true;
                    gridmarca.DataSource = Tablamarca;
                    gridmarca.Rows[0].Selected = false;
                    gridmarca.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #22
0
 void CargarCmbMarca()
 {
     tb_pt_marcaBL BL = new tb_pt_marcaBL();
     tb_pt_marca BE = new tb_pt_marca();
     DataTable dt = new DataTable();
     dt = BL.GetAll(EmpresaID, BE).Tables[0];
     if (dt.Rows.Count > 0)
     {
         cmb_marca01.DataSource = dt;
         cmb_marca01.ValueMember = "marcaid";
         cmb_marca01.DisplayMember = "marcaname";
         cmb_marca01.SelectedIndex = -1;
     }
 }
コード例 #23
0
 public bool Delete(string empresaid, tb_pt_marca BE)
 {
     return tablaDA.Delete(empresaid, BE);
 }