Beispiel #1
0
        private void SetupDropdown()
        {
            var isTesting            = SessionVariables.IsTesting;
            var questionCategoryData = QuestionCategoryDataManager.GetList(SessionVariables.RequestProfile);

            UIHelper.LoadDropDown(questionCategoryData, drpCategoryList, StandardDataModel.StandardDataColumns.Name, QuestionCategoryDataModel.DataColumns.QuestionCategoryId);

            if (isTesting)
            {
                drpCategoryList.AutoPostBack = true;
                if (drpCategoryList.Items.Count > 0)
                {
                    if (!string.IsNullOrEmpty(txtCategoryId.Text.Trim()))
                    {
                        drpCategoryList.SelectedValue = txtCategoryId.Text;
                    }
                    else
                    {
                        txtCategoryId.Text = drpCategoryList.SelectedItem.Value;
                    }
                }
                txtCategoryId.Visible = true;
            }
            else
            {
                if (!string.IsNullOrEmpty(txtCategoryId.Text.Trim()))
                {
                    drpCategoryList.SelectedValue = txtCategoryId.Text;
                }
            }
        }
Beispiel #2
0
        protected override DataTable UpdateData()
        {
            var UpdatedData = new DataTable();

            var data = new QuestionCategoryDataModel();

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

                QuestionCategoryDataManager.Update(data, SessionVariables.RequestProfile);
                data = new QuestionCategoryDataModel();
                data.QuestionCategoryId = Convert.ToInt32(SelectedData.Rows[i][QuestionCategoryDataModel.DataColumns.QuestionCategoryId].ToString());
                var dt = QuestionCategoryDataManager.Search(data, SessionVariables.RequestProfile);

                if (dt.Rows.Count == 1)
                {
                    UpdatedData.ImportRow(dt.Rows[0]);
                }
            }
            return(UpdatedData);
        }
Beispiel #3
0
        public override int?Save(string action)
        {
            var data = new QuestionCategoryDataModel();

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

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

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

            return(data.QuestionCategoryId);
        }
Beispiel #4
0
        public void LoadData(int questionCategoryId, bool showId)
        {
            Clear();

            var data = new QuestionCategoryDataModel();

            data.QuestionCategoryId = questionCategoryId;

            var items = QuestionCategoryDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count != 1)
            {
                return;
            }

            var item = items[0];

            SetData(item);

            if (!showId)
            {
                SystemKeyId = item.QuestionCategoryId;
                oHistoryList.Setup(PrimaryEntity, questionCategoryId, PrimaryEntityKey);
            }
            else
            {
                CoreSystemKey.Text = String.Empty;
            }
        }
Beispiel #5
0
        private DataTable GetData()
        {
            var data = new QuestionCategoryDataModel();
            var dt   = QuestionCategoryDataManager.Search(data, SessionVariables.RequestProfile);

            return(dt);
        }
Beispiel #6
0
        protected override DataTable GetEntityData(int?entityKey)
        {
            var questionCategorydata = new QuestionCategoryDataModel();

            questionCategorydata.QuestionCategoryId = entityKey;
            var results = QuestionCategoryDataManager.Search(questionCategorydata, SessionVariables.RequestProfile);

            return(results);
        }
Beispiel #7
0
        protected override void Update(Dictionary <string, string> values)
        {
            var data = new QuestionCategoryDataModel();

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

            QuestionCategoryDataManager.Update(data, SessionVariables.RequestProfile);
            base.Update(values);
        }
Beispiel #8
0
        private void UpdateData(ArrayList values)
        {
            var data = new QuestionCategoryDataModel();

            data.QuestionCategoryId = int.Parse(values[0].ToString());
            data.Name        = values[1].ToString();
            data.Description = values[2].ToString();
            data.SortOrder   = int.Parse(values[3].ToString());
            QuestionCategoryDataManager.Update(data, SessionVariables.RequestProfile);
            ReBindEditableGrid();
        }
