示例#1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (txtName.Text.Trim() == "")
     {
         MessageBox.Show("飞机型号不能为空!");
         return;
     }
     BLL.plane_type Bll = new BLL.plane_type();
     if (Bll.GetModel(txtName.Text.Trim()) != null)
     {
         MessageBox.Show("飞机型号已存在!");
         return;
     }
     Model.plane_type addModel = new Model.plane_type();
     addModel.ptype_name   = txtName.Text.Trim();
     addModel.plane_remark = rchTxtRemark.Text;
     Bll.Add(addModel);
     this.Close();
 }
示例#2
0
        private void initPlaneType()
        {
            progressBar1.Value = 40;
            try
            {
                DataSet          ds    = LoadDataFromExcel(fileName, "飞机型号");
                BLL.plane_type   bll   = new BLL.plane_type();
                Model.plane_type model = new Model.plane_type();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["型号"].ToString() == "")
                    {
                        return;
                    }
                    model.ptype_name = dr["型号"].ToString();;
                    bll.Add(model);
                }
            }

            catch
            {
            }
        }