Exemplo n.º 1
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new ProjectTimeLineDataModel();

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

                data.StartDate =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ProjectTimeLineDataModel.DataColumns.StartDate))
                    ? DateTime.Parse(CheckAndGetRepeaterTextBoxValue(ProjectTimeLineDataModel.DataColumns.StartDate).ToString())
                    : DateTime.Parse(SelectedData.Rows[i][ProjectTimeLineDataModel.DataColumns.StartDate].ToString());

                data.EndDate =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ProjectTimeLineDataModel.DataColumns.EndDate))
                    ? DateTime.Parse(CheckAndGetRepeaterTextBoxValue(ProjectTimeLineDataModel.DataColumns.EndDate).ToString())
                    : DateTime.Parse(SelectedData.Rows[i][ProjectTimeLineDataModel.DataColumns.EndDate].ToString());

                ProjectTimeLineDataManager.Update(data, SessionVariables.RequestProfile);
                data = new ProjectTimeLineDataModel();
                data.ProjectTimeLineId = Convert.ToInt32(SelectedData.Rows[i][ProjectTimeLineDataModel.DataColumns.ProjectTimeLineId].ToString());
                var dt = ProjectTimeLineDataManager.Search(data, SessionVariables.RequestProfile);

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

            return(UpdatedData);
        }
Exemplo n.º 2
0
        public override int?Save(string action)
        {
            var data = new ProjectTimeLineDataModel();

            data.ProjectTimeLineId = ProjectTimeLineId;
            data.ProjectId         = ProjectId;
            data.StartDate         = StartDate;
            data.EndDate           = EndDate;

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

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

            // not correct ... when doing insert, we didn't get/change the value of CountryID ?
            return(ProjectTimeLineId);
        }
Exemplo n.º 3
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new ProjectTimeLineDataModel();

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

            ProjectTimeLineDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }