📄 roominfo.cs
字号:
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@客房编号", System.Data.SqlDbType.VarChar, 12, "客房编号"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@类型编号", System.Data.SqlDbType.VarChar, 4, "类型编号"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@楼层编号", System.Data.SqlDbType.Int, 4, "楼层编号"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@额定人数", System.Data.SqlDbType.Int, 4, "额定人数"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@床数", System.Data.SqlDbType.Int, 4, "床数"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@客房描述", System.Data.SqlDbType.VarChar, 40, "客房描述"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@备注", System.Data.SqlDbType.VarChar, 100, "备注"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@状态", System.Data.SqlDbType.VarChar, 4, "状态"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@是否可拼房", System.Data.SqlDbType.Bit, 1, "是否可拼房"));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_客房编号", System.Data.SqlDbType.VarChar, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "客房编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_客房描述", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "客房描述", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_床数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "床数", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否可拼房", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否可拼房", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_楼层编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "楼层编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_类型编号", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "类型编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand7.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_额定人数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "额定人数", System.Data.DataRowVersion.Original, null));
//
// sqlCommand8
//
this.sqlCommand8.CommandText = @"DELETE FROM 客房信息 WHERE (客房编号 = @Original_客房编号) AND (备注 = @Original_备注 OR @Original_备注 IS NULL AND 备注 IS NULL) AND (客房描述 = @Original_客房描述 OR @Original_客房描述 IS NULL AND 客房描述 IS NULL) AND (床数 = @Original_床数 OR @Original_床数 IS NULL AND 床数 IS NULL) AND (是否可拼房 = @Original_是否可拼房 OR @Original_是否可拼房 IS NULL AND 是否可拼房 IS NULL) AND (楼层编号 = @Original_楼层编号) AND (状态 = @Original_状态 OR @Original_状态 IS NULL AND 状态 IS NULL) AND (类型编号 = @Original_类型编号) AND (额定人数 = @Original_额定人数 OR @Original_额定人数 IS NULL AND 额定人数 IS NULL)";
this.sqlCommand8.Connection = this.sqlConnection1;
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_客房编号", System.Data.SqlDbType.VarChar, 12, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "客房编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_备注", System.Data.SqlDbType.VarChar, 100, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "备注", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_客房描述", System.Data.SqlDbType.VarChar, 40, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "客房描述", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_床数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "床数", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_是否可拼房", System.Data.SqlDbType.Bit, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "是否可拼房", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_楼层编号", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "楼层编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_状态", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "状态", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_类型编号", System.Data.SqlDbType.VarChar, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "类型编号", System.Data.DataRowVersion.Original, null));
this.sqlCommand8.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Original_额定人数", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "额定人数", System.Data.DataRowVersion.Original, null));
//
// da2
//
this.da2.SelectCommand = this.sqlSelectCommand2;
this.da2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "楼层信息", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("楼层编号", "楼层编号"),
new System.Data.Common.DataColumnMapping("楼层名称", "楼层名称")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 楼层编号, 楼层名称 FROM 楼层信息";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
//
// da3
//
this.da3.SelectCommand = this.sqlSelectCommand3;
this.da3.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "客房类型", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("类型编号", "类型编号"),
new System.Data.Common.DataColumnMapping("类型名称", "类型名称"),
new System.Data.Common.DataColumnMapping("价格", "价格"),
new System.Data.Common.DataColumnMapping("拼房价格", "拼房价格"),
new System.Data.Common.DataColumnMapping("可超预定数", "可超预定数"),
new System.Data.Common.DataColumnMapping("是否可拼房", "是否可拼房")})});
//
// sqlSelectCommand3
//
this.sqlSelectCommand3.CommandText = "SELECT 类型编号, 类型名称, 价格, 拼房价格, 可超预定数, 是否可拼房 FROM 客房类型";
this.sqlSelectCommand3.Connection = this.sqlConnection1;
//
// RoomInfo
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(736, 509);
this.Name = "RoomInfo";
this.Text = "【客房信息设置】";
this.Load += new System.EventHandler(this.RoomInfo_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
} #endregion
//----------初始化窗体时读入全部信息--------------
private void RoomInfo_Load(object sender, System.EventArgs e)
{
da1.SelectCommand.Parameters[0].Value="%";
da1.SelectCommand.Parameters[1].Value="%";
da1.SelectCommand.Parameters[2].SqlDbType=SqlDbType.VarChar;
da1.SelectCommand.Parameters[2].Value="%";
da1.Fill(dataSet11);//填充客房信息
//设置数据导航控件
this.cmOrders=(CurrencyManager) BindingContext[dataSet11,"客房信息"];
//将基类中的数据集与派生类中的数据集连接
base.dataSet11=this.dataSet11;
//填充其他编号和名称数据
da2.Fill(dataSet11);
da3.Fill(dataSet11);
}
//-----------根据输入,检索信息----------
private void btnSearch_Click(object sender, System.EventArgs e)
{
da1.SelectCommand.Parameters[0].Value="%";
da1.SelectCommand.Parameters[1].Value="%";
da1.SelectCommand.Parameters[2].Value="%";
if(txt1.Text.Trim()!="")
{
da1.SelectCommand.Parameters[0].Value="%"+txt1.Text.Trim()+"%";
}
if(txt2.Text.Trim()!="")
{
da1.SelectCommand.Parameters[1].Value="%"+txt2.Text.Trim()+"%";
}
if(txt3.Text.Trim()!="")
{
da1.SelectCommand.Parameters[2].Value="%"+txt3.Text.Trim()+"%";
}
dataSet11.Clear();//刷新数据集
da1.Fill(dataSet11);
//填充其他编号和名称数据
da2.Fill(dataSet11);
da3.Fill(dataSet11);
} //----------重写设置控件只读属性函数----------
protected override void SetModifyMode(bool blnEdit)
{
base.SetModifyMode (blnEdit);
txt4.ReadOnly=!blnEdit;
txt5.ReadOnly=!blnEdit;
txt6.ReadOnly=!blnEdit;
txt8.ReadOnly=!blnEdit;
txt9.ReadOnly=!blnEdit;
cmb2.Enabled=blnEdit;
cmb3.Enabled=blnEdit;
checkBox1.Enabled=blnEdit;
}
//-------重写新增记录时设置默认值函数--------
protected override void SetDefaultValue()
{
base.SetDefaultValue ();
cmb2.SelectedText="";
cmb3.SelectedText="";
txt7.Text="空房";//新增房间默认都为空房
} //-------重写检查非空字段函数--------
protected override bool CheckNotNull()
{
if(txt4.Text.Trim()=="")// 检查房间编号
{
MessageBox.Show("房间号不能为空","提示",MessageBoxButtons.OK,MessageBoxIcon.Stop);
return(false);
}
if(cmb2.Text.Trim()=="")//检查客房类型
{
MessageBox.Show("请选择客房类型","提示",MessageBoxButtons.OK,MessageBoxIcon.Stop);
return(false);
}
if(cmb3.Text.Trim()=="")//检查楼层
{
MessageBox.Show("请选择楼层","提示",MessageBoxButtons.OK,MessageBoxIcon.Stop);
return(false);
}
return base.CheckNotNull ();
} }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -