public static string ValidarIdentifier(string sIdentifier) { string retorno = "0"; DataTable DTRetorno = null; string strError = string.Empty; InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); Ent_tticol132 ent_tticol132 = new Ent_tticol132(); if (string.IsNullOrEmpty(sIdentifier)) { retorno = "0"; } else { Ent_tticol132 param = new Ent_tticol132() { barcode = sIdentifier }; try { DTRetorno = tticol132.ObtenerBox(ref param, ref strError); if (DTRetorno.Rows.Count > 0) { retorno = string.Empty; } } catch (Exception ex) { retorno = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } } return(retorno); }
protected void btnContinue_Click(object sender, EventArgs e) { InterfazDAL_tticol132 tticol132 = new InterfazDAL_tticol132(); Ent_tticol132 ent_tticol132 = new Ent_tticol132(); string strError = string.Empty; int retorno; List <Ent_tticol132> param = new List <Ent_tticol132>(); DataTable DTBox; try { if (String.IsNullOrEmpty(txtIdentifier.Text)) { strError = "Box Identifier doesn't exist"; return; } ent_tticol132.barcode = txtIdentifier.Text; DTBox = tticol132.ObtenerBox(ref ent_tticol132, ref strError); if (DTBox.Rows.Count > 0) { ent_tticol132.item = string.Format(" {0}", DTBox.Rows[0]["t$item"].ToString().Trim()); ent_tticol132.type = int.Parse(DTBox.Rows[0]["t$type"].ToString()); ent_tticol132.user = Session["user"].ToString(); //Modificado por petición de DMontoya //Al digitar un registro de uso el registro que se está guardando en la tabla el registro con: //status “Nuevo” y este campo debe quedar con valor “En Uso” (2) Pendiente //ent_tticol132.status = int.Parse(DTBox.Rows[0]["t$stat"].ToString()); ent_tticol132.status = 2; ent_tticol132.machine = txtMachine.Text.Trim().ToUpperInvariant(); ent_tticol132.refcntd = 0; ent_tticol132.refcntu = 0; param.Add(ent_tticol132); } retorno = tticol132.insertarRegistro(ref param, ref strError); if (retorno == 0 && !string.IsNullOrEmpty(strError)) { strError = "Save unsuccessfully (" + strError + ")"; } else { strError = "Save successfully"; txtIdentifier.Text = ""; //txtMachine.Text = ""; } } catch (Exception ex) { strError = ex.InnerException != null ? ex.Message + " (" + ex.InnerException + ")" : ex.Message; } lblMensaje.Text = strError; }