コード例 #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);
        }
コード例 #2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new ActivityXDeliverableArtifactDataModel();

            // copies properties from values dictionary object to data object
            PropertyMapper.CopyProperties(data, values);

            ActivityXDeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
コード例 #3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new ActivityXDeliverableArtifactDataModel();

            UpdatedData = ActivityXDeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile).Clone();

            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.ActivityXDeliverableArtifactId =
                    Convert.ToInt32(SelectedData.Rows[i][ActivityXDeliverableArtifactDataModel.DataColumns.ActivityXDeliverableArtifactId].ToString());
                data.ActivityId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ActivityXDeliverableArtifactDataModel.DataColumns.ActivityId))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(ActivityXDeliverableArtifactDataModel.DataColumns.ActivityId))
                                        : int.Parse(SelectedData.Rows[i][ActivityXDeliverableArtifactDataModel.DataColumns.ActivityId].ToString());
                data.DeliverableArtifactId =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ActivityXDeliverableArtifactDataModel.DataColumns.DeliverableArtifactId))
                                        ? int.Parse(CheckAndGetRepeaterTextBoxValue(ActivityXDeliverableArtifactDataModel.DataColumns.DeliverableArtifactId))
                                        : int.Parse(SelectedData.Rows[i][ActivityXDeliverableArtifactDataModel.DataColumns.DeliverableArtifactId].ToString());

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

                ActivityXDeliverableArtifactDataManager.Update(data, SessionVariables.RequestProfile);
                data = new ActivityXDeliverableArtifactDataModel();
                data.ActivityXDeliverableArtifactId = Convert.ToInt32(SelectedData.Rows[i][ActivityXDeliverableArtifactDataModel.DataColumns.ActivityXDeliverableArtifactId].ToString());
                var dt = ActivityXDeliverableArtifactDataManager.Search(data, SessionVariables.RequestProfile);

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