Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
elham2155 authored Jul 28, 2019
0 parents commit e8569dc
Show file tree
Hide file tree
Showing 67 changed files with 11,359 additions and 0 deletions.
141 changes: 141 additions & 0 deletions AbetGroupReport.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="AbetGroupReport.aspx.cs" Inherits="AbetGroupReport" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.auto-style2 {
width: 250px;
}
.auto-style3 {
height: 32px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table align="center" dir="rtl" class="Table90P">
<tr>
<td align="left" colspan="4">
<asp:ImageButton ID="imgbHome" runat="server" Height="60px" ImageUrl="~/Images/Home2.png" Width="60px" OnClick="imgbHome_Click" />
<asp:ImageButton ID="imgbExit" runat="server" ImageUrl="~/Images/exit2.JPG" OnClick="imgbExit_Click" />
</td>
</tr>
<tr>
<td align="right" colspan="4">
<asp:Label ID="Label1" runat="server" CssClass="BigLabel" Text="واجدین شرایط دریافت طبقه تشویقی"></asp:Label>
</td>
</tr>
<tr>
<td align="right" colspan="4">
<asp:Label ID="lblSearch" runat="server" CssClass="greenLbl" Text="لطفا سال جاری را وارد کنید"></asp:Label>
&nbsp;<asp:TextBox ID="txtYear" runat="server" MaxLength="2" Width="23px"></asp:TextBox>
&nbsp;<asp:Label ID="lblCount" runat="server" CssClass="greenLbl" Text=" تعداد سالهای مورد نظر تا سال جاری"></asp:Label>
&nbsp;<asp:TextBox ID="txtCount" runat="server" MaxLength="1" Width="18px"></asp:TextBox>
&nbsp;<asp:Label ID="Label2" runat="server" CssClass="greenLbl" Text=" حداقل نمره ارزشیابی مورد قبول"></asp:Label>
&nbsp;<asp:TextBox ID="txtGrade" runat="server" MaxLength="2" Width="23px">85</asp:TextBox>
</td>
</tr>
<tr>
<td align="right" colspan="2">
&nbsp;</td>
<td align="right" colspan="2">
<asp:Label ID="lblDL" runat="server" CssClass="greenLbl" Text="دانلود اطلاعات واجدین شرایط دریافت طبقه تشویقی"></asp:Label>
&nbsp;<asp:ImageButton ID="imgbExport" runat="server" ImageUrl="~/Images/xls-download.png" OnClick="imgbExport_Click" Height="50px" Width="70px" />
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;<asp:Button ID="btnSearch" runat="server" CssClass="btn" Text="نمایش اطلاعات" OnClick="btnSearch_Click" />
&nbsp;&nbsp;<asp:Button ID="btnNew" runat="server" CssClass="btn" Text="گزارش جدید" OnClick="btnNew_Click" />
</td>
</tr>
<tr>
<td colspan="4" class="auto-style3">
</td>
</tr>
<tr>
<td colspan="4">
<asp:GridView ID="GridView4" runat="server" CellPadding="4" CssClass="label" ForeColor="#333333" GridLines="None" Width="100%">
<AlternatingRowStyle BackColor="White" />
<EditRowStyle BackColor="#7C6F57" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="4" align="center">
&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center">
&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center">
&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center">
&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="center">
&nbsp;</td>
</tr>
<tr>
<td colspan="4" align="right">
<asp:Label ID="Label3" runat="server" CssClass="BigLabel" Text="سایر اطلاعات"></asp:Label>
</td>
</tr>
<tr>
<td valign="top">
<asp:GridView ID="GridView2" runat="server" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" CssClass="label" GridLines="Vertical">
<AlternatingRowStyle BackColor="#DCDCDC" />
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
</td>
<td class="auto-style2" valign="top" colspan="2">
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" CssClass="label" Width="100%" CaptionAlign="Top">
<FooterStyle BackColor="White" ForeColor="#000066" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#007DBB" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#00547E" />
</asp:GridView>
</td>
<td valign="top">
<asp:GridView ID="GridView3" runat="server" CellPadding="4" CssClass="label" ForeColor="#333333" GridLines="None" Width="100%" CaptionAlign="Top">
<AlternatingRowStyle BackColor="White" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="#FDF5AC" />
<SortedAscendingHeaderStyle BackColor="#4D0000" />
<SortedDescendingCellStyle BackColor="#FCF6C0" />
<SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
</td>
</tr>
</table>
</asp:Content>

226 changes: 226 additions & 0 deletions AbetGroupReport.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
using System;
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.IO;
using System.Collections.Generic;

public partial class AbetGroupReport : System.Web.UI.Page
{
DataTable dtPersonValuation,dtGroup,dtResult;
SqlDataReader drValuation,drGroup,drResult;
protected void Page_Load(object sender, EventArgs e)
{
SetFocus(txtYear);
imgbExport.Visible = false;
lblDL.Visible = false;
//********************
string CountPersonID = "";
CountPersonID = DB.ExecuteScalar("select count(PersonID) from Person").ToString();

//********************
SqlDataReader drPersonID;
drPersonID = DB.ExecuteReader("select PersonID from Person");

GridView2.DataSource = drPersonID;
GridView2.DataBind();
//********************
dtPersonValuation = new DataTable("tblPerson");

DataColumn dcPersonMelliCode = new DataColumn();
dcPersonMelliCode.DataType = typeof(String);
dcPersonMelliCode.ColumnName = "PersonMelliCode";

DataColumn dcPersonName = new DataColumn();
dcPersonName.DataType = typeof(String);
dcPersonName.ColumnName = "PersonName";

DataColumn dcPersonFamily = new DataColumn();
dcPersonFamily.DataType = typeof(String);
dcPersonFamily.ColumnName = "PersonFamily";

DataColumn dcValuationYear = new DataColumn();
dcValuationYear.DataType = typeof(String);
dcValuationYear.ColumnName = "ValuationYear";

DataColumn dcValuationGrade = new DataColumn();
dcValuationGrade.DataType = typeof(String);
dcValuationGrade.ColumnName = "ValuationGrade";

dtPersonValuation.Columns.Add(dcPersonMelliCode);
dtPersonValuation.Columns.Add(dcPersonName);
dtPersonValuation.Columns.Add(dcPersonFamily);
dtPersonValuation.Columns.Add(dcValuationYear);
dtPersonValuation.Columns.Add(dcValuationGrade);
//**********************************************
dtGroup = new DataTable("tblGroup");

DataColumn dcGMelliCode = new DataColumn();
dcGMelliCode.DataType = typeof(String);
dcGMelliCode.ColumnName = "MelliCode";

DataColumn dcGName = new DataColumn();
dcGName.DataType = typeof(String);
dcGName.ColumnName = "Name";

DataColumn dGFamily = new DataColumn();
dGFamily.DataType = typeof(String);
dGFamily.ColumnName = "Family";

DataColumn dcGDate = new DataColumn();
dcGDate.DataType = typeof(String);
dcGDate.ColumnName = "GroupDate";

DataColumn dGGrade = new DataColumn();
dGGrade.DataType = typeof(String);
dGGrade.ColumnName = "GroupGrade";

dtGroup.Columns.Add(dcGMelliCode);
dtGroup.Columns.Add(dcGName);
dtGroup.Columns.Add(dGFamily);
dtGroup.Columns.Add(dcGDate);
dtGroup.Columns.Add(dGGrade);
//*********************************************

}
protected void imgbHome_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("Home.aspx");
}
protected void imgbExit_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("ValuationReport.aspx");
}
protected void btnSearch_Click(object sender, EventArgs e)
{
imgbExport.Visible = true;
lblDL.Visible = true;
foreach (GridViewRow row2 in GridView2.Rows)
{
string CountID = "";

Dictionary<string, object> paramID = new Dictionary<string, object>();
paramID.Add("@Year", txtYear.Text);
paramID.Add("@Count", txtCount.Text);
paramID.Add("@Grade", txtGrade.Text);
paramID.Add("@PersonID", row2.Cells[0].Text);
//**********
CountID = DB.ExecuteScalar("SELECT count(*) FROM Valuation,Person WHERE ((Valuation.Year <= @Year) AND (Valuation.Year > ((@Year )-(@Count+0)))) AND (Valuation.PersonID=Person.PersonID) AND (Valuation.PersonID=@PersonID) AND (Valuation.Grade>=@Grade) ", paramID).ToString();

if (CountID == txtCount.Text)
{

//*********************Show Valuations on GridView1
drValuation = DB.ExecuteReader("SELECT Valuation.PersonID, Valuation.Year, Valuation.Grade, Person.Name, Person.Family, Person.MelliCode FROM Valuation,Person WHERE ((Valuation.Year <= @Year) AND (Valuation.Year > ((@Year )-(@Count+0)))) AND (Valuation.PersonID=Person.PersonID) AND (Valuation.PersonID=@PersonID) AND (Valuation.Grade>=@Grade) ORDER BY Valuation.Year ", paramID);

while (drValuation.Read()) dtPersonValuation.Rows.Add(drValuation["MelliCode"].ToString(), drValuation["Name"].ToString(), drValuation["Family"].ToString(), drValuation["Year"].ToString(), drValuation["Grade"].ToString());

GridView1.DataSource = dtPersonValuation.DefaultView;
GridView1.DataBind();
//********************Show * Groups on GridView3
drGroup = DB.ExecuteReader("select ClassDate,ClassGrade,Person.Name, Person.Family, Person.MelliCode from Groupe,Person where (Groupe.PersonID=@PersonID) AND (Groupe.PersonID=Person.PersonID) and (Groupe.ClassGrade='*' or Groupe.ClassGrade='**' or Groupe.ClassGrade='***')", paramID);


while (drGroup.Read()) dtGroup.Rows.Add(drGroup["MelliCode"].ToString(), drGroup["Name"].ToString(), drGroup["Family"].ToString(), drGroup["ClassDate"].ToString(), drGroup["ClassGrade"].ToString());

GridView3.DataSource = dtGroup.DefaultView;
GridView3.DataBind();
}
}
foreach (GridViewRow row3 in GridView3.Rows)
{
string r0 = "";
r0 = row3.Cells[3].Text + "";

int countResult1 = 0;
int countResult2 = 0;
string r1 = "";
r1 =row3.Cells[0].Text + "";

//********************************************
foreach (GridViewRow row1 in GridView1.Rows)
{
if (row1.Cells[0].Text == r1)
{
if (row1.Cells[3].Text != r0)
{
countResult1++;
if (countResult1 == int.Parse(txtCount.Text))
{
//********************Show Result on GridView4
Dictionary<string, object> paramM = new Dictionary<string, object>();
paramM.Add("@MCode", r1);

drResult = DB.ExecuteReader("select Name AS [نام],Family AS [نام خانوادگی],MelliCode AS[کدملی],CaseNumber AS [شماره پرونده],PersonelNumber AS [شماره کارمندی] from Person where MelliCode=@MCode", paramM);

GridView4.DataSource = drResult;
GridView4.DataBind();
}
}
}
else
{
countResult2++;
if (countResult2 == int.Parse(txtCount.Text))
{
//********************Show Result on GridView4
Dictionary<string, object> paramM = new Dictionary<string, object>();
paramM.Add("@MCode", row1.Cells[0].Text);

drResult = DB.ExecuteReader("select Name AS [نام],Family AS [نام خانوادگی],MelliCode AS[کدملی],CaseNumber AS [شماره پرونده],PersonelNumber AS [شماره کارمندی] from Person where MelliCode=@MCode", paramM);

GridView4.DataSource = drResult;
GridView4.DataBind();
}

}
}

}
}
public override void VerifyRenderingInServerForm(Control control)
{
//required to avoid the runtime error "
//Control 'GridView1' of type 'GridView' must be placed inside a form tag with runat=server."
}
private void ExportGridToExcel()
{
Response.Clear();
Response.Buffer = true;
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
string FileName = "List" + DateTime.Now + ".xls";
StringWriter strwritter = new StringWriter();
HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName);
GridView4.GridLines = GridLines.Both;
GridView4.HeaderStyle.Font.Bold = true;
GridView4.RenderControl(htmltextwrtter);
Response.Write(strwritter.ToString());
Response.End();

}
protected void imgbExport_Click(object sender, ImageClickEventArgs e)
{
ExportGridToExcel();
}


protected void btnNew_Click(object sender, System.EventArgs e)
{
Response.Redirect("AbetGroupReport.aspx");
}
}
Loading

0 comments on commit e8569dc

Please sign in to comment.