Skip to content

Commit

Permalink
filter added #12
Browse files Browse the repository at this point in the history
  • Loading branch information
elifdiril committed Feb 7, 2018
1 parent ccbc718 commit 07bad8a
Show file tree
Hide file tree
Showing 8 changed files with 221 additions and 154 deletions.
3 changes: 1 addition & 2 deletions InternshipER/App_Code/Database.cs
Original file line number Diff line number Diff line change
Expand Up @@ -430,15 +430,14 @@ internal static void saveEvaluation(String reviewer,String target,String title,
{
using (NpgsqlConnection con = connect())
{
using (NpgsqlCommand cmd = new NpgsqlCommand("INSERT INTO review (target, reviewer, message ,grade, title, rate, date, job_id) VALUES(@Target, @Reviewer, @Message ,@Grade, @Title, @Rate, @Date, @JobId)"))
using (NpgsqlCommand cmd = new NpgsqlCommand("INSERT INTO review (target, reviewer, message , title, grade, date, job_id) VALUES(@Target, @Reviewer, @Message , @Title, @Grade, @Date, @JobId)"))
{
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@Target", target);
cmd.Parameters.AddWithValue("@Reviewer", reviewer);
cmd.Parameters.AddWithValue("@Message", message);
cmd.Parameters.AddWithValue("@Grade", rate);
cmd.Parameters.AddWithValue("@Title", title);
cmd.Parameters.AddWithValue("@Rate", rate);
cmd.Parameters.AddWithValue("@Date", DateTime.Now);
cmd.Parameters.AddWithValue("@JobId", jobId);
cmd.Connection = con;
Expand Down
9 changes: 6 additions & 3 deletions InternshipER/InternshipER.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -34,6 +35,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand All @@ -43,6 +45,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Expand All @@ -55,15 +58,13 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Threading.Tasks.Extensions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.3.0\lib\portable-net45+win8+wp8+wpa81\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
Expand All @@ -90,6 +91,7 @@
<Reference Include="System.Web.Optimization, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
<HintPath>..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="WebGrease">
<Private>True</Private>
<HintPath>..\packages\WebGrease.1.5.2\lib\WebGrease.dll</HintPath>
Expand Down Expand Up @@ -184,6 +186,7 @@
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxTimer.js" />
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebForms.js" />
<Content Include="Scripts\WebForms\MSAjax\MicrosoftAjaxWebServices.js" />
<Content Include="Scripts\WebForms\Search.js" />
<Content Include="Scripts\WebForms\SmartNav.js" />
<Content Include="Scripts\WebForms\Student.js" />
<Content Include="Scripts\WebForms\TreeView.js" />
Expand Down
46 changes: 46 additions & 0 deletions InternshipER/Scripts/WebForms/Search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
$(document).ready(function() {
var activeSystemClass = $('.list-group-item.active');

//something is entered in search form
$('#system-search').keyup( function() {
var that = this;
// affect all table rows on in systems table
var tableBody = $('.table-list-search tbody');
var tableRowsClass = $('.table-list-search tbody tr');
$('.search-sf').remove();
tableRowsClass.each( function(i, val) {

//Lower text for case insensitive
var rowText = $(val).text().toLowerCase();
var inputText = $(that).val().toLowerCase();
if(inputText != '')
{
$('.search-query-sf').remove();
tableBody.prepend('<tr class="search-query-sf"><td colspan="6"><strong>Searching for: "'
+ $(that).val()
+ '"</strong></td></tr>');
}
else
{
$('.search-query-sf').remove();
}

if( rowText.indexOf( inputText ) == -1 )
{
//hide rows
tableRowsClass.eq(i).hide();

}
else
{
$('.search-sf').remove();
tableRowsClass.eq(i).show();
}
});
//all tr elements are hidden
if(tableRowsClass.children(':visible').length == 0)
{
tableBody.append('<tr class="search-sf"><td class="text-muted" colspan="6">No entries found.</td></tr>');
}
});
});
4 changes: 2 additions & 2 deletions InternshipER/company.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<link rel="stylesheet" type="text/css" href="Content/Company.css">
<script src="Scripts/Company.js"></script>
<script src="Scripts/WebForms/Company.js"></script>
<script src="https://use.fontawesome.com/bfdd1d98a1.js"></script>
<div class="container">
<div class="row">
Expand Down Expand Up @@ -64,7 +64,7 @@
<div class="row" id="post-review-box" style="display: none;">
<div class="col-md-12">
<input runat="server" id="ratingsHidden" name="rating" type="hidden">
<input runat="server" id="ratingsHidden" name="rating" value="" type="hidden">
<input type="text" runat="server" class="form-control" id="reviewTitle" placeholder="Değerlendirme Başlığı">
<textarea class="form-control animated" cols="15" runat="server" id="newReview" name="comment" placeholder="Değerlendirmenizi buraya giriniz..." rows="15"></textarea>
Expand Down
8 changes: 6 additions & 2 deletions InternshipER/company.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ protected void Page_Load(object sender, EventArgs e)
int user_id = getCompanyId();
getCompanyInfo(user_id);
//Öğrenci için company sayfasında saklanacak objeler.
if(Session["id"]==null)
if(Session["id"]!=null)
if (Database.isStudent(Session["id"].ToString())){
postReviewBox.Visible = true;
}
Expand Down Expand Up @@ -119,7 +119,11 @@ protected void getCompanyInfo(int user_id)
}
protected void SaveReviewClick_Event(object sender, EventArgs e)
{
Database.saveEvaluation(Session["id"].ToString(), Request.QueryString["UserId"].ToString(), reviewTitle.Value, newReview.Value, int.Parse(ratingsHidden.Value.ToString()), "");
int rating = 0;
if (ratingsHidden == null || ratingsHidden.Value.Equals(""));
else
rating = int.Parse(ratingsHidden.Value);
Database.saveEvaluation(Session["id"].ToString(), Request.QueryString["UserId"], reviewTitle.Value, newReview.Value, rating, "");
}
protected void updateCompanyProfile(object sender, EventArgs e)
{
Expand Down
17 changes: 15 additions & 2 deletions InternshipER/search.aspx
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="search.aspx.cs" Inherits="InternshipER.searchForm" %>

<asp:Content ID="Search" ContentPlaceHolderID="MainContent" runat="server">

<script src="Scripts/WebForms/Search.js"></script>
<link rel="stylesheet" type="text/css" href="Content/Search.css">
<div class="container">
<div class="row col-md-12 col-md-offset-1 custyle">
<table class="table table-striped custab">
<div class="col-md-3">
<form action="#" method="get">
<div class="input-group">
<!-- USE TWITTER TYPEAHEAD JSON WITH API TO SEARCH -->
<input class="form-control" id="system-search" name="q" placeholder="Search for" required>
<span class="input-group-btn">
<button type="submit" class="btn btn-default"><i class="glyphicon glyphicon-search"></i></button>
</span>
</div>
</form>
</div>
<table class="table table-striped custab table-list-search">
<thead>
<tr>
<asp:PlaceHolder ID = "searchTableHeader" runat="server" />
</tr>
</thead>
<tbody>
<asp:PlaceHolder ID = "searchTable" runat="server" />
</tbody>
</table>
</div>
</div>
Expand Down
186 changes: 94 additions & 92 deletions InternshipER/search.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ protected void Page_Load(object sender, EventArgs e)
string user_id = "0";
string param;

param = Request.QueryString["UserId"];
user_id = Request.QueryString["UserId"];
if (user_id == null)
{
if (Session["id"] != null && !Session["id"].Equals(""))
Expand All @@ -42,100 +42,102 @@ protected void Page_Load(object sender, EventArgs e)
if(jobid!=null)
Database.jobAdd2User(jobid, user_id, "", new DateTime()); /* TODO database sop ve date eklemesi ve mevcutsa silinmesi*/

if (!this.IsPostBack)
{
DataTable dt=null;
param = Request.QueryString["param"];
StringBuilder html2=null;
if (param == null)
{

//Populating a DataTable from database.
dt=Database.GetJob();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> Firma </th>");
html2.Append("<th> Pozisyon </th>");
html2.Append("<th> Açıklama </th>");
html2.Append("<th> Lokasyon </th>");
html2.Append("<th> İlan Tarihi </th>");
html2.Append("<th> Son Tarihi </th>");
html2.Append("<th> Staj Dönemi </th>");
html2.Append("<th class=\"text-center\"></th>");


}
else if (param.Equals("1")) // Student
{
//Populating a DataTable from database.
dt=Database.GetAllUsers();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> İsim </th>");
html2.Append("<th> Email </th>");
html2.Append("<th> Okul </th>");
html2.Append("<th> Bölüm </th>");
html2.Append("<th class=\"text-center\"></th>");

}
else if (param.Equals("2")) //Company
{
//Populating a DataTable from database.
dt = Database.GetAllCompanies();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> Firma </th>");
html2.Append("<th> Email </th>");
html2.Append("<th> Web Sitesi </th>");
html2.Append("<th> Telefon </th>");
html2.Append("<th> Lokasyon </th>");
html2.Append("<th class=\"text-center\"></th>");

}


//Building an HTML string.
StringBuilder html = new StringBuilder();



//Building the Data rows.
foreach (System.Data.DataRow row in dt.Rows)
{
html.Append("<tr>");
foreach (System.Data.DataColumn column in dt.Columns)
{
html.Append("<td>");
html.Append(row[column.ColumnName]);
html.Append("</td>");
}
if(!param.Equals("2") && !param.Equals("1"))
{
html.Append("<td> <a class='btn btn-info btn-xs' href=\"search?UserId=");
html.Append(user_id);
html.Append("&jobid=");
html.Append(row["job_id"]);
html.Append("\" >Başvur</a> </td>");

}

html.Append("</tr>");
}


//Append the HTML string to Placeholder.
searchTable.Controls.Add(new LiteralControl { Text = html.ToString() });
if (!this.IsPostBack)
{

DataTable dt = null;
param = Request.QueryString["param"];
StringBuilder html2 = null;
if (param == null)
{

//Populating a DataTable from database.
dt = Database.GetJob();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> Firma </th>");
html2.Append("<th> Pozisyon </th>");
html2.Append("<th> Açıklama </th>");
html2.Append("<th> Lokasyon </th>");
html2.Append("<th> İlan Tarihi </th>");
html2.Append("<th> Son Tarihi </th>");
html2.Append("<th> Staj Dönemi </th>");
html2.Append("<th class=\"text-center\"></th>");


}
else if (param.Equals("1")) // Student
{
//Populating a DataTable from database.
dt = Database.GetAllUsers();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> İsim </th>");
html2.Append("<th> Email </th>");
html2.Append("<th> Okul </th>");
html2.Append("<th> Bölüm </th>");
html2.Append("<th class=\"text-center\"></th>");

}
else if (param.Equals("2")) //Company
{
//Populating a DataTable from database.
dt = Database.GetAllCompanies();

html2 = new StringBuilder();

html2.Append("<th>#</th>");
html2.Append("<th> Firma </th>");
html2.Append("<th> Email </th>");
html2.Append("<th> Web Sitesi </th>");
html2.Append("<th> Telefon </th>");
html2.Append("<th> Lokasyon </th>");
html2.Append("<th class=\"text-center\"></th>");

}


//Building an HTML string.
StringBuilder html = new StringBuilder();



//Building the Data rows.
foreach (System.Data.DataRow row in dt.Rows)
{
html.Append("<tr>");
foreach (System.Data.DataColumn column in dt.Columns)
{
html.Append("<td>");
html.Append(row[column.ColumnName]);
html.Append("</td>");
}
if (param==null)
{
html.Append("<td> <a class='btn btn-info btn-xs' href=\"search?UserId=");
html.Append(user_id);
html.Append("&jobid=");
html.Append(row["job_id"]);
html.Append("\" >Başvur</a> </td>");

}

html.Append("</tr>");
}


//Append the HTML string to Placeholder.
searchTable.Controls.Add(new LiteralControl { Text = html.ToString() });
searchTableHeader.Controls.Add(new LiteralControl { Text = html2.ToString() });

}


}


}
protected void jobAdd2User(object sender, EventArgs e)
{
Expand Down
Loading

0 comments on commit 07bad8a

Please sign in to comment.