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.GetRelationProjectHasCRAs(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0)            //--Var
                        {
                            _businesscode.DeleteRelationProjectHasCRAs(RecordID);                                                       //--Var
                        }
                        if (_businesscode.GetRelationProjectHasDoctors(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0)         //--Var
                        {
                            _businesscode.DeleteRelationProjectHasDoctors(RecordID);                                                    //--Var
                        }
                        if (_businesscode.GetRelationProjectHasHospitals(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0)       //--Var
                        {
                            _businesscode.DeleteRelationProjectHasHospitals(RecordID);                                                  //--Var
                        }
                        if (_businesscode.GetRelationProjectHasProjectManagers(Convert.ToInt32(GridView.DataKeys[i].Value)).Count != 0) //--Var
                        {
                            _businesscode.DeleteRelationProjectHasProjectManagers(RecordID);                                            //--Var
                        }
                        _businesscode.DeleteContract(-1, string.Format("OR Project_ID = {0}", RecordID));
                        _businesscode.DeleteProject(RecordID); //--Var
                    }
                }
            }
            Response.Redirect("../Site/ProjectPage.aspx");
        }
Example #2
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.DeleteContract(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/ContractPage.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 id = (int)GridView.DataKeys[i].Value;
                 _businesscode.DeleteContract(-1, string.Format("OR Client_ID = {0}", id));
                 _businesscode.DeleteClient(Convert.ToInt32(id));
             }
         }
     }
     Response.Redirect("../Site/ClientPage.aspx");
 }