protected override void AddObject() { CodeEditWindow form = new CodeEditWindow(2, CharacterCasing.Upper, false); form.FormClosed += (o, e) => { if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { T_MaterailType matType = new T_MaterailType() { Code = form.Code, Desc = form.Desc }; _Proxy.AddMatType(matType); this.gvCode.RefreshData(); } }; form.ShowDialog(); }
protected override void EditObject() { if (this.gvCode.GetFocusedRow() == null) return; T_MaterailType matType = this.gvCode.GetFocusedRow() as T_MaterailType; CodeEditWindow form = new CodeEditWindow(2, CharacterCasing.Upper, true); form.Code = matType.Code; form.Desc = matType.Desc; form.FormClosed += (o, e) => { matType.Desc = form.Desc; _Proxy.UpdateMatType(matType); this.gvCode.RefreshData(); }; form.ShowDialog(); }
protected override void AddObject() { CodeEditWindow form = new CodeEditWindow(3, CharacterCasing.Upper, false); form.FormClosed += (o, e) => { if (form.DialogResult == System.Windows.Forms.DialogResult.OK) { T_StockCode stockCode =new T_StockCode() { Code = form.Code, Desc = form.Desc }; if (this.StockCodeTreeList.DataSource != null) { List<T_StockCode> codeList = this.StockCodeTreeList.DataSource as List<T_StockCode>; stockCode.Id = codeList.Select(t => t.Id).Max() + 1; } else { stockCode.Id = 0; } if (this.StockCodeTreeList.FocusedNode == null) { stockCode.ParentId = -1; } else { stockCode.ParentId = Convert.ToInt16(this.StockCodeTreeList.FocusedNode.GetValue("Id")); } //_Proxy.AddStockCode(stockCode); this.StockCodeTreeList.BeginUnboundLoad(); DevExpress.XtraTreeList.Nodes.TreeListNode node = this.StockCodeTreeList.AppendNode(stockCode, this.StockCodeTreeList.FocusedNode); node.SetValue("Id", stockCode.Id); node.SetValue("Code", stockCode.Code); node.SetValue("Desc", stockCode.Desc); this.StockCodeTreeList.EndUnboundLoad(); } }; form.ShowDialog(); }
protected override void EditObject() { if (this.StockCodeTreeList.FocusedNode == null) return; CodeEditWindow form = new CodeEditWindow(2, CharacterCasing.Upper, false); form.Code = this.StockCodeTreeList.FocusedNode.GetValue("Code").ToString(); form.Desc = this.StockCodeTreeList.FocusedNode.GetValue("Desc").ToString(); form.FormClosed += (o, e) => { T_CodeType codeType = new T_CodeType() { Code = form.Code, Desc = form.Desc, Id = Convert.ToInt16(this.StockCodeTreeList.FocusedNode.GetValue("Id")), ParentId = Convert.ToInt16(this.StockCodeTreeList.FocusedNode.GetValue("ParentId")) }; _Proxy.UpdateCodeType(codeType); this.StockCodeTreeList.FocusedNode.SetValue("Code", codeType.Code); this.StockCodeTreeList.FocusedNode.SetValue("Desc", codeType.Desc); }; form.ShowDialog(); }