예제 #1
0
 //单条增加
 private void barBtnSingle_ItemClick(object sender, ItemClickEventArgs e)
 {
     using (SingleDicData singleForm = new SingleDicData()
     {
         StartPosition = FormStartPosition.CenterScreen, Text = "新增信息"
     })
     {
         singleForm.ShowDialog();
     }
     this.refrashCurrentPage();
     //记录操作日志
     LogUtils.ReviewLogManager.ReviewLog(Properties.Settings.Default.LocalUserName, "数据字典-" + this.barBtnSingle.Caption);
 }
예제 #2
0
        //单条修改
        private void barBtnUpdate_ItemClick(object sender, ItemClickEventArgs e)
        {
            if (this.gvDataInfo.DataSource == null)
            {
                XtraMessageBox.Show("没有可以操作的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            this.gvDataInfo.PostEditor();
            var dataSource = (DataView)this.gvDataInfo.DataSource;
            var dtSelected = dataSource.Table.Copy();

            dtSelected.Clear();
            if (dataSource != null && dataSource.Table.Rows.Count > 0)
            {
                for (int i = 0; i < dataSource.Table.Rows.Count; i++)
                {
                    bool result = false;
                    bool.TryParse(dataSource.Table.Rows[i]["check"].ToString(), out result);
                    if (result)
                    {
                        dtSelected.Rows.Add(dataSource.Table.Rows[i].ItemArray);
                    }
                }
            }
            if (dtSelected.Rows.Count != 1)
            {
                XtraMessageBox.Show(String.Format("每次只能操作一条记录,您选择了{0}条!", dtSelected.Rows.Count), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            string no = dtSelected.Rows[0]["ID"].ToString();

            using (SingleDicData singleForm = new SingleDicData(no)
            {
                StartPosition = FormStartPosition.CenterScreen, Text = "修改信息"
            })
            {
                singleForm.ShowDialog();
            }
            this.refrashCurrentPage();
            //记录操作日志
            LogUtils.ReviewLogManager.ReviewLog(Properties.Settings.Default.LocalUserName, "数据字典-" + this.barBtnUpdate.Caption);
        }