示例#1
0
    /*
     * Delete chapter if training is not sceduled.
     * The pageSize passed in GET_Program_List is -1 as it lists all program in table LMS_DTL_TRAINING_PROGRAM
     *
     * */
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        try
        {
            string    IsProgram_Scheduled = string.Empty;
            int       is_Fetch_Count      = 1;
            DataTable dt = BLL_LMS_Training.GET_Program_List("", null, 1, -1, ref is_Fetch_Count).Tables[0];

            if (dt.Rows.Count > 0)
            {
                DataRow[] dr = dt.Select("PROGRAM_ID='" + Convert.ToInt32(Request.QueryString["Program_Id"]) + "'");
                if (dr.Length > 0)
                {
                    if (dr[0].ItemArray[2].ToString() != "" && dr[0].ItemArray[3].ToString() != "")
                    {
                        string js = String.Format("alert('Chapter can not be deleted as Training schedule has already been planned for this chapter.'); " + "parent.ReloadParent_ByButtonID();");
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ReloadParent", js, true);
                    }
                    else
                    {
                        int Result = BLL_LMS_Training.Del_TRAINING_CHAPTER(UDFLib.ConvertToInteger(ViewState["Chapter_Id"]), Convert.ToInt32(Session["USERID"]));
                        // Response.Redirect("LMS_Chapter_Details.aspx");
                        string js = String.Format("alert('Chapter Deleted Successfully'); " + "parent.ReloadParent_ByButtonID();");
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "ReloadParent", js, true);
                    }
                }
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }