?? pz_sh.aspx.cs
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using com.unicafe.ui;
using com.unicafe.common;
using com.unicafe.security;
using com.ascs.plp.common;
using com.ascs.plp.publics;
namespace PLP.CWZZ.PZGL
{
/// <summary>
/// PZ_SH 的摘要說明。
/// </summary>
public class PZ_SH : com.unicafe.ui.UnicafePage
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.LinkButton LinkButton5;
protected System.Web.UI.WebControls.LinkButton LinkButton4;
protected System.Web.UI.WebControls.DataGrid DataGrid1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
SqlConnection cn = new SqlConnection (com.unicafe.common.Configuration.GetDBConnectionString());
Com.Ascs.Plp.CW.CW_PZ CW_PZ = new Com.Ascs.Plp.CW.CW_PZ();
Com.Ascs.Plp.CW.CW_PZMgr CW_PZMgr = new Com.Ascs.Plp.CW.CW_PZMgr();
Com.Ascs.Plp.CW.CW_KMYE CW_KMYE = new Com.Ascs.Plp.CW.CW_KMYE();
Com.Ascs.Plp.CW.CW_KMYE CW_KMYEADD = new Com.Ascs.Plp.CW.CW_KMYE();
protected System.Web.UI.WebControls.DropDownList DDL_KJQJBH;
protected System.Web.UI.WebControls.DropDownList DDL_KJND;
protected System.Web.UI.WebControls.LinkButton LinkButton1;
protected System.Web.UI.WebControls.Panel PanelSH;
protected System.Web.UI.WebControls.LinkButton LinkButton2;
protected System.Web.UI.WebControls.Label Label6;
protected System.Web.UI.WebControls.Label Label7;
protected System.Web.UI.WebControls.Panel Panel1;
protected System.Web.UI.WebControls.Panel Panel2;
protected System.Web.UI.WebControls.Panel Panel3;
protected System.Web.UI.WebControls.Panel Panel4;
Com.Ascs.Plp.CW.CW_KMYEMgr CW_KMYEMgr = new Com.Ascs.Plp.CW.CW_KMYEMgr();
private void Page_Load(object sender, System.EventArgs e)
{
try
{
this.VerifyPage(); //登錄檢查
this.VerifyPage("zz_pzsh_mgr");
// 在此處放置用戶代碼以初始化頁面
if(!this.IsPostBack) //判斷第一次顯示
{
this.Panel1.Visible=true;
this.Panel4.Visible=true;
this.Panel2.Visible=false;
this.Panel3.Visible=false;
ViewState["JGDM"]=this.CurrentJGXX.JGDM.ToString();
ViewState["EmployID"]=this.CurrentEmployee.EmplID;
this.Label1.Text=this.CurrentEmployee.EmplName;
ViewState["SH"]="0";
string[] DQKJ=this.GetDQKJQJ(this.CurrentJGXX.JGDM.ToString());
ViewState["KJND"]=DQKJ[1];
ViewState["KJQJBH"]=DQKJ[0];
ViewState["PZBH"]="0";
this.DDL_KJQJBHBind();
//ViewState["credit"] = credit; //首次加載時,將判斷標志賦值給一個視圖狀態(tài)值保存在客戶端z
ViewState["sql"]= string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
string sql = ViewState["sql"].ToString();
//處理DataGrid控件(綁定DataGrid控件 -> 檢查是否需要定位 -> 給導(dǎo)航文本賦值)
if(CommonService.HandleDataGrid(this, sql, DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在處理數(shù)據(jù)時發(fā)生錯誤。");
}
else
{
//檢查回發(fā)的請求操作是否是要進入上頁或下頁
if(CommonService.PageNavigate(this, DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在處理數(shù)據(jù)時發(fā)生錯誤。");
}
}
catch(Exception e1)
{
LogService.Write ("憑證顯示時產(chǎn)生異常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"憑證顯示時產(chǎn)生異常。");
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN:該調(diào)用是 ASP.NET Web 窗體設(shè)計器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.DDL_KJND.SelectedIndexChanged += new System.EventHandler(this.DDL_KJND_SelectedIndexChanged);
this.DDL_KJQJBH.SelectedIndexChanged += new System.EventHandler(this.DDL_KJQJBH_SelectedIndexChanged);
this.LinkButton2.Click += new System.EventHandler(this.LinkButton2_Click);
this.LinkButton1.Click += new System.EventHandler(this.Linkbutton3_Click);
this.LinkButton5.Click += new System.EventHandler(this.LinkButton5_Click);
this.LinkButton4.Click += new System.EventHandler(this.LinkButton4_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void Linkbutton3_Click(object sender, System.EventArgs e)
{
try
{
this.SH_Dispose(this.LinkButton1.Text.Trim());
}
catch(Exception e1)
{
string strErr=string.Format("{0}時產(chǎn)生異常。",this.LinkButton1.Text);
LogService.Write (strErr);
LogService.Write (e1.Message);
Prompt.PromptError(this,strErr);
}
}
private void DDL_KJNDBind(string KJND)
{
string strsql2=string.Format("SELECT KJND FROM CW_KJQJ where JGDM='{0}' GROUP BY KJND",ViewState["JGDM"].ToString());
DataTable dtKJND=this.CW_PZMgr.CreateDataTableFromSql(strsql2);
this.DDL_KJND.DataSource=dtKJND;
this.DDL_KJND.DataTextField="KJND";
this.DDL_KJND.DataValueField="KJND";
this.DDL_KJND.DataBind();
this.DDL_KJND.SelectedIndex=-1;
if(KJND.Trim()!=string.Empty)
this.DDL_KJND.Items.FindByValue(KJND.Trim()).Selected=true;
}
private void DDL_KJND_SelectedIndexChanged(object sender, System.EventArgs e)
{
try
{
ViewState["KJND"]=this.DDL_KJND.SelectedItem.ToString();
this.DDL_KJQJBH.SelectedIndex=0;
ViewState["KJQJBH"]=this.DDL_KJQJBH.SelectedItem.Value.ToString();
this.DDL_KJQJBHBind();
if(ViewState["SH"].ToString()=="0")
{
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
}
else
{
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='1' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
}
//處理DataGrid控件(綁定DataGrid控件 -> 檢查是否需要定位 -> 給導(dǎo)航文本賦值)
if(CommonService.HandleDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在處理數(shù)據(jù)時發(fā)生錯誤。");
}
catch(Exception e1)
{
LogService.Write ("會計年度選擇時產(chǎn)生異常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"會計年度選擇時產(chǎn)生異常。");
}
}
private void DDL_KJQJBHBind()
{
string strsql=string.Empty;
if(ViewState["KJND"]!=null)
{
strsql=string.Format(" Select * from CW_KJQJ where KJND='{0}' and JGDM='{1}' order by KSRQ",ViewState["KJND"].ToString(),ViewState["JGDM"].ToString());
this.DDL_KJNDBind(ViewState["KJND"].ToString());
}
DataTable dt=this.CW_KMYEMgr.CreateDataTableFromSql(strsql);
if(dt.Rows.Count>0)
{
this.DDL_KJQJBH.DataSource=dt;
this.DDL_KJQJBH.DataTextField="KJQJBH";
this.DDL_KJQJBH.DataValueField="KJQJBH";
this.DDL_KJQJBH.DataBind();
this.DDL_KJQJBH.SelectedIndex=-1;
if(ViewState["KJQJBH"]!=null&&ViewState["KJQJBH"].ToString().Trim()!=string.Empty)
this.DDL_KJQJBH.Items.FindByValue(ViewState["KJQJBH"].ToString().Trim()).Selected=true;
}
}
private void LinkButton4_Click(object sender, System.EventArgs e)
{
try
{
this.Panel1.Visible=false;
this.Panel4.Visible=false;
this.Panel2.Visible=true;
this.Panel3.Visible=true;
this.LinkButton1.Text="取消審核過帳";
ViewState["SH"]="1";
this.PanelSH.Visible=false;
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='1' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
//處理DataGrid控件(綁定DataGrid控件 -> 檢查是否需要定位 -> 給導(dǎo)航文本賦值)
if(CommonService.ReBindDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在處理數(shù)據(jù)時發(fā)生錯誤。");
}
catch(Exception e1)
{
LogService.Write ("顯示已審核過帳憑證時產(chǎn)生異常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"顯示已審核過帳憑證時產(chǎn)生異常。");
}
}
private void LinkButton5_Click(object sender, System.EventArgs e)
{
try
{
this.Panel1.Visible=true;
this.Panel4.Visible=true;
this.Panel2.Visible=false;
this.Panel3.Visible=false;
this.LinkButton1.Text="審核過帳";
ViewState["SH"]="0";
this.PanelSH.Visible=true;
ViewState["sql"]=string.Format("select * from CW_PZ where JGDM='{0}' and KJND ='{1}' and KJQJ='{2}' and GZBJ='0' and BZ='3' order by PZBH DESC",ViewState["JGDM"].ToString(),ViewState["KJND"].ToString(),ViewState["KJQJBH"].ToString()) ;
//處理DataGrid控件(綁定DataGrid控件 -> 檢查是否需要定位 -> 給導(dǎo)航文本賦值)
if(CommonService.ReBindDataGrid(this, ViewState["sql"].ToString(), DataGrid1, "DataSH", Label2, Label3, Label4) == false)
this.Response.Redirect("../../publics/Error.aspx?errmsg=在處理數(shù)據(jù)時發(fā)生錯誤。");
}
catch(Exception e1)
{
LogService.Write ("顯示未審核過帳憑證時產(chǎn)生異常。");
LogService.Write (e1.Message);
Prompt.PromptError(this,"顯示未審核過帳憑證時產(chǎn)生異常。");
}
}
private ArrayList GetPk(string CheckBoxName,string[] DataTypes,string[] Pk,DataGrid dg)
{
ArrayList ArPks=new ArrayList();
int n=0;
if(dg.Items.Count>0)
{
for (int i=0; i<dg.Items.Count; i++)
{
//將當前行賦值給一個DataGridItem對象
DataGridItem _item = dg.Items[i];
//判斷當前行上的CheckBox控件賦值給一個CheckBox對象
CheckBox CheckFlag = (CheckBox)_item.FindControl(CheckBoxName);
//判斷當前行上的復(fù)選框是否被選中,如果被選中則進行刪除處理,否則不予處理
if(CheckFlag.Checked == true)
{
//獲取關(guān)鍵字的值,逐個加入對象數(shù)組obj
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -