private void AddUpdateEventDetails()
    {
        BLL.EventsLib oEventsLib = new BLL.EventsLib();
        Entity.EventInfo oEventInfo = new Entity.EventInfo();
        oEventInfo.IntEventsId = 0;
        oEventInfo.StrUserName = AppLib.GetLoggedInUserName();
        oEventInfo.DtEventDate = Convert.ToDateTime(txtDate.Text);
        oEventInfo.StrActivity = txtActivity.Text.Trim();
        oEventInfo.StrLocation = txtLocation.Text.Trim();
        oEventInfo.StrComments = txtComments.Text.Trim();

        if (oEventInfo.StrComments.Length > 200)
            oEventInfo.StrComments = oEventInfo.StrComments.Substring(0, 199);

        oEventInfo.ChrIsActive = Convert.ToChar(rdoIsActive.SelectedValue);
        oEventInfo.ChrStatus = Convert.ToChar(rdoApproved.SelectedValue);

        oEventInfo.DtCreatedOn = DateTime.Now;
        oEventInfo.ChrIsDeleted = 'N';
        if (Request.QueryString["id"] != null)
        {
            oEventInfo.IntEventsId = Convert.ToInt32(Request.QueryString["id"]);
            if (oEventsLib.UpdateEventDetails(oEventInfo) > 0)
            {
                oEventsLib = null;
                oEventInfo = null;
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/ManageEvents.aspx?msg=up");
            }
            else
            {
                lblMsg.Text = "Event already exists.";
                return;
            }
        }
        else
        {
            if (oEventsLib.SaveEventDetails(oEventInfo) > 0)
            {
                oEventsLib = null;
                oEventInfo = null;
                Response.Redirect(AppConfig.GetBaseSiteUrl() + "BackOffice/ManageEvents.aspx?msg=ins");
            }
            else
            {
                lblMsg.Text = "Event already exists.";
                return;
            }
        }
        oEventInfo = null;
        oEventsLib = null;
    }
    private void AddUpdateEventDetails()
    {
        BLL.EventsLib oEventsLib = new BLL.EventsLib();
        Entity.EventInfo oEventInfo = new Entity.EventInfo();
        oEventInfo.IntEventsId = 0;
        oEventInfo.StrUserName = AppLib.GetLoggedInUserName();
        oEventInfo.DtEventDate = Convert.ToDateTime(txtDate.Text);
        oEventInfo.StrActivity = txtActivity.Text.Trim();
        oEventInfo.StrLocation = txtLocation.Text.Trim();
        oEventInfo.StrComments = txtComments.Text.Trim();

        oEventInfo.ChrIsActive = 'Y';
        oEventInfo.ChrStatus = 'D';
        oEventInfo.ChrIsDeleted = 'N';

        oEventInfo.DtCreatedOn = DateTime.Now;

        if (ViewState["intEventId"] != null)
        {
            oEventInfo.IntEventsId = Convert.ToInt32(ViewState["intEventId"]);
            if (oEventsLib.UpdateEventDetails(oEventInfo) > 0)
            {
                lblMsg.Text = "Event has been updated successfully.";
                ViewState["intEventId"] = null;
                ClearControls();
                BindEvents();
            }
            else
            {
                lblMsg.Text = "Event already exists.";
                return;
            }
        }
        else
        {
            if (oEventsLib.SaveEventDetails(oEventInfo) > 0)
            {
                lblMsg.Text = "Event has been added successfully.";
                ClearControls();
                BindEvents();
            }
            else
            {
                lblMsg.Text = "Event already exists.";
                return;
            }
        }
        oEventInfo = null;
        oEventsLib = null;
    }