示例#1
0
        public override int?Save(string action)
        {
            var data = new ActivityXDeliverableArtifactDataModel();

            data.ActivityXDeliverableArtifactId = ActivityXDeliverableArtifactId;
            data.ActivityId                  = ActivityId;
            data.DeliverableArtifactId       = DeliverableArtifactId;
            data.DeliverableArtifactStatusId = DeliverableArtifactStatusId;

            if (action == "Insert")
            {
                var dtActivityXDeliverableArtifact = ActivityXDeliverableArtifactDataManager.DoesExist(data, SessionVariables.RequestProfile);

                if (dtActivityXDeliverableArtifact.Rows.Count == 0)
                {
                    ActivityXDeliverableArtifactDataManager.Create(data, SessionVariables.RequestProfile);
                }
                else
                {
                    throw new Exception("Record with given ID already exists.");
                }
            }
            else
            {
                ActivityXDeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
            }

            // not correct ... when doing insert, we didn't get/change the value of ActivityXDeliverableArtifactID ?
            return(data.ActivityXDeliverableArtifactId);
        }