示例#1
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new MilestoneDataModel();

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

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.Name))
            {
                data.Name = values[StandardDataModel.StandardDataColumns.Name].ToString();
            }

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.Description))
            {
                data.Description = values[StandardDataModel.StandardDataColumns.Description].ToString();
            }

            if (values.ContainsKey(StandardDataModel.StandardDataColumns.SortOrder))
            {
                data.SortOrder = int.Parse(values[StandardDataModel.StandardDataColumns.SortOrder].ToString());
            }

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

            MilestoneDataManager.Update(data, SessionVariables.RequestProfile);

            base.Update(values);
        }
示例#2
0
        public override int?Save(string action)
        {
            var data = new MilestoneDataModel();

            data.MilestoneId = SystemKeyId;
            data.ProjectId   = ProjectId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

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

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

            // not correct ... when doing insert, we didn't get/change the value of MilestoneID ?
            return(data.MilestoneId);
        }
示例#3
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new MilestoneDataModel();

            UpdatedData = MilestoneDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.MilestoneId =
                    Convert.ToInt32(SelectedData.Rows[i][MilestoneDataModel.DataColumns.MilestoneId].ToString());
                data.Name        = SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Name].ToString();
                data.Description =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description))
                                        ? CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.Description)
                                        : SelectedData.Rows[i][StandardDataModel.StandardDataColumns.Description].ToString();

                data.SortOrder =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder))
                                ? int.Parse(CheckAndGetRepeaterTextBoxValue(StandardDataModel.StandardDataColumns.SortOrder).ToString())
                                : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString());

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

                MilestoneDataManager.Update(data, SessionVariables.RequestProfile);
                data             = new MilestoneDataModel();
                data.MilestoneId = Convert.ToInt32(SelectedData.Rows[i][MilestoneDataModel.DataColumns.MilestoneId].ToString());
                var dt = MilestoneDataManager.Search(data, SessionVariables.RequestProfile);

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