Ejemplo n.º 1
0
        public override int?Save(string action)
        {
            var data = new RiskDataModel();

            data.RiskId      = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;

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

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

            return(data.RiskId);
        }
Ejemplo n.º 2
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new RiskDataModel();

            UpdatedData = RiskDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.RiskId =
                    Convert.ToInt32(SelectedData.Rows[i][RiskDataModel.DataColumns.RiskId].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());

                RiskDataManager.Update(data, SessionVariables.RequestProfile);
                data        = new RiskDataModel();
                data.RiskId = Convert.ToInt32(SelectedData.Rows[i][RiskDataModel.DataColumns.RiskId].ToString());
                var dt = RiskDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Ejemplo n.º 3
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new RiskDataModel();

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

            RiskDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Ejemplo n.º 4
0
        private void UpdateData(ArrayList values)
        {
            var data = new RiskDataModel();

            data.RiskId      = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            RiskDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }