📄 addhomeholdfee.aspx.cs
字号:
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 System.Data.SqlClient;
public partial class admin_addfixrepair : System.Web.UI.Page
{
BaseClass bc = new BaseClass();
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Session["UID"]) == "")
{
Response.Redirect("login.aspx");
}
else
{
txthandle.Text = Session["adminName"].ToString();
}
if (!IsPostBack)
{
this.bind();
}
}
protected void bind()
{
bc.ExecDropDownList(name, "select * from chargeFeeType", "name", "typeID");
bc.ExecDropDownList(pav, "select * from pavilion", "Name", "paID");//楼宇
bc.ExecDropDownList(cell, "select * from type where type='DY'", "name", "code");//单元
string pavcell=pav.SelectedItem.Value.ToString()+cell.SelectedItem.Value.ToString();
int pavcelllength=pavcell.Length;
string sql="select Code,ownerID from room where left(Code,"+pavcelllength+")="+pavcell+" and state=1";
// Response.Write(sql);
//Response.End();
bc.ExecDropDownList(ddlownerID, sql, "ownerID", "Code");
}
protected void Button1_Click(object sender, EventArgs e)
{
string Code = ddlownerID.SelectedItem.Value.ToString();//编号
string typeID=name.SelectedItem.Value;//收费类型
decimal Number = Math.Abs(Convert.ToDecimal(this.Number.Text));//数量
decimal Pirce = Math.Abs(Convert.ToDecimal(this.Pirce.Text));//价格
decimal Payment = Math.Abs(Convert.ToDecimal(Request["Payment"]));//应付
decimal FactPayment = Math.Abs(Convert.ToDecimal(this.FactPayment.Text));//实付
decimal NotPayment = Math.Abs(Convert.ToDecimal(Request["NotPayment"]));//未付
string handle1 = Session["adminName"].ToString();//经手人
//判断用户金额
if (Number * Pirce < Payment)
{
Response.Write("<script>alert('应付金额填写错误');history.back()</script>");
Response.End();
}
string startDate=start.Text;//开始日期
string addName=Session["adminName"].ToString();//添加人
string addDate = DateTime.Now.ToShortDateString();//添加日期
//限制收同样的费用应在30天之外
string sql = "select count(*) from homeChargeFee where code='" + Code + "' and typeID=" + typeID + " and startDate<'"+startDate+"' and '" + startDate + "'-startDate<30";
// Response.Write(sql);
// Response.End();
int count=(int)bc.ExecCscalar(sql);
if(count>0)
{
Response.Write("<script>alert('30天之内不能重复收费!');</script>");
return;
}
sql = "insert into homeChargeFee (code,typeID,number,price,payment,factpayment,notpayment,startDate,loginDate,handle,addName)values('";
sql =sql+ Code + "'," + typeID + ","+Number +","+Pirce+","+Payment+","+FactPayment+","+NotPayment+",'"+startDate+"','"+addDate+"','"+handle1+"','"+addName+"')";
// Response.Write(sql);
// Response.End();
if (bc.ExecSql(sql))
{
Response.Write("<script language=javascript>alert('添加住户费用成功!');location='homechargefee.aspx'</script>");
return;
}
else
{
Response.Write("<script language=javascript>alert('添加住户费用失败!');location='addhomeholdfee.aspx'</script>");
return;
}
}
//根据单元的选择将相应的房间绑定到下拉列表框中
protected void cell_SelectedIndexChanged(object sender, EventArgs e)
{
string pavcell = pav.SelectedItem.Value.ToString() + cell.SelectedItem.Value.ToString();
int pavcelllength = pavcell.Length;
string sql = "select Code,ownerID from room where left(Code," + pavcelllength + ")=" + pavcell + " and state=1";
// Response.Write(sql);
// Response.End();
bc.ExecDropDownList(ddlownerID, sql, "ownerID", "Code");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -