Exemple #1
0
        public override int?Save(string action)
        {
            var data = new TaskPriorityTypeDataModel();

            data.TaskPriorityTypeId = SystemKeyId;
            data.Name        = Name;
            data.Description = Description;
            data.SortOrder   = SortOrder;
            data.Weight      = Weight;

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

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

            return(data.TaskPriorityTypeId);
        }
Exemple #2
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new TaskPriorityTypeDataModel();

            PropertyMapper.CopyProperties(data, values);

            TaskPriorityTypeDataManager.Update(data, SessionVariables.RequestProfile);

            base.Update(values);
        }
Exemple #3
0
        private void UpdateData(ArrayList values)
        {
            var data = new TaskPriorityTypeDataModel();

            data.TaskPriorityTypeId = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            TaskPriorityTypeDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Exemple #4
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();
            var data        = new TaskPriorityTypeDataModel();

            UpdatedData = TaskPriorityTypeDataManager.Search(data, SessionVariables.RequestProfile).Clone();
            for (var i = 0; i < SelectedData.Rows.Count; i++)
            {
                data.TaskPriorityTypeId =
                    Convert.ToInt32(SelectedData.Rows[i][TaskPriorityTypeDataModel.DataColumns.TaskPriorityTypeId].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.Weight =
                    !string.IsNullOrEmpty(CheckAndGetRepeaterTextBoxValue(TaskPriorityTypeDataModel.DataColumns.Weight))
                                        ? decimal.Parse(CheckAndGetRepeaterTextBoxValue(TaskPriorityTypeDataModel.DataColumns.Weight))
                                        : decimal.Parse(SelectedData.Rows[i][TaskPriorityTypeDataModel.DataColumns.Weight].ToString());

                TaskPriorityTypeDataManager.Update(data, SessionVariables.RequestProfile);
                data = new TaskPriorityTypeDataModel();
                data.TaskPriorityTypeId = Convert.ToInt32(SelectedData.Rows[i][TaskPriorityTypeDataModel.DataColumns.TaskPriorityTypeId].ToString());
                var dt = TaskPriorityTypeDataManager.Search(data, SessionVariables.RequestProfile);

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