223 lines
8.7 KiB
C#
223 lines
8.7 KiB
C#
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using GThinking.N_MODEL.Page;
|
|
using GThinking.N_MISPRO.Utility;
|
|
using GThinking.N_MISPRO;
|
|
using GThinking.N_MISPRO.Data;
|
|
using System.Collections.Generic;
|
|
using GThinking.N_MODEL.Dialog;
|
|
using GThinking.N_CONTROL;
|
|
using System.Data.Common;
|
|
using GThinking.N_PUBLIC;
|
|
using GThinking.N_MISPRO.MISPROAS;
|
|
using System.IO;
|
|
|
|
namespace GThinking.N_XLJC
|
|
{
|
|
public partial class XLJCYWDHInfo : SingleCardBase
|
|
{
|
|
XLJCYWDH entity = new XLJCYWDH();
|
|
|
|
public string Path = "";
|
|
|
|
#region Page事件
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
this.UMID = 101421005;
|
|
this.UMName = "线缆基础业务导航";
|
|
this.CurMaster = Master;
|
|
this.CurEntity = entity;
|
|
this.PageHeight = 400;
|
|
this.PageWidth = 500;
|
|
this.Master.EnableDeleteBtn = false;
|
|
this.Master.EnableInsertBtn = false;
|
|
this.Master.EnableCopyBtn = false;
|
|
this.Master.EnableEditBtn = false;
|
|
this.Master.EnablePrintBtn = false;
|
|
this.Master.EnableSaveBtn = false;
|
|
this.Master.EnableRefreshBtn = false;
|
|
this.Master.EnableAttachBtn = false;
|
|
this.Master.EnableCancelBtn = false;
|
|
UseCorrelationModule = false;
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
txtDHBH_NOW.Text = "";
|
|
InitYWDHYM("");
|
|
}
|
|
|
|
base.InitPage();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 模板事件继承
|
|
|
|
#endregion
|
|
|
|
#region 自定义函数
|
|
|
|
//获取默认的导航页面
|
|
private void InitYWDHYM(string sXLDHBH)
|
|
{
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL SQL = new TSQL(dberp);
|
|
SQL.Clear();
|
|
SQL.Add("select XLJCYWDH_XLDHBH,XLJCYWDH_XLDHMC,XLJCYWDH_QSXS,XLJCYWDH_XLDHNR ");
|
|
SQL.Add(" from XLJCYWDH where XLJCYWDH_PTLX='N' ");
|
|
if (sXLDHBH.Trim().Equals(""))
|
|
{
|
|
SQL.Add(" and isnull(XLJCYWDH_QSXS,'N')='Y' ");
|
|
}
|
|
else
|
|
{
|
|
SQL.Add(" and XLJCYWDH_XLDHBH=:pXLDHBH ");
|
|
SQL.ParamByName("pXLDHBH").Value = CMISproConvert.StrToFloat(sXLDHBH.Trim());
|
|
}
|
|
DataSet ds = dberp.OpenDataSet(SQL);
|
|
if (ds.Tables[0].Rows.Count > 0)
|
|
{
|
|
if (ds.Tables[0].Rows[0]["XLJCYWDH_XLDHMC"].ToString().Trim().Contains(".")) //导航文件的名称含有扩展名
|
|
{
|
|
if (!ds.Tables[0].Rows[0]["XLJCYWDH_XLDHNR"].ToString().Trim().Equals(""))
|
|
{
|
|
byte[] FileBytes = MISproUtils.GetBlobByte(ds.Tables[0].Rows[0]["XLJCYWDH_XLDHNR"]);
|
|
string FilePath = Server.MapPath("../../work/temp/" + ds.Tables[0].Rows[0]["XLJCYWDH_XLDHMC"].ToString().Trim());
|
|
FileStream fs;
|
|
fs = File.Create(FilePath);
|
|
fs.Write(FileBytes, 0, FileBytes.Length);
|
|
fs.Close();
|
|
|
|
if (File.Exists(FilePath))
|
|
{
|
|
Path = ds.Tables[0].Rows[0]["XLJCYWDH_XLDHMC"].ToString().Trim();
|
|
txtDHBH_NOW.Text = ds.Tables[0].Rows[0]["XLJCYWDH_XLDHBH"].ToString().Trim();
|
|
AjaxRunScript(this, "myscript", "changeDHYM('" + Path + "');");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 控件事件
|
|
|
|
protected void btnReLoad_OnClick(object sender, EventArgs e)
|
|
{
|
|
if (!txtDHBH.Value.ToString().Trim().Equals(""))
|
|
{
|
|
InitYWDHYM(txtDHBH.Value.ToString().Trim()); //加载设置的文件
|
|
}
|
|
}
|
|
|
|
protected void btnSZDH_Click(object sender, EventArgs e)
|
|
{
|
|
TPageParams param = new TPageParams();
|
|
param.UrlPath = "XLJCYWDH_SZDHYM.aspx";
|
|
OpenDialogClickBtn(param, "ctl00_CPHUserToolbar_btnReLoad");//调用窗口后,点击此按钮
|
|
}
|
|
|
|
protected void btnSZDH_MenuItemClick(object sender, string Value)
|
|
{
|
|
InitYWDHYM(Value); //点击下拉导航文件
|
|
}
|
|
|
|
protected void btnSZDH_DropDown(object sender, EventArgs e)
|
|
{
|
|
btnSZDH.Nodes.Clear();
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL sSql = new TSQL(dberp);
|
|
sSql.Add("select XLJCYWDH_XLDHBH,XLJCYWDH_XLDHMC from XLJCYWDH where XLJCYWDH_PTLX='N' order by XLJCYWDH_XLDHBH ");
|
|
DataSet ds = dberp.OpenDataSet(sSql);
|
|
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
|
|
{
|
|
btnSZDH.Nodes.Add(new gtTreeNode(ds.Tables[0].Rows[i]["XLJCYWDH_XLDHBH"].ToString().Trim(), ds.Tables[0].Rows[i]["XLJCYWDH_XLDHMC"].ToString().Trim()));
|
|
}
|
|
MenuAreaUpdate();
|
|
}
|
|
|
|
//下载文档
|
|
protected void btnDownload_Click(object sender, EventArgs e)
|
|
{
|
|
Response.Clear();
|
|
//Response.Buffer = true;
|
|
Response.Charset = "GB2312";
|
|
Response.ContentType = "application";
|
|
Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + HttpUtility.UrlEncode(txtFileName.Value.Trim()) + "\"");
|
|
//Response.AppendHeader( "Content-Disposition", "attachment;filename=" + new String( fileName.getBytes("gb2312"), "ISO8859-1" ) );
|
|
//Response.AppendHeader("Content-Disposition", "attachment;filename=\"" + HttpUtility.UrlEncode(txtFileName.Value.Trim(), Encoding.UTF8) + "\"");
|
|
Response.AddHeader("Content-Transfer-Encoding", "binary");
|
|
Response.ContentType = "binary";
|
|
Response.TransmitFile(Server.MapPath("../../components/" + MACID.Substring(0, MACID.Length - 1) + "/" + txtFileName.Value.Trim()));
|
|
//Response.Flush();
|
|
Response.End();
|
|
}
|
|
|
|
protected void btnYMPZ_dropDownClick(object sender, EventArgs e)
|
|
{
|
|
btnYMPZ.Nodes.Clear();
|
|
btnYMPZ.Nodes.Add(new gtTreeNode("QS", "设为缺省"));
|
|
btnYMPZ.Nodes.Add(new gtTreeNode("SC", "删除页面"));
|
|
MenuAreaUpdate();
|
|
}
|
|
|
|
protected void btnYMPZ_MenuItemClick(object sender, string Value)
|
|
{
|
|
if (!txtDHBH_NOW.Text.Trim().Equals(""))
|
|
{
|
|
if (Value == "QS")
|
|
{
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL sSQL = new TSQL(dberp);
|
|
sSQL.Clear();
|
|
sSQL.Add("update XLJCYWDH set XLJCYWDH_QSXS='Y' where XLJCYWDH_XLDHBH=:pXLDHBH ");
|
|
sSQL.ParamByName("pXLDHBH").Value = CMISproConvert.StrToFloat(txtDHBH_NOW.Text.Trim());
|
|
dberp.ExecSQL(sSQL);
|
|
sSQL.Clear();
|
|
sSQL.Add("update XLJCYWDH set XLJCYWDH_QSXS='N' where XLJCYWDH_XLDHBH<>:pXLDHBH and XLJCYWDH_PTLX='N' ");
|
|
sSQL.ParamByName("pXLDHBH").Value = CMISproConvert.StrToFloat(txtDHBH_NOW.Text.Trim());
|
|
dberp.ExecSQL(sSQL);
|
|
ShowMessage("已设置为缺省显示,下次进入模块将自动显示该导航!");
|
|
}
|
|
if (Value == "SC")
|
|
{
|
|
//Confirm.Register("SCYM", "是否确定删除当前导航页面?");
|
|
//if (Confirm.GetValue("SCYM").Trim().Equals(""))
|
|
//{
|
|
// Confirm.Ask("SCYM");
|
|
// return;
|
|
//}
|
|
//else if (Confirm.GetValue("SCYM").Trim().Equals("N"))
|
|
//{
|
|
// Confirm.Clear();
|
|
// return;
|
|
//}
|
|
//else if (Confirm.GetValue("SCYM").Trim().Equals("Y"))
|
|
//{
|
|
// Confirm.Clear();
|
|
//}
|
|
|
|
TDatabase dberp = TContextDatabases.GetDatabase("DBERP");
|
|
TSQL sSQL = new TSQL(dberp);
|
|
sSQL.Clear();
|
|
sSQL.Add("delete from XLJCYWDH where XLJCYWDH_XLDHBH=:pXLDHBH ");
|
|
sSQL.ParamByName("pXLDHBH").Value = CMISproConvert.StrToFloat(txtDHBH_NOW.Text.Trim());
|
|
dberp.ExecSQL(sSQL);
|
|
ShowMessage("删除完成,下次进入模块生效!");
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|