Beispiel #1
0
        private DataTable GetEvent(int EventID, int EventPeriodID)
        {
            BusinessServices.Event objEvent = new BusinessServices.Event();
            DataTable dtEvent = objEvent.GetEvent(EventID, EventPeriodID, UserContext.UserData.OrgID);

            return(dtEvent);
        }
Beispiel #2
0
        private void LoadEvent(int EventID, int EventPeriodID)
        {
            try
            {
                BusinessServices.Event objEvent = new BusinessServices.Event();
                DataTable dtEvent = objEvent.GetEvent(EventID, EventPeriodID, UserContext.UserData.OrgID);
                if (dtEvent.Rows.Count > 0)
                {
                    this.txtEventName.Text          = dtEvent.Rows[0]["EventName"].ToString();
                    EventNameCheck                  = dtEvent.Rows[0]["EventName"].ToString();
                    this.txtEventItem.Text          = dtEvent.Rows[0]["EventItem"].ToString();
                    this.txtEventLocation.Text      = dtEvent.Rows[0]["EventLocation"].ToString();
                    this.txtEventProvider.Text      = dtEvent.Rows[0]["EventProvider"].ToString();
                    this.ddlEventType.SelectedValue = dtEvent.Rows[0]["EventType"].ToString();
                    // this.chkstatus.Checked = Boolean.Parse(dtEvent.Rows[0]["RegisterPoint"].ToString());
                    //this.chkallowuser.Checked = Boolean.Parse(dtEvent.Rows[0]["AllowUser"].ToString());
                    this.ddlCPDProfile.SelectedValue = dtEvent.Rows[0]["ProfileID"].ToString();
                    ViewState["EventID"]             = EventID;
                    ViewState["EventPeriodID"]       = EventPeriodID;
                    ViewState["CurrentEventPoints"]  = dtEvent.Rows[0]["Points"].ToString();;
                    // if (Session["Action"] == "Edit")
                    EventFileList();

                    if (this.panPeriod.Visible == true)
                    {
                        if (!dtEvent.Rows[0]["datestart"].Equals(System.DBNull.Value))
                        {
                            DateTime dtStart = (DateTime)dtEvent.Rows[0]["datestart"];
                            this.ddlCurrentDateStartDay.SelectedValue    = dtStart.Day.ToString();
                            this.ddlCurrentDateStartMonth.SelectedValue  = dtStart.Month.ToString();
                            this.ddlCurrentDateStartYear.SelectedValue   = dtStart.Year.ToString();
                            this.ddlCurrentDateStartHour.SelectedValue   = dtStart.Hour.ToString();
                            this.ddlCurrentDateStartMinute.SelectedValue = dtStart.Minute.ToString();
                        }
                        if (!dtEvent.Rows[0]["dateend"].Equals(System.DBNull.Value))
                        {
                            DateTime dtStart = (DateTime)dtEvent.Rows[0]["dateend"];
                            this.ddlCurrentDateEndDay.SelectedValue    = dtStart.Day.ToString();
                            this.ddlCurrentDateEndMonth.SelectedValue  = dtStart.Month.ToString();
                            this.ddlCurrentDateEndYear.SelectedValue   = dtStart.Year.ToString();
                            this.ddlCurrentDateEndHour.SelectedValue   = dtStart.Hour.ToString();
                            this.ddlCurrentDateEndMinute.SelectedValue = dtStart.Minute.ToString();
                        }
                        if (!dtEvent.Rows[0]["Points"].Equals(System.DBNull.Value))
                        {
                            this.txtCurrentPoints.Text = dtEvent.Rows[0]["Points"].ToString();
                        }

                        string strEndOfPeriodAction = dtEvent.Rows[0]["EndOfPeriodAction"].ToString();
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLog el = new ErrorHandler.ErrorLog(ex, ErrorLevel.High, "Usercpdevent.aspx.cs", "LoadEvent", ex.Message);
            }
        }
        private void dgrCPD_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
        {
            //if (e.Item.ItemType != ListItemType.Pager)
            //{
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                DataRowView drv     = (DataRowView)e.Item.DataItem;
                int         EventID = (int)drv["EventID"];

                BusinessServices.Event objEvent = new BusinessServices.Event();
                DataTable dtEvent = objEvent.GetEvent(EventID, -1, UserContext.UserData.OrgID);

                if (dtEvent.Rows.Count > 0)
                {
                    if (GEventid != EventID)
                    {
                        GEventid       = EventID;
                        GEventrowcount = 0;
                    }
                    else
                    {
                        GEventrowcount++;
                    }
                    if (!dtEvent.Rows[GEventrowcount]["DateStart"].Equals(System.DBNull.Value))
                    {
                        DateTime dtStart = (DateTime)dtEvent.Rows[GEventrowcount]["DateStart"];
                        if (dtStart < DateTime.Now) //Current Period
                        {
                            Label lblCurrentDate = (Label)e.Item.FindControl("lblCurrentDate");
                            lblCurrentDate.Text =
                                string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["DateStart"])
                                + " - " +
                                string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["DateEnd"]);

                            Label lblStarttime = (Label)e.Item.FindControl("lblStarttime");
                            lblStarttime.Text = string.Format("{0:hh:mm tt}", (DateTime)dtEvent.Rows[GEventrowcount]["DateStart"]);

                            Label lblendtime = (Label)e.Item.FindControl("lblendtime");
                            lblendtime.Text = string.Format("{0:hh:mm tt}", (DateTime)dtEvent.Rows[GEventrowcount]["DateEnd"]);

                            Label lblFutureDate = (Label)e.Item.FindControl("lblFutureDate");
                            if (!dtEvent.Rows[GEventrowcount]["FutureDateStart"].Equals(System.DBNull.Value))
                            {
                                lblFutureDate.Text =
                                    string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["FutureDateStart"])
                                    + " - " +
                                    string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["FutureDateEnd"]);
                            }
                        }
                        else //Future Period
                        {
                            Label lblFutureDate = (Label)e.Item.FindControl("lblFutureDate");
                            lblFutureDate.Text =
                                string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["DateStart"])
                                + " - " +
                                string.Format("{0:dd/MM/yyyy}", (DateTime)dtEvent.Rows[GEventrowcount]["DateEnd"]);
                        }
                    }
                }
            }
            //}
        }
