Пример #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);
        }
Пример #2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new MilestoneXFeatureDataModel();

            if (values.ContainsKey(MilestoneXFeatureDataModel.DataColumns.MilestoneXFeatureId))
            {
                data.MilestoneXFeatureId = int.Parse(values[MilestoneXFeatureDataModel.DataColumns.MilestoneXFeatureId].ToString());
            }

            if (values.ContainsKey(MilestoneXFeatureDataModel.DataColumns.MilestoneId))
            {
                data.MilestoneId = int.Parse(values[MilestoneXFeatureDataModel.DataColumns.MilestoneId].ToString());
            }

            if (values.ContainsKey(MilestoneXFeatureDataModel.DataColumns.FeatureId))
            {
                data.FeatureId = int.Parse(values[MilestoneXFeatureDataModel.DataColumns.FeatureId].ToString());
            }

            MilestoneXFeatureDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Пример #3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new MilestoneXFeatureDataModel();

            UpdatedData = MilestoneXFeatureDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.MilestoneXFeatureId =
                    Convert.ToInt32(SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.MilestoneXFeatureId].ToString());

                data.MilestoneFeatureStateId = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.MilestoneFeatureStateId))
                    ? int.Parse(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.MilestoneFeatureStateId))
                    : int.Parse(SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.MilestoneFeatureStateId].ToString());
                data.MilestoneId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.MilestoneId))
                    ? int.Parse(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.MilestoneId))
                    : int.Parse(SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.MilestoneId].ToString());

                data.FeatureId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.FeatureId))
                    ? int.Parse(CheckAndGetRepeaterTextBoxValue(MilestoneXFeatureDataModel.DataColumns.FeatureId).ToString())
                    : int.Parse(SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.FeatureId].ToString());

                data.Memo = SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.Memo].ToString();

                MilestoneXFeatureDataManager.Update(data, SessionVariables.RequestProfile);
                data = new MilestoneXFeatureDataModel();
                data.MilestoneXFeatureId = Convert.ToInt32(SelectedData.Rows[i][MilestoneXFeatureDataModel.DataColumns.MilestoneXFeatureId].ToString());
                var dt = MilestoneXFeatureDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }