tijian_jichuang/Code/SOH.Queuing.Setting/frm_LouCeng.cs
2025-02-20 11:54:48 +08:00

133 lines
3.5 KiB
C#

using EAS.Services;
using SOH.BLL;
using SOH.Entities;
using SOH.Kernel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SOH.Queuing.Setting
{
[ModuleAttribute(ModuleID = "0B1CF062-BA59-43D7-AF4C-2B7F59255125", ModuleName = "楼层设置")]
public partial class frm_LouCeng : SOH.Window.baseChildForm
{
int lcid = 0;
public frm_LouCeng()
{
InitializeComponent();
}
private void frm_LouCeng_Load(object sender, EventArgs e)
{
loaddata();
}
private void panel1_Paint(object sender, PaintEventArgs e)
{
}
private void btn_new_Click(object sender, EventArgs e)
{
new_init();
}
private void new_init()
{
//throw new NotImplementedException();
lcid = 0;
txt_beizhu.Text = txt_mingcheng.Text = "";
}
IPaiDuiJiaoHao vser = ServiceContainer.GetService<IPaiDuiJiaoHao>();
private void btn_add_Click(object sender, EventArgs e)
{
if(lcid!=0)
{
MessageBox.Show("请先点击新建!");
return;
}
if (string.IsNullOrEmpty(txt_mingcheng.Text))
{
MessageBox.Show("楼层名称不能为空!");
return;
}
var lc = new Pd_louceng();
lc.Lcmc = txt_mingcheng.Text;
lc.Bz = txt_beizhu.Text;
var or = vser.addlouceng(lc);
MessageBox.Show(or.Message);
if (or.State == 1)
{
loaddata();
new_init();
}
}
private void loaddata()
{
//throw new NotImplementedException();
var lclist = vser.getLouceng(false);
pdloucengBindingSource.DataSource = lclist;
}
private void btn_modify_Click(object sender, EventArgs e)
{
if (lcid == 0)
{
MessageBox.Show("请先选择要修改的楼层!");
return;
}
if (string.IsNullOrEmpty(txt_mingcheng.Text))
{
MessageBox.Show("楼层名称不能为空!");
return;
}
var lc = new Pd_louceng();
lc.Id = lcid;
lc.Lcmc = txt_mingcheng.Text;
lc.Bz = txt_beizhu.Text;
var or = vser.addlouceng(lc);
MessageBox.Show(or.Message);
if (or.State == 1)
{
loaddata();
new_init();
}
}
private void btn_del_Click(object sender, EventArgs e)
{
if (lcid == 0)
{
MessageBox.Show("请先选择要删除的楼层!");
return;
}
var or = vser.deleteLouCeng(lcid); ;
MessageBox.Show(or.Message);
if (or.State == 1)
{
loaddata();
new_init();
}
}
private void dgv_lc_CellClick(object sender, DataGridViewCellEventArgs e)
{
var lc = dgv_lc.Rows[e.RowIndex].DataBoundItem as Pd_louceng;
lcid = lc.Id;
txt_beizhu.Text = lc.Bz;
txt_mingcheng.Text = lc.Lcmc;
}
}
}