コード例 #1
0
        private bool ValidateFormFieldsLeaveBalance()
        {
            bool ReturnValue = true;

            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            var LeaveBalance = (from st in LeaveBalanceList
                                where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                                select st.TotalNumberOfLeavesElligibleToAvail).First();

            int TotalLeaveBalance = LeaveBalance;

            LeaveBalance = (from st in LeaveBalanceList
                            where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                            select st.NumberOfConsecutiveDaysAllowed).First();


            if (TotalLeaveBalance < int.Parse(txt_Count.Text))
            {
                lbl_TheMessage.Text = ReadXML.GetFailureMessage("KO_INSUFFICIENT_LEAVEBALANCE");
                ReturnValue         = false;
            }
            else
            {
                ReturnValue = true;
            }

            return(ReturnValue);
        }
コード例 #2
0
        private void FillGridView()
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            txt_From.Text = TheEmployee.EmailID;

            //*******************************//
            //To Get emailAddress his/her supervisor
            List <Employee> ReporttingEmployeeList = new List <Employee>();

            ReporttingEmployeeList = EmployeeManagement.GetInstance.GetReportingEmployeesEmailAllByEmployee(TheEmployee.EmployeeID);


            foreach (Employee emp in ReporttingEmployeeList)
            {
                string email = emp.EmailID;
                txt_To.Text = email;
            }

            List <LeaveTypeSettings> LeaveBalanceList;

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            gridview_LeaveApplyBalance.DataSource = LeaveBalanceList;
            gridview_LeaveApplyBalance.DataBind();

            List <LeaveApplication> LeaveApplicationLists = new List <LeaveApplication>();

            LeaveApplicationLists = LeaveApplicationManagement.GetEmployeeLeaveApplicationsAll(TheEmployee.EmployeeID);
            gridview_LeaveApplyBalanceShow.DataSource = LeaveApplicationLists;
            gridview_LeaveApplyBalanceShow.DataBind();
        }
コード例 #3
0
        private int InsertRecord()
        {
            int ProcReturnValue = 0;
            LeaveApplication TheLeaveApplication = new LeaveApplication();

            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            var LeaveBalance = (from st in LeaveBalanceList
                                where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                                select st.TotalNumberOfLeavesElligibleToAvail).First();

            int TotalLeaveBalance = LeaveBalance;

            LeaveBalance = (from st in LeaveBalanceList
                            where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                            select st.NumberOfConsecutiveDaysAllowed).First();


            LeaveBalance = (from st in LeaveBalanceList
                            where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                            select st.LeaveTypeID).First();
            int LeaveTypeID = LeaveBalance;

            if (txt_Count.Text == "")
            {
                txt_Count.Text = "0";
            }

            TheLeaveApplication.EmployeeID           = TheEmployee.EmployeeID;
            TheLeaveApplication.LeaveTypeID          = LeaveTypeID;
            TheLeaveApplication.LeaveTypeDescription = ddl_LeaveDescription.SelectedItem.ToString();
            TheLeaveApplication.DateApplied          = DateTime.Today.Date;
            TheLeaveApplication.DateFrom             = DateTime.Parse(txt_FromDate.Text);
            TheLeaveApplication.DateTo            = DateTime.Parse(txt_Todate.Text);
            TheLeaveApplication.ApplicationReason = txt_Reason.Text;
            TheLeaveApplication.Status            = "Pending";

            ProcReturnValue = LeaveApplicationManagement.InsertLeaveApplication(TheLeaveApplication);
            if (ProcReturnValue > 0)
            {
                //=========================================================
                // SENDING THE LEAVE REQUEST MAIL TO THE SUPERVISOR
                //=========================================================
                SendLeaveRequestMail(TheEmployee, TheLeaveApplication);
                //==========================================================
            }
            return(ProcReturnValue);
        }
