📄 companyinfo.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;
namespace HTMS.Web.CompanyManage.CompanyManage
{
/// <summary>
/// CompanyInfo 的摘要说明。
/// </summary>
public class CompanyInfo : HTMS.Web.CompanySysMange.BasePage
{
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.DropDownList DropDownList2;
protected System.Web.UI.HtmlControls.HtmlInputHidden myvalue;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.HtmlControls.HtmlInputButton Submit1;
protected System.Web.UI.WebControls.DropDownList Dropdownlist2;
protected System.Web.UI.HtmlControls.HtmlInputText name;
protected System.Web.UI.HtmlControls.HtmlInputText daibiao;
protected System.Web.UI.HtmlControls.HtmlInputText regcode;
protected System.Web.UI.HtmlControls.HtmlInputText bankname;
protected System.Web.UI.HtmlControls.HtmlInputText bankaccount;
protected System.Web.UI.HtmlControls.HtmlInputText ratepaying;
protected System.Web.UI.HtmlControls.HtmlInputText fax;
protected System.Web.UI.HtmlControls.HtmlInputText post;
protected System.Web.UI.HtmlControls.HtmlInputText web;
protected System.Web.UI.HtmlControls.HtmlInputText linkman;
protected System.Web.UI.HtmlControls.HtmlInputText linkmanpho;
protected System.Web.UI.HtmlControls.HtmlInputText telphone;
protected System.Web.UI.HtmlControls.HtmlInputText email;
protected System.Web.UI.HtmlControls.HtmlInputText address;
protected System.Web.UI.HtmlControls.HtmlGenericControl divimage;
protected System.Web.UI.HtmlControls.HtmlGenericControl divfile;
protected System.Web.UI.HtmlControls.HtmlInputHidden myvalueimage;
protected System.Web.UI.HtmlControls.HtmlInputText Text1;
protected System.Web.UI.WebControls.DropDownList realtionShip;
protected FreeTextBoxControls.FreeTextBox FreeTextBox1;
public string CompanyID
{
get{return Convert.ToString(this.ViewState["CompanyID"]);}
set{this.ViewState["CompanyID"]=value;}
}
private string UserID
{
get{return Convert.ToString(this.ViewState["UserID"]);}
set{this.ViewState["UserID"]=value;}
}
private string UserType
{
get{return Convert.ToString(this.ViewState["UserType"]);}
set{this.ViewState["UserID"]=value;}
}
private string FatherCompanyID
{
get{return Convert.ToString(this.ViewState["FatherCompanyID"]);}
set{this.ViewState["FatherCompanyID"]=value;}
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!base.CheckUser())
{
return;
}
if(!Page.IsPostBack)
{
this.CompanyID=Convert.ToString(this.Request.QueryString["CompanyID"]);
this.FatherCompanyID=Convert.ToString(this.Session["CompanyID"]);
this.UserID=Convert.ToString(this.Session["UserID"]);
this.showClass();
}
if(this.FatherCompanyID=="0")
{
this.realtionShip.Visible=false;
}
else
{
this.DataBindRelClass();
}
//Common.Common.ShowMessageBox(this.CompanyID);
if(this.CompanyID!="")
{
this.showInfo(this.CompanyID);
}
if(this.UserType=="0")
{
Common.Common.RunScript("var arrary=document.getElementsByTagName('input');for(i=0;i<arrary.length;i++){arrary[i].readOnly=true;}");
}
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Submit1.ServerClick += new System.EventHandler(this.Submit1_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void DataBindRelClass()
{
System.Data.DataTable mytable=HTMS.SQLServerDAL.DAL.DAI.RunProcTable("CompanyRelClassByRelClass",this.FatherCompanyID);
if(mytable==null || mytable.Rows.Count<=0)
{
return;
}
this.realtionShip.DataTextField="RelClassName";
this.realtionShip.DataValueField="RelClassID";
this.realtionShip.DataSource=mytable;
this.realtionShip.DataBind();
}
private void Submit1_ServerClick(object sender, System.EventArgs e)
{
HTMS.BLL.CompanyInfo temp=new HTMS.BLL.CompanyInfo();
HTMS.Model.CompanyInfo companyinfo=new HTMS.Model.CompanyInfo();
companyinfo.CompanyID=Common.GetNextId.getNextID("CompanyInfo","CompanyID");
Common.Common.ShowMessageBox(this.myvalueimage.Value);
companyinfo.DesPic=this.myvalueimage.Value;
companyinfo.CompanyClassID=this.DropDownList1.SelectedValue;
companyinfo.DesText=System.Web.HttpUtility.HtmlDecode(this.FreeTextBox1.Text);
companyinfo.CompanyName=this.name.Value;
companyinfo.JuridicalPerson=this.daibiao.Value;
companyinfo.RegCode=this.regcode.Value;
companyinfo.BankAccount=this.bankaccount.Value;
companyinfo.BankName=this.bankname.Value;
companyinfo.RatePaying=this.ratepaying.Value;
companyinfo.Faxes=this.fax.Value;
companyinfo.PostNum=this.post.Value;
companyinfo.Web=this.web.Value;
companyinfo.LinkMan=this.linkman.Value;
companyinfo.LinkManMPhone=this.linkmanpho.Value;
companyinfo.TelPhone=this.telphone.Value;
companyinfo.Mail=this.email.Value;
companyinfo.DesFile=this.myvalue.Value;
companyinfo.RegDate=DateTime.Now;
companyinfo.Address=this.address.Value;
companyinfo.ClickCount="0";
companyinfo.IsFreeze="0";
//companyinfo.CompanyClassID="0";
companyinfo.CompanyClassRelID=this.realtionShip.SelectedValue;
companyinfo.FatherCompanyID=this.FatherCompanyID;
//companyinfo.UserID=this.Dropdownlist2.SelectedValue;
companyinfo.UserID=this.UserID;
companyinfo.Param="1";//公司不可见;param==isvisible
try
{
this.showMessage(temp.Add(companyinfo));
this.Response.Redirect("../../SysManage/CompanyManage/CompanyList.aspx");
}
catch(System.Exception ee)
{
//Common.Common.ShowMessageBox("操作失败");
throw ee;
}
}
private void showInfo(string companyID)
{
HTMS.BLL.CompanyInfo temp=new HTMS.BLL.CompanyInfo();
HTMS.Model.CompanyInfo companyinfo =temp.GetModel(companyID);
if(companyinfo==null || Convert.ToString(companyinfo.CompanyID)=="")
return ;
else
{
//this.image.ImageUrl=companyinfo.DesPic;
this.DropDownList1.SelectedValue=companyinfo.CompanyClassID;
this.FreeTextBox1.Text=System.Web.HttpUtility.UrlDecode(companyinfo.DesText);//System.Web.HttpUtility.UrlEncode(System.Web.HttpUtility.HtmlDecode(companyinfo.DesText));
this.name.Value=companyinfo.CompanyName;
this.daibiao.Value=companyinfo.JuridicalPerson;
this.regcode.Value=companyinfo.RegCode;
this.bankaccount.Value=companyinfo.BankAccount;
this.bankname.Value=companyinfo.BankName;
this.ratepaying.Value=companyinfo.RatePaying;
this.fax.Value=companyinfo.Faxes;
this.post.Value=companyinfo.PostNum;
this.web.Value=companyinfo.Web;
this.linkman.Value=companyinfo.LinkMan;
this.linkmanpho.Value=companyinfo.LinkManMPhone;
this.telphone.Value=companyinfo.TelPhone;
this.email.Value=companyinfo.Mail;
this.divimage.Style.Add("width","20");
this.divimage.InnerHtml="<a onclick=OpenWindow('"+companyinfo.DesPic+"'); >"+this.getValidataName(this.getName(companyinfo.DesPic))+"</a>";
this.divfile.InnerHtml="<a href='"+this.getUrlPath(companyinfo.DesFile,1)+"'>"+this.getValidataName(this.getName(companyinfo.DesFile))+"</a>";
this.myvalue.Value=companyinfo.DesFile;
this.myvalueimage.Value=companyinfo.DesPic;
this.address.Value=companyinfo.Address;
}
}
private string getUrlPath(string filename ,int type)
{
if(type==0)
return "../../Data/Images/"+filename;
else
return "../../Data/Files/"+filename;
}
private string getName(string path)
{
if(path.IndexOf("_")!=-1)
return path.Substring(0,path.IndexOf("_"));
else
return path;
//return myvalue;
}
private string getValidataName(string name)
{
int count=name.Length;
if(count<10)
{
for(int i=count;i<10;i++)
{
name+=" ";
}
}
else
{
name=name.Substring(0,10);
}
return "<font color=red style='FONT-WEIGHT: bold;cursor:hand; FONT-SIZE: 12px'>"+name+"</font>";
}
private void showClass()
{
System.Data.DataTable mytable=HTMS.SQLServerDAL.DAL.DAI.RunProcTable("CompanyClass_GetClassIDName");
this.DropDownList1.DataTextField="CompanyClassName";
this.DropDownList1.DataValueField="CompanyClassID";
this.DropDownList1.DataSource=mytable;
this.DropDownList1.DataBind();
}
private void showMessage(int count)
{
if(count<0)
Common.Common.ShowMessageBox("操作失败");
else
Common.Common.ShowMessageBox("操作成功");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -