コード例 #1
0
 public DataSet GetAllnoLSI(string empresaid, tb_me_linea BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeLinea_SEARCH_noLSI", cnx))
         {
             DataSet ds = new DataSet();
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@local", SqlDbType.Char, 3).Value = BE.local;
                 //cmd.Parameters.Add("@lineaname", SqlDbType.VarChar, 20).Value = BE.lineaname;
             }
             try
             {
                 cnx.Open();
                 using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                 {
                     da.Fill(ds);
                 }
                 return ds;
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #2
0
 public bool Delete(string empresaid, tb_me_linea BE)
 {
     using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
     {
         using (SqlCommand cmd = new SqlCommand("gspTbMeLinea_DELETE", cnx))
         {
             {
                 cmd.CommandType = CommandType.StoredProcedure;
                 cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                 cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
             }
             try
             {
                 cnx.Open();
                 if (cmd.ExecuteNonQuery() > 0)
                 {
                     return true;
                 }
                 else
                 {
                     return false;
                 }
             }
             catch (Exception ex)
             {
                 throw new Exception(ex.Message);
             }
         }
     }
 }
コード例 #3
0
        private DataTable Movimiento_linea()
        {
            try
            {
                var TablaLinea = new DataTable("Linea");

                var BL = new tb_me_lineaBL();
                var BE = new tb_me_linea();

                BE.moduloid = moduloid.Trim();

                TablaLinea = BL.GetReport(VariablesPublicas.EmpresaID.ToString(), BE).Tables[0];
                if (TablaLinea != null)
                {
                    return TablaLinea;
                }
                else
                {
                    return null;
                }
            }
            catch (Exception ex)
            {
                return null;
            }
        }
コード例 #4
0
        private void Update()
        {
            try
            {
                if (lineaid.Text.Trim().Length != 3)
                {
                    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
                {
                    tb_me_lineaBL BL = new tb_me_lineaBL();
                    tb_me_linea BE = new tb_me_linea();
                    BE.moduloid = modulo;
                    BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0');
                    BE.lineaname = lineaname.Text.ToUpper();
                    BE.nostock = Convert.ToBoolean(nostock.SelectedIndex);
                    if (estructuraid.SelectedValue != null && estructuraid.Text.Trim().Length > 0)
                        BE.estructuraid = estructuraid.SelectedValue.ToString();
                    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);
            }
        }
コード例 #5
0
        private void form_cargar_datos(String posicion)
        {
            try
            {
                tb_me_lineaBL BL = new tb_me_lineaBL();
                tb_me_linea BE = new tb_me_linea();
                DataTable dt = new DataTable();

                BE.moduloid = modulo;
                if (lineaid.Text.Trim().Length > 0)
                {
                    BE.lineaid = lineaid.Text.Trim().PadLeft(3, '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();
                    nostock.SelectedIndex = Convert.ToInt16(dt.Rows[0]["nostock"].ToString());

                    btn_editar.Enabled = true;
                    btn_eliminar.Enabled = true;
                    btn_imprimir.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);
            }
        }
コード例 #6
0
        private void Delete()
        {
            try
            {
                if (lineaid.Text.Trim().Length != 3)
                {
                    MessageBox.Show("Falta Codigo linea !!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                else
                {
                    tb_me_lineaBL BL = new tb_me_lineaBL();
                    tb_me_linea BE = new tb_me_linea();
                    BE.moduloid = modulo;
                    BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0');
                    BE.lineaname = lineaname.Text.ToUpper();
                    if (estructuraid.SelectedValue != null && estructuraid.Text.Trim().Length > 0)
                        BE.estructuraid = estructuraid.SelectedValue.ToString();
                    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_Tablalinea();
                        btn_nuevo.Enabled = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #7
0
        private void data_Tablalinea()
        {
            try
            {
                if (Tablalinea.Rows.Count > 0)
                    Tablalinea.Rows.Clear();
                tb_me_lineaBL BL = new tb_me_lineaBL();
                tb_me_linea BE = new tb_me_linea();

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

                Tablalinea = BL.GetAll(EmpresaID, BE).Tables[0];
                if (Tablalinea.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    gridlinea.DataSource = Tablalinea;
                    gridlinea.Rows[0].Selected = false;
                    gridlinea.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #8
0
        private void ValidaLinea()
        {
            if (lineaid.Text.Trim().Length > 0 && ssModo == "NEW")
            {
                var BL = new tb_me_lineaBL();
                var BE = new tb_me_linea();
                var dt = new DataTable();

                BE.moduloid = modulo;
                BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim();
                    lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim();
                    generar_denominacion();
                }
                else
                {
                    lineaid.Text = string.Empty;
                    lineaname.Text = string.Empty;
                    generar_denominacion();
                }
            }
            if (lineaid.Text.Trim().Length == 0 && ssModo == "NEW")
            {
                lineaid.Text = string.Empty;
                lineaname.Text = string.Empty;
                generar_denominacion();
            }
        }
コード例 #9
0
        public bool Update(string empresaid, tb_me_linea BE)
        {
            using (SqlConnection cnx = new SqlConnection(conex.empConexion(empresaid)))
            {
                using (SqlCommand cmd = new SqlCommand("gspTbMeLinea_UPDATE", cnx))
                {

                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add("@moduloid", SqlDbType.Char, 4).Value = BE.moduloid;
                        cmd.Parameters.Add("@lineaid", SqlDbType.Char, 3).Value = BE.lineaid;
                        cmd.Parameters.Add("@lineaname", SqlDbType.VarChar, 20).Value = BE.lineaname;
                        cmd.Parameters.Add("@estructuraid", SqlDbType.Char, 1).Value = BE.estructuraid;
                        cmd.Parameters.Add("@usuar", SqlDbType.Char, 15).Value = BE.usuar;
                        cmd.Parameters.Add("@nostock", SqlDbType.Bit).Value = BE.nostock;
                    }
                    try
                    {
                        cnx.Open();
                        if (cmd.ExecuteNonQuery() > 0)
                        {
                            return true;
                        }
                        else
                        {
                            return false;
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new Exception(ex.Message);
                    }
                    finally
                    {
                        cnx.Close();
                    }
                }
            }
        }
コード例 #10
0
        private void ValidaLinea()
        {
            if (lineaid.Text.Trim().Length > 0)
            {
                tb_me_lineaBL BL = new tb_me_lineaBL();
                tb_me_linea BE = new tb_me_linea();
                DataTable dt = new DataTable();

                BE.moduloid = modulo;
                BE.lineaid = lineaid.Text.Trim().PadLeft(3, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    lineaid.Text = dt.Rows[0]["lineaid"].ToString().Trim();
                    lineaname.Text = dt.Rows[0]["lineaname"].ToString().Trim();
                }
                else
                {
                    lineaid.Text = "";
                    lineaname.Text = "";
                }
            }
            else
            {
                lineaid.Text = "";
                lineaname.Text = "";
            }
        }