protected void btnSend_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim())) { RequiredField.Enabled = true; RequiredField.IsValid = false; RequiredField.Validate(); txtWorkOrderFrom.Focus(); return; } if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim())) { RequiredFieldValidator1.Enabled = true; RequiredFieldValidator1.IsValid = false; RequiredFieldValidator1.Validate(); txtWorkOrderTo.Focus(); return; } lblResult.Text = string.Empty; txtWorkOrderFrom.Text = txtWorkOrderFrom.Text.ToUpperInvariant(); txtWorkOrderTo.Text = txtWorkOrderTo.Text.ToUpperInvariant(); if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim())) { return; } if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim())) { return; } if (txtWorkOrderFrom.Text.Trim().ToUpperInvariant() == txtWorkOrderTo.Text.Trim().ToUpperInvariant()) { lblResult.Text = mensajes("ordersequals"); lblResult.ForeColor = System.Drawing.Color.Red; return; } string ErrorOrden = "FROM "; obj.fpdn = txtWorkOrderFrom.Text.ToUpperInvariant(); resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError); if (resultado.Rows.Count < 1) { lblResult.Text = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim()); lblResult.ForeColor = System.Drawing.Color.Red; return; } ErrorOrden = "TO "; obj.fpdn = txtWorkOrderTo.Text.ToUpperInvariant(); resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError); if (resultado.Rows.Count < 1) { lblResult.Text = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim()); lblResult.ForeColor = System.Drawing.Color.Red; return; } obj.fpdn = txtWorkOrderFrom.Text.ToUpperInvariant(); resultado = idal.lineClearance_listaRegistrosOrden_Param(ref obj, ref strError); if (resultado.Rows.Count < 1) { lblResult.Text = string.Format(mensajes("ordernotexists"), ErrorOrden, obj.fpdn.Trim()); lblResult.ForeColor = System.Drawing.Color.Red; return; } hidden.Value = txtWorkOrderTo.Text.Trim(); grdRecords.DataSource = resultado; grdRecords.DataBind(); HeaderGrid.Visible = true; btnSave.Visible = true; }
protected void btnSend_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim())) { RequiredField.Enabled = true; RequiredField.IsValid = false; RequiredField.Validate(); txtWorkOrderFrom.Focus(); return; } if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim())) { RequiredFieldValidator1.Enabled = true; RequiredFieldValidator1.IsValid = false; RequiredFieldValidator1.Validate(); txtWorkOrderTo.Focus(); return; } lblResult.Text = string.Empty; txtWorkOrderFrom.Text = txtWorkOrderFrom.Text.ToUpperInvariant(); txtWorkOrderTo.Text = txtWorkOrderTo.Text.ToUpperInvariant(); if (string.IsNullOrEmpty(txtWorkOrderFrom.Text.Trim())) { return; } if (string.IsNullOrEmpty(txtWorkOrderTo.Text.Trim())) { return; } if (txtWorkOrderFrom.Text.Trim().ToUpperInvariant() == txtWorkOrderTo.Text.Trim().ToUpperInvariant()) { lblResult.Text = "Work Order's are equals. Cannot continue"; return; } string ErrorOrden = "FROM "; obj.fpdn = txtWorkOrderFrom.Text.ToUpperInvariant(); resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError); ErrorOrden = "TO "; obj.fpdn = txtWorkOrderTo.Text.ToUpperInvariant(); resultado = idal.lineClearance_verificaOrdenes_Param(ref obj, ref strError); obj.fpdn = txtWorkOrderFrom.Text.ToUpperInvariant(); resultado = idal.lineClearance_listaRegistrosOrden_Param(ref obj, ref strError); if (resultado.Rows.Count < 1) { lblResult.Text = string.Format("Order Work {0}: {1} doesn't exist or the status is not active, release or completed.", ErrorOrden, obj.fpdn.Trim()); return; } hidden.Value = txtWorkOrderTo.Text.Trim(); grdRecords.DataSource = resultado; grdRecords.DataBind(); HeaderGrid.Visible = true; btnSave.Visible = true; }