コード例 #1
0
        public override void Load(ClsKeys Keys = null)
        {
            base.Load(Keys);
            this.CheckIfDeleted();

            //[-]

            Int64 QuestionID = Convert.ToInt64(Layer01_Methods.IsNull(this.pDr["RecruitmentTestQuestionsID"], 0));
            if (QuestionID != 0)
            {
                Keys = new ClsKeys();
                Keys.Add("Lkp_RecruitmentTestQuestionsID", QuestionID);
            }
            else
            { Keys = null; }

            this.mBL_QuestionAnswer.Load(Keys);

            foreach (DataRow Dr in this.mBL_QuestionAnswer.pDt_List.Rows)
            {
                ClsAnswer Inner_Obj = new ClsAnswer();
                ClsKeys Inner_Keys = null;
                Int64 Inner_ID = Convert.ToInt64(Layer01_Methods.IsNull(Dr["Lkp_RecruitmentTestAnswersID"], 0));

                if (Inner_ID != 0)
                {
                    Inner_Keys = new ClsKeys();
                    Inner_Keys.Add("RecruitmentTestAnswersID", Inner_ID);
                }

                Inner_Obj.Load(Inner_Keys);
                this.mBO_Answer.Add(Convert.ToInt64(Layer01_Methods.IsNull(Dr["TmpKey"], 0)).ToString(), Inner_Obj);
            }

            DataRow[] ArrDr = this.mBL_QuestionAnswer.pDt_List.Select("", "OrderIndex");
            int Ct = 0;
            foreach (DataRow Dr in ArrDr)
            {
                Ct++;
                Dr["OrderIndex"] = Ct;
            }

            this.FixOrderIndex(true);
            this.mBL_QuestionAnswer.pDt_List.DefaultView.Sort = "OrderIndex";
        }
コード例 #2
0
        protected void RadAjaxPanel1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
        {
            string[] Tmp;
            string CommandName = string.Empty;
            Int32 ItemIndex = -1;
            string ComboText = "";
            try
            {
                Tmp = e.Argument.Split(',');
                CommandName = Tmp[0];

                switch (CommandName)
                {
                    case "Dialog_Answer":
                        ComboText = Tmp[1];
                        break;
                    case "Delete":
                        ItemIndex = Methods.Convert_Int32(Tmp[1], -1);
                        break;
                }
            }
            catch { }

            switch (CommandName)
            {
                case "Dialog_Answer":
                    {
                        Int64 Key = Methods.Convert_Int64(this.RadWindow1_Hid_TmpKey.Value);
                        Layer02_Objects.Modules_Objects.ClsQuestion Obj = (Layer02_Objects.Modules_Objects.ClsQuestion)this.mObj_Base;
                        Layer02_Objects.Modules_Objects.ClsAnswer Obj_Answer = null;
                        System.Data.DataRow Dr_QA = null;

                        bool IsNew = false;
                        if (Key == 0)
                        { IsNew = true; }
                        else
                        {
                            System.Data.DataRow[] Arr_Dr = Obj.pDt_QuestionAnswer.Select("TmpKey = " + Key);
                            if (Arr_Dr.Length > 0)
                            {
                                Dr_QA = Arr_Dr[0];
                                Obj_Answer = (Layer02_Objects.Modules_Objects.ClsAnswer)Obj.pBO_Answer[Key.ToString()];
                            }
                            else
                            { IsNew = true; }
                        }

                        if (IsNew)
                        {
                            Dr_QA = Obj.pDt_QuestionAnswer.NewRow();
                            Dr_QA["TmpKey"] = Layer02_Objects.Modules_Base.Abstract.ClsBase.GetNewTmpKey(Obj.pDt_QuestionAnswer);
                            Obj.pDt_QuestionAnswer.Rows.Add(Dr_QA);
                        }

                        bool IsNewAnswer = false;
                        if (this.RadWindow1_RadComboBox1.SelectedValue == "")
                        { IsNewAnswer = true; }

                        if (IsNewAnswer || IsNew)
                        {
                            Obj_Answer = new Layer02_Objects.Modules_Objects.ClsAnswer();
                            if (IsNewAnswer)
                            {
                                Obj_Answer.Load();
                                //Obj_Answer.pDr["Answer"] = this.RadWindow1_RadComboBox1.Text;
                                Obj_Answer.pDr["Answer"] = ComboText;
                            }

                            Obj.pBO_Answer.Add(Dr_QA["TmpKey"].ToString(), Obj_Answer);
                        }

                        if (!IsNewAnswer)
                        {
                            Layer02_Objects._System.ClsKeys Inner_Key = null;
                            Inner_Key = new Layer02_Objects._System.ClsKeys();
                            Inner_Key.Add("RecruitmentTestAnswersID", Layer01_Common.Common.Methods.Convert_Int64(this.RadWindow1_RadComboBox1.SelectedValue));
                            Obj_Answer.Load(Inner_Key);
                        }

                        Dr_QA["IsAnswer"] = this.RadWindow1_Chk_IsAnswer.Checked;
                        Dr_QA["Lkp_RecruitmentTestAnswersID_Desc"] = (string)Layer01_Common.Common.Methods.IsNull(Obj_Answer.pDr["Answer"], "");

                        break;
                    }
                case "Delete":
                    {
                        Int64 Key = Methods.Convert_Int64(this.RadGrid1.MasterTableView.Items[ItemIndex].GetDataKeyValue("TmpKey").ToString());
                        ClsQuestion Obj = (ClsQuestion)this.mObj_Base;
                        DataRow[] Arr_Dr = Obj.pDt_QuestionAnswer.Select("TmpKey = " + Key);
                        if (Arr_Dr.Length > 0)
                        { Arr_Dr[0].Delete(); }
                        break;
                    }
            }

            this.BindGrid();
        }