protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SchoolId"] == null || Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            if (!IsPostBack)
            {
                try
                {
                    Common.BindRelationship(ddlRelationshipGuardian1, GetSchoolId());
                    Common.BindRelationship(ddlRelationshipGuardian2, GetSchoolId());
                    DayCareBAL.SchoolService proxy = new DayCareBAL.SchoolService();
                    // Common.BindCountryDropDown(ddlCountry);
                    try
                    {
                        Common.BindStateDropDown(ddlState, proxy.LoadSchoolInfo(new Guid(Session["SchoolId"].ToString())).CountryId.Value.ToString());
                        //ddlState.Items.Insert(0, new ListItem("--Select--", "00000000-0000-0000-0000-000000000000"));
                        Guid Id = proxy.LoadSchoolInfo(new Guid(Session["SchoolId"].ToString())).StateId.Value;

                        ddlState.SelectedValue = Id.ToString();
                    }
                    catch
                    {
                        ddlState.Items.Clear();
                        ddlState.Items.Insert(0, new ListItem("--Select--", "00000000-0000-0000-0000-000000000000"));
                    }



                    if (!string.IsNullOrEmpty(Request.QueryString["ChildFamilyId"]))
                    {
                        ViewState["ChildFamilyId"] = Request.QueryString["ChildFamilyId"].ToString();
                        Session["ChildFamilyId"]   = Request.QueryString["ChildFamilyId"].ToString();
                        LoadFamilyData(new Guid(ViewState["ChildFamilyId"].ToString()));
                    }
                    if (Session["FamilyInfoMessage"] != null)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                        Session.Remove("FamilyInfoMessage");
                    }
                }
                catch (Exception ex)
                {
                    DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.FamilyInfo, "Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                }
            }

            //if (!Common.IsCurrentYear(GetCurrentSchoolYearId(), GetSchoolId()))
            //{
            //    btnSave.Enabled = false;
            //    btnCancel.Enabled = false;
            //}
            SetMenuLink();

            this.Form.DefaultButton = btnSave.UniqueID;
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["SchoolId"] == null || Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }
            if (Session["SchoolId"] != null)
            {
                SchoolId = new Guid(Session["SchoolId"].ToString());
            }
            if (!IsPostBack)
            {
                try
                {
                    this.Form.DefaultButton = btnSave.UniqueID;
                    Common.BindUserGroupDropDown(ddlUserGroup, SchoolId);
                    Common.BindStaffCategoryDropDown(ddlStaffCategory, SchoolId);
                    Common.BindCountryDropDown(ddlCountry);

                    //ddlState.Items.Insert(0, new ListItem("--Select--", "00000000-0000-0000-0000-000000000000"));
                    if (!string.IsNullOrEmpty(Request.QueryString["Id"]))// != null && Request.QueryString["Id"]
                    {
                        ViewState["SelectedStaffId"] = Request.QueryString["Id"].ToString();
                        LoadStaffDetails(new Guid(ViewState["SelectedStaffId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                    }
                    else
                    {
                        DayCareBAL.SchoolService   proxySchool = new DayCareBAL.SchoolService();
                        DayCarePL.SchoolProperties objSchool   = proxySchool.LoadSchoolInfo(new Guid(Session["SchoolId"].ToString()));
                        if (objSchool != null)
                        {
                            if (ddlCountry != null && ddlCountry.Items.Count > 0)
                            {
                                if (ddlCountry.Items.IndexOf(ddlCountry.Items.FindByValue(objSchool.CountryId.ToString())) != -1)
                                {
                                    ddlCountry.SelectedValue = objSchool.CountryId.ToString();
                                }
                            }
                            Common.BindStateDropDown(ddlState, ddlCountry.SelectedValue);
                            if (ddlState != null && ddlState.Items.Count > 0)
                            {
                                if (ddlState.Items.IndexOf(ddlState.Items.FindByValue(objSchool.StateId.ToString())) != -1)
                                {
                                    ddlState.SelectedValue = objSchool.StateId.ToString();
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Staff, "Page_Load", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                }
            }

            if (Session["CurrentSchoolYearId"] != null)
            {
                CurrentSchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString());
            }

            //if (!Common.IsCurrentYear(CurrentSchoolYearId, SchoolId))
            //{
            //    btnSave.Enabled = false;
            //    btnCancel.Enabled = false;
            //}
            SetMenuLink();
        }
Beispiel #3
0
        public void LoadSchoolInfo(Guid SchoolId)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.School, "LoadSchoolInfo", "LoadSchoolInfo called", DayCarePL.Common.GUID_DEFAULT);
            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.School, "LoadSchoolInfo", "Debug LoadSchoolInfo Of Role", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.SchoolService   proxySchoolService = new DayCareBAL.SchoolService();
                DayCarePL.SchoolProperties objSchool          = proxySchoolService.LoadSchoolInfo(SchoolId);
                DayCareBAL.FontService     proxyFontService   = new DayCareBAL.FontService();
                DayCarePL.FontProperties[] lstFont            = proxyFontService.LoadFont();

                if (objSchool != null)
                {
                    if (!string.IsNullOrEmpty(objSchool.iPadBackgroundImage))
                    {
                        imgSchholImage.ImageUrl = "../StaffImages/" + objSchool.iPadBackgroundImage;
                    }
                    else
                    {
                        imgSchholImage.ImageUrl = "../StaffImages/Filetype-Blank-Alt-icon.png";
                    }
                    txtName.Text             = objSchool.Name;
                    txtAddress1.Text         = objSchool.Address1;
                    txtAddress2.Text         = objSchool.Address2;
                    txtCity.Text             = objSchool.City;
                    txtZip.Text              = objSchool.Zip;
                    ddlCountry.SelectedValue = objSchool.CountryId.ToString();
                    if (!objSchool.CountryId.ToString().Equals(DayCarePL.Common.GUID_DEFAULT))
                    {
                        Common.BindStateDropDown(ddlState, objSchool.CountryId.ToString());
                    }
                    if (ddlState.Items != null && ddlState.Items.Count > 0)
                    {
                        ddlState.SelectedValue = objSchool.StateId.ToString();
                    }
                    txtMainPhone.Text      = objSchool.MainPhone;
                    txtSecondaryPhone.Text = objSchool.SecondaryPhone;
                    txtFax.Text            = objSchool.Fax;
                    txtEmail.Text          = objSchool.Email;
                    txtWebSite.Text        = objSchool.WebSite;
                    chkCodeRequire.Checked = objSchool.CodeRequired;
                    if (objSchool.LateFeeAmount != null)
                    {
                        txtLateFee.Text = objSchool.LateFeeAmount.ToString();
                    }

                    txtiPadHeader.Text = objSchool.iPadHeader;
                    //txtiPadHeaderFont.Text = objSchool.iPadHeaderFont;
                    //txtiPadHeaderFontSize.Text = objSchool.iPadHeaderFontSize.HasValue ? objSchool.iPadHeaderFontSize.ToString() : "0";
                    lbliPadHeaderColor.BackColor     = System.Drawing.ColorTranslator.FromHtml(objSchool.iPadHeaderColor);
                    rcpiPadHeaderColor.SelectedColor = System.Drawing.ColorTranslator.FromHtml(objSchool.iPadHeaderColor);
                    txtiPadMessage.Text = objSchool.iPadMessage;
                    //txtiPadMessageFont.Text = objSchool.iPadMessageFont;
                    //txtiPadMessageFontSize.Text = objSchool.iPadMessageFontSize.HasValue ? objSchool.iPadMessageFontSize.ToString() : "0"; ;
                    lbliPadBackgroundImage.Text       = objSchool.iPadBackgroundImage;
                    lbliPadMessageColor.BackColor     = System.Drawing.ColorTranslator.FromHtml(objSchool.iPadMessageColor);
                    rcpiPadMessageColor.SelectedColor = System.Drawing.ColorTranslator.FromHtml(objSchool.iPadMessageColor);
                    if (lstFont != null && lstFont.Count() > 0)
                    {
                        ddliPadHeaderFont.Items.Clear();
                        ddliPadMessageFont.Items.Clear();
                        foreach (DayCarePL.FontProperties objFont in lstFont)
                        {
                            ddliPadHeaderFont.Items.Add(new ListItem(objFont.Name, objFont.Name));
                            ddliPadMessageFont.Items.Add(new ListItem(objFont.Name, objFont.Name));
                        }
                        ddliPadHeaderFont.Items.Insert(0, new ListItem("--Select--", "-1"));
                        ddliPadMessageFont.Items.Insert(0, new ListItem("--Select--", "-1"));
                    }
                    if (!string.IsNullOrEmpty(objSchool.iPadHeaderFont))
                    {
                        ddliPadHeaderFont.SelectedValue = objSchool.iPadHeaderFont;
                    }
                    else
                    {
                        ddliPadHeaderFont.SelectedIndex = 0;
                    }

                    if (objSchool.iPadHeaderFontSize != null)
                    {
                        ddliPadHeaderFontSize.SelectedValue = objSchool.iPadHeaderFontSize.ToString();
                    }
                    else
                    {
                        ddliPadHeaderFontSize.SelectedIndex = 0;
                    }
                    if (!string.IsNullOrEmpty(objSchool.iPadMessageFont))
                    {
                        ddliPadMessageFont.SelectedValue = objSchool.iPadMessageFont;
                    }
                    else
                    {
                        ddliPadMessageFont.SelectedIndex = 0;
                    }
                    if (objSchool.iPadMessageFontSize != null)
                    {
                        ddliPadMessageFontSize.SelectedValue = objSchool.iPadMessageFontSize.ToString();
                    }
                    else
                    {
                        ddliPadMessageFontSize.SelectedIndex = 0;
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }