public override int?Save(string action) { var data = new ActivityDataModel(); data.ActivityId = SystemKeyId; data.Name = Name; data.Description = Description; data.SortOrder = SortOrder; data.LayerId = LayerId; if (action == "Insert") { var dtActivity = ActivityDataManager.DoesExist(data, SessionVariables.RequestProfile); if (dtActivity.Rows.Count == 0) { ActivityDataManager.Create(data, SessionVariables.RequestProfile); } else { throw new Exception("Record with given ID already exists."); } } else { ActivityDataManager.Update(data, SessionVariables.RequestProfile); } return(data.ActivityId); }
protected override void Update(Dictionary <string, string> values) { var data = new ActivityDataModel(); PropertyMapper.CopyProperties(data, values); ActivityDataManager.Update(data, SessionVariables.RequestProfile); base.Update(values); }
private void UpdateData(ArrayList values) { var data = new ActivityDataModel(); data.ActivityId = int.Parse(values[0].ToString()); data.Name = values[1].ToString(); data.Description = values[2].ToString(); data.SortOrder = int.Parse(values[3].ToString()); data.LayerId = int.Parse(values[4].ToString()); ActivityDataManager.Update(data, SessionVariables.RequestProfile); ReBindEditableGrid(); }
protected override DataTable UpdateData() { var UpdatedData = new DataTable(); var data = new ActivityDataModel(); UpdatedData = ActivityDataManager.Search(data, SessionVariables.RequestProfile).Clone(); for (var i = 0; i < SelectedData.Rows.Count; i++) { data.ActivityId = Convert.ToInt32(SelectedData.Rows[i][ActivityDataModel.DataColumns.ActivityId].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)) : int.Parse(SelectedData.Rows[i][StandardDataModel.StandardDataColumns.SortOrder].ToString()); data.LayerId = !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(ActivityDataModel.DataColumns.LayerId)) ? int.Parse(CheckAndGetRepeaterTextBoxValue(ActivityDataModel.DataColumns.LayerId)) : int.Parse(SelectedData.Rows[i][ActivityDataModel.DataColumns.LayerId].ToString()); ActivityDataManager.Update(data, SessionVariables.RequestProfile); data = new ActivityDataModel(); data.ActivityId = Convert.ToInt32(SelectedData.Rows[i][ActivityDataModel.DataColumns.ActivityId].ToString()); var dt = ActivityDataManager.Search(data, SessionVariables.RequestProfile); if (dt.Rows.Count == 1) { UpdatedData.ImportRow(dt.Rows[0]); } } return(UpdatedData); }