public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e) { DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.Font, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT); bool result = false; string FontSize = ""; try { DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.Font, "SubmitRecord", " Debug Submit record method called of Font", DayCarePL.Common.GUID_DEFAULT); DayCareBAL.FontService proxySave = new DayCareBAL.FontService(); DayCarePL.FontProperties objFont = new DayCarePL.FontProperties(); Telerik.Web.UI.GridDataItem item = (Telerik.Web.UI.GridDataItem)e.Item; var InsertItem = e.Item as Telerik.Web.UI.GridEditableItem; Telerik.Web.UI.GridEditManager editMan = InsertItem.EditManager; if (InsertItem != null) { foreach (GridColumn column in e.Item.OwnerTableView.RenderColumns) { if (column is IGridEditableColumn) { IGridEditableColumn editableCol = (column as IGridEditableColumn); if (editableCol.IsEditable) { IGridColumnEditor editor = editMan.GetColumnEditor(editableCol); switch (column.UniqueName) { case "Name": { objFont.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString(); ViewState["Name"] = objFont.Name; break; } case "Color": { //objFont.Color=(e.Item.FindControl("rcpColor") as RadColorPicker ). if ((e.Item.FindControl("rcpColor") as RadColorPicker) != null && (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name != "0") { objFont.Color = "#" + (e.Item.FindControl("rcpColor") as RadColorPicker).SelectedColor.Name; } break; } case "Size": { FontSize = (e.Item.FindControl("txtSize") as TextBox).Text.Trim(); //objFont.Size = Convert.ToInt32((e.Item.FindControl("txtSize") as TextBox).Text.Trim()); ViewState["Size"] = objFont.Size; break; } case "Active": { objFont.Active = (editor as GridCheckBoxColumnEditor).Value; break; } } } } } int res = 0; Int32.TryParse(FontSize, out res); if (res == 0) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Font size must be numeric.", "false")); return(false); } else { objFont.Size = Convert.ToInt32(FontSize); } if (string.IsNullOrEmpty(objFont.Color)) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select color.", "false")); return(false); } if (e.CommandName != "PerformInsert") { //objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); objFont.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString()); if (!objFont.Name.Trim().Equals(hdnName.Value.Trim())) { bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "update", objFont.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } } else { bool ans = Common.CheckDuplicate("Font", "Name", objFont.Name, "insert", objFont.Id.ToString()); if (ans) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Already Exist", "false")); return(false); } } hdnName.Value = ""; result = proxySave.Save(objFont); if (result == true) { MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager; MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false")); } } } catch (Exception ex) { DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.Font, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT); result = false; } return(result); }
protected void rgFont_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) { DayCareBAL.FontService proxyFont = new DayCareBAL.FontService(); rgFont.DataSource = proxyFont.LoadFont(); }
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) { } }