📄 bargain.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.CompanySysMange.Bargain
{
/// <summary>
/// Bargain 的摘要说明。
/// </summary>
public class Bargain :HTMS.Web.CompanySysMange.BasePage
{
protected System.Web.UI.HtmlControls.HtmlInputHidden myvalue;
protected System.Web.UI.HtmlControls.HtmlInputButton tijiao;
protected System.Web.UI.WebControls.DropDownList hetongleix;
protected System.Web.UI.HtmlControls.HtmlInputText title;
protected System.Web.UI.HtmlControls.HtmlTextArea htbeiz;
protected System.Web.UI.HtmlControls.HtmlTextArea productdes;
protected System.Web.UI.HtmlControls.HtmlInputText pname;
protected System.Web.UI.HtmlControls.HtmlInputText pnum;
protected System.Web.UI.HtmlControls.HtmlInputText jine;
protected System.Web.UI.HtmlControls.HtmlInputText BargainOverTime;
protected FreeTextBoxControls.FreeTextBox FreeTextBox1;
public string CompanyID
{
get{return Convert.ToString(this.ViewState["CompanyID"]);}
set{this.ViewState["CompanyID"]=value;}
}
private string BargainID
{
get{return Convert.ToString(this.ViewState["BargainID"]);}
set{this.ViewState["BargainID"]=value;}
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
{
if(!base.CheckUser())
{
this.Page.Visible=false;return;
}
else
{
this.CompanyID=this.Session["CompanyID"].ToString();
this.BargainID=this.Request.QueryString["BargainID"];
}
if(this.BargainID!="")
{
this.ShowInfo(this.BargainID);
}
showClass();
}
}
private void showClass()
{
System.Data.DataTable mytable=HTMS.SQLServerDAL.DAL.DAI.RunProcTable("BargainClass_GetClassIDNameByCompanyID",this.CompanyID);
this.hetongleix.DataTextField="ClassName";
this.hetongleix.DataValueField="ClassID";
this.hetongleix.DataSource=mytable;
this.hetongleix.DataBind();
this.hetongleix.Items.Insert(0,new System.Web.UI.WebControls.ListItem("未选择","-1"));
}
private void ShowInfo(string BargainID)
{
System.Data.DataTable mytable=HTMS.SQLServerDAL.DAL.DAI.RunProcTable("GetCompanyBargainByBargainID",this.BargainID);
if(mytable==null || mytable.Rows.Count<=0)
{
return ;
}
this.ShowEntity(mytable.Rows[0]);
}
private void ShowEntity(System.Data.DataRow myrow)
{
this.myvalue.Value=myrow["CompanyBadgeID"].ToString();
this.hetongleix.SelectedValue=myrow["BargainClassID"].ToString();
this.title.Value=myrow["BargainTitle"].ToString();
this.htbeiz.Value=myrow["BargainDes"].ToString();
this.productdes.Value=myrow["ProductDes"].ToString();
this.pname.Value=myrow["ProductName"].ToString();
this.pnum.Value=myrow["ProductNum"].ToString();
this.jine.Value=myrow["BargainMoney"].ToString();
this.FreeTextBox1.Text=System.Web.HttpUtility.UrlDecode(System.Web.HttpUtility.HtmlDecode(myrow["BargainContent"].ToString()));
}
#region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.tijiao.ServerClick += new System.EventHandler(this.tijiao_ServerClick);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void tijiao_ServerClick(object sender, System.EventArgs e)
{
HTMS.Model.CompanyBargainInfo myinfo=new HTMS.Model.CompanyBargainInfo();
HTMS.BLL.CompanyBargainInfo temp=new HTMS.BLL.CompanyBargainInfo();
myinfo.BargainID=Common.GetNextId.getNextID("CompanyBargainInfo","BargainID");
myinfo.BargainTitle=this.title.Value;
myinfo.BargainContent=System.Web.HttpUtility.UrlEncode(System.Web.HttpUtility.HtmlEncode(this.FreeTextBox1.Text));
myinfo.BargainDes=this.htbeiz.Value;
myinfo.BargainDraft=System.DateTime.Now;
myinfo.BargainMoney=this.jine.Value;
myinfo.BargainOverTime=DateTime.Parse(this.BargainOverTime.Value);
myinfo.BargainStartTime=System.DateTime.Now;
if(this.myvalue.Value!="")
{
myinfo.IsAllChecked="1";
}
else
{
myinfo.IsAllChecked="0";
}
myinfo.IsEfficacy="0";
myinfo.Param="0";
myinfo.ProductDes=this.productdes.Value;
myinfo.ProductName=this.pname.Value;
myinfo.ProductNum=this.pnum.Value;
temp.Add(myinfo);
HTMS.Model.CompanyBargainRel myrel=new HTMS.Model.CompanyBargainRel();
HTMS.BLL.CompanyBargainRel reltemp=new HTMS.BLL.CompanyBargainRel();
myrel.CompanyID=this.CompanyID;
string myid=this.hetongleix.SelectedValue;
myrel.BargainClassID="0000000001";//this.hetongleix.SelectedValue == "-1" ? "" : this.hetongleix.SelectedValue;
myrel.BargainID=myinfo.BargainID;
myrel.CompanyBadgeID=this.myvalue.Value;
myrel.CompanyID=this.CompanyID;
myrel.IsChecked=this.myvalue.Value == "" ? "0" : "1";
myrel.IsDelete="0";
myrel.IsWriter="1";
myrel.Param="0";
reltemp.Add(myrel);
try
{}
catch(System.Exception ee)
{
temp.Delete(myinfo.BargainID);
this.ShowMessage(0);
}
//this.ShowMessage(1);
}
/*protected System.Web.UI.HtmlControls.HtmlInputHidden myvalue;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.HtmlControls.HtmlInputButton tijiao;
protected System.Web.UI.WebControls.DropDownList hetongleix;
protected System.Web.UI.HtmlControls.HtmlInputText title;
protected System.Web.UI.HtmlControls.HtmlTextArea htbeiz;
protected System.Web.UI.HtmlControls.HtmlTextArea productdes;
protected System.Web.UI.HtmlControls.HtmlInputText pname;
protected System.Web.UI.HtmlControls.HtmlInputText pnum;
protected System.Web.UI.HtmlControls.HtmlInputText jine;
protected FreeTextBoxControls.FreeTextBox FreeTextBox1;*/
private void SetClear()
{
this.myvalue.Value="";
this.hetongleix.SelectedValue="-1";
this.title.Value="";
this.htbeiz.Value="";
this.pname.Value="";
this.pnum.Value="";
this.productdes.Value="";
this.jine.Value="";
this.FreeTextBox1.Text="";
}
private void ShowMessage(int count)
{
if(count<=0)
{
Common.Common.ShowMessageBox("操作失败");
}
else
{
Common.Common.ShowMessageBox("操作成功");
this.SetClear();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -