コード例 #1
0
ファイル: DutyListViewModel.cs プロジェクト: ali50m/ToolMgt
        private async void Delete()
        {
            if (!Global.HasRight("0403"))
            {
                MessageAlert.Alert("权限不足!");
                return;
            }
            if (SelectedDuty == null)
            {
                MessageAlert.Alert("请选择要删除的记录!");
                return;
            }
            var confirm = await MessageAlert.Confirm("确定删除此记录?");

            if (!confirm)
            {
                return;
            }
            DutyDao dao = new DutyDao();
            var     rlt = dao.DeleteDuty(SelectedDuty.Id);

            if (rlt.HasError)
            {
                MessageAlert.Alert(rlt.Msg);
            }
            RefreshList(null);
        }
コード例 #2
0
        /// <summary>
        /// 确认保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnOK_Click(object sender, EventArgs e)
        {
            if (textDutyName.EditValue == null)
            {
                MessageBox.Show("请输入部门名称");
                return;
            }
            Duty model = new Duty

            {
                DutyName     = textDutyName.EditValue.ToString(),
                DutyCode     = textDutyCode.EditValue.ToString(),
                MnemonicCode = ValueConvert.ToString(textMnemonicCode.EditValue),
                Note         = memoNote.Text.Trim(),
                OperateID    = Program.CurrentEmployee.EmployeeID,
                OperateTime  = DateTime.Now
            };
            bool result = false;

            if (FormState == DS.MSClient.FormState.Modify)
            {
                model.DutyID = curData.DutyID;
                result       = new DutyDao().Update(model);
            }
            else
            {
                model.DutyID = new CommonDAO().GetIntUniqueNumber("t_duty");
                result       = new DutyDao().Add(model);
            }
            if (result)
            {
                MessageBox.Show("保存成功");
                this.DialogResult = DialogResult.OK;
            }
        }
コード例 #3
0
ファイル: MainDuty.cs プロジェクト: zGodless/CarDistpatchSYS
 void MainDuty_Load(object sender, EventArgs e)
 {
     _list = new DutyDao().GetList();
     if (_list.Count > 0)
     {
         gcDuty.DataSource = _list;
         gcDuty.RefreshDataSource();
     }
 }