You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CaiQie/RfidWeb/Frm/FormPlanAdd.cs

67 lines
1.6 KiB
C#

1 week ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using DB.Entity;
using DB.Service;
using Tool;
namespace RfidWeb.Frm
{
public partial class FormPlanAdd : Form
{
private FromPlanService fromPlanService = new FromPlanService();
private FromPlan fromPlan = null;
private long id = default;
public FormPlanAdd()
{
InitializeComponent();
this.ucCode.InputText = fromPlanService.GetMaxCode();
this.ucNo.InputText = "50";
fromPlan = new FromPlan();
fromPlan.ID = SnowflakeFactory.NewId;
}
public FormPlanAdd(long id)
{
InitializeComponent();
this.id = id;
fromPlan = fromPlanService.Query(id);
this.ucNo.InputText = fromPlan.Num.ToString();
this.ucCode.InputText=fromPlan.Code;
}
private void btnCancel_BtnClick(object sender, EventArgs e)
{
this.Close();
}
private void btnOK_BtnClick(object sender, EventArgs e)
{
fromPlan.Num = ucNo.InputText.ToInt();
fromPlan.Code=ucCode.InputText.ToString();
if (id == 0)
{
fromPlanService.Insert(fromPlan);
}
else
{
fromPlanService.Update(fromPlan);
}
this.Close();
}
}
}