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

155 lines
4.4 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using EAS.Services;
using SOH.Kernel;
using SOH.BLL;
using SOH.Entities;
using SOH.Data;
namespace SOH.Queuing.Setting
{
[ModuleAttribute(ModuleID = "9DDE2875-7C1F-4A09-935D-E3848E358883", ModuleName = "检区管理")]
public partial class frm_pd_jianqu : SOH.Window.baseChildForm
{
int jqid = 0;
IPaiDuiJiaoHao vser = ServiceContainer.GetService<IPaiDuiJiaoHao>();
public frm_pd_jianqu()
{
InitializeComponent();
}
private void btn_new_Click(object sender, EventArgs e)
{
new_init();
}
private void new_init()
{
//throw new NotImplementedException();
jqid = 0;
txt_bz.Text = txt_jqmc.Text = txt_pdsx.Text = "";
}
private void frm_pd_jianqu_Load(object sender, EventArgs e)
{
loaddata();
}
private void loaddata()
{
//throw new NotImplementedException();
List<pd_jianqu> jqlist = vser.getJianqulist(false);
pdjianquBindingSource.DataSource = jqlist;
ccb_JQLB.DataSource = SOH.Entities.DTO.dto_khlx.khlxs;
}
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
var jq = dgv_jq.Rows[e.RowIndex].DataBoundItem as pd_jianqu;
jqid = jq.id;
txt_bz.Text = jq.jqbz;
txt_jqmc.Text = jq.jqmc;
txt_pdsx.Text = jq.pdsx.ToString();
ccb_JQLB.SelectedValue = jq.khlx;
}
private void btn_add_Click(object sender, EventArgs e)
{
int jqpx = 0;
if (jqid != 0)
{
MessageBox.Show("请先点击新建!");
return;
}
if(string.IsNullOrEmpty(txt_jqmc.Text))
{
MessageBox.Show("检区名称不能为空!");
return;
}
if(string.IsNullOrEmpty(txt_pdsx.Text))
{
MessageBox.Show("排队顺序不能为空!");
return;
}
if(!int.TryParse(txt_pdsx.Text,out jqpx))
{
MessageBox.Show("排队顺序只能为数字!");
return;
}
var jq = new pd_jianqu();
jq.id = 0;
jq.jqmc = txt_jqmc.Text;
jq.pdsx = jqpx;
jq.jqbz = txt_bz.Text;
jq.khlx = (int)ccb_JQLB.SelectedValue;
OperationResult or = vser.addJianQu(jq);
MessageBox.Show(or.Message);
if(or.State==1)
{
new_init();
loaddata();
}
}
private void btn_modify_Click(object sender, EventArgs e)
{
int jqpx = 0;
if (jqid == 0)
{
MessageBox.Show("请先选择要修改的检区!");
return;
}
if (string.IsNullOrEmpty(txt_jqmc.Text))
{
MessageBox.Show("检区名称不能为空!");
return;
}
if (string.IsNullOrEmpty(txt_pdsx.Text))
{
MessageBox.Show("排队顺序不能为空!");
return;
}
if (!int.TryParse(txt_pdsx.Text, out jqpx))
{
MessageBox.Show("排队顺序只能为数字!");
return;
}
var jq = new pd_jianqu();
jq.id = jqid;
jq.jqmc = txt_jqmc.Text;
jq.pdsx = jqpx;
jq.khlx = (int)ccb_JQLB.SelectedValue;
jq.jqbz = txt_bz.Text;
OperationResult or = vser.addJianQu(jq);
MessageBox.Show(or.Message);
if (or.State == 1)
{
new_init();
loaddata();
}
}
private void btn_del_Click(object sender, EventArgs e)
{
if (jqid == 0)
{
MessageBox.Show("请先选择要删除的检区!");
return;
}
var or = vser.delJianQu(jqid); ;
MessageBox.Show(or.Message);
if (or.State == 1)
{
loaddata();
new_init();
}
}
}
}