📄 frmgroup.cs
字号:
MessageBox.Show("预住天数输入错误!", "提示");
return;
}
// 以证件号码查询客户表,是否存在该客户
string str = txtCardNum.Text.Trim();
objBuyerAccess = new BuyerAccess();
ds = new DataSet();
ds = objBuyerAccess.GetBuyerInfo(str);
if (ds.Tables[0].Rows.Count == 0)
{
lear = true;
}
else
{
lear = false;
}
//获取最大的宾客编号
objBuyerAccess = new BuyerAccess();
int maxBuyerID = objBuyerAccess.GetMaxBuyerID();
//如果客户表里不存在该客户,则插入记录
if (lear == true)
{
//使用储存过程插入客户信息
buyerEntity = new Buyer();
buyerEntity.BName = txtBuyerName.Text;
buyerEntity.Birthday = DateTime.Now.ToString("yyyy-MM-dd");
buyerEntity.CertificateID = cboCardType.SelectedIndex + 1;
buyerEntity.BCarNum = txtCardNum.Text;
buyerEntity.BSex = cboSex.Text;
buyerEntity.Phone = txtPhone.Text;
buyerEntity.Company = txtCompany.Text;
buyerEntity.NationalityID = cboNationality.SelectedIndex + 1;
buyerEntity.ProvinceID = cboProvince.SelectedIndex + 1;
buyerEntity.Address = txtAddress.Text;
buyerEntity.Remark = txtRemark.Text;
maxBuyerID += 1;//如果是新宾客,宾客号要加一
int k = objBuyerAccess.AddBuyerInfo(buyerEntity);
if (k != 0)
{
//MessageBox.Show("添加成功", "提示");
//插入操作日志
JobInfoAccess obj = new JobInfoAccess();
int ac = obj.AddJobInfo(Program.strName, DateTime.Now.ToString(), "添加宾客信息" + txtBuyerName.Text,0);
if (ac == 0)
{
MessageBox.Show("插入操作日志失败!");
}
}
else
{
MessageBox.Show("添加失败!", "提示");
return;
}
}
//开房
for(int i=0;i<lsvShow.Items.Count;i++)
{
SqlParameter[] paraRoom ={
new SqlParameter("@Buyer",maxBuyerID),
new SqlParameter("@GuesRoomID",lsvShow.Items[i].SubItems[0].Text.ToString()),
new SqlParameter("@ArriveTime",DateTime.Now.ToString("yyyy-MM-dd")),
new SqlParameter("@InTime",int.Parse(txtHow.Text.Trim())),
new SqlParameter("@CountMode",lblHow.Text.Trim()),
new SqlParameter("@charge",float.Parse(txtRoomSum.Text.Trim())),
new SqlParameter("@otherExpenses","0"),
new SqlParameter("@InForegift",float.Parse(txtDeposit.Text.Trim())),
new SqlParameter("@OutForegift","0"),
new SqlParameter("@BNum",int.Parse(cboCount.Text.Trim())),
new SqlParameter("@ConsumeID",cboMode.SelectedIndex+1),
new SqlParameter("@Rebate","1"),
new SqlParameter("@OpenUser",txtUser.Text.Trim()),
new SqlParameter("@FillTime",DateTime.Now.ToString("yyyy-MM-dd")),
new SqlParameter("@EndCharge",float.Parse(txtSumPrice.Text.Trim())),
new SqlParameter("@State","正在消费"),
new SqlParameter("@UserID",txtUser.Text.Trim()),
new SqlParameter("@ReckoningTime",DateTime.Now.ToString("yyyy-MM-dd")),
new SqlParameter("@Remark","无")};
objRoomUseAccess = new RoomUseAccess();
int a = objRoomUseAccess.AddRoomUseInfo(paraRoom);
if (a == 0)
{
MessageBox.Show("添加失败!");
return;
}
else
{
MessageBox.Show("添加成功!");
//插入操作日志
JobInfoAccess obj = new JobInfoAccess();
int ac = obj.AddJobInfo(Program.strName, DateTime.Now.ToString(), "团体开单" + maxBuyerID, float.Parse(txtSumPrice.Text.Trim()));
if (ac == 0)
{
MessageBox.Show("插入操作日志失败!");
}
}
//修改房间状态
objGuestRoomAccess = new GuestRoomAccess();
int sta = objGuestRoomAccess.ModifiRoomState(lsvShow.Items[i].SubItems[0].Text.ToString(), "使用");
if (sta == 0)
{
MessageBox.Show("出错误!", "提示");
}
}
}
private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}
//按姓名查找
public static string card = "";
public static ArrayList li = new ArrayList();
private void btnFindName_Click(object sender, EventArgs e)
{
//验证是否为空
if (txtBuyerName.Text.Trim().Equals(""))
{
MessageBox.Show("请输入宾客姓名!", "提示");
return;
}
str = txtBuyerName.Text.Trim();
ds = new DataSet();
//调用按姓名查找的方法
objBuyerAccess = new BuyerAccess();
ds = objBuyerAccess.GetBuyerDS(str);
if (ds.Tables[0].Rows.Count > 1)
{
li.Clear();
//调用按姓名查找的方法
objBuyerAccess = new BuyerAccess();
ds = objBuyerAccess.GetBuyerDS(str);
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
li.Add(ds.Tables[0].Rows[i][4].ToString().Trim());
}
frmSelect frm = new frmSelect();
frm.ShowDialog();
ds = new DataSet();
//调用按证件号码查找的方法
ds = objBuyerAccess.GetBuyerInfo(card);
txtBuyerName.Text = ds.Tables[0].Rows[0][1].ToString();
cboCardType.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][3].ToString()) - 1;
txtCardNum.Text = ds.Tables[0].Rows[0][4].ToString();
cboSex.Text = ds.Tables[0].Rows[0][5].ToString();
txtPhone.Text = ds.Tables[0].Rows[0][6].ToString();
txtCompany.Text = ds.Tables[0].Rows[0][7].ToString();
cboNationality.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][8].ToString()) - 1;
cboProvince.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][9].ToString()) - 1;
txtAddress.Text = ds.Tables[0].Rows[0][10].ToString();
txtRemark.Text = ds.Tables[0].Rows[0][12].ToString();
lear = false;
}
else if (ds.Tables[0].Rows.Count == 1)
{
txtBuyerName.Text = ds.Tables[0].Rows[0][1].ToString();
cboCardType.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][3].ToString()) - 1;
txtCardNum.Text = ds.Tables[0].Rows[0][4].ToString();
cboSex.Text = ds.Tables[0].Rows[0][5].ToString();
txtPhone.Text = ds.Tables[0].Rows[0][6].ToString();
txtCompany.Text = ds.Tables[0].Rows[0][7].ToString();
cboNationality.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][8].ToString()) - 1;
cboProvince.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][9].ToString()) - 1;
txtAddress.Text = ds.Tables[0].Rows[0][10].ToString();
txtRemark.Text = ds.Tables[0].Rows[0][12].ToString();
lear = false;
}
else
{
MessageBox.Show("这位宾客还没有登记过!", "提示");
lear = true;
}
}
private void btnFind_Click(object sender, EventArgs e)
{
if (txtCardNum.Text.Trim().Equals(""))
{
MessageBox.Show("请输入证件号码!", "提示");
return;
}
string str = txtCardNum.Text.Trim();
objBuyerAccess = new BuyerAccess();
ds = new DataSet();
ds = objBuyerAccess.GetBuyerInfo(str);
if (ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("没有找到!", "提示");
lear = true;
return;
}
//将搜到的值添加到界面
txtBuyerName.Text = ds.Tables[0].Rows[0][1].ToString();
cboCardType.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][3].ToString()) - 1;
txtCardNum.Text = ds.Tables[0].Rows[0][4].ToString();
cboSex.Text = ds.Tables[0].Rows[0][5].ToString();
txtPhone.Text = ds.Tables[0].Rows[0][6].ToString();
txtCompany.Text = ds.Tables[0].Rows[0][7].ToString();
cboNationality.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][8].ToString()) - 1;
cboProvince.SelectedIndex = int.Parse(ds.Tables[0].Rows[0][9].ToString()) - 1;
txtAddress.Text = ds.Tables[0].Rows[0][10].ToString();
txtRemark.Text = ds.Tables[0].Rows[0][12].ToString();
lear = false;
}
//选择计费方式
private void rdbDay_CheckedChanged(object sender, EventArgs e)
{
if (rdbDay.Checked)
{
lblHow.Text = "天";
}
//计费
CountPrice();
}
private void rdbHalf_CheckedChanged(object sender, EventArgs e)
{
if (rdbHalf.Checked)
{
lblHow.Text = "半天";
}
//计费
CountPrice();
}
private void rdbHours_CheckedChanged(object sender, EventArgs e)
{
if (rdbHours.Checked)
{
lblHow.Text = "小时";
}
//计费
CountPrice();
}
private void btnAddDes_Click(object sender, EventArgs e)
{
//添加预定房
//string str= lsbShow.SelectedItem.ToString();
//ListViewItem lsvItem = null;
//DataSet dsRoom = new DataSet();
//objGuestRoomAccess = new GuestRoomAccess();
//dsRoom = objGuestRoomAccess.GetRoomInfoPrice(str);
//lsvItem = new ListViewItem(dsRoom.Tables[0].Rows[0][0].ToString());
//for (int i = 1; i < dsRoom.Tables[0].Columns.Count; i++)
//{
// lsvItem.SubItems.Add(dsRoom.Tables[0].Rows[0][i].ToString());
//}
//lsvShow.Items.Add(lsvItem);
//lsbShow.Items.Remove(str);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -