protected void rgClassRoom_DeleteCommand(object source, GridCommandEventArgs e)
        {
            DayCareBAL.ClassRoomService proxyCheckAssignedClassRoom = new DayCareBAL.ClassRoomService();
            Guid Id    = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
            bool Check = proxyCheckAssignedClassRoom.CheckClassRoomAssignedSchoolProgramm(Id);

            if (!Check)
            {
                if (proxyCheckAssignedClassRoom.Delete(Id, new Guid(Session["CurrentSchoolYearId"].ToString())))
                {
                    rgClassRoom.MasterTableView.Rebind();
                    MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Delete Successfully", "false"));
                    return;
                }
                else
                {
                    MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                    MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "This Class Room cannot be deleted until all kids and school programs have been reassigned to another class room.", "false"));
                    return;
                }
            }
            else
            {
                MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "This Class Room cannot be deleted until all kids and school programs have been reassigned to another class room.", "false"));
                return;
            }
        }
        protected void rgClassRoom_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item.ItemType == GridItemType.EditItem)
            {
                DayCarePL.ClassRoomProperties objClassRoom = e.Item.DataItem as DayCarePL.ClassRoomProperties;
                DropDownList ddlStaff = e.Item.FindControl("ddlStaff") as DropDownList;
                Guid         SchoolId = new Guid();
                if (Session["SchoolId"] != null)
                {
                    SchoolId = new Guid(Session["SchoolId"].ToString());
                }
                Guid CurrentSchoolYearId = new Guid();
                if (Session["CurrentSchoolYearId"] != null)
                {
                    CurrentSchoolYearId = new Guid(Session["CurrentSchoolYearId"].ToString());
                }
                if (ddlStaff != null)
                {
                    Common.BindStaff(ddlStaff, SchoolId, CurrentSchoolYearId);
                }
                if (objClassRoom != null)
                {
                    if (ddlStaff != null && ddlStaff.Items.Count > 0)
                    {
                        ddlStaff.SelectedValue = Convert.ToString(objClassRoom.StaffId);
                    }
                }

                if (e.Item.ItemIndex != -1)
                {
                    GridEditableItem            itm            = e.Item as GridEditableItem;
                    CheckBox                    chkActive      = itm["Active"].Controls[0] as CheckBox;
                    DayCareBAL.ClassRoomService proxyClassRoom = new DayCareBAL.ClassRoomService();
                    if (proxyClassRoom.CheckClassRoomAssignedSchoolProgramm(new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString())))
                    {
                        chkActive.Enabled = false;
                        chkActive.ToolTip = "Class is already assigned to program";
                    }
                }
            }
            if (e.Item.ItemIndex == -1)
            {
                if (e.Item.Edit == true)
                {
                    GridEditableItem dataItem  = e.Item as Telerik.Web.UI.GridEditableItem;
                    CheckBox         chkActive = dataItem["Active"].Controls[0] as CheckBox;
                    chkActive.Checked = true;
                }
            }
        }
 protected void rgClassRoom_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     try
     {
         DayCareBAL.ClassRoomService proxyLoad = new DayCareBAL.ClassRoomService();
         Guid SchoolId = new Guid();
         if (Session["SchoolId"] != null)
         {
             SchoolId = new Guid(Session["SchoolId"].ToString());
         }
         rgClassRoom.DataSource = proxyLoad.LoadClassRoom(SchoolId, new Guid(Session["CurrentSchoolYearId"].ToString()));
     }
     catch (Exception ex)
     {
         DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.ClassRoom, "rgClassRoom_NeedDataSource", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
     }
 }
