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

            data.MilestoneXFeatureId     = MilestoneXFeatureId;
            data.MilestoneId             = MilestoneId;
            data.FeatureId               = FeatureId;
            data.MilestoneFeatureStateId = MilestoneFeatureStateId;
            data.Memo = Memo;

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

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

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