Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (this.textBox3.Text == null || this.textBox3.Text.ToString().Trim() == "")
            {
                MessageBox.Show("字段規則編號不能為空,請選擇字段規則!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.clearAll();
                this.comboBox2.Focus();
                return;
            }
            ManRelFieldType manRelFieldType = new ManRelFieldType();

            manRelFieldType.ManNo   = this.textBox3.Text.ToString().Trim();
            manRelFieldType.FieldNo = this.comboBox1.SelectedValue.ToString().Trim();

            if (!manRelFieldTypeService.checkAdd(manRelFieldType) && checkFieldNameRepeat(manRelFieldType.FieldNo))
            {
                if (manRelFieldTypeService.saveManRelFieldType(manRelFieldType) != null)
                {
                    this.displayList(manRelFieldType.ManNo);
                    MessageBox.Show("字段類型值分配成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                MessageBox.Show("該字段規則已經存在該字段類型值!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Beispiel #2
0
        public ManRelFieldType queryManRelFieldTypeById(string uuid)
        {
            ManRelFieldType manRelFieldType = null;
            StringBuilder   strSql          = new StringBuilder();

            strSql.Append("SELECT uuid,man_no,field_no,op_user,create_time,update_user,update_time FROM t_mand_relfieldtype where uuid=@uuid and del_flag is null");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@uuid", MySqlDbType.VarChar, 900),
            };
            parameters[0].Value = uuid;
            DataSet ds = SQLHelper.ExecuteDataset(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                manRelFieldType            = new ManRelFieldType();
                manRelFieldType.Uuid       = ds.Tables[0].Rows[0]["uuid"].ToString();
                manRelFieldType.ManNo      = ds.Tables[0].Rows[0]["man_no"].ToString();
                manRelFieldType.FieldNo    = ds.Tables[0].Rows[0]["field_no"].ToString();
                manRelFieldType.OpUser     = ds.Tables[0].Rows[0]["op_user"].ToString();
                manRelFieldType.CreateTime = ds.Tables[0].Rows[0]["create_time"].ToString();
                manRelFieldType.Updateuser = ds.Tables[0].Rows[0]["update_user"].ToString();
                manRelFieldType.UpdateTime = ds.Tables[0].Rows[0]["update_time"].ToString();
            }
            return(manRelFieldType);
        }
Beispiel #3
0
        public bool saveManRelFieldType(ManRelFieldType manRelFieldType)
        {
            bool          saveMark = true;
            StringBuilder strSql   = new StringBuilder();

            strSql.Append("insert into t_mand_relfieldtype (uuid,man_no,field_no,op_user,create_time)");
            strSql.Append("values(@uuid,@manNo,@fieldNo,@opuser,@createtime)");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@uuid",       MySqlDbType.VarChar, 900),
                new MySqlParameter("@manNo",      MySqlDbType.VarChar, 900),
                new MySqlParameter("@fieldNo",    MySqlDbType.VarChar, 900),
                new MySqlParameter("@opuser",     MySqlDbType.VarChar, 900),
                new MySqlParameter("@createtime", MySqlDbType.VarChar, 900)
            };
            parameters[0].Value = manRelFieldType.Uuid;
            parameters[1].Value = manRelFieldType.ManNo;
            parameters[2].Value = manRelFieldType.FieldNo;
            parameters[3].Value = manRelFieldType.OpUser;
            parameters[4].Value = manRelFieldType.CreateTime;
            int rows = SQLHelper.ExecuteNonQuery(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (rows > 0)
            {
                saveMark = true;
            }
            else
            {
                saveMark = false;
            }
            return(saveMark);
        }
Beispiel #4
0
        public ManRelFieldType saveManRelFieldType(ManRelFieldType manRelFieldType)
        {
            ManRelFieldType reManRelFieldType = null;

            manRelFieldType.Uuid       = Auxiliary.Get_UUID();
            manRelFieldType.OpUser     = Auxiliary.loginName;
            manRelFieldType.CreateTime = Auxiliary.Get_CurrentTime();
            if (manRelFieldTypeDao.saveManRelFieldType(manRelFieldType))
            {
                reManRelFieldType = manRelFieldTypeDao.queryManRelFieldTypeById(manRelFieldType.Uuid);
            }
            return(reManRelFieldType);
        }
Beispiel #5
0
        /// <summary>
        /// 檢查是否存在
        /// </summary>
        /// <param name="manRelFieldType"></param>
        /// <returns></returns>
        public bool exists(ManRelFieldType manRelFieldType)
        {
            bool          repeatJudge = false;
            StringBuilder strSql      = new StringBuilder();

            strSql.Append("select count(1) from t_mand_relfieldtype where man_no=@manNo and field_no=@fieldNo and del_flag is null");
            MySqlParameter[] parameters =
            {
                new MySqlParameter("@manNo",   MySqlDbType.VarChar, 900),
                new MySqlParameter("@fieldNo", MySqlDbType.VarChar, 900)
            };
            parameters[0].Value = manRelFieldType.ManNo;
            parameters[1].Value = manRelFieldType.FieldNo;
            int rows = int.Parse(SQLHelper.ExecuteScalar(SQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters).ToString().Trim());

            if (rows > 0)
            {
                repeatJudge = true;
            }
            return(repeatJudge);
        }
Beispiel #6
0
 public bool checkAdd(ManRelFieldType manRelFieldType)
 {
     return(manRelFieldTypeDao.exists(manRelFieldType));
 }