void pGrid_ItemCommand(object sender, GridCommandEventArgs e)
        {
            Int64 Key = 0;

            // Get the ID for the row to select or delete
            if (e.CommandName.ToUpper() == "SELECT" || e.CommandName.ToUpper() == "DELETE")
            {
                //Key = Methods.Convert_Int64(this.UserGrid.pGrid.MasterTableView.Items[e.Item.ItemIndex].GetDataKeyValue("RecruitmentTestUserID").ToString());
                Key = this.UserGrid.GetKey(e.Item.ItemIndex);
            }

            switch (e.CommandName)
            {
                case "Select":
                    this.Response.Redirect(@"~/Page/User_Details.aspx?ID=" + Key);
                    break;

                case "Delete":
                    ClsKeys ClsKey = new ClsKeys();
                    ClsKey.Add("RecruitmentTestUserID", Convert.ToInt64(Key));

                    this.ClsUser.Load(ClsKey);
                    this.ClsUser.Delete();
                    this.UserGrid.RebindGrid();

                    break;
            }
        }
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Int64 Key = Convert.ToInt64(Request.QueryString["ID"].ToString());
            ClsKeys ClsKey = new ClsKeys();
            ClsKey.Add("RecruitmentTestQuestionsID", Key);

            ClsQuestion objQuestion = new ClsQuestion(this.Master.pCurrentUser);
            objQuestion.Load(ClsKey);
            objQuestion.Delete();

            Response.Redirect("Question.aspx");
        }
        void pGrid_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Int64 Key = 0;

            // Get the ID for the row to select or delete
            if (e.CommandName.ToUpper() == "SELECT" || e.CommandName.ToUpper() == "DELETE")
            {
                Key = this.QuestionGrid.GetKey(e.Item.ItemIndex);
            }

            switch (e.CommandName)
            {
                case "Select":
                    this.Response.Redirect(@"~/Page/Question_Details.aspx?ID=" + Key);
                    break;

                case "Delete":
                    ClsKeys ClsKey = new ClsKeys();
                    ClsKey.Add("RecruitmentTestQuestionsID", Convert.ToInt64(Key));

                    ClsQuestion Obj_Question = new ClsQuestion(this.Master.pCurrentUser);
                    Obj_Question.Load(ClsKey);

                    if (this.Master.pCurrentUser.pUserType != Layer02_Constants.eLookupUserType.Administrator)
                    {
                        Int64 CurrentUserID = Methods.Convert_Int64(this.Master.pCurrentUser.pDrUser["RecruitmentTestUserID"], 0);
                        Int64 OwnerUserID = Methods.Convert_Int64(Obj_Question.pDr["RecruitmentTestUserID_CreatedBy"], 0);

                        if (CurrentUserID != OwnerUserID)
                        {
                            this.Show_EventMsg("You can't delete this question.", ClsBaseMain_Master.eStatus.Event_Error);
                            this.QuestionGrid.RebindGrid();
                            return;
                        }
                    }

                    Obj_Question.Delete();
                    this.QuestionGrid.RebindGrid();
                    break;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the Keys of the supplier datarow using the supplier Key Definition
        /// </summary>
        /// <param name="Dr">
        /// Source datarow
        /// </param>
        /// <param name="KeyNames">
        /// Key definition
        /// </param>
        /// <returns></returns>
        public ClsKeys GetKeys(DataRow Dr, List<string> KeyNames)
        {
            bool IsFound = false;
            ClsKeys Key = new ClsKeys();

            foreach (string Inner_Key in KeyNames)
            {
                if (!Information.IsDBNull(Dr[Inner_Key]))
                { Key.Add(Inner_Key, (Int64)Methods.IsNull(Dr[Inner_Key], 0)); }
                else
                {
                    IsFound = true;
                    break;
                }
            }

            if (IsFound)
            { Key = null; }

            return Key;
        }
Esempio n. 5
0
        /// <summary>
        /// Gets the Keys of the supplied row using the Key Definition of the Data Object
        /// </summary>
        /// <param name="Dr">
        /// Source datarow, mostly the same definition as from Me.List()
        /// </param>
        /// <returns></returns>
        public ClsKeys GetKeys(DataRow Dr)
        {
            ClsKeys Obj = new ClsKeys();

            foreach (string Key in this.mHeader_Key)
            {
                Int64 ID = (Int64)Methods.IsNull(Dr[Key], 0);
                Obj.Add(Key, ID);
            }

            return Obj;
        }
Esempio n. 6
0
        //[-]
        /// <summary>
        /// Gets the current Keys of the Data Object
        /// </summary>
        /// <returns></returns>
        public ClsKeys GetKeys()
        {
            ClsKeys Obj = new ClsKeys();

            foreach (string Key in this.mHeader_Key)
            {
                Int64 ID = Convert.ToInt64(Methods.IsNull(this.mHeader_Dr[Key], 0));
                Obj.Add(Key, ID);
            }

            return Obj;
        }
        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";
        }
