public void init() { smService = SystemManageService.getInstance(); comboBoxEdit_type.Properties.Items.AddRange(smService.getTypes().ToArray()); //设置ComboBoxEdit下拉不可编辑 comboBoxEdit_type.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; comboBoxEdit_type.SelectedIndex = 0; }
public SystemManageForm() { InitializeComponent(); smService = SystemManageService.getInstance(); comboBoxEdit_type.Properties.Items.AddRange(smService.getTypes().ToArray()); //设置ComboBoxEdit下拉不可编辑 comboBoxEdit_type.Properties.TextEditStyle = TextEditStyles.DisableTextEditor; pageUpControl.MyControl = gridControl; pageUpControl.QueryService = smService; initData(formatWhere()); }
private void simpleButton_add_Click(object sender, EventArgs e) { SystemManage sm = new SystemManage(); sm.UserName = textEdit_userName.Text; sm.Password = textEdit_password.Text; sm.Name = textEdit_name.Text; sm.IdCard = textEdit_IDCard.Text; if (String.IsNullOrEmpty(sm.UserName)) { MessageBox.Show("用户名不能为空!", "提示"); return; } if (smService.findRowByIdAndName(id, sm.UserName)) { MessageBox.Show("用户名已重复!", "提示"); return; } if (String.IsNullOrEmpty(sm.Password)) { MessageBox.Show("密码不能为空!", "提示"); return; } if (String.IsNullOrEmpty(sm.Name)) { MessageBox.Show("姓名不能为空!", "提示"); return; } if (String.IsNullOrEmpty(sm.IdCard)) { MessageBox.Show("证件号不能为空!", "提示"); return; } if (comboBoxEdit_type.SelectedIndex == -1 || comboBoxEdit_type.SelectedIndex == 0) { MessageBox.Show("请选择类型!", "提示"); return; } sm.Type = (smService.getTypes())[comboBoxEdit_type.SelectedIndex].Key; sm.Id = Id; //保存 if (Id == 0 && smService.addRow(sm) == true) { MessageBox.Show("保存成功!", "提示"); LogService.getInstance().log("新增,用户名为" + sm.UserName, ModuleConstant.SystemManage_MODULE); this.Close(); } //编辑 else if (Id != 0 && smService.modifyRow(sm) == true) { MessageBox.Show("保存成功!", "提示"); LogService.getInstance().log("修改,用户名为" + sm.UserName, ModuleConstant.SystemManage_MODULE); this.Close(); } else { MessageBox.Show("保存失败!", "提示"); } }