Exemple #4
0
 public static void BindClassRoomReport(DropDownList ddlClassRoom, Guid SchoolId, Guid SchoolYearId)
 {
     try
     {
         DayCareBAL.ClassRoomService     proxyClassRoom = new DayCareBAL.ClassRoomService();
         DayCarePL.ClassRoomProperties[] ClassRoom      = proxyClassRoom.LoadClassRoomReport(SchoolId, SchoolYearId);
         if (ClassRoom != null && ClassRoom.Count() > 0)
         {
             ddlClassRoom.DataSource     = ClassRoom.Where(c => c.Active.Equals(true));
             ddlClassRoom.DataTextField  = "Name";
             ddlClassRoom.DataValueField = "Id";
             ddlClassRoom.DataBind();
             ddlClassRoom.Items.Insert(0, new ListItem("--Select--", DayCarePL.Common.GUID_DEFAULT));
         }
     }
     catch
     {
     }
 }
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;

            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            String strLastNameFrom = Convert.ToString(Request.QueryString["lastnamefrom"]);
            String strLastNameTo   = Convert.ToString(Request.QueryString["lastnameto"]);

            // crp.AfterRender += this.crp_AfterRender;


            rpt.FileName = Server.MapPath("rptStudentSchedule.rpt");
            DayCareBAL.ClassRoomService proxy = new DayCareBAL.ClassRoomService();
            CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"];
            CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"];
            CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
            footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
            //CrystalDecisions.CrystalReports.Engine.TextObject titleText4 = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
            //titleText4.Text = ViewState["title"].ToString();

            titleText.Text       = "Student Schedule";
            titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
            ds = proxy.GetStudentSchedule(new Guid(DayCarePL.Common.GUID_DEFAULT), new Guid(Session["CurrentSchoolYearId"].ToString()), strLastNameFrom, strLastNameTo);
            dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]);
            rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]);

            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.DEBUG, DayCarePL.ModuleToLog.ClassRoom, "SubmitRecord", " Debug Submit record method called of ClassRoom", DayCarePL.Common.GUID_DEFAULT);

                DayCareBAL.ClassRoomService   proxySave    = new DayCareBAL.ClassRoomService();
                DayCarePL.ClassRoomProperties objClassRoom = new DayCarePL.ClassRoomProperties();

                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":
                                {
                                    objClassRoom.Name = (editor as GridTextBoxColumnEditor).Text.Trim().ToString();
                                    ViewState["Name"] = objClassRoom.Name;
                                    break;
                                }

                                case "MaxSize":
                                {
                                    if (!string.IsNullOrEmpty((e.Item.FindControl("txtMaxSize") as TextBox).Text))
                                    {
                                        objClassRoom.MaxSize = Convert.ToInt32((e.Item.FindControl("txtMaxSize") as TextBox).Text);
                                        ViewState["MaxSize"] = objClassRoom.MaxSize;
                                    }
                                    else
                                    {
                                        objClassRoom.MaxSize = 0;
                                    }
                                    break;
                                }

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

                                case "FullName":
                                {
                                    objClassRoom.StaffId = new Guid((e.Item.FindControl("ddlStaff") as DropDownList).SelectedValue);
                                    break;
                                }
                                }
                            }
                        }
                    }
                    if (Session["SchoolId"] != null)
                    {
                        objClassRoom.SchoolId = new Guid(Session["SchoolId"].ToString());
                    }
                    if (e.CommandName != "PerformInsert")
                    {
                        if (Session["StaffId"] != null)
                        {
                            objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString());
                        }
                        objClassRoom.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        // objClassRoom.StaffId = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["FullName"].ToString());
                        if (!objClassRoom.Id.ToString().Equals(hdnName.Value.Trim()))
                        {
                            //  bool ans = Common.CheckDuplicate("ClassRoom", "Name", objClassRoom.Name, "update", objClassRoom.Id.ToString());
                            bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].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("ClassRoom", "Name", objClassRoom.Name, "insert", objClassRoom.Id.ToString());
                        bool ans = proxySave.CheckDuplicateClassRoomName(objClassRoom.Name, objClassRoom.Id, objClassRoom.SchoolId, objClassRoom.StaffId.Value, new Guid(Session["CurrentSchoolYearId"].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(objClassRoom);
                    if (Session["StaffId"] == null)
                    {
                        Response.Redirect("~/Login.aspx");
                    }
                    else
                    {
                        objClassRoom.LastModifiedById = new Guid(Session["StaffId"].ToString());
                    }

                    result = proxySave.SaveClassRoomYearWise(objClassRoom, new Guid(Session["CurrentSchoolYearId"].ToString()));

                    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.ClassRoom, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Exemple #7
0
        protected void Page_Init(object sender, EventArgs e)
        {
            if (Session["CurrentSchoolYearId"] == null)
            {
                Response.Redirect("~/Login.aspx");
            }

            crdata.Report = rpt;
            rpt1          = crdata.ReportDocument;

            DataSet dsReport = new xmlClassWiseStudentAttendTime();
            DataSet ds       = new DataSet();

            // crp.AfterRender += this.crp_AfterRender;

            if (!String.IsNullOrEmpty(Request.QueryString["ClassRoomId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"]))
            {
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent"))
                {
                    rpt.FileName = Server.MapPath("rptClassroomWiseStudent.rpt");
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee"))
                {
                    rpt.FileName = Server.MapPath("rptClassroomWiseStudentWithFee.rpt");
                }
                DayCareBAL.ClassRoomService proxy = new DayCareBAL.ClassRoomService();
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text3"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text1"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                //CrystalDecisions.CrystalReports.Engine.TextObject titleText4 = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text4"];
                //titleText4.Text = ViewState["title"].ToString();
                //titleText.Text = "Class room wise student list report";

                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudent"))
                {
                    titleText.Text = "Student list by class report";
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ClassWiseStudentWithFee"))
                {
                    titleText.Text = "Student fees by class report";
                }
                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                ds = proxy.GetClassroomWiseStudentWeeklySchedule(new Guid(Request.QueryString["ClassRoomId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
                dsReport.Tables["dtClassWiseStudent"].Merge(ds.Tables[0]);
                rpt1.SetDataSource(dsReport.Tables["dtClassWiseStudent"]);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ProgramId"]) && !String.IsNullOrEmpty(Request.QueryString["RepId"]))
            {
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent"))
                {
                    rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklySchedule.rpt");
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee"))
                {
                    rpt.FileName = Server.MapPath("rptProgramWiseStudentWeeklyScheduleWithFee.rpt");
                }
                DayCareBAL.SchoolProgramService proxy = new DayCareBAL.SchoolProgramService();
                CrystalDecisions.CrystalReports.Engine.TextObject titleText       = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text13"];
                CrystalDecisions.CrystalReports.Engine.TextObject titleTextSchool = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["Text10"];
                CrystalDecisions.CrystalReports.Engine.TextObject footer          = (CrystalDecisions.CrystalReports.Engine.TextObject)rpt1.ReportDefinition.ReportObjects["txtfooter"];
                footer.Text = Common.GetSchoolWiseAddress(new Guid(Session["SchoolId"].ToString()));
                // titleText.Text = "Program wise student list report";

                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudent"))
                {
                    titleText.Text = "Student list by Program report";
                }
                if (Convert.ToString(Request.QueryString["RepId"]).Equals("ProgramWiseStudentWithFee"))
                {
                    titleText.Text = "Student fees by Program report";
                }

                titleTextSchool.Text = Session["SchoolName"].ToString().ToUpper();
                ds = proxy.GetSchoolProgramWiseStudentWeeklySchedule(new Guid(Session["CurrentSchoolYearId"].ToString()), new Guid(Request.QueryString["ProgramId"].ToString()));
                dsReport.Tables["dtProgramWiseStudent"].Merge(ds.Tables[0]);
                rpt1.SetDataSource(dsReport.Tables["dtProgramWiseStudent"]);
            }



            crp.DisplayGroupTree = false;
            crp.ReportSource     = rpt1;
            crp.RefreshReport();

            crp.DataBind();
        }