Click here to Skip to main content
16,007,472 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
hi all,

in my project i added one webpage ConferenceRoom in that i am entering the data related to it but that data i am entering is not getting displayed in database.can u please help me.i am posting the code what i used.

C#
public partial class HRMSNewConferenceRoom : System.Web.UI.Page
{

    #region Global Declaration
    private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    #endregion

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            BindPjctEmployees();
            ddlEmployeeName.Visible = true;
            btnSave.Visible = true;
            btnCancel.Visible = true;
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            ConferenceBM confBM = new ConferenceBM();
            ConferenceBL confBL = new ConferenceBL();

            confBM.EmployeeName = ddlEmployeeName.SelectedItem.Text;
            confBM.PurposeOfBooking = txtPurpose.Text;
            confBM.StartDate = Convert.ToDateTime(txtStartDate.Text);
            confBM.EndDate = Convert.ToDateTime(txtEndDate.Text);
            confBM.StartTime = Convert.ToDateTime(txtStartTime.Text);
            confBM.EndTime = Convert.ToDateTime(txtEndTime.Text);
            confBM.ConferenceRoom = dd1conference.SelectedItem.Text;

            ClientScript.RegisterClientScriptBlock(this.GetType(), "AlertWindow", "<script language='Javascript'>alert('ConferenceRoom Booked Successfully'); </script>");


        }

        catch (Exception ex)
        {
            if (log.IsErrorEnabled)
            {
                log.Error(ex.Message);
            }

        }
    }

    private void BindPjctEmployees()
    {
        TimeSheetBL timeSheetBL = new TimeSheetBL();
        EmpBL empBL = new EmpBL();
        DataSet ds;

        ProjectsBL pjctBL = new ProjectsBL();
        int roleID = pjctBL.GetemployeeRole((string)Session["EmployeeID"]);

        ds = empBL.GetAllEmployees();
        ddlEmployeeName.DataSource = ds;
        ddlEmployeeName.DataTextField = "FullName";
        ddlEmployeeName.DataBind();
        ddlEmployeeName.Items.Insert(0, "--All Employees--");
    }

   }

please suggest me what i need to do?
Posted
Updated 20-Feb-11 22:45pm
v3
Comments
Prerak Patel 21-Feb-11 4:47am    
Where does it save data on btnSave_Click?

You're not actually calling save anywhere though are you?

In btnSave_Click, you're creating an object from type ConferenceBM and assigning values to it. But you haven't persisted this object!

e.g. you need to use your ConferenceBL like...

confBL.SaveConferenceDetails(confBM);


(or whatever method you've created that makes the call to the database for this object type)
 
Share this answer
 
Comments
mandarapu 21-Feb-11 5:39am    
thank u.it is working fine.
You don't appear to have any database related code in your fragment. Did you forget to save anything in the btnSave_Click method?
 
Share this answer
 
You don't save it, so it's not displayed in database. confBM (or congBL, which is unused in your code) should have Save method and you have to call it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900