zoukankan      html  css  js  c++  java
  • winform

     
    保存按钮
    #region 保存
    private void button1_Click(object sender, EventArgs e)
    {
    //温湿度采录记录表--新增
    Coldstoragerecord cik = new Coldstoragerecord();
    //部门
    //db.BindDataToComboBox("select * from Coldstoragerecord", comboBox2, "BMID", "BMname");
    cik.BMID1 =int.Parse(this.comboBox1.Text.ToString());
    //监控区域
    cik.AreaID1 = this.comboBox2.Text;
    //采样时间
    cik.DecordDate1 = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
    //温度
    cik.Temperature = this.textBox1.Text;
    //湿度
    cik.Humidity = this.textBox2.Text;
    //处理措施
    cik.Treatmentmeasures1 = this.comboBox3.Text;
    //记录员
    cik.Recordkeeper1 = this.comboBox4.Text;
     
    cik.BMname1 = this.textBox1.Text;
     
    //添加冷库温湿度记录
    Mangar.AddColdstoragerecord(cik);
     
    MessageBox.Show("保存成功!");
    }
    #endregion
     
     
    BLL层
    #region 冷库温湿度记录
    public static bool AddColdstoragerecord(Coldstoragerecord cik)
    {
    return servise.AddColdstoragerecord(cik);
    }
    #endregion
     
     
    DAL层
    #region 冷库温湿度记录
    public static bool AddColdstoragerecord(Coldstoragerecord cik)
    {
     
    //Com c = new Com();
    //int smID = c.getMax("Coldstoragerecord", "1");
     
    string sql = string.Format(@"Insert into Coldstoragerecord (kingID,BMID, AreaID, DecordDate, temperature, humidity, Treatmentmeasures, Recordkeeper, Operator,BMname)values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}')"
    ,cik.KingID ,cik.BMID1, cik.AreaID1, cik.DecordDate1, cik.Temperature, cik.Humidity, cik.Treatmentmeasures1, cik.Recordkeeper1, cik.Operator1, cik.BMname1);
     
    return db.Exect(sql);
     
    }
     
    #endregion
     
     
    DBHelper
    #region 增删改
    public bool Exect(string sql)
    {
    Init();
    SqlCommand com = new SqlCommand(sql, con);
    int i = com.ExecuteNonQuery();
    con.Close();
    return i > 0;
    }
    #endregion
     
     
    Model层
    namespace Model
    {
    public class Coldstoragerecord
    {
     
    public Coldstoragerecord()
    { }
     
    //冷库温湿度记录
     
     
    //ID
    private string kingID;
     
    public string KingID
    {
    get { return kingID; }
    set { kingID = value; }
    }
     
     
    //部门
    private int BMID;
     
    public int BMID1
    {
    get { return BMID; }
    set { BMID = value; }
    }
     
     
     
     
    //监控区域
    private string AreaID;
     
    public string AreaID1
    {
    get { return AreaID; }
    set { AreaID = value; }
    }
    //采样时间
    private string DecordDate;
     
    public string DecordDate1
    {
    get { return DecordDate; }
    set { DecordDate = value; }
    }
    //温度
    private string temperature;
     
    public string Temperature
    {
    get { return temperature; }
    set { temperature = value; }
    }
    //湿度
    private string humidity;
     
    public string Humidity
    {
    get { return humidity; }
    set { humidity = value; }
    }
    //处理措施
    private string Treatmentmeasures;
     
    public string Treatmentmeasures1
    {
    get { return Treatmentmeasures; }
    set { Treatmentmeasures = value; }
    }
    //记录员
    private string Recordkeeper;
     
    public string Recordkeeper1
    {
    get { return Recordkeeper; }
    set { Recordkeeper = value; }
    }
    //操作员
    private string Operator;
     
    public string Operator1
    {
    get { return Operator; }
    set { Operator = value; }
    }
     
     
    //部门名称
     
    private string BMname;
     
    public string BMname1
    {
    get { return BMname; }
    set { BMname = value; }
    }
     
     
     
    }
    }
     
     
     
     
     
     
     
     
  • 相关阅读:
    软件测试中桩模块与驱动模块的概念与区别(转载),打桩
    DataFactory使用和注意,排列组合
    SCWS中文分词,功能函数实例应用
    按指定长度截取中英文混合字符串
    CSS截取中英文混合字符串长度
    使DIV相对窗口大小左右拖动始终水平居中
    浮动5-常用列表显示(案例)
    多选项卡切换原理
    使当前对象相对于上层DIV 水平、垂直居中定位
    使图片相对于上层DIV始终水平、垂直都居中
  • 原文地址:https://www.cnblogs.com/linnew/p/7856854.html
Copyright © 2011-2022 走看看