Exemplo n.º 1
0
        protected void rgRelationship_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            DayCareBAL.RelationshipService proxyRelationship = new DayCareBAL.RelationshipService();
            Guid SchoolId = new Guid();

            if (Session["SchoolId"] != null)
            {
                SchoolId = new Guid(Session["SchoolId"].ToString());
            }
            rgRelationship.DataSource = proxyRelationship.LoadRelationship(SchoolId);
        }
Exemplo n.º 2
0
 public static void BindRelationship(DropDownList ddlRelationship, Guid SchoolId)
 {
     try
     {
         DayCareBAL.RelationshipService          proxyRelationship = new DayCareBAL.RelationshipService();
         List <DayCarePL.RelationshipProperties> lstRelationship   = proxyRelationship.LoadRelationship(SchoolId);
         ddlRelationship.Items.Clear();
         if (lstRelationship != null && lstRelationship.Count > 0)
         {
             ddlRelationship.DataSource     = lstRelationship.FindAll(r => r.Active == true);
             ddlRelationship.DataTextField  = "Name";
             ddlRelationship.DataValueField = "Id";
             ddlRelationship.DataBind();
         }
         ddlRelationship.Items.Insert(0, new ListItem("--Select--", DayCarePL.Common.GUID_DEFAULT));
     }
     catch
     {
     }
 }
Exemplo n.º 3
0
        public bool SubmitRecord(object sender, GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.SchoolYear, "SubmitRecord", "Debug Submit Record Of SchoolYear", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.RelationshipService   proxyRelationship = new DayCareBAL.RelationshipService();
                DayCarePL.RelationshipProperties objRelationship   = new DayCarePL.RelationshipProperties();

                GridDataItem item       = (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 GridEditableColumn)
                        {
                            IGridEditableColumn editTableColumn = (column as IGridEditableColumn);

                            if (editTableColumn.IsEditable)
                            {
                                IGridColumnEditor editor = editMan.GetColumnEditor(editTableColumn);

                                switch (column.UniqueName)
                                {
                                case "Name":
                                {
                                    objRelationship.Name = (e.Item.FindControl("txtName") as TextBox).Text;
                                    break;
                                }

                                case "Comments":
                                {
                                    objRelationship.Comments = (e.Item.FindControl("txtComments") as TextBox).Text;
                                    break;
                                }

                                case "Active":
                                {
                                    objRelationship.Active = (editor as GridCheckBoxColumnEditor).Value;
                                    break;
                                }
                                }
                            }
                        }
                    }

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

                    if (e.CommandName != "PerformInsert")
                    {
                        objRelationship.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());

                        bool ans = proxyRelationship.CheckDuplicateRelationshipName(objRelationship.Name, objRelationship.Id, objRelationship.SchoolId);
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Relationship name Already Exist", "false"));
                            return(false);
                        }

                        if (Session["StaffId"] != null)
                        {
                            objRelationship.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                    }
                    else
                    {
                        bool ans = proxyRelationship.CheckDuplicateRelationshipName(objRelationship.Name, objRelationship.Id, objRelationship.SchoolId);
                        if (ans)
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Relationship name Already Exist", "false"));
                            return(false);
                        }
                    }
                    hdnName.Value = "";

                    result = proxyRelationship.Save(objRelationship);
                    if (result)
                    {
                        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.Relationship, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }