Skip to content

Commit

Permalink
EM: Apply conditionl expression preferences
Browse files Browse the repository at this point in the history
Signed-off-by: Zinadin Zidan <zidan.roking@gmail.com>
Change-Id: I849043d93c8656cfb46aade3543da759a77a8228
  • Loading branch information
ZIDAN44 committed Jan 2, 2024
1 parent 4527eb7 commit 2c27add
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 40 deletions.
8 changes: 2 additions & 6 deletions Admin/Election/E_AppCan.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,8 @@ private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
private bool IsPdfFile(byte[] data)
{
// Check for the PDF signature in the first few bytes
if (data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46) // '%PDF'
{
return true;
}
return false;
return data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46;
}

private void SearchNominee(string searchTerm)
Expand Down
8 changes: 2 additions & 6 deletions Admin/Election/E_CanData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
private bool IsPdfFile(byte[] data)
{
// Check for the PDF signature in the first few bytes
if (data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46) // '%PDF'
{
return true;
}
return false;
return data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46;
}

private void SearchNominee(string searchTerm)
Expand Down
8 changes: 2 additions & 6 deletions Admin/Election/E_Data.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
private bool IsPdfFile(byte[] data)
{
// Check for the PDF signature in the first few bytes
if (data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46) // '%PDF'
{
return true;
}
return false;
return data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46;
}

private void SearchElection(string searchTerm)
Expand Down
9 changes: 1 addition & 8 deletions Common/Notification_Panel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,7 @@ private string GetVotingStatusMessage()
{
bool hasVotedStatus = Convert.ToBoolean(hasVoted);

if (hasVotedStatus)
{
return "You have voted successfully";
}
else
{
return "You still haven't voted";
}
return hasVotedStatus ? "You have voted successfully" : "You still haven't voted";
}
}
catch (Exception ex)
Expand Down
9 changes: 1 addition & 8 deletions Nominee/N_Dashboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,7 @@ private void FetchNomineeDetails()
label5.Text = (nominee.VCOUNT != 0) ? "Vote Count: " + nominee.VCOUNT : "Vote Count: N/A";
label4.Text = "Welcome, " + nominee.N_NAME;

if (nominee.P_NAME == null)
{
label3.Text = "Party: N/A";
}
else
{
label3.Text = "Party: " + nominee.P_NAME;
}
label3.Text = string.IsNullOrEmpty(nominee.P_NAME) ? "Party: N/A" : "Party: " + nominee.P_NAME;

if (nominee.LOGO != null)
{
Expand Down
8 changes: 2 additions & 6 deletions Nominee/Selects/Election_Select.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,8 @@ private void LoadAvailableElections()
private bool IsPdfFile(byte[] data)
{
// Check for the PDF signature in the first few bytes
if (data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46) // '%PDF'
{
return true;
}
return false;
return data.Length > 4 &&
data[0] == 0x25 && data[1] == 0x50 && data[2] == 0x44 && data[3] == 0x46;
}

private void DisplayPdf(byte[] fileData)
Expand Down

0 comments on commit 2c27add

Please sign in to comment.