public IList <HREmployeeLeaveApplicationEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <HREmployeeLeaveApplicationEntity> hREmployeeLeaveApplicationEntityList = new List <HREmployeeLeaveApplicationEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                hREmployeeLeaveApplicationEntityList = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (hREmployeeLeaveApplicationEntityList != null && hREmployeeLeaveApplicationEntityList.Count > 0)
                {
                    totalRowCount = hREmployeeLeaveApplicationEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hREmployeeLeaveApplicationEntityList ?? new List <HREmployeeLeaveApplicationEntity>());
        }
Ejemplo n.º 2
0
        private void SaveHREmployeeLeaveApplicationEntity()
        {
            if (IsValid)
            {
                try
                {
                    HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = BuildHREmployeeLeaveApplicationEntity();

                    Int64 result = -1;

                    if (hREmployeeLeaveApplicationEntity.IsNew)
                    {
                        result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Add(hREmployeeLeaveApplicationEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, hREmployeeLeaveApplicationEntity.EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal);
                        result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Update(hREmployeeLeaveApplicationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EmployeeLeaveApplicationID       = result;
                        _HREmployeeLeaveApplicationEntity = CurrentHREmployeeLeaveApplicationEntity;
                        PrepareEditView();
                        BindHREmployeeLeaveApplicationList();

                        if (hREmployeeLeaveApplicationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hREmployeeLeaveApplicationEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Leave Application Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Leave Application Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Ejemplo n.º 3
0
        private void HasPendingLeave()
        {
            String fe = "EmployeeID = " + OverviewEmployeeID + " and LeaveApplicationApplicationStatusID = " + MasterDataConstants.MDLeaveApplicatoinStatus.PENDING + "";
            IList <HREmployeeLeaveApplicationEntity> leaveList = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (leaveList != null && leaveList.Count > 0)
            {
                btnSubmit.Enabled        = false;
                lblPending.Text          = "Sorry You Have Submitted one application which is under process. You can not submit another application until it is approved or reject.";
                this.messageDetails.Text = lblPending.Text;
                this.MPE.Show();
            }
        }
Ejemplo n.º 4
0
        protected void lvHREmployeeLeaveApplication_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 EmployeeLeaveApplicationID;

            Int64.TryParse(e.CommandArgument.ToString(), out EmployeeLeaveApplicationID);

            if (EmployeeLeaveApplicationID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _EmployeeLeaveApplicationID = EmployeeLeaveApplicationID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal);

                        HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity();


                        result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Delete(hREmployeeLeaveApplicationEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EmployeeLeaveApplicationID       = 0;
                            _HREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity();
                            PrepareInitialView();
                            BindHREmployeeLeaveApplicationList();

                            MiscUtil.ShowMessage(lblMessage, "Employee Leave Application has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Employee Leave Application.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        private void HavingLeave()
        {
            String fe_alreadyRequested1 = "(RequestStartDate >= '" + DateTime.Now + "' and  RequestEndDate <='" + DateTime.Now + "' OR RequestEndDate >= '" + DateTime.Now + "' and RequestStartDate <='" + DateTime.Now + "')";

            String fe_alreadyRequested2 = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeID, OverviewEmployeeID.ToString(), SQLMatchType.Equal);
            String fe_alreadyRequested  = SqlExpressionBuilder.PrepareFilterExpression(fe_alreadyRequested1, SQLJoinType.AND, fe_alreadyRequested2);
            IList <HREmployeeLeaveApplicationEntity> lstHREmployeeLeaveApplication = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(null, null, String.Empty, fe_alreadyRequested, DatabaseOperationType.LoadWithFilterExpression);

            if (lstHREmployeeLeaveApplication != null && lstHREmployeeLeaveApplication.Count > 0)
            {
                btnSubmit.Enabled        = false;
                lblPending.Text          = "<font color='green'>You are having leave</font>";
                this.messageDetails.Text = lblPending.Text;
                this.MPE.Show();
            }
        }
        public IList <HREmployeeLeaveApplicationEntity> GetData()
        {
            IList <HREmployeeLeaveApplicationEntity> hREmployeeLeaveApplicationEntityList = new List <HREmployeeLeaveApplicationEntity>();

            try
            {
                hREmployeeLeaveApplicationEntityList = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (hREmployeeLeaveApplicationEntityList != null && hREmployeeLeaveApplicationEntityList.Count > 0)
                {
                    totalRowCount = hREmployeeLeaveApplicationEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(hREmployeeLeaveApplicationEntityList ?? new List <HREmployeeLeaveApplicationEntity>());
        }
Ejemplo n.º 7
0
        private void SaveHREmployeeLeaveApplicationEntity()
        {
            if (ValidationInput())
            {
                if (IsValid)
                {
                    try
                    {
                        HREmployeeLeaveApplicationEntity hREmployeeLeaveApplicationEntity = BuildHREmployeeLeaveApplicationEntity();

                        hREmployeeLeaveApplicationEntity.SalarySessionID = Int64.Parse(ViewState["SalarySessionID"].ToString());



                        Int64 result = -1;
                        if (hREmployeeLeaveApplicationEntity.IsNew)
                        {
                            result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Add(hREmployeeLeaveApplicationEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            if (hREmployeeLeaveApplicationEntity.BackupEmployeeID != null)
                            {
                                SendMail(hREmployeeLeaveApplicationEntity);
                            }
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeLeaveApplicationID, hREmployeeLeaveApplicationEntity.EmployeeLeaveApplicationID.ToString(), SQLMatchType.Equal);
                            result = FCCHREmployeeLeaveApplication.GetFacadeCreate().Update(hREmployeeLeaveApplicationEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        if (result > 0)
                        {
                            if (hREmployeeLeaveApplicationEntity.IsNew)
                            {
                                #region Approval Process

                                if (ddlAPPanelID != null && ddlAPPanelID.SelectedValue != "0")
                                {
                                    Boolean apResult = APRobot.CreateApprovalProcessForNewLeaveApplication(result, Int64.Parse(ddlAPPanelID.SelectedValue.ToString()));
                                    if (apResult == true)
                                    {
                                        MiscUtil.ShowMessage(lblMessage, "Approval Process Submited successfully.", UIConstants.MessageType.GREEN);
                                    }
                                    else
                                    {
                                        MiscUtil.ShowMessage(lblMessage, "Failed to Submit Approval Process.", UIConstants.MessageType.RED);
                                    }
                                }
                            }

                            #endregion

                            _EmployeeLeaveApplicationID       = 0;
                            _HREmployeeLeaveApplicationEntity = new HREmployeeLeaveApplicationEntity();
                            PrepareInitialView();
                            BindHREmployeeLeaveApplicationList();

                            if (hREmployeeLeaveApplicationEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Leave Application Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (hREmployeeLeaveApplicationEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Leave Application Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Leave Application Information.", false);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Ejemplo n.º 8
0
        private Boolean ValidationInput()
        {
            Boolean flag = true;

            #region Check Balance

            Decimal?totalLeaveEarned  = GetToalLeaveEarned();
            Decimal?totalLeaveEnjoyed = GetToalLeaveEnjoyed() + Decimal.Parse(txtTotalLeaveDays.Text);

            if (totalLeaveEarned > 0 && totalLeaveEarned <= totalLeaveEnjoyed)
            {
                //MiscUtil.ShowMessage(lblMessage, "Sorry you do not have sufficient balance to take a leave please ask your HOD for extra leave.", true);
                this.messageDetails.Text = "Sorry you do not have sufficient balance to take a leave please ask your HOD for extra leave.";
                this.MPE.Show();
                flag = false;
            }

            #endregion

            String fe = "SessionStartDate<= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and  SessionEndDate>='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "'";
            IList <MDSalarySessionEntity> lstMDSalarySession = FCCMDSalarySession.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (lstMDSalarySession != null && lstMDSalarySession.Count > 0)
            {
                ViewState["SalarySessionID"] = lstMDSalarySession[0].SalarySessionID;
            }
            else
            {
                //MiscUtil.ShowMessage(lblMessage, "Sorry your Request start and end date is not under any session please choose.", true);
                this.messageDetails.Text = "Sorry your Request Start or End Date did not match with our month. May be they are under two different month. So please check the date.";
                this.MPE.Show();
                flag = false;
            }

            if (flag)
            {
                String fe_alreadyRequested1 = "(RequestStartDate >= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and  RequestEndDate <='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "' OR RequestEndDate >= '" + MiscUtil.ParseToDateTime(txtRequestStartDate.Text) + "' and RequestStartDate <='" + MiscUtil.ParseToDateTime(txtRequestEndDate.Text) + "')";
                String fe_alreadyRequested2 = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeLeaveApplicationEntity.FLD_NAME_EmployeeID, OverviewEmployeeID.ToString(), SQLMatchType.Equal);
                String fe_alreadyRequested  = SqlExpressionBuilder.PrepareFilterExpression(fe_alreadyRequested1, SQLJoinType.AND, fe_alreadyRequested2);
                IList <HREmployeeLeaveApplicationEntity> lstHREmployeeLeaveApplication = FCCHREmployeeLeaveApplication.GetFacadeCreate().GetIL(null, null, String.Empty, fe_alreadyRequested, DatabaseOperationType.LoadWithFilterExpression);

                if (lstHREmployeeLeaveApplication != null && lstHREmployeeLeaveApplication.Count > 0)
                {
                    //MiscUtil.ShowMessage(lblMessage, "Sorry You already have leave in this session please take carefully", true);
                    this.messageDetails.Text = "Sorry You already have leave in this date. Please Check.";
                    this.MPE.Show();
                    flag = false;
                }
            }

            return(flag);
        }