예제 #1
0
        private void btnCopyNewVersion_Execute(object sender, SimpleActionExecuteEventArgs e)
        {
            if (View.CurrentObject == null)
                return;

            ControlDrawing CurrentControlDrawing = (ControlDrawing)View.CurrentObject;
            if (CurrentControlDrawing.CurrentVersion == false)
            {
                XtraMessageBox.Show("�˲�Ʒ����ͼ���������°汾 !!", "����", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            DialogResult dr = XtraMessageBox.Show("��ȷ�������Ҫ�����°汾, ��Ϊ�⶯���Dz����޸ĵ� !!!", "����", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation);

            if (dr == DialogResult.Cancel)
            {
                XtraMessageBox.Show("�]�н����°汾", "��Ϣ", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            UnitOfWork uow = (UnitOfWork)((XPObjectSpace)View.ObjectSpace).Session;
            ControlDrawing NewControlDrawing = new ControlDrawing(uow);
            CurrentControlDrawing.CopyTo(NewControlDrawing);
            CurrentControlDrawing.Revision++;
            CurrentControlDrawing.Save();
            NewControlDrawing.CurrentVersion = false;
            NewControlDrawing.Save();
            uow.CommitChanges();
        }
예제 #2
0
        public void CopyTo(ControlDrawing ToControlDrawing)
        {
            ToControlDrawing.Item = Item;
            ToControlDrawing.Jia = Jia;
            ToControlDrawing.Machine = Machine;
            ToControlDrawing.NextProcessNo = NextProcessNo;
            ToControlDrawing.ProcessNo = ProcessNo;
            ToControlDrawing.PreProcessNo = PreProcessNo;
            ToControlDrawing.CurrentVersion = CurrentVersion;
            ToControlDrawing.Revision = Revision;
            ToControlDrawing.Control = Control;
            ToControlDrawing.CycleTime = CycleTime;

            foreach (ControlDrawingTool ControlDrawingTool in ControlDrawingTools)
            {
                ToControlDrawing.ControlDrawingTools.Add(ControlDrawingTool);
            }

            foreach(ControlDrawingDetail CDDetail in ControlDrawingDetails)
            {
                ControlDrawingDetail NewCDDetail = new ControlDrawingDetail(Session);
                CDDetail.CopyTo(NewCDDetail);
                ToControlDrawing.ControlDrawingDetails.Add(NewCDDetail);
            }
        }