private void Save_Add_New() { if (txtUser_id.Text == "") { MessageBox.Show("用户組別编号不可以为空格!"); return; } if (Check_User_Exists()) { return; } const string sql_new = @"INSERT INTO sys_user(user_id,user_name,group_id,remark,createby,createdate,modifyby,modifydate,status,typeid) VALUES(@user_id,@user_name,@group_id,@remark,@userid,getdate(),@userid,getdate(),'0',@typeid)"; SqlParameter[] spras = new SqlParameter[] { new SqlParameter("@user_id", txtUser_id.Text), new SqlParameter("@user_name", txtUser_name.Text), new SqlParameter("@group_id", prent_node), new SqlParameter("@remark", txtRemark.Text), new SqlParameter("@typeid", "G"), new SqlParameter("@userid", DBUtility._user_id), }; if (clsApp.ExecuteNonQuery(sql_new, spras, false) > 0) { MessageBox.Show("新增用户组别成功!"); } Set_cur_user_node(); }
private void Delete() //刪除當前行 { if (String.IsNullOrEmpty(txtPkey.Text)) { return; } if (dgvDetails.RowCount == 0) { return; } DialogResult result = MessageBox.Show("此操作将刪除当前记奶的资料,请谨慎操作!", "提示信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { const string sql_del = @"Update dbo.formula Set state='2' WHERE pkey=@pkey"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@pkey", int.Parse(txtPkey.Text)) }; if (clsApp.ExecuteNonQuery(sql_del, paras, false) > 0) { int curRow = dgvDetails.FocusedRowHandle; dgvDetails.DeleteRow(curRow);//移走當前行 } } }
private void Save_Add_New() { if (txtUser_id.Text == "") { MessageBox.Show("用户不可以为空格!"); return; } if (Check_User_Exists()) { return; } const string sql_new = @"INSERT INTO sys_user(user_id,user_name,group_id,ava_date,mis_date,createby,createdate,modifyby,modifydate,status,typeid,inherit_type) VALUES(@user_id,@user_name,@group_id,@ava_date,case LEN(@mis_date) when 0 then null else @mis_date end,@userid,getdate(),@userid,getdate(),'0','U','Y')"; string misdate; if (mskMis_date.Text == " / /") { misdate = ""; } else { misdate = mskMis_date.Text; } SqlParameter[] spras = new SqlParameter[] { new SqlParameter("@user_id", txtUser_id.Text), new SqlParameter("@user_name", txtUser_name.Text), new SqlParameter("@group_id", prent_node), new SqlParameter("@ava_date", mskAva_date.Text), new SqlParameter("@mis_date", misdate), new SqlParameter("@userid", DBUtility._user_id) }; if (clsApp.ExecuteNonQuery(sql_new, spras, false) > 0) { MessageBox.Show("新增用户成功!"); } Set_cur_user_node(); }
private void ApproveState(string state) //批準或反批準 { if (txtID.Text == "") { return; } //批準 const string str1 = @"Update dbo.bs_productline Set state=@state Where id=@id"; //反批準 const string str2 = @"Update dbo.bs_productline Set state=@state ,update_by=@user_id,update_date=getdate() Where id=@id"; SqlParameter[] paras = new SqlParameter[] { new SqlParameter("@state", state), new SqlParameter("@user_id", DBUtility._user_id), new SqlParameter("@id", txtID.Text) }; string strSql; if (state == "0") { strSql = str2; } else { strSql = str1; } int num = clsApp.ExecuteNonQuery(strSql, paras, false); if (num > 0) { luestate.EditValue = state; //state=1狀態是1時直接更新庫存. //TO DO } }