Example #1
0
 protected void rgStaffAttendanceHistory_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     if (ViewState["StaffSchoolYearId"] != null)
     {
         DayCareBAL.StaffAttendanceHistoryListService proxyStaffAttendanceList = new DayCareBAL.StaffAttendanceHistoryListService();
         rgStaffAttendanceHistory.DataSource = proxyStaffAttendanceList.LoadStaffAttendanceHistoryList(new Guid(ViewState["StaffSchoolYearId"].ToString()), new Guid(Session["CurrentSchoolYearId"].ToString()));
     }
 }
        protected void FillCoboofStaff()
        {
            DayCareBAL.StaffAttendanceHistoryListService proxystaff = new DayCareBAL.StaffAttendanceHistoryListService();
            DayCarePL.StaffProperties[]      result = proxystaff.LoadStaffList(new Guid(Session["CurrentSchoolYearId"].ToString())).ToArray();
            List <DayCarePL.StaffProperties> data   = new List <DayCarePL.StaffProperties>();

            DayCarePL.StaffProperties Rec = new DayCarePL.StaffProperties();
            Rec.Id       = new Guid("00000000-0000-0000-0000-000000000000");
            Rec.FullName = "--Select All--";
            foreach (DayCarePL.StaffProperties d in result)
            {
                data.Add(d);
            }
            data.Insert(0, Rec);
            rcbStudentList.Items.Clear();
            rcbStudentList.DataSource    = data;
            rcbStudentList.DataTextField = "FullName";
            rcbStudentList.DataBind();
            rcbStudentList.EmptyMessage = "---Select---";
        }
Example #3
0
        public bool SubmitRecord(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Submit record method called", DayCarePL.Common.GUID_DEFAULT);
            bool result = false;

            try
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.INFO, DayCarePL.ModuleToLog.clAbsentReason, "SubmitRecord", "Debug Submit record method called of AbsentReason", DayCarePL.Common.GUID_DEFAULT);
                DayCareBAL.StaffAttendanceHistoryListService proxySave          = new DayCareBAL.StaffAttendanceHistoryListService();
                DayCarePL.StaffAttendenceHistoryProperties   objStaffAttendance = new DayCarePL.StaffAttendenceHistoryProperties();

                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 "CheckInCheckOutDateTime":
                                {
                                    objStaffAttendance.CheckInCheckOutDateTime = Convert.ToDateTime((e.Item.FindControl("rdpCheckInCheckOutDateTime") as RadDatePicker).SelectedDate);
                                    break;
                                }

                                case "CheckInTime":
                                {
                                    if ((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate != null)
                                    {
                                        objStaffAttendance.CheckInTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckInTime") as RadTimePicker).SelectedDate);
                                    }
                                    break;
                                }

                                case "CheckOutTime":
                                {
                                    if ((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate != null)
                                    {
                                        objStaffAttendance.CheckOutTime = Convert.ToDateTime((e.Item.FindControl("rtpCheckOutTime") as RadTimePicker).SelectedDate);
                                    }
                                    break;
                                }
                                    //case "StaffSchoolYearId":
                                    //    {
                                    //        objStaffAttendance.StaffSchoolYearId = new Guid((editor as GridTextBoxColumnEditor).Text.Trim());
                                    //        break;
                                    //    }
                                }
                            }
                        }
                    }
                    if (objStaffAttendance.CheckInTime != null)
                    {
                        objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckInTime.Value.TimeOfDay;
                        objStaffAttendance.CheckInCheckOut         = true;
                    }
                    if (objStaffAttendance.CheckOutTime != null)
                    {
                        objStaffAttendance.CheckInCheckOutDateTime = objStaffAttendance.CheckInCheckOutDateTime + objStaffAttendance.CheckOutTime.Value.TimeOfDay;
                        objStaffAttendance.CheckInCheckOut         = false;
                    }
                    if (objStaffAttendance.CheckInTime == null && objStaffAttendance.CheckOutTime == null)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false"));
                        result = false;
                    }
                    else if (objStaffAttendance.CheckInTime != null && objStaffAttendance.CheckOutTime != null)
                    {
                        MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                        MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Please select check in or check out time", "false"));
                        result = false;
                    }
                    else
                    {
                        if (ViewState["StaffSchoolYearId"] != null)
                        {
                            objStaffAttendance.StaffSchoolYearId = new Guid(ViewState["StaffSchoolYearId"].ToString());
                        }

                        if (e.CommandName != "PerformInsert")
                        {
                            objStaffAttendance.Id = new Guid(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString());
                        }
                        if (proxySave.Save(objStaffAttendance))
                        {
                            MasterAjaxManager = this.Page.Master.FindControl("RadAjaxManager1") as Telerik.Web.UI.RadAjaxManager;
                            MasterAjaxManager.ResponseScripts.Add(string.Format("ShowMessage('{0}','{1}')", "Saved Successfully", "false"));
                            result = true;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                DayCarePL.Logger.Write(DayCarePL.LogType.EXCEPTION, DayCarePL.ModuleToLog.AbsentReason, "SubmitRecord", ex.Message.ToString(), DayCarePL.Common.GUID_DEFAULT);
                result = false;
            }
            return(result);
        }
Example #4
0
 protected void rgStaffAttendanceList_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
 {
     DayCareBAL.StaffAttendanceHistoryListService proxyLoad = new DayCareBAL.StaffAttendanceHistoryListService();
     rgStaffAttendanceList.DataSource = proxyLoad.LoadStaffList(new Guid(Session["CurrentSchoolYearId"].ToString()));
 }