温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:小区物业管理系统源码
当前文件:
SmallHouse/admin/addhomeholdfee.aspx.cs,打开代码结构图
SmallHouse/admin/addhomeholdfee.aspx.cs,打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
using System.Collections; 5
using System.Web; 6
using System.Web.Security; 7
using System.Web.UI; 8
using System.Web.UI.WebControls; 9
using System.Web.UI.WebControls.WebParts; 10
using System.Web.UI.HtmlControls; 11
using System.Data.SqlClient; 12
13
public partial class admin_addfixrepair : System.Web.UI.Page 14
{ 15
BaseClass bc = new BaseClass(); 16
protected void Page_Load(object sender, EventArgs e) 17
{ 18
19
20
if (Convert.ToString(Session["UID"]) == "") 21
{ 22
Response.Redirect("login.aspx"); 23
24
} 25
else 26
{ 27
txthandle.Text = Session["adminName"].ToString(); 28
} 29
30
if (!IsPostBack) 31
{ 32
this.bind(); 33
34
35
} 36
} 37
38
39
protected void bind() 40
{ 41
42
43
44
bc.ExecDropDownList(name, "select * from chargeFeeType", "name", "typeID"); 45
bc.ExecDropDownList(pav, "select * from pavilion", "Name", "paID");//楼宇 46
bc.ExecDropDownList(cell, "select * from type where type='DY'", "name", "code");//单元 47
string pavcell=pav.SelectedItem.Value.ToString()+cell.SelectedItem.Value.ToString(); 48
int pavcelllength=pavcell.Length; 49
string sql="select Code,ownerID from room where left(Code,"+pavcelllength+")="+pavcell+" and state=1"; 50
// Response.Write(sql); 51
//Response.End(); 52
bc.ExecDropDownList(ddlownerID, sql, "ownerID", "Code"); 53
54
55
56
57
58
59
60
} 61
62
63
64
protected void Button1_Click(object sender, EventArgs e) 65
{ 66
string Code = ddlownerID.SelectedItem.Value.ToString();//编号 67
string typeID=name.SelectedItem.Value;//收费类型 68
69
decimal Number = Math.Abs(Convert.ToDecimal(this.Number.Text));//数量 70
decimal Pirce = Math.Abs(Convert.ToDecimal(this.Pirce.Text));//价格 71
72
73
decimal Payment = Math.Abs(Convert.ToDecimal(Request["Payment"]));//应付 74
decimal FactPayment = Math.Abs(Convert.ToDecimal(this.FactPayment.Text));//实付 75
decimal NotPayment = Math.Abs(Convert.ToDecimal(Request["NotPayment"]));//未付 76
string handle1 = Session["adminName"].ToString();//经手人 77
//判断用户金额 78
if (Number * Pirce < Payment) 79
{ 80
Response.Write("<script>alert('应付金额填写错误');history.back()</script>"); 81
Response.End(); 82
} 83
84
85
86
87
string startDate=start.Text;//开始日期 88
89
string addName=Session["adminName"].ToString();//添加人 90
string addDate = DateTime.Now.ToShortDateString();//添加日期 91
//限制收同样的费用应在30天之外 92
string sql = "select count(*) from homeChargeFee where code='" + Code + "' and typeID=" + typeID + " and startDate<'"+startDate+"' and '" + startDate + "'-startDate<30"; 93
// Response.Write(sql); 94
// Response.End(); 95
int count=(int)bc.ExecCscalar(sql); 96
if(count>0) 97
{ 98
Response.Write("<script>alert('30天之内不能重复收费!');</script>"); 99
return; 100
} 101
102
103
104
sql = "insert into homeChargeFee (code,typeID,number,price,payment,factpayment,notpayment,startDate,loginDate,handle,addName)values('"; 105
106
sql =sql+ Code + "'," + typeID + ","+Number +","+Pirce+","+Payment+","+FactPayment+","+NotPayment+",'"+startDate+"','"+addDate+"','"+handle1+"','"+addName+"')"; 107
// Response.Write(sql); 108
// Response.End(); 109
110
if (bc.ExecSql(sql)) 111
{ 112
Response.Write("<script language=javascript>alert('添加住户费用成功!');location='homechargefee.aspx'</script>"); 113
return; 114
} 115
else 116
{ 117
Response.Write("<script language=javascript>alert('添加住户费用失败!');location='addhomeholdfee.aspx'</script>"); 118
119
return; 120
} 121
122
123
124
} 125
//根据单元的选择将相应的房间绑定到下拉列表框中 126
127
protected void cell_SelectedIndexChanged(object sender, EventArgs e) 128
{ 129
string pavcell = pav.SelectedItem.Value.ToString() + cell.SelectedItem.Value.ToString(); 130
int pavcelllength = pavcell.Length; 131
string sql = "select Code,ownerID from room where left(Code," + pavcelllength + ")=" + pavcell + " and state=1"; 132
// Response.Write(sql); 133
// Response.End(); 134
bc.ExecDropDownList(ddlownerID, sql, "ownerID", "Code"); 135
} 136
} 137




BaseClass bc 
}
}