Beispiel #9
0
        private DataTable GetQuestionData(int?QuestionCategoryId)
        {
            QuestionCategoryDataModel data = new QuestionCategoryDataModel();

            data.QuestionCategoryId = QuestionCategoryId;
            var dt         = QuestionCategoryDataManager.GetDetails(data, SessionVariables.RequestProfile);
            var Questiondt = QuestionDataManager.GetList(SessionVariables.RequestProfile);
            var resultdt   = Questiondt.Clone();

            foreach (DataRow row in dt.Rows)
            {
                var rows = Questiondt.Select("QuestionId = " + row[QuestionDataModel.DataColumns.QuestionId]);
                resultdt.ImportRow(rows[0]);
            }

            return(resultdt);
        }
Beispiel #10
0
 protected void btnDelete_Click(object sender, EventArgs e)
 {
     try
     {
         string[] deleteIndexList = DeleteIds.Split(',');
         foreach (string index in deleteIndexList)
         {
             var data = new QuestionCategoryDataModel();
             data.QuestionCategoryId = int.Parse(index);
             QuestionCategoryDataManager.Delete(data, SessionVariables.RequestProfile);
             DeleteAndRedirect();
         }
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Beispiel #11
0
        protected override DataTable GetData()
        {
            try
            {
                SuperKey = ApplicationCommon.GetSuperKey();
                SetId    = ApplicationCommon.GetSetId();

                var selectedrows         = new DataTable();
                var questionCategorydata = new QuestionCategoryDataModel();

                selectedrows = QuestionCategoryDataManager.GetDetails(questionCategorydata, SessionVariables.RequestProfile).Clone();
                if (!string.IsNullOrEmpty(SuperKey))
                {
                    var systemEntityTypeId = (int)PrimaryEntity;
                    var lstEntityKeys      = ApplicationCommon.GetSuperKeyDetails(systemEntityTypeId, SuperKey);

                    foreach (var entityKey in lstEntityKeys)
                    {
                        questionCategorydata.QuestionCategoryId = entityKey;
                        var result = QuestionCategoryDataManager.GetDetails(questionCategorydata, SessionVariables.RequestProfile);
                        selectedrows.ImportRow(result.Rows[0]);
                    }
                }
                else
                {
                    questionCategorydata.QuestionCategoryId = SetId;
                    var result = QuestionCategoryDataManager.GetDetails(questionCategorydata, SessionVariables.RequestProfile);
                    selectedrows.ImportRow(result.Rows[0]);
                }
                return(selectedrows);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }

            return(null);
        }
Beispiel #12
0
        protected override void ShowData(int questionCategoryId)
        {
            base.ShowData(questionCategoryId);

            oDetailButtonPanel.SetId = SetId;

            Clear();

            var data = new QuestionCategoryDataModel();

            data.QuestionCategoryId = questionCategoryId;

            var items = QuestionCategoryDataManager.GetEntityDetails(data, SessionVariables.RequestProfile);

            if (items.Count == 1)
            {
                var item = items[0];

                SetData(item);

                oHistoryList.Setup(PrimaryEntity, questionCategoryId, "QuestionCategory");
            }
        }
Beispiel #13
0
        public IEnumerable <QuestionCategoryDataModel> GetQuestionCategoryList()
        {
            var items = QuestionCategoryDataManager.GetEntityDetails(QuestionCategoryDataModel.Empty, SessionVariables.RequestProfile);

            return(items);
        }
Beispiel #14
0
        protected override DataTable GetData()
        {
            var dt = QuestionCategoryDataManager.Search(oSearchFilter.SearchParameters, SessionVariables.RequestProfile);

            return(dt);
        }
Beispiel #15
0
 private void ReBindEditableGrid()
 {
     var data = new QuestionCategoryDataModel();
     var dtQuestionCategory = QuestionCategoryDataManager.Search(data, SessionVariables.RequestProfile);
 }
Beispiel #16
0
        private DataTable GetQuestionCategoryList()
        {
            var dt = QuestionCategoryDataManager.GetList(SessionVariables.RequestProfile);

            return(dt);
        }