Beispiel #4
0
        //override protected void OnInit(EventArgs e)
        //{
        //    //
        //    // CODEGEN: This call is required by the ASP.NET Web Form Designer.
        //    //
        //    InitializeComponent();
        //    base.OnInit(e);

        //}
        //private void InitializeComponent()
        //{
        //    this.txtCurrentPoints.TextChanged +=new EventHandler(txtCurrentPoints_TextChanged);
        //}

        //void txtCurrentPoints_TextChanged(object sender, EventArgs e)
        //{
        //    if (int.Parse(txtCurrentPoints.Text) <= int.Parse(lblavailablepoint.Text))
        //    {

        //    }
        //    else
        //    {
        //        txtCurrentPoints.Text = "0";
        //    }

        //}
        protected void Page_Load(object sender, System.EventArgs e)
        {
            try
            {
                BusinessServices.Organisation objOrganisation = new BusinessServices.Organisation();
                if (objOrganisation.GetOrganisationCPDAccess(UserContext.UserData.OrgID))
                {
                    pagTitle.InnerText = ResourceManager.GetString("pagTitle");

                    int EventID;
                    int EventPeriodID;
                    //int ProfileID;
                    //string EventName;
                    //int EventType;

                    try
                    {
                        EventID = int.Parse(Session["EventID"].ToString());
                    }
                    catch
                    {
                        EventID = -1;
                    }
                    try
                    {
                        EventPeriodID = int.Parse(Session["EventPeriodID"].ToString());
                    }
                    catch
                    {
                        EventPeriodID = -1;
                    }

                    this.InitialisePage(EventID, EventPeriodID);

                    if (!Page.IsPostBack)
                    {
                        Session["PageIndex"] = 0;
                        PopulateDropdown(this.ddlCurrentDateStartDay, this.ddlCurrentDateStartMonth, this.ddlCurrentDateStartYear);
                        PopulateDropdown(this.ddlCurrentDateEndDay, this.ddlCurrentDateEndMonth, this.ddlCurrentDateEndYear);

                        this.ddlCurrentDateStartDay.SelectedValue   = System.DateTime.Today.Day.ToString();
                        this.ddlCurrentDateStartMonth.SelectedValue = System.DateTime.Today.Month.ToString();
                        this.ddlCurrentDateStartYear.SelectedValue  = System.DateTime.Today.Year.ToString();


                        this.ddlCurrentDateEndDay.SelectedValue   = System.DateTime.Today.Day.ToString();
                        this.ddlCurrentDateEndMonth.SelectedValue = System.DateTime.Today.Month.ToString();
                        this.ddlCurrentDateEndYear.SelectedValue  = System.DateTime.Today.Year.ToString();


                        SetSortOrder("LastName");
                        BindCPDProfile();
                        BindEventType();
                        checkAvailablepoint(EventID, EventPeriodID);
                        BusinessServices.Event objEvent = new BusinessServices.Event();
                        DataTable dtEvent = objEvent.GetEvent(EventID, EventPeriodID, UserContext.UserData.OrgID);
                        try
                        {
                            txtEventName.Text           = dtEvent.Rows[0]["EventName"].ToString();
                            txtEventName.ReadOnly       = true;
                            ddlCPDProfile.SelectedValue = dtEvent.Rows[0]["ProfileID"].ToString();
                            ddlCPDProfile.Enabled       = false;
                            ddlEventType.SelectedValue  = dtEvent.Rows[0]["EventType"].ToString();
                            // ddlEventType.Enabled = false;
                            ViewState["CurrentEventPoints"] = "0";
                        }
                        catch
                        { }
                        if (Session["Action"].ToString() == "Add")
                        {
                            EventID       = -1;
                            EventPeriodID = -1;
                        }
                        //By default "No Action" radiobutton checked if a new Event
                        if (EventID > 0) //Existing Event
                        {
                            LoadEvent(EventID, EventPeriodID);
                        }

                        var hours   = Enumerable.Range(0, 24).Select(i => i.ToString());
                        var minutes = Enumerable.Range(0, 60).Select(i => i.ToString());
                        ddlCurrentDateStartHour.DataSource = hours;
                        ddlCurrentDateStartHour.DataBind();
                        ddlCurrentDateStartMinute.DataSource = minutes;
                        ddlCurrentDateStartMinute.DataBind();

                        ddlCurrentDateEndHour.DataSource = hours;
                        ddlCurrentDateEndHour.DataBind();
                        ddlCurrentDateEndMinute.DataSource = minutes;
                        ddlCurrentDateEndMinute.DataBind();
                    }
                }
                else// dosnt have access to CPD
                {
                    pagTitle.InnerText     = ResourceManager.GetString("pagTitle");
                    this.lblPageTitle.Text = ResourceManager.GetString("lblPageTitle");
                    panCPD.Visible         = false;
                    lblMessage.Text        = ResourceManager.GetString("NoAccess");
                    lblMessage.CssClass    = "WarningMessage";
                }
            }
            catch (Exception ex)
            {
                //log exception to event log
                ErrorHandler.ErrorLog el = new ErrorHandler.ErrorLog(ex, ErrorLevel.High, "Usercpdevent.aspx.cs", "Page_Load", ex.Message);
            }
        }