private void data_cbo_mottrasladointid()
 {
     try
     {
         var BL = new tb_mottrasladointBL();
         var BE = new tb_mottrasladoint();
         BE.moduloid = modulo;
         BE.tipmov = almacaccionid.Trim().PadLeft(1, '0').Substring(0, 1);
         mottrasladointid.DataSource = BL.GetAll(EmpresaID, BE).Tables[0];
         mottrasladointid.ValueMember = "mottrasladointid";
         mottrasladointid.DisplayMember = "mottrasladointname";
         mottrasladointid.SelectedIndex = -1;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        void CargarMotivos()
        {
            try
            {
                var BL = new tb_mottrasladointBL();
                var BE = new tb_mottrasladoint();
                DataTable dt = new DataTable();
                BE.moduloid = modulo;
                BE.tipmov = Equivalencias.Left(cmb_tipdoc.SelectedValue.ToString(),1).ToString();
                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    cmb_motivo.DataSource = dt;
                    cmb_motivo.ValueMember = "mottrasladointid";
                    cmb_motivo.DisplayMember = "mottrasladointname";
                    cmb_motivo.SelectedIndex = -1;

                    cmb_motivo.Enabled = true;
                    txt_serop.Enabled = true;

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ValidaMottrasladoint()
        {
            if (mottrasladointid.Text.Trim().Length > 0 && ssModo == "NEW")
            {
                tb_mottrasladointBL BL = new tb_mottrasladointBL();
                tb_mottrasladoint BE = new tb_mottrasladoint();
                DataTable dt = new DataTable();

                BE.moduloid = modulo;
                BE.mottrasladointid = mottrasladointid.Text.Trim().PadLeft(4, '0');

                dt = BL.GetAll(EmpresaID, BE).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    mottrasladointid.Text = dt.Rows[0]["mottrasladointid"].ToString().Trim();
                    mottrasladointname.Text = dt.Rows[0]["mottrasladointname"].ToString().Trim();
                    mottrasladointname.Text = moduloname.Text.Trim() + " " + dt.Rows[0]["mottrasladointname"].ToString().Trim();
                }
                else
                {
                    mottrasladointid.Text = "";
                    mottrasladointname.Text = "";
                    mottrasladointname.Text = moduloname.Text.Trim();
                }
            }
            if (mottrasladointid.Text.Trim().Length == 0 && ssModo == "NEW")
            {
                mottrasladointid.Text = "";
                mottrasladointname.Text = "";
                mottrasladointname.Text = moduloname.Text.Trim();
            }
        }
        private void data_Tablamottrasladoint()
        {
            try
            {
                if (Tablamottrasladoint.Rows.Count > 0)
                    Tablamottrasladoint.Rows.Clear();
                tb_mottrasladointBL BL = new tb_mottrasladointBL();
                tb_mottrasladoint BE = new tb_mottrasladoint();
                BE.moduloid = moduloid.Text.Trim();
                switch (cbo_buscar.SelectedIndex)
                {
                    case 0:
                        BE.mottrasladointname = txt_criterio.Text.Trim();
                        break;
                    case 1:
                        if (txt_criterio.Text.Trim().Length > 0)
                        {
                            BE.mottrasladointid = txt_criterio.Text.Trim().ToUpper().PadLeft(3, '0');
                        }
                        break;
                    case 2:
                        if (txt_criterio.Text.Trim().Length > 0)
                        {
                            BE.tipmov = txt_criterio.Text.Trim();
                        }
                        break;
                    default:
                        //**
                        break;
                }

                Tablamottrasladoint = BL.GetAll(EmpresaID, BE).Tables[0];
                if (Tablamottrasladoint.Rows.Count > 0)
                {
                    btn_imprimir.Enabled = true;
                    gridmottrasladoint.DataSource = Tablamottrasladoint;
                    gridmottrasladoint.Rows[0].Selected = false;
                    gridmottrasladoint.Focus();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void ValidaMottrasladoint()
        {
            if (mottrasladointid.Text.Trim().Length > 0)
            {
                var BL = new tb_mottrasladointBL();
                var BE = new tb_mottrasladoint();
                var dt = new DataTable();

                BE.moduloid = modulo.Trim();
                BE.mottrasladointid = mottrasladointid.Text.Trim().PadLeft(2, '0');

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