Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AuthenticateUser();
            intProfile = Int32.Parse(Request.Cookies["profileid"].Value);
            int intApplication = 290;

            oUser       = new Users(intProfile, dsn);
            oScheduling = new Scheduling(intProfile, dsn);
            if (Request.QueryString["schd_id"] != null && Request.QueryString["schd_id"] != "")
            {
                schd_id = Int32.Parse(Request.QueryString["schd_id"]);
                ds      = oScheduling.GetSch(DateTime.Parse(Request.QueryString["date"]), DateTime.MinValue, schd_id);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    lblFacilitator.Text = ds.Tables[0].Rows[0]["facilitator"].ToString();
                    lblEventName.Text   = ds.Tables[0].Rows[0]["event"].ToString();
                    lblLocation.Text    = ds.Tables[0].Rows[0]["location"].ToString();
                    lblNetMeeting.Text  = ds.Tables[0].Rows[0]["netmeeting"].ToString() == string.Empty ? "Not Available" : ds.Tables[0].Rows[0]["netmeeting"].ToString();
                    lblConfLine.Text    = ds.Tables[0].Rows[0]["confline"].ToString() == string.Empty ? "Not Available" : ds.Tables[0].Rows[0]["confline"].ToString();
                    lblPassCode.Text    = ds.Tables[0].Rows[0]["passcode"].ToString() == string.Empty ? "Not Available" : ds.Tables[0].Rows[0]["passcode"].ToString();
                    lblStartTime.Text   = ds.Tables[0].Rows[0]["start_time"].ToString();
                    lblEndTime.Text     = ds.Tables[0].Rows[0]["end_time"].ToString();
                    if (Request.QueryString["view"] != null && Request.QueryString["view"] != "")
                    {
                        panView.Visible     = true;
                        rptUsers.DataSource = oScheduling.GetSchUsers(schd_id);
                        rptUsers.DataBind();
                        lblUsersNone.Visible = (rptUsers.Items.Count == 0);
                    }
                    else
                    {
                        if (Request.QueryString["max"] != null)
                        {
                            lblResult.Text = "<img src='/images/bigError.gif' border='0' align='absmiddle' /> Exceeded the maximum number of people";
                        }
                        if (Request.QueryString["register"] != null)
                        {
                            lblResult.Text = "<img src='/images/bigCheck.gif' border='0' align='absmiddle' /> Registration Successful";
                        }
                        if (Request.QueryString["unregister"] != null)
                        {
                            lblResult.Text = "<img src='/images/bigCheck.gif' border='0' align='absmiddle' /> Unregistration Successful";
                        }
                        panEdit.Visible = true;
                        is_regd         = oScheduling.VerifyUser(intProfile, schd_id);
                        if (is_regd == 1)
                        {
                            panUnregister.Visible = true;
                        }
                        else
                        {
                            panRegister.Visible = true;
                        }
                        if (!IsPostBack)
                        {
                            ds = oUser.Get(intProfile);
                            if (ds.Tables[0].Rows.Count > 0)
                            {
                                lblName.Text = ds.Tables[0].Rows[0]["lname"].ToString() + ", " + ds.Tables[0].Rows[0]["fname"].ToString();
                                if (ds.Tables[0].Rows[0]["phone"].ToString() != String.Empty)
                                {
                                    txtPhone.Text = ds.Tables[0].Rows[0]["phone"].ToString();
                                }
                            }
                            drpDept.DataSource     = oScheduling.GetDeptName(intProfile);
                            drpDept.DataTextField  = "name";
                            drpDept.DataValueField = "name";
                            drpDept.DataBind();
                        }
                    }
                }
                if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
                {
                    intApplication = Int32.Parse(Request.Cookies["application"].Value);
                }
                lblDate.Text = DateTime.Parse(Request.QueryString["date"]).ToLongDateString();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            intProfile  = Int32.Parse(Request.Cookies["profileid"].Value);
            oPage       = new Pages(intProfile, dsn);
            oScheduling = new Scheduling(intProfile, dsn);
            if (Request.QueryString["applicationid"] != null && Request.QueryString["applicationid"] != "")
            {
                intApplication = Int32.Parse(Request.QueryString["applicationid"]);
            }
            if (Request.QueryString["pageid"] != null && Request.QueryString["pageid"] != "")
            {
                intPage = Int32.Parse(Request.QueryString["pageid"]);
            }
            if (Request.Cookies["application"] != null && Request.Cookies["application"].Value != "")
            {
                intApplication = Int32.Parse(Request.Cookies["application"].Value);
            }
            if (Request.QueryString["all"] != null)
            {
                calThis.DayStyle.Width  = Unit.Percentage(15.00);
                calThis.DayStyle.Height = Unit.Percentage(100.00);
                calThis.Width           = Unit.Percentage(100.00);
                calThis.Height          = Unit.Percentage(100.00);
            }
            else
            {
                calThis.DayStyle.Width  = Unit.Percentage(15.00);
                calThis.DayStyle.Height = Unit.Pixel(80);
                calThis.Width           = Unit.Percentage(100.00);
                calThis.Height          = Unit.Pixel(500);
            }
            lblTitle.Text = oPage.Get(intPage, "title");
            DateTime _date = DateTime.Today;

            if (Request.QueryString["d"] != null)
            {
                DateTime.TryParse(Request.QueryString["d"], out _date);
            }
            calThis.VisibleDate    = _date;
            calThis.SelectedDate   = _date;
            ddlYear.SelectedValue  = _date.Year.ToString();
            ddlMonth.SelectedValue = _date.Month.ToString();
            btnToday.ToolTip       = DateTime.Today.ToLongDateString();


            // DateTime fromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            DateTime fromDate, toDate;

            if (_date != DateTime.Today)
            {
                fromDate = _date;
            }
            else
            {
                fromDate = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
            }

            from = fromDate.ToString("M/d/yyyy");

            toDate = new DateTime(fromDate.Year, fromDate.AddMonths(1).Month, 1);
            toDate = toDate.AddDays(-1);

            to = toDate.ToString("M/d/yyyy");

            ds = oScheduling.GetSch(DateTime.Parse(from), DateTime.Parse(to), -1);
        }