Esempio n. 1
0
        protected void Delete(object sender, EventArgs e)
        {
            bool CheckedOrNot = false;

            for (int i = 0; i < GridView.Rows.Count; i++)
            {
                if (GridView.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    CheckBox chk = (CheckBox)GridView.Rows[i].Cells[0].FindControl("CheckBox") as CheckBox;
                    if (chk.Checked)
                    {
                        int id = (int)GridView.DataKeys[i].Value;
                        _businesscode.DeleteEvaluation(Convert.ToInt32(id), "");
                        CheckedOrNot = true;
                    }
                }
            }

            if (CheckedOrNot == false)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Please select one or more records to delete.')", true);
            }
            else
            {
                Response.Redirect("../Site/EvaluationPage.aspx");
            }
        }
        protected void Delete(object sender, EventArgs e)
        {
            for (int i = 0; i < GridView.Rows.Count; i++)
            {
                if (GridView.Rows[i].RowType == DataControlRowType.DataRow)
                {
                    CheckBox chk = (CheckBox)GridView.Rows[i].Cells[0].FindControl("CheckBox") as CheckBox;
                    if (chk.Checked)
                    {
                        int RecordID = (int)GridView.DataKeys[i].Value;

                        if (_businesscode.GetRelationDoctorHasHospitals(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0)         //--Var
                        {
                            _businesscode.DeleteRelationDoctorHasHospitals(RecordID);                                                    //--Var
                        }
                        if (_businesscode.GetRelationDoctorHasStudyCoordinators(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0) //--Var
                        {
                            _businesscode.DeleteRelationDoctorHasStudyCoordinators(RecordID);                                            //--Var
                        }
                        if (_businesscode.GetRelationDoctorHasProjects(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0)          //--Var
                        {
                            _businesscode.DeleteRelationDoctorHasProjects(RecordID);                                                     //--Var
                        }
                        _businesscode.DeleteEvaluation(-1, string.Format("OR Doctor_ID = {0}", RecordID));
                        _businesscode.DeleteDoctor(RecordID); //--Var
                    }
                }
            }
            Response.Redirect("../Site/DoctorPage.aspx"); //--Var
        }