Esempio n. 8
0
        public void LoadExam(Int64 ExamID, Int64 ItemsLimit)
        {
            ClsBase Base = new ClsBase();
            Interface_DataAccess Da = Base.pDa;

            DataTable Dt_Exam = Da.GetQuery("RecruitmentTestExams", "", "RecruitmentTestExamsID = " + ExamID);
            Int64 ApplicantID = 0;
            if (Dt_Exam.Rows.Count > 0)
            {
                this.mDr_Exam = Dt_Exam.Rows[0];
                ApplicantID = Convert.ToInt64(Layer01_Methods.IsNull(this.mDr_Exam["RecruitmentTestApplicantID"], 0));
            }
            else
            { throw new Exception("Exam Data not found."); }

            ClsKeys Key = new ClsKeys();
            Key.Add("RecruitmentTestApplicantID", ApplicantID);

            this.mObj_Applicant = new ClsApplicant();
            this.mObj_Applicant.Load(Key);

            DataSet Ds = this.mEm.LoadExam(ExamID);
            this.mDs = Ds;
            this.mDt_Question = Ds.Tables[0];
            this.mDt_Question_Answer = Ds.Tables[1];

            this.mDt_Question.Columns.Add("Ct", typeof(Int64));
            Int64 Ct = 0;
            foreach (DataRow Dr in this.mDt_Question.Rows)
            {
                Ct++;
                Dr["Ct"] = Ct;
            }

            this.mDt_Question_Answer.Columns.Add("Ct", typeof(Int64));
            Ct = 0;
            foreach (DataRow Dr in this.mDt_Question_Answer.Rows)
            {
                Ct++;
                Dr["Ct"] = Ct;
            }

            this.mItemsLimit = ItemsLimit;
            this.mItems = this.mDt_Question.Rows.Count;

            this.mPages = this.mItems / this.mItemsLimit;
            if (this.mItems % this.mItemsLimit > 0)
            { this.mPages++; }
        }
        void SetupPage()
        {
            ClsSysCurrentUser CurrentUser = this.Master.pCurrentUser;
            Int64 ID = Methods.Convert_Int64(this.Request.QueryString["ID"]);
            ClsKeys Key = null;

            if (ID != 0)
            {
                Key = new Layer02_Objects._System.ClsKeys();
                Key.Add("RecruitmentTestQuestionsID", ID);
            }
            else
            { this.mIsNew = true; }

            this.mObj_Base = new ClsQuestion(this.Master.pCurrentUser);
            this.mObj_Base.Load(Key);

            this.mObjID = CurrentUser.GetNewPageObjectID();
            this.ViewState[CnsObjID] = this.mObjID;
            this.Session[this.mObjID] = this.mObj_Base;

            //[-]

            Int64 UserID = Methods.Convert_Int64(CurrentUser.pDrUser["RecruitmentTestUserID"], 0);
            Int64 UserID_CreatedBy = Methods.Convert_Int64(this.mObj_Base.pDr["RecruitmentTestUserID_CreatedBy"], 0);
            bool IsApproved = Convert.ToBoolean(Methods.IsNull(this.mObj_Base.pDr["IsApproved"], false));

            if (!
                    (
                        (CurrentUser.pIsAdmin || ((UserID == UserID_CreatedBy) && (!IsApproved)))
                        || (this.mIsNew)
                    )
                )
            { this.mIsReadOnly = true; }

            //[-]

            if ((bool)Methods.IsNull(CurrentUser.pDrUser["IsAdministrator"], false))
            {
                this.Btn_Approve.Enabled = true;
                //this.Btn_Approve2.Enabled = true;
            }

            //[-]

            ClsQuestion Obj_Question = (ClsQuestion)this.mObj_Base;

            this.Txt_Question.Text = (string)Methods.IsNull(Obj_Question.pDr["Question"], "");
            this.Chk_IsMultipleAnswer.Checked = Convert.ToBoolean(Methods.IsNull(Obj_Question.pDr["IsMultipleAnswer"], false));

            //[-]

            this.SetupPage_ControlAttributes();
            this.BindGrid();
        }
        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();
        }