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; } }
protected override void DeleteRecord(long KeyID) { /* Customer DeleteRecord Rights A Question Record can be deleted by: The user who created the record and has the Delete Rights and the record is not approved. A user who has the Delete and View Rights and the record is not approved. */ Keys ClsKey = new Keys(); ClsKey.Add("RecruitmentTestQuestionsID", Convert.ToInt64(KeyID)); ClsQuestion Obj_Question = new ClsQuestion(this.pCurrentUser); Obj_Question.Load(ClsKey); if (this.pCurrentUser.CheckAccess(Layer02_Constants.eSystem_Modules.Question, Layer02_Constants.eAccessLib.eAccessLib_Delete)) { Int64 CurrentUserID = Do_Methods.Convert_Int64(this.pCurrentUser.pDrUser["RecruitmentTestUserID"], 0); Int64 OwnerUserID = Do_Methods.Convert_Int64(Obj_Question.pDr["RecruitmentTestUserID_CreatedBy"], 0); bool IsApproved = Do_Methods.Convert_Boolean(Obj_Question.pDr["IsApproved"]); if (! ( ( (CurrentUserID == OwnerUserID) || (this.pCurrentUser.CheckAccess(Layer02_Constants.eSystem_Modules.Question, Layer02_Constants.eAccessLib.eAccessLib_View)) ) && (!IsApproved) ) ) { this.Show_EventMsg("You can't delete this question.", ClsBaseMain_Master.eStatus.Event_Error); } else { Obj_Question.Delete(); } } this.pGridList.RebindGrid(); }
void SetupPage() { ClsQuestion Obj_Question = new ClsQuestion(this.pCurrentUser); //[-] List<ClsBindGridColumn_Web_Telerik> List_Gct = new List<ClsBindGridColumn_Web_Telerik>(); /* ClsBindGridColumn_Telerik RedirectColumn = new ClsBindGridColumn_Telerik("", "", 50, "", Constants.eSystem_Lookup_FieldType.FieldType_Button); RedirectColumn.mCommandName = "Select"; RedirectColumn.mFieldText = ">>"; List_Gct.Add(RedirectColumn); */ ClsBindGridColumn_Web_Telerik Gc_Select = new ClsBindGridColumn_Web_Telerik("", "", 50, "", Layer01_Constants.eSystem_Lookup_FieldType.FieldType_HyperLink); Gc_Select.mFieldText = ">>"; Gc_Select.mFieldNavigateUrl_Text = this.ResolveUrl("~/Page/Question_Details.aspx?ID={0}"); Gc_Select.mFieldNavigateUrl_Field = "RecruitmentTestQuestionsID"; List_Gct.Add(Gc_Select); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("RecruitmentTestQuestionsID", "Question ID", 120)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("Question", "Question Description", 400)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("Category_Desc", "Category", 200)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("QuestionType_Desc", "Question Type", 200)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("Status_Desc", "Status", 120)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("UserName_CreatedBy", "Created By", 120)); List_Gct.Add(new ClsBindGridColumn_Web_Telerik("UserName_ApprovedBy", "Approved By", 120)); ClsBindGridColumn_Web_Telerik DeleteColumn = new ClsBindGridColumn_Web_Telerik("", "", 100, "", Layer01_Constants.eSystem_Lookup_FieldType.FieldType_Button); DeleteColumn.mCommandName = "Delete"; DeleteColumn.mFieldText = "Delete"; List_Gct.Add(DeleteColumn); QuestionGrid.pGrid.ClientSettings.ClientEvents.OnCommand = "Grid_OnDeleteCommand"; QuestionGrid.Setup_WithRequery(this.Master.pCurrentUser, Obj_Question, List_Gct, "RecruitmentTestQuestionsID", true, true); //[-] this.ListFilter.Setup(this.pCurrentUser, new List<ClsBindGridColumn>(List_Gct), Obj_Question.List_Empty(), this.QuestionGrid.pAjaxPanel); //[-] this.Panel_Back.Visible = this.Master.pCurrentUser.pUserType == Layer02_Constants.eLookupUserType.Administrator; }
protected override void Page_Load(object sender, EventArgs e) { if (this.pIsPageLoaded) { return; } base.Page_Load(sender, e); this.RadAjaxPanel_AnswerWindow.AjaxRequest += new Telerik.Web.UI.RadAjaxControl.AjaxRequestDelegate(RadAjaxPanel_AnswerWindow_AjaxRequest); this.RadAjaxPanel1.AjaxRequest += new Telerik.Web.UI.RadAjaxControl.AjaxRequestDelegate(RadAjaxPanel1_AjaxRequest); this.Btn_Approve.Click += new EventHandler(Btn_Approve_Click); this.mObj = (ClsQuestion)this.pObj_Base; if (!this.IsPostBack) { this.SetupPage_Rights(); this.SetupPage(); } }