コード例 #4
0
        private void DataBindDropDownList()
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);
            List <LeaveTypeSettings> LeaveBalanceList;

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            gridview_LeaveApplyBalance.DataSource = LeaveBalanceList;
            gridview_LeaveApplyBalance.DataBind();


            var LeaveTypeDescriptionList = from st in LeaveBalanceList
                                           select st.LeaveTypeDescription;

            ddl_LeaveDescription.DataSource = LeaveTypeDescriptionList;
            ddl_LeaveDescription.DataMember = "LeaveTypeDescription";
            ddl_LeaveDescription.DataBind();
        }
コード例 #5
0
        protected void lnkCancel_Click(object sender, EventArgs e)
        {
            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            LinkButton TheLinkBtn = (LinkButton)sender;

            LeaveApplicationID = int.Parse(TheLinkBtn.CommandArgument);
            LeaveApplication LType = new LeaveApplication();

            int ProcReturnValue = 0;

            LType = LeaveApplicationManagement.GetLeaveApplicationByLeaveApplicationID(LeaveApplicationID);
            if (LType.Status == "Pending")
            {
                LeaveApplication LeaveApplicationObject = new LeaveApplication();

                LeaveApplicationObject.EmployeeID        = TheEmployee.EmployeeID;
                LeaveApplicationObject.ApplicationReason = txt_Reason.Text;
                LeaveApplicationObject.Status            = "Pending";

                if (LeaveApplicationID > 0)
                {
                    LeaveApplicationObject.LeaveApplicationID = LeaveApplicationID;
                    ProcReturnValue     = LeaveApplicationManagement.DeletetLeaveApplication(LeaveApplicationObject);
                    lbl_TheMessage.Text = ReadXML.GetSuccessMessage("OK_LEAVEAPPLICATION_DELETED");

                    dialog_Message.Show();
                    // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application Deleted Successfully');", true);
                    btn_LeaveCancel.Visible = false;
                    FillGridView();
                }
            }
            else
            {
                lbl_TheMessage.Text = ReadXML.GetSuccessMessage("KO_LEAVEAPPLICATION_DELETED");
                dialog_Message.Show();
                // ScriptManager.RegisterClientScriptBlock(this, GetType(), "Message", "alert('Leave Application n't Cancelled Due to Approved/Cancelled');", true);
            }
        }
コード例 #6
0
        private int UpdateRecord()
        {
            int ProcReturnValue = 0;
            LeaveApplication TheLeaveApplication = new LeaveApplication();

            PageVariables.TheUserReferenceID = Connection.LoggedOnUser.UserReferenceID;
            Employee TheEmployee = EmployeeManagement.GetInstance.GetEmployeeByID(PageVariables.TheUserReferenceID);

            LeaveBalanceList = LeaveBalanceManagement.GetLeaveBalanceByEmployee(TheEmployee.EmployeeID);
            var LeaveBalance = (from st in LeaveBalanceList
                                where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                                select st.TotalNumberOfLeavesElligibleToAvail).First();


            LeaveBalance = (from st in LeaveBalanceList
                            where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                            select st.NumberOfConsecutiveDaysAllowed).First();


            LeaveBalance = (from st in LeaveBalanceList
                            where st.LeaveTypeDescription == ddl_LeaveDescription.Text
                            select st.LeaveTypeID).First();
            int LeaveTypeID = LeaveBalance;

            TheLeaveApplication.LeaveApplicationID   = LeaveApplicationID;
            TheLeaveApplication.LeaveTypeID          = LeaveTypeID;
            TheLeaveApplication.LeaveTypeDescription = ddl_LeaveDescription.SelectedItem.ToString();
            TheLeaveApplication.DateApplied          = DateTime.Today.Date;
            TheLeaveApplication.DateFrom             = DateTime.Parse(txt_FromDate.Text);
            TheLeaveApplication.DateTo            = DateTime.Parse(txt_Todate.Text);
            TheLeaveApplication.ApplicationReason = txt_Reason.Text;
            TheLeaveApplication.Status            = "Pending";

            ProcReturnValue = LeaveApplicationManagement.UpdateLeaveApplication(TheLeaveApplication);


            return(ProcReturnValue);
        }