Example #1
0
 //成品库位保存
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (CheckDataIntegrity() == true)
     {
         Model.CPKW ck = new Model.CPKW();
         ck.Id       = Guid.NewGuid().ToString();
         ck.Cpkw     = textBox1.Text;
         ck.CPKWName = textBox2.Text;
         //检测库位代码和库位名称时候重复
         if (CheckLocationCodeRepeat(textBox1.Text))
         {
             MessageBox.Show("库位代码重复", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (CheckLocationNameRepeat(textBox2.Text))
         {
             MessageBox.Show("库位名称重复", "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         if (SQL.SqlExecute.CPKWInsert(ck) == 0)
         {
             MessageBox.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
         }
         else
         {
             MessageBox.Show("保存失败", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     else
     {
         MessageBox.Show("所填数据必须为非空", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #2
0
        public static int CPKWInsert(Model.CPKW ck)
        {
            SqlHelper.connectionStr = GetSQLConnect();
            string sqlstr = "INSERT INTO WMS_M_CPKW (ID,CPKW,CPKWName) VALUES ('" + ck.Id + "','" + ck.Cpkw + "','" + ck.CPKWName + "')";

            try
            {
                SqlHelper.ExecCommand(sqlstr);
                return(0);
            }
            catch
            {
                return(-1);
            }
        }