You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Shipping/CompanysInfo.aspx.cs

628 lines
32 KiB
C#

3 years ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
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.Text;
using DSWeb.DataAccess;
using System.Data.SqlClient;
using DSWeb.Models;
using DSWeb.EntityDA;
using System.Web.Script.Serialization;
using System.IO;
using System.Drawing;
namespace DSWeb.Shipping
{
public partial class CompanysInfo : System.Web.UI.Page
{
public string strHandleType = String.Empty;
public string sSQL = String.Empty;
public string gvid = String.Empty;
T_ALL_DA T_ALL_DA = new T_ALL_DA();
MoneyConvert MoneyConvert = new MoneyConvert();
CompanyEntity CompanyEntity = new CompanyEntity();
CompanyDA CompanyDA = new CompanyDA();
public string strUserID;//用户GID
protected void Page_Load(object sender, EventArgs e)
{
if (Session["USERID"] != null)
{
strUserID = Session["USERID"].ToString().Trim();
this.hdUserID.Value = strUserID.Trim();
}
//
if (!IsPostBack)
{
if (Request.QueryString["handle"] != null) //if (Request.QueryString["handle"] != null)
{
ViewState["strHandleType"] = Request.QueryString["handle"].ToString();//"edit";
strHandleType = ViewState["strHandleType"].ToString().Trim();
if (Request.QueryString["id"] != null)//if (Request.QueryString["id"] != null)
{
ViewState["GID"] = Request.QueryString["id"].ToString();//"topseaeusername129481962859531250";
this.hdGid.Value = ViewState["GID"].ToString().Trim();
}
switch (strHandleType)
{
case "add"://新增
//ViewState["GID"] = getBSNO();
//this.hdGid.Value = ViewState["GID"].ToString().Trim();
//
tbCODENAME.Text = "";
tbNAME.Text = "";
tbFULLNAME.Text = "";
tbENNAME.Text = "";
tbADDRESS.Text = "";
tbENADDRESS.Text = "";
tbOFFICEPHONE.Text = "";
tbFAX.Text = "";
tbWEBSITEURL.Text = "";
tbEMAIL.Text = "";
tbLICENSECODE.Text = "";
tbTAXCODE.Text = "";
tbBillRises.Text = "";
tbChequePayable.Text = "";
tbPRTHEADXML1.Text = "";
tbPRTHEADXML2.Text = "";
tbPRTHEADXML3.Text = "";
tbPRTHEADXML4.Text = "";
tbPRTHEADXML5.Text = "";
tbBANKSHEAD.Text = "";
//
getImage2(myimg.Src.Trim());
break;
case "edit"://录入
CompanyEntity = CompanyDA.GetCompanyByID(ViewState["GID"].ToString().Trim());
if (CompanyEntity.GID != null)
{
tbCODENAME.Text = CompanyEntity.CODENAME.ToString().Trim();
tbNAME.Text = CompanyEntity.NAME.ToString().Trim();
tbFULLNAME.Text = CompanyEntity.FULLNAME.ToString().Trim();
tbENNAME.Text = CompanyEntity.ENNAME.ToString().Trim();
tbADDRESS.Text = CompanyEntity.ADDRESS.ToString().Trim();
tbENADDRESS.Text = CompanyEntity.ENADDRESS.ToString().Trim();
tbOFFICEPHONE.Text = CompanyEntity.OFFICEPHONE.ToString().Trim();
tbFAX.Text = CompanyEntity.FAX.ToString().Trim();
tbWEBSITEURL.Text = CompanyEntity.WEBSITEURL.ToString().Trim();
tbEMAIL.Text = CompanyEntity.EMAIL.ToString().Trim();
tbLICENSECODE.Text = CompanyEntity.LICENSECODE.ToString().Trim();
tbTAXCODE.Text = CompanyEntity.TAXCODE.ToString().Trim();
tbBillRises.Text = CompanyEntity.BillRises.ToString().Trim();
tbChequePayable.Text = CompanyEntity.ChequePayable.ToString().Trim();
tbPRTHEADXML1.Text = CompanyEntity.PRTHEADXML1.ToString().Trim();
tbPRTHEADXML2.Text = CompanyEntity.PRTHEADXML2.ToString().Trim();
tbPRTHEADXML3.Text = CompanyEntity.PRTHEADXML3.ToString().Trim();
tbPRTHEADXML4.Text = CompanyEntity.PRTHEADXML4.ToString().Trim();
tbPRTHEADXML5.Text = CompanyEntity.PRTHEADXML5.ToString().Trim();
tbBANKSHEAD.Text = CompanyEntity.BANKSHEAD.ToString().Trim();
if (CompanyEntity.LOGO != null)
{
getLOGO(CompanyEntity.LOGO);
//getImage("select LOGO from [company] where GID='" + CompanyEntity.GID + "'");
}
}
break;
}
}
else
{
}
}
}
protected void getLOGO(byte[] photo)
{
//byte[] photo = (byte[])myds.Tables[0].Rows[0]["LOGO"];
//图片路径
string strPath = "../images/logo/" + ViewState["GID"].ToString().Trim() + ".gif";
string strPhotoPath = Server.MapPath(strPath);
//保存图片文件
BinaryWriter bw = new BinaryWriter(File.Open(strPhotoPath, FileMode.OpenOrCreate));
bw.Write(photo);
bw.Close();
//显示图片
this.myimg.Src = strPath;
ViewState["myFile"] = photo;
}
protected void getImage(string strSQL)
{
//设置Image控件显示从数据库中读出的二进制图片
SqlConnection myConn = new SqlConnection(ConfigurationManager.ConnectionStrings["DongShengDB"].ConnectionString);
SqlDataAdapter myda = new SqlDataAdapter(strSQL, myConn);
DataSet myds = new DataSet();
myConn.Open();
myda.Fill(myds);
myConn.Close();
//
byte[] photo = (byte[])myds.Tables[0].Rows[0]["LOGO"];
//图片路径
string strPath = "../images/logo/" + ViewState["GID"].ToString().Trim() + ".gif";
string strPhotoPath = Server.MapPath(strPath);
//保存图片文件
BinaryWriter bw = new BinaryWriter(File.Open(strPhotoPath,FileMode.OpenOrCreate));
bw.Write(photo);
bw.Close();
//显示图片
this.myimg.Src = strPath;
}
protected void getImage2(string strPath)
{
//图片路径
string strPhotoPath = Server.MapPath(strPath);
FileStream fs = new FileStream(strPhotoPath, FileMode.Open);
int filelength = 0;
filelength = (int)fs.Length; //获得文件长度
Byte[] photo = new Byte[filelength]; //建立一个字节数组
fs.Read(photo, 0, filelength); //按字节流读取
fs.Close();
ViewState["myFile"] = photo;
}
protected String getBSNO()
{
string strBSNO = Guid.NewGuid().ToString();
strBSNO = strBSNO.Replace("-", "");
strBSNO = "Com" + strBSNO;
return strBSNO;
}
protected bool getAdd()
{
CompanyEntity.GID = getBSNO();
CompanyEntity.CODENAME = tbCODENAME.Text.Trim();
CompanyEntity.NAME = tbNAME.Text.Trim();
CompanyEntity.FULLNAME = tbFULLNAME.Text.Trim();
CompanyEntity.ENNAME = tbENNAME.Text.Trim();
CompanyEntity.ADDRESS = tbADDRESS.Text.Trim();
CompanyEntity.ENADDRESS = tbENADDRESS.Text.Trim();
CompanyEntity.OFFICEPHONE = tbOFFICEPHONE.Text.Trim();
CompanyEntity.FAX = tbFAX.Text.Trim();
CompanyEntity.WEBSITEURL = tbWEBSITEURL.Text.Trim();
CompanyEntity.EMAIL = tbEMAIL.Text.Trim();
CompanyEntity.LICENSECODE = tbLICENSECODE.Text.Trim();
CompanyEntity.TAXCODE = tbTAXCODE.Text.Trim();
CompanyEntity.BillRises = tbBillRises.Text.Trim();
CompanyEntity.ChequePayable = tbChequePayable.Text.Trim();
CompanyEntity.PRTHEADXML1 = tbPRTHEADXML1.Text.Trim();
CompanyEntity.PRTHEADXML2 = tbPRTHEADXML2.Text.Trim();
CompanyEntity.PRTHEADXML3 = tbPRTHEADXML3.Text.Trim();
CompanyEntity.PRTHEADXML4 = tbPRTHEADXML4.Text.Trim();
CompanyEntity.PRTHEADXML5 = tbPRTHEADXML5.Text.Trim();
CompanyEntity.CREATEUSER = strUserID.Trim();
CompanyEntity.MODIFIEDUSER = strUserID.Trim();
CompanyEntity.BANKSHEAD = tbBANKSHEAD.Text.Trim();
//
CompanyEntity.POSTCODE = "";
CompanyEntity.ISDELETED= false;
CompanyEntity.ISDISABLE = false;
CompanyEntity.PARENTID = "";
//
Int32 FileLength = 0;//有可能图片的大小会超出INT的范围所以声明为Int32,当然这和下面大小的判断有关系
try
{
string FileName = this.myFile.FileName;
string fileTitle = this.myFile.PostedFile.FileName.ToString();
HttpPostedFile UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
//UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
FileLength = UpFile.ContentLength;//获取上传文件的字节大小
if (FileLength == 0)
{
CompanyEntity.LOGO = (Byte[])ViewState["myFile"];
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3,this.GetType(),"unReport32","alert('对不起请选择要上传的LOGO');", true);
//return false;
}
else
{
string exName = FileName.Substring(FileName.LastIndexOf(".") + 1).ToUpper();//截取图片的后缀名
if (exName == "JPG" || exName == "BMP" || exName == "GIF")//判断图片的类型
{
Byte[] FileByte = new Byte[FileLength]; //图象文件储存到数组
Stream ObjectStream = UpFile.InputStream;//建立数据流对像,获取一个 Stream 对象,该对象指向一个上载文件,以准备读取该文件的内容。
ObjectStream.Read(FileByte, 0, FileLength); //读取图象文件数据
CompanyEntity.LOGO = FileByte;
/*
int nWidth = 75;
int nHeight = 75;
string ImageName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + exName;//图片名称设置为保存的时间
System.Drawing.Image image;
image = System.Drawing.Bitmap.FromStream(ObjectStream);
nWidth = image.Width;
nHeight = image.Height;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DongShengDB"].ConnectionString);
string StrSql = "update [company] set LOGO=@LOGO where GID='" + ViewState["GID"].ToString().Trim() + "'";
SqlCommand Cmd = new SqlCommand(StrSql, conn);
Cmd.Parameters.Add("@LOGO", SqlDbType.Binary);
Cmd.Parameters["@LOGO"].Value = FileByte;
conn.Open();
Cmd.ExecuteNonQuery();
conn.Close();
//Response.Write("<script>alert('图片保存到数据库成功');window.opener.location.reload();window.close();history.back();</script>");
*/
}
else
{
//Response.Write("<script>alert('对不起,请选择正确的的图片')</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport33", "alert('出错,请选择正确的的图片!');", true);
return false;
}
}
}
catch (Exception)
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport34", "alert('出错,请选择正确的的图片!');", true);
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return false;
}
//
int iResult = CompanyDA.InserInfo(CompanyEntity);
if (iResult > 0)
{
ViewState["GID"] = CompanyEntity.GID.Trim();
this.hdGid.Value = CompanyEntity.GID.Trim();
ViewState["strHandleType"] = "edit";
return true;
}
else
{
return false;
}
}
protected bool getEdit()
{
CompanyEntity.GID = ViewState["GID"].ToString().Trim();
CompanyEntity.CODENAME = tbCODENAME.Text.Trim();
CompanyEntity.NAME = tbNAME.Text.Trim();
CompanyEntity.FULLNAME = tbFULLNAME.Text.Trim();
CompanyEntity.ENNAME = tbENNAME.Text.Trim();
CompanyEntity.ADDRESS = tbADDRESS.Text.Trim();
CompanyEntity.ENADDRESS = tbENADDRESS.Text.Trim();
CompanyEntity.OFFICEPHONE = tbOFFICEPHONE.Text.Trim();
CompanyEntity.FAX = tbFAX.Text.Trim();
CompanyEntity.WEBSITEURL = tbWEBSITEURL.Text.Trim();
CompanyEntity.EMAIL = tbEMAIL.Text.Trim();
CompanyEntity.LICENSECODE = tbLICENSECODE.Text.Trim();
CompanyEntity.TAXCODE = tbTAXCODE.Text.Trim();
CompanyEntity.BillRises = tbBillRises.Text.Trim();
CompanyEntity.ChequePayable = tbChequePayable.Text.Trim();
CompanyEntity.PRTHEADXML1 = tbPRTHEADXML1.Text.Trim();
CompanyEntity.PRTHEADXML2 = tbPRTHEADXML2.Text.Trim();
CompanyEntity.PRTHEADXML3 = tbPRTHEADXML3.Text.Trim();
CompanyEntity.PRTHEADXML4 = tbPRTHEADXML4.Text.Trim();
CompanyEntity.PRTHEADXML5 = tbPRTHEADXML5.Text.Trim();
CompanyEntity.CREATEUSER = strUserID.Trim();
CompanyEntity.MODIFIEDUSER = strUserID.Trim();
CompanyEntity.BANKSHEAD = tbBANKSHEAD.Text.Trim();
//
CompanyEntity.POSTCODE = "";
CompanyEntity.ISDELETED = false;
CompanyEntity.ISDISABLE = false;
CompanyEntity.PARENTID = "";
//
Int32 FileLength = 0;//有可能图片的大小会超出INT的范围所以声明为Int32,当然这和下面大小的判断有关系
try
{
string FileName = this.myFile.FileName;
string fileTitle = this.myFile.PostedFile.FileName.ToString();
HttpPostedFile UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
//UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
FileLength = UpFile.ContentLength;//获取上传文件的字节大小
if (FileLength == 0)
{
CompanyEntity.LOGO = (Byte[])ViewState["myFile"];
}
else
{
string exName = FileName.Substring(FileName.LastIndexOf(".") + 1).ToUpper();//截取图片的后缀名
if (exName == "JPG" || exName == "BMP" || exName == "GIF")//判断图片的类型
{
Byte[] FileByte = new Byte[FileLength]; //图象文件储存到数组
Stream ObjectStream = UpFile.InputStream;//建立数据流对像,获取一个 Stream 对象,该对象指向一个上载文件,以准备读取该文件的内容。
ObjectStream.Read(FileByte, 0, FileLength); //读取图象文件数据
CompanyEntity.LOGO = FileByte;
/*
int nWidth = 75;
int nHeight = 75;
string ImageName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + exName;//图片名称设置为保存的时间
System.Drawing.Image image;
image = System.Drawing.Bitmap.FromStream(ObjectStream);
nWidth = image.Width;
nHeight = image.Height;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DongShengDB"].ConnectionString);
string StrSql = "update [company] set LOGO=@LOGO where GID='" + ViewState["GID"].ToString().Trim() + "'";
SqlCommand Cmd = new SqlCommand(StrSql, conn);
Cmd.Parameters.Add("@LOGO", SqlDbType.Binary);
Cmd.Parameters["@LOGO"].Value = FileByte;
conn.Open();
Cmd.ExecuteNonQuery();
conn.Close();
//Response.Write("<script>alert('图片保存到数据库成功');window.opener.location.reload();window.close();history.back();</script>");
*/
}
else
{
//Response.Write("<script>alert('对不起,请选择正确的图片')</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport36", "alert('出错,请选择正确的图片!');", true);
return false;
}
}
}
catch (Exception)
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport37", "alert('出错,请选择正确的图片!');", true);
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return false;
}
//
int iResult = CompanyDA.UpdateInfo(CompanyEntity);
if (iResult > 0)
{
//Response.Write("<script>alert('成功提交!');history.back();</script>");
return true;
}
else
{
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return false;
}
}
protected void btnEnter_Click(object sender, EventArgs e)
{
if (tbCODENAME.Text.Trim() == "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3,this.GetType(),"unReport38", "alert('公司代码不允许为空,请重新填写!');", true);
return;
}
//
if (tbNAME.Text.Trim() == "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport39", "alert('公司简称不允许为空,请重新填写!');", true);
return;
}
//
if (tbBANKSHEAD.Text.Trim() == "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport41", "alert('票号头字符不允许为空,请重新填写!');", true);
return;
}
//
bool bl = false;
strHandleType = ViewState["strHandleType"].ToString();
if (strHandleType.Equals("add"))//新增
{
DataSet ds = CompanyDA.GetCompanySQL(" and CODENAME='" + tbCODENAME.Text.Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim() != "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport310", "alert('公司代码重复,请重新填写!');", true);
return;
}
}
//
ds = CompanyDA.GetCompanySQL(" and [NAME]='" + tbNAME.Text.Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows[0]["NAME"].ToString().Trim() != "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport311", "alert('公司简称重复,请重新填写!');", true);
return;
}
}
//
Int32 FileLength = 0;//有可能图片的大小会超出INT的范围所以声明为Int32,当然这和下面大小的判断有关系
HttpPostedFile UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
FileLength = UpFile.ContentLength;//获取上传文件的字节大小
if (FileLength == 0)
{
CompanyEntity.LOGO = (Byte[])ViewState["myFile"];
//Response.Write("<script>alert('对不起,请选择要上传的图片')</script>");
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport312", "alert('对不起请选择要上传的LOGO');", true);
//return;
}
//
bl = getAdd();
}
else if (strHandleType.Equals("edit"))//录入
{
DataSet ds = CompanyDA.GetCompanySQL(" and CODENAME='" + tbCODENAME.Text.Trim() + "' and Gid<>'" + ViewState["GID"].ToString().Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows[0]["CODENAME"].ToString().Trim() != "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport313", "alert('公司代码重复,请重新填写!');", true);
return;
}
}
//
ds = CompanyDA.GetCompanySQL(" and [NAME]='" + tbNAME.Text.Trim() + "' and Gid<>'" + ViewState["GID"].ToString().Trim() + "'");
if (ds != null)
{
if (ds.Tables[0].Rows[0]["NAME"].ToString().Trim() != "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport314", "alert('公司简称重复,请重新填写!');", true);
return;
}
}
//
bl = getEdit();
}
//
ibDel.Enabled = true;
ibAdd.Enabled = true;
//
if (bl)
{
/*
//Int32 FileLength = 0;//有可能图片的大小会超出INT的范围所以声明为Int32,当然这和下面大小的判断有关系
try
{
string FileName = this.myFile.FileName;
string fileTitle = this.myFile.PostedFile.FileName.ToString();
//HttpPostedFile UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
UpFile = this.myFile.PostedFile;//获取对由客户端指定的上传文件的访问
FileLength = UpFile.ContentLength;//获取上传文件的字节大小
if (FileLength == 0)
{
//Response.Write("<script>alert('对不起,请选择要上传的图片')</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('对不起请选择要上传的LOGO');", true);
return;
}
string exName = FileName.Substring(FileName.LastIndexOf(".") + 1).ToUpper();//截取图片的后缀名
if (exName == "JPG" || exName == "BMP" || exName == "GIF")//判断图片的类型
{
Byte[] FileByte = new Byte[FileLength]; //图象文件储存到数组
Stream ObjectStream = UpFile.InputStream;//建立数据流对像,获取一个 Stream 对象,该对象指向一个上载文件,以准备读取该文件的内容。
ObjectStream.Read(FileByte, 0, FileLength); //读取图象文件数据
int nWidth = 75;
int nHeight = 75;
string ImageName = DateTime.Now.ToString("yyyyMMddhhmmssfff") + "." + exName;//图片名称设置为保存的时间
System.Drawing.Image image;
image = System.Drawing.Bitmap.FromStream(ObjectStream);
nWidth = image.Width;
nHeight = image.Height;
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["DongShengDB"].ConnectionString);
string StrSql = "update [company] set LOGO=@LOGO where GID='" + ViewState["GID"].ToString().Trim() + "'";
SqlCommand Cmd = new SqlCommand(StrSql, conn);
Cmd.Parameters.Add("@LOGO", SqlDbType.Binary);
Cmd.Parameters["@LOGO"].Value = FileByte;
conn.Open();
Cmd.ExecuteNonQuery();
conn.Close();
//Response.Write("<script>alert('图片保存到数据库成功');window.opener.location.reload();window.close();history.back();</script>");
}
else
{
//Response.Write("<script>alert('对不起,请选择正确的的图片')</script>");
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('出错,请选择正确的的图片!');", true);
return;
}
}
catch (Exception ex)
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport31", "alert('出错,请选择正确的的图片!');", true);
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return;
}
*/
//
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "reloadParent('" + ViewState["GID"].ToString().Trim() + "');", true);
//System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport30", "alert('成功提交!');", true);
//Response.Write("<script>alert('成功提交!');history.back();</script>");
return;
}
else
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport31", "alert('出错,请重新填写!');", true);
//Response.Write("<script>alert('出错,请重新填写!');history.back();</script>");
return;
}
}
protected void btnAdd_Click(object sender, EventArgs e)
{
ViewState["strHandleType"] = "add";
tbCODENAME.Text = "";
tbNAME.Text = "";
tbFULLNAME.Text = "";
tbENNAME.Text = "";
tbADDRESS.Text = "";
tbENADDRESS.Text = "";
tbOFFICEPHONE.Text = "";
tbFAX.Text = "";
tbWEBSITEURL.Text = "";
tbEMAIL.Text = "";
tbLICENSECODE.Text = "";
tbTAXCODE.Text = "";
tbBillRises.Text = "";
tbChequePayable.Text = "";
tbPRTHEADXML1.Text = "";
tbPRTHEADXML2.Text = "";
tbPRTHEADXML3.Text = "";
tbPRTHEADXML4.Text = "";
tbPRTHEADXML5.Text = "";
tbBANKSHEAD.Text = "";
//
ibDel.Enabled = false;
ibAdd.Enabled = true;
ibEnter.Enabled = true;
}
protected void btnDel_Click(object sender, EventArgs e)
{
string alt = CompanyDA.GetCompanyDel(ViewState["GID"].ToString().Trim(), strUserID.Trim());
if (alt != "")
{
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport40", "alert('" + alt + "');", true);
return;
}
else
{
//window.opener.location.reload();
System.Web.UI.ScriptManager.RegisterStartupScript(this.UpdatePanel3, this.GetType(), "unReport50", "alert('删除成功!');", true);
}
//
ViewState["strHandleType"] = "edit";
CompanyEntity = CompanyDA.GetCompanyTop1();
if (CompanyEntity.GID != null)
{
tbCODENAME.Text = CompanyEntity.CODENAME.ToString().Trim();
tbNAME.Text = CompanyEntity.NAME.ToString().Trim();
tbFULLNAME.Text = CompanyEntity.FULLNAME.ToString().Trim();
tbENNAME.Text = CompanyEntity.ENNAME.ToString().Trim();
tbADDRESS.Text = CompanyEntity.ADDRESS.ToString().Trim();
tbENADDRESS.Text = CompanyEntity.ENADDRESS.ToString().Trim();
tbOFFICEPHONE.Text = CompanyEntity.OFFICEPHONE.ToString().Trim();
tbFAX.Text = CompanyEntity.FAX.ToString().Trim();
tbWEBSITEURL.Text = CompanyEntity.WEBSITEURL.ToString().Trim();
tbEMAIL.Text = CompanyEntity.EMAIL.ToString().Trim();
tbLICENSECODE.Text = CompanyEntity.LICENSECODE.ToString().Trim();
tbTAXCODE.Text = CompanyEntity.TAXCODE.ToString().Trim();
tbBillRises.Text = CompanyEntity.BillRises.ToString().Trim();
tbChequePayable.Text = CompanyEntity.ChequePayable.ToString().Trim();
tbPRTHEADXML1.Text = CompanyEntity.PRTHEADXML1.ToString().Trim();
tbPRTHEADXML2.Text = CompanyEntity.PRTHEADXML2.ToString().Trim();
tbPRTHEADXML3.Text = CompanyEntity.PRTHEADXML3.ToString().Trim();
tbPRTHEADXML4.Text = CompanyEntity.PRTHEADXML4.ToString().Trim();
tbPRTHEADXML5.Text = CompanyEntity.PRTHEADXML5.ToString().Trim();
tbBANKSHEAD.Text = CompanyEntity.BANKSHEAD.ToString().Trim();
if (CompanyEntity.LOGO != null)
{
getLOGO(CompanyEntity.LOGO);
//getImage("select LOGO from [company] where GID='" + CompanyEntity.GID + "'");
}
}
//
ibDel.Enabled = false;
ibAdd.Enabled = false;
}
public bool IsNumeric(string s)
{
int inum = 0;
bool bReturn = true;
try
{
inum = int.Parse(s);
}
catch
{
inum = 0;
bReturn = false;
}
return bReturn;
}
}
}