示例#1
0
    public string Get_FAQ_List(string SearchFaq, int?Page_Index, int?Page_Size, string TableStyleCSS, string HeaderStyleCSS, string QuestionCSS, string AnswerCSS, int Edit)
    {
        int       is_Fetch_Count = 1;
        DataTable dt             = BLL_LMS_FAQ.Get_FAQ_List(UDFLib.ConvertStringToNull(SearchFaq), UDFLib.ConvertIntegerToNull(Page_Index), UDFLib.ConvertIntegerToNull(Page_Size), ref is_Fetch_Count).Tables[0];

        string result = CreateFAQListFromDataTable(dt, TableStyleCSS, HeaderStyleCSS, QuestionCSS, AnswerCSS, Edit);

        return(result + "~totalrecordfound~" + is_Fetch_Count.ToString());
    }
示例#2
0
    public bool check(string s, string a)
    {
        //DataTable dt = BLL_LMS_FAQ.Check_Faq_List(s,a);
        DataTable dt = BLL_LMS_FAQ.Check_Faq_List(s, a, UDFLib.ConvertToInteger(ddlTopic.SelectedValue));

        if (dt.Rows.Count > 0)
        {
            return(false);
        }
        else
        {
            return(true);
        }
    }
示例#3
0
    protected void btnPublishToCrew_Click(object sender, EventArgs e)
    {
        int    ItemId    = 0;
        string sFileName = "CTRN_" + Guid.NewGuid().ToString() + ".pdf";
        string htmlStr   = "";
        string Question  = "";
        string Answer    = "";

        if (Get_FAQ_ID() > 0)
        {
            DataTable dt = BLL_LMS_FAQ.Get_FAQ_Details(Get_FAQ_ID());
            Question = Convert.ToString(dt.Rows[0]["Question"]);
            Answer   = Convert.ToString(dt.Rows[0]["Answer"]);
            htmlStr += "<table style='width:100%' ><tr><td style='font-size:14;color:navy;font-family:verdana;border-bottom:1px solid black' ><b> " + Question + "</b></td> </tr> <tr> <td  style='font-size:11;color:black;font-family:verdana' >" + Answer + "</td> </tr></table> ";
            string filePath = Server.MapPath("~/") + "Uploads\\TrainingItems\\" + sFileName;
            EO.Pdf.HtmlToPdf.Options.AfterRenderPage = new EO.Pdf.PdfPageEventHandler(On_AfterRenderPage);
            // This use For IIS
            EO.Pdf.HtmlToPdf.Options.BaseUrl = "http://" + HttpContext.Current.Request.Url.Host + "/";
            //This use For Local machine
            EO.Pdf.HtmlToPdf.ConvertHtml(@"<html><head></head><body><div>" + htmlStr + "</div></body></html> ", filePath);
            if (Question.Length > 250)
            {
                Question = Question.Substring(0, 250);
            }
            int Result = BLL_LMS_Training.Ins_Training_Items(Question, null, "ARTICLE", "0", sFileName, sFileName, Convert.ToInt32(Session["USERID"]), 1, ref ItemId);

            string js = "alert(' FAQ published successfully! !');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true);
            txtquestion.Text = string.Empty;
            txtProcedureSectionDetails.Content = string.Empty;
        }
        else
        {
            string js = "alert('Please save the FAQ to proceed!');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert3", js, true);
        }
    }
示例#4
0
    protected void btnSave_FAQ_Click(object sender, EventArgs e)
    {
        //if (!check(txtquestion.Text.ToString(), (txtProcedureSectionDetails.Content)))
        //{
        //    string js = "alert('Faq Question AllReady Exist!');";
        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert9", js, true);
        //    txtquestion.Focus();
        //    return;
        //}
        if (ddlModule.SelectedValue == "0")
        {
            string js2 = "alert('Please select Module to save FAQ!');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert11", js2, true);
            ddlTopic.Focus();
            return;
        }
        if (ddlTopic.SelectedValue == "0")
        {
            string js1 = "alert('Please select Topic to save FAQ!');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "alert10", js1, true);
            ddlTopic.Focus();
            return;
        }
        int    FAQ_ID     = Get_FAQ_ID();
        string successmsg = "";

        if (FAQ_ID == 0)
        {
            successmsg = "FAQ created successfully!";
        }
        else
        {
            successmsg = "FAQ updated successfully!";
        }
        int Sync_To_Vessel = 0;

        if (chkvessel.Checked)
        {
            Sync_To_Vessel = 1;
        }

        try
        {
            // Validate your data, if any
            //FAQ_ID = BLL_LMS_FAQ.Upd_Faq_Details(FAQ_ID, txtquestion.Text.Trim(), txtProcedureSectionDetails.Content, UDFLib.ConvertToInteger(Session["userid"]));
            FAQ_ID = BLL_LMS_FAQ.Upd_Faq_Details(FAQ_ID, txtquestion.Text.Trim(), txtProcedureSectionDetails.Content, UDFLib.ConvertToInteger(Session["userid"]), UDFLib.ConvertToInteger(ddlTopic.SelectedValue));
            if (FAQ_ID > 0)
            {
                DataTable dt_FAQ_Attachments = new DataTable();
                dt_FAQ_Attachments.Columns.Add("ID", typeof(Int32));
                dt_FAQ_Attachments.Columns.Add("ATTACHMENT_NAME", typeof(String));

                string[] FAQ_Attachs = txtProcedureSectionDetails.Content.Split(new string[] { "Uploads/FAQ/" }, StringSplitOptions.None);

                foreach (string Attach in FAQ_Attachs)
                {
                    if (Attach.StartsWith("FAQ_", StringComparison.OrdinalIgnoreCase))
                    {
                        DataRow dr = dt_FAQ_Attachments.NewRow();
                        dr["ID"] = FAQ_ID.ToString();
                        dr["ATTACHMENT_NAME"] = Attach.Substring(0, 44);
                        dt_FAQ_Attachments.Rows.Add(dr);
                    }
                }

                DataTable dtAttachToDelete = BLL_LMS_FAQ.Ins_Attachment(FAQ_ID, Convert.ToInt32(Session["userid"]), dt_FAQ_Attachments, Sync_To_Vessel);


                // delete file not in use
                foreach (DataRow drAttach in dtAttachToDelete.Rows)
                {
                    File.Delete(HttpContext.Current.Server.MapPath("~/Uploads/FAQ/" + drAttach["ATTACHMENT_NAME"]));
                    BLL_LMS_FAQ.Del_Faq_Attachment(Convert.ToString(drAttach["ATTACHMENT_NAME"]), Sync_To_Vessel);
                }
                btnPublishToCrew.Enabled = true;
                btnSave_FAQ.Visible      = false;
                btn_Update_FAQ.Visible   = true;
                string js = "alert('" + successmsg + "');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert1", js, true);
                btnSave_FAQ.Attributes.Add("OnClick", "self.close()");
            }
            else
            {
                btnPublishToCrew.Enabled = false;
                string js = "alert('Question and Answer is mandatory field...!');";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "alert2", js, true);
            }

            hdnFaq_Id.Value = UDFLib.ConvertToInteger(FAQ_ID).ToString();
        }
        catch (Exception ee)
        {
            //"Error occured. " + ee.Message;
        }
    }
示例#5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            BindModule();

            if (Request.QueryString["FAQ_ID"] != null)
            {
                DataTable dt = BLL_LMS_FAQ.Get_FAQ_Details(Convert.ToInt16(Request.QueryString["FAQ_ID"]));
                txtquestion.Text = Convert.ToString(dt.Rows[0]["Question"]);

                if (dt.Rows[0]["Sync_To_Vessel"].ToString() == "1")
                {
                    chkvessel.Checked = true;
                }

                if (ddlModule.Items.FindByValue(dt.DefaultView[0]["Module_ID"].ToString()) != null)
                {
                    ddlModule.SelectedValue = dt.DefaultView[0]["Module_ID"].ToString() != "" ? dt.DefaultView[0]["Module_ID"].ToString() : "0";
                }
                else
                {
                    ddlModule.SelectedValue = "0";
                }

                BindTopic();

                if (ddlTopic.Items.FindByValue(dt.DefaultView[0]["Topic_ID"].ToString()) != null)
                {
                    ddlTopic.SelectedValue = dt.DefaultView[0]["Topic_ID"].ToString() != "" ? dt.DefaultView[0]["Topic_ID"].ToString() : "0";
                }
                else
                {
                    ddlTopic.SelectedValue = "0";
                }



                hdnFaq_Id.Value = UDFLib.ConvertToInteger(Request.QueryString["FAQ_ID"]).ToString();
                txtProcedureSectionDetails.Content = "<html><body>" + Convert.ToString(dt.Rows[0]["Answer"]) + "</body></html>";
                btnSave_FAQ.Visible      = false;
                btn_Update_FAQ.Visible   = true;
                btnPublishToCrew.Enabled = true;
                btnAttach.Visible        = true;
            }
            else
            {
                btnSave_FAQ.Visible      = true;
                btn_Update_FAQ.Visible   = false;
                btnPublishToCrew.Enabled = false;
                ListItem liselect = new ListItem("--Select--", "0", true);
                ddlTopic.Items.Clear();
                ddlTopic.Items.Insert(0, liselect);
                ddlModule.SelectedValue = "0";
            }
            Session["UploadsFiles_Name"] = "";
        }
        string js = "initScripts();";

        ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js, true);
    }