示例#1
0
        public override void OnBtnCommand(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            // MessageBox.Show(e.Item.Caption);
            //新增
            if (e.Item.Caption == BtnCommandEnum.Add)
            {
                ERP_C001_CodeDictionary codeDic = this.eRPC001CodeDictionaryBindingSource.Current as ERP_C001_CodeDictionary;
                if (codeDic == null)
                {
                    throw new AppException("请先选择类别");
                }
                eRPC001CodeBindingSource.AddNew();
                ERP_C001_Code temp = eRPC001CodeBindingSource.Current as ERP_C001_Code;
                temp.CodeID     = codeDic.Code;
                temp.CodeIDDesc = codeDic.FullName;
                // temp.CodeID = treeCodeType.FocusedNode[treeColumnCodeID] == null ? null : treeCodeType.FocusedNode[treeColumnCodeID].ToStr();
                //temp.CodeIDDesc = treeCodeType.FocusedNode[treeColumnCodeIDDesc] == null ? null : treeCodeType.FocusedNode[treeColumnCodeIDDesc].ToStr();

                EditForm("基础代号新增", BtnCommandEnum.Add);
                InitData();
            }
            else if (e.Item.Caption == BtnCommandEnum.Edit)
            {
                EditForm("基础代号修改", BtnCommandEnum.Edit);
            }
            else if (e.Item.Caption == BtnCommandEnum.Delete)
            {
                if (ERPHelper.Instance.MessageDel())
                {
                    var temp = eRPC001CodeBindingSource.Current as ERP_C001_Code;
                    if (temp == null)
                    {
                        throw new AppException("请先选择要删除的数据");
                    }
                    codeService.Delete(temp.Id);
                    eRPC001CodeBindingSource.RemoveCurrent();
                }
            }
            else if (e.Item.Caption == BtnCommandEnum.AddCodeDic)
            {
                eRPC001CodeDictionaryBindingSource.AddNew();
                ERP_C001_CodeDictionary temp = this.eRPC001CodeDictionaryBindingSource.Current as ERP_C001_CodeDictionary;
                temp.ParentId = "0";
                EditDicForm("类型新增", BtnCommandEnum.AddCodeDic);
            }
            else if (e.Item.Caption == BtnCommandEnum.EditCodeDic)
            {
                EditDicForm("类型修改", BtnCommandEnum.EditCodeDic);
            }
        }
示例#2
0
        public ActionResult DeleteConfirmed(int id)
        {
            service.Delete(x => x.SN == id);

            return(RedirectToAction("Index"));
        }