/// <summary> /// 添加对象 /// </summary> public void AddObject() { //检查对象链表是否已经加载 //if (ObjectList == null) //{ // return; //} //新建对象 if (catygory == "") { return; } RtfAttachFiles obj = new RtfAttachFiles(); obj.C_UID = catygory; obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null); //执行添加操作 using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR()) { string parentid = "0"; if (treeList1.FocusedNode != null && treeList1.FocusedNode.GetValue("ParentID").ToString() != "0") { MessageBox.Show("只能在一级目录下添加附件"); return; } else { parentid = FocusedObject.UID; } dlg.IsCreate = true; //设置新建标志 dlg.Object = obj; dlg.ParentID = parentid; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //Common.Services.BaseService.Create<RtfAttachFiles>(obj); RefreshData(); ////将新对象加入到链表中 //ObjectList.Add(obj); ////刷新表格,并将焦点行定位到新对象上。 //treeList1.RefreshDataSource(); //Set_Focus(obj.UID); }
/// <summary> /// 修改焦点对象 /// </summary> public void UpdateObject() { if (catygory == "") { return; } //获取焦点对象 RtfAttachFiles obj = FocusedObject; if (obj == null) { return; } if (obj.ParentID == "0") { return; } //创建对象的一个副本 RtfAttachFiles objCopy = new RtfAttachFiles(); DataConverter.CopyTo <RtfAttachFiles>(obj, objCopy); //执行修改操作 using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR()) { dlg.Object = objCopy; //绑定副本 if (dlg.ShowDialog() != DialogResult.OK) { return; } } //Common.Services.BaseService.Update<RtfAttachFiles>(objCopy); RefreshData(); ////用副本更新焦点对象 DataConverter.CopyTo <RtfAttachFiles>(objCopy, obj); ////刷新表格 //treeList1.RefreshDataSource(); }
/// <summary> /// �Ľ������ /// </summary> public void UpdateObject() { if (catygory == "") { return; } //��ȡ������� RtfAttachFiles obj = FocusedObject; if (obj == null) { return; } if (obj.ParentID== "0") { return; } //���������һ������ RtfAttachFiles objCopy = new RtfAttachFiles(); DataConverter.CopyTo<RtfAttachFiles>(obj, objCopy); //ִ���IJ��� using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR()) { dlg.Object = objCopy; //���� if (dlg.ShowDialog() != DialogResult.OK) { return; } } //Common.Services.BaseService.Update<RtfAttachFiles>(objCopy); RefreshData(); ////�ø������½������ DataConverter.CopyTo<RtfAttachFiles>(objCopy, obj); ////ˢ�±�� //treeList1.RefreshDataSource(); }
/// <summary> /// ��Ӷ��� /// </summary> public void AddObject() { //�����������Ƿ��Ѿ����� //if (ObjectList == null) //{ // return; //} //�½����� if (catygory == "") { return; } RtfAttachFiles obj = new RtfAttachFiles(); obj.C_UID = catygory; obj.CreateDate = (DateTime)Services.BaseService.GetObject("SelectSysData", null); //ִ����Ӳ��� using (FrmRtfAttachFilesDialogTR dlg = new FrmRtfAttachFilesDialogTR()) { string parentid = "0"; if (treeList1.FocusedNode!=null&&treeList1.FocusedNode.GetValue("ParentID").ToString()!="0") { MessageBox.Show("ֻ����һ��Ŀ¼����Ӹ���"); return; } else { parentid = FocusedObject.UID; } dlg.IsCreate = true; //�����½���־ dlg.Object = obj; dlg.ParentID = parentid; if (dlg.ShowDialog() != DialogResult.OK) { return; } } //Common.Services.BaseService.Create<RtfAttachFiles>(obj); RefreshData(); ////���¶�����뵽������ //ObjectList.Add(obj); ////ˢ�±���������ж�λ���¶����ϡ� //treeList1.RefreshDataSource(); //Set_Focus(obj.UID); }