private void PrepareEditView()
        {
            CMConsultantEntity cMConsultantEntity = CurrentCMConsultantEntity;
            HRMemberEntity     hRMemberEntity     = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();
            }

            if (!cMConsultantEntity.IsNew)
            {
                txtName.Text            = cMConsultantEntity.Name.ToString();
                txtCurrentPosition.Text = cMConsultantEntity.CurrentPosition.ToString();
                txtInstitueName.Text    = cMConsultantEntity.InstitueName.ToString();
                txtEmailAddress1.Text   = cMConsultantEntity.EmailAddress1.ToString();
                txtEmailAddress2.Text   = cMConsultantEntity.EmailAddress2.ToString();
                txtContactNo1.Text      = cMConsultantEntity.ContactNo1.ToString();
                txtContactNo2.Text      = cMConsultantEntity.ContactNo2.ToString();
                txtPhone.Text           = cMConsultantEntity.Phone.ToString();
                txtRemarks.Text         = cMConsultantEntity.Remarks.ToString();
                chkIsRemoved.Checked    = cMConsultantEntity.IsRemoved;

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = false;
            }
        }
        public static HRMemberEntity GetMemberByASPNETUserName(String userName)
        {
            HRMemberEntity member = null;

            MembershipUser user = GetASPNETUserByUserName(userName);

            if (user != null)
            {
                Guid userID = (Guid)user.ProviderUserKey;

                String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ASMemberAspnetUsersMapEntity.FLD_NAME_UserId, userID.ToString(), SQLMatchType.Equal);

                IList <ASMemberAspnetUsersMapEntity> aSMemberAspnetUsersMapEntityList = FCCASMemberAspnetUsersMap.GetFacadeCreate().GetIL(null, null, null, filterExpression, DatabaseOperationType.LoadWithFilterExpression);

                if (aSMemberAspnetUsersMapEntityList != null && aSMemberAspnetUsersMapEntityList.Count > 0)
                {
                    filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, aSMemberAspnetUsersMapEntityList[0].MemberID.ToString(), SQLMatchType.Equal);

                    IList <HRMemberEntity> memberEntityList = FCCHRMember.GetFacadeCreate().GetIL(null, null, null, filterExpression, DatabaseOperationType.LoadWithFilterExpression);

                    if (memberEntityList != null && memberEntityList.Count > 0)
                    {
                        member = memberEntityList[0];
                    }
                }
            }

            return(member);
        }
Example #3
0
        Int64 IHRMemberDataAccess.Add(HRMemberEntity hRMemberEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(hRMemberEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(hRMemberEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #4
0
        Int64 IHRMemberDataAccess.Delete(HRMemberEntity hRMemberEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Delete(hRMemberEntity, filterExpression, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = DeleteTran(hRMemberEntity, filterExpression, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #5
0
        private void GetEmployeeNameAndCode()
        {
            HREmployeeEntity entity = FCCHREmployee.GetFacadeCreate().GetByID(_CurrentEmployeeEvaluatedID);
            HRMemberEntity   ent    = FCCHRMember.GetFacadeCreate().GetByID(entity.MemberID);

            txtEmployeeCode.Text = entity.EmployeeCode;
            txtEmployeeName.Text = ent.FirstName + " " + ent.MiddleName + " " + ent.LastName;
        }
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            _MemberID       = 0;
            _HRMemberEntity = new HRMemberEntity();

            _ConsultantID       = 0;
            _CMConsultantEntity = new CMConsultantEntity();

            PrepareInitialView();
        }
Example #7
0
        protected void btnAddNew_Click(object sender, EventArgs e)
        {
            _MemberID       = 0;
            _HRMemberEntity = new HRMemberEntity();

            _EmployeeID       = 0;
            _HREmployeeEntity = new HREmployeeEntity();

            PrepareInitialView();
        }
Example #8
0
        private Int64 UpdateTran(HRMemberEntity hRMemberEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRMember_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);

                db.AddInParameter(cmd, "@MemberID", DbType.Int64, hRMemberEntity.MemberID);
                db.AddInParameter(cmd, "@FirstName", DbType.String, hRMemberEntity.FirstName);
                db.AddInParameter(cmd, "@MiddleName", DbType.String, hRMemberEntity.MiddleName);
                db.AddInParameter(cmd, "@LastName", DbType.String, hRMemberEntity.LastName);
                db.AddInParameter(cmd, "@MemberTypeID", DbType.Int64, hRMemberEntity.MemberTypeID);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
Example #9
0
        private void SaveHRMemberEntity()
        {
            if (IsValid)
            {
                try
                {
                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                        PrepareInitialView();
                        BindHRMemberList();

                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Member Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Member Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        public static void UserLogedIn(String userName)
        {
            HRMemberEntity member = GetMemberByASPNETUserName(userName);

            SetCurrentMember(member);

            PermissionHelper.PreserveUserPermissionKeys(userName);

            CreateMenuSourceForLogedInUser();

            HttpContext.Current.Response.Cookies.Remove(FormsAuthentication.FormsCookieName);
            FormsAuthentication.SetAuthCookie(userName, false);
        }
        //public static String[] GetRolesForAssignToUserByMemberID(Int64 memberID)
        //{
        //    String[] roleList = null;

        //    MembershipUser member = GetASPNETUserByMemberID(memberID);

        //    String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberUserCreationRoleListEntity.FLD_NAME_MemberID, memberID.ToString(), SQLMatchType.Equal);

        //    IList<ERMMemberUserCreationRoleListEntity> eRMMemberUserCreationRoleListEntityList = FCCERMMemberUserCreationRoleList.GetFacadeCreate().GetIL(null, null, String.Empty, filterExpression, DatabaseOperationType.LoadWithFilterExpression);

        //    if (eRMMemberUserCreationRoleListEntityList != null && eRMMemberUserCreationRoleListEntityList.Count > 0)
        //    {
        //        roleList = new String[eRMMemberUserCreationRoleListEntityList.Count];

        //        for (int i = 0; i < eRMMemberUserCreationRoleListEntityList.Count; i++)
        //        {
        //            roleList[i] = eRMMemberUserCreationRoleListEntityList[i].RoleName;
        //        }
        //    }

        //    return roleList;
        //}

        #endregion

        public static HRMemberEntity CreateMember(HRMemberEntity member)
        {
            Int64 memberID = FCCHRMember.GetFacadeCreate().Add(member, DatabaseOperationType.Add, TransactionRequired.No);

            if (memberID > 0)
            {
                member.MemberID = memberID;

                return(member);
            }

            return(null);
        }
Example #12
0
        protected void lvHRMember_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 MemberID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, MemberID.ToString(), SQLMatchType.Equal);

                        HRMemberEntity hRMemberEntity = new HRMemberEntity();


                        result = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _MemberID       = 0;
                            _HRMemberEntity = new HRMemberEntity();
                            PrepareInitialView();
                            BindHRMemberList();

                            MiscUtil.ShowMessage(lblMessage, "Member has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Member.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private HRMemberEntity BuildHRMemberEntity()
        {
            HRMemberEntity hRMemberEntity = CurrentHRMemberEntity;

            hRMemberEntity.FirstName  = txtFirstName.Text.Trim();
            hRMemberEntity.MiddleName = txtMiddleName.Text.Trim();
            hRMemberEntity.LastName   = txtLastName.Text.Trim();

            if (hRMemberEntity.IsNew)
            {
                hRMemberEntity.MemberTypeID = MasterDataConstants.MemberType.CONSULATANT;
            }

            return(hRMemberEntity);
        }
Example #14
0
        private void PrepareEditView()
        {
            HRMemberEntity hRMemberEntity = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();

                if (ddlMemberTypeID.Items.Count > 0 && hRMemberEntity.MemberTypeID != null)
                {
                    ddlMemberTypeID.SelectedValue = hRMemberEntity.MemberTypeID.ToString();
                }

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Example #15
0
        private Int64 Update(HRMemberEntity hRMemberEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRMember_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@MemberID", DbType.Int64, hRMemberEntity.MemberID);
                Database.AddInParameter(cmd, "@FirstName", DbType.String, hRMemberEntity.FirstName);
                Database.AddInParameter(cmd, "@MiddleName", DbType.String, hRMemberEntity.MiddleName);
                Database.AddInParameter(cmd, "@LastName", DbType.String, hRMemberEntity.LastName);
                Database.AddInParameter(cmd, "@MemberTypeID", DbType.Int64, hRMemberEntity.MemberTypeID);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("HRMemberEntity already exists. Please specify another HRMemberEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("HRMemberEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("HRMemberEntity already exists. Please specify another HRMemberEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
Example #16
0
        private HRMemberEntity BuildHRMemberEntity()
        {
            HRMemberEntity hRMemberEntity = CurrentHRMemberEntity;

            hRMemberEntity.FirstName  = txtFirstName.Text.Trim();
            hRMemberEntity.MiddleName = txtMiddleName.Text.Trim();
            hRMemberEntity.LastName   = txtLastName.Text.Trim();
            if (ddlMemberTypeID.Items.Count > 0)
            {
                if (ddlMemberTypeID.SelectedValue == "0")
                {
                }
                else
                {
                    hRMemberEntity.MemberTypeID = Int64.Parse(ddlMemberTypeID.SelectedValue);
                }
            }

            return(hRMemberEntity);
        }
        protected HRMemberEntity GetMember(int memberId)
        {
            if (!_memberCache.ContainsKey(memberId))
            {
                IHRMemberDataAccess da = new HRMemberDataAccess(_context);

                //Member member = da.GetById(memberId); reza changed this
                //MemberEntity member = da.GetAll()[0];
                HRMemberEntity member = null;

                if (member == null)
                {
                    return(null);
                }

                _memberCache.Add(memberId, member);
            }

            return(_memberCache[memberId]);
        }
Example #18
0
        private void PrepareEditView()
        {
            CMContractorEntity cMContractorEntity = CurrentCMContractorEntity;
            HRMemberEntity     hRMemberEntity     = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();
            }

            if (!cMContractorEntity.IsNew)
            {
                txtNameOfWork.Text = cMContractorEntity.NameOfWork.ToString();
                txtDate.Text       = cMContractorEntity.Date.ToStringDefault();
                txtName.Text       = cMContractorEntity.Name.ToString();

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Example #19
0
        private void PrepareEditView()
        {
            HREmployeeEntity hREmployeeEntity = CurrentHREmployeeEntity;

            HRMemberEntity hRMemberEntity = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();
            }

            if (!hREmployeeEntity.IsNew)
            {
                txtEmployeeCode.Text = hREmployeeEntity.EmployeeCode.ToString();

                if (ddlEmployeeJobTypeID.Items.Count > 0 && hREmployeeEntity.EmployeeJobTypeID != null)
                {
                    ddlEmployeeJobTypeID.SelectedValue = hREmployeeEntity.EmployeeJobTypeID.ToString();
                }

                txtConfirmDate.Text = hREmployeeEntity.ConfirmDate.ToStringDefault();
                txtJoinDate.Text    = hREmployeeEntity.JoinDate.ToStringDefault();
                txtDOB.Text         = hREmployeeEntity.DOB.ToStringDefault();
                if (ddlBloodGroupID.Items.Count > 0 && hREmployeeEntity.BloodGroupID != null)
                {
                    ddlBloodGroupID.SelectedValue = hREmployeeEntity.BloodGroupID.ToString();
                }

                txtPrimaryEmail.Text   = hREmployeeEntity.PrimaryEmail.ToString();
                txtSecondaryEmail.Text = hREmployeeEntity.SecondaryEmail.ToString();
                txtInitials.Text       = hREmployeeEntity.Initials.ToString();

                //btnSubmit.Enabled = true;
                btnSubmit.Text = "Update";
            }
        }
Example #20
0
 Int64 IHRMemberFacade.Add(HRMemberEntity hRMemberEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRMemberDataAccess().Add(hRMemberEntity, option, reqTran));
 }
        protected void lvCMConsultant_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ConsultantID;

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

            if (ConsultantID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ConsultantID = ConsultantID;
                    _MemberID     = CurrentCMConsultantEntity.MemberID.Value;


                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        CMConsultantEntity tempConsultant = FCCCMConsultant.GetFacadeCreate().GetByID(ConsultantID);

                        #region Resource Delete

                        Int64 resultOne = -1;

                        String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConsultantID.ToString(), SQLMatchType.Equal);
                        String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.CONSULTANT.ToString(), SQLMatchType.Equal);
                        String fe_re  = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re);

                        IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression);

                        foreach (ResourceEntity ent in resourceList)
                        {
                            String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal);

                            resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Consultant Delete

                        Int64 resultTwo = -1;

                        if (resultOne == 0)
                        {
                            String fe_con_delete = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, ConsultantID.ToString(), SQLMatchType.Equal);

                            CMConsultantEntity cMConsultantEntity = new CMConsultantEntity();

                            resultTwo = FCCCMConsultant.GetFacadeCreate().Delete(cMConsultantEntity, fe_con_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Member Delete

                        Int64 resultThree = -1;

                        if (resultTwo == 0)
                        {
                            String fe_mem_delete = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, tempConsultant.MemberID.ToString(), SQLMatchType.Equal);

                            HRMemberEntity hRMemberEntity = new HRMemberEntity();

                            resultThree = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe_mem_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        if (resultOne == 0 && resultTwo == 0 && resultThree == 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            _MemberID           = 0;
                            _HRMemberEntity     = new HRMemberEntity();

                            PrepareInitialView();
                            BindCMConsultantList();

                            MiscUtil.ShowMessage(lblMessage, "Consultant has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Consultant.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private void SaveCMConsultantEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }

                    if (result > 0)
                    {
                        CMConsultantEntity cMConsultantEntity = BuildCMConsultantEntity();

                        Int64 resultC = -1;

                        if (cMConsultantEntity.IsNew)
                        {
                            cMConsultantEntity.MemberID = result;
                            resultC = FCCCMConsultant.GetFacadeCreate().Add(cMConsultantEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, cMConsultantEntity.ConsultantID.ToString(), SQLMatchType.Equal);
                            resultC = FCCCMConsultant.GetFacadeCreate().Update(cMConsultantEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        if (resultC > 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            PrepareInitialView();
                            BindCMConsultantList();

                            if (cMConsultantEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new contractor id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.CONSULTANT;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Consultant Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Consultant Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
 public static void SetCurrentMember(HRMemberEntity member)
 {
     HttpContext.Current.Session[SessionConstants.LOGIN_MEMBER_INFO] = member;
 }
Example #24
0
        private void PrepareEditView()
        {
            HREmployeeEntity hREmployeeEntity = CurrentHREmployeeEntity;

            HRMemberEntity hRMemberEntity = CurrentHRMemberEntity;

            if (!hRMemberEntity.IsNew)
            {
                txtFirstName.Text  = hRMemberEntity.FirstName.ToString();
                txtMiddleName.Text = hRMemberEntity.MiddleName.ToString();
                txtLastName.Text   = hRMemberEntity.LastName.ToString();
            }

            if (!hREmployeeEntity.IsNew)
            {
                txtEmployeeCode.Text = hREmployeeEntity.EmployeeCode.ToString();

                if (ddlEmployeeJobTypeID.Items.Count > 0 && hREmployeeEntity.EmployeeJobTypeID != null)
                {
                    ddlEmployeeJobTypeID.SelectedValue = hREmployeeEntity.EmployeeJobTypeID.ToString();
                }

                if (ddlDesignationID.Items.Count > 0 && hREmployeeEntity.DesignationID != null)
                {
                    ddlDesignationID.SelectedValue = hREmployeeEntity.DesignationID.ToString();
                }

                if (hREmployeeEntity.ConfirmDate != null)
                {
                    DateTime datetime = (DateTime)hREmployeeEntity.ConfirmDate;

                    txtConfirmDate.Text = datetime.ToValidDateString();
                }
                else
                {
                    txtConfirmDate.Text = hREmployeeEntity.ConfirmDate.ToStringDefault();
                }
                txtJoinDate.Text    = hREmployeeEntity.JoinDate.ToStringDefault();
                txtDOB.Text         = hREmployeeEntity.DOB.ToStringDefault();
                txtSalaryLevel.Text = hREmployeeEntity.SalaryLevel.ToString();
                if (ddlBloodGroupID.Items.Count > 0 && hREmployeeEntity.BloodGroupID != null)
                {
                    ddlBloodGroupID.SelectedValue = hREmployeeEntity.BloodGroupID.ToString();
                }

                txtPrimaryEmail.Text   = hREmployeeEntity.PrimaryEmail.ToString();
                txtSecondaryEmail.Text = hREmployeeEntity.SecondaryEmail.ToString();
                txtInitials.Text       = hREmployeeEntity.Initials.ToString();

                if (ddlEmploymentStatusID.Items.Count > 0 && hREmployeeEntity.EmploymentStatusID != null)
                {
                    ddlEmploymentStatusID.SelectedValue = hREmployeeEntity.EmploymentStatusID.ToString();
                }

                if (ddlEmploymentStatusID.Items.Count > 0 && hREmployeeEntity.EmploymentStatusID != null && hREmployeeEntity.EmploymentStatusID == MasterDataConstants.MDEmploymentStatus.DISCONTINUED)
                {
                    pnlDiscontinuedDate.Visible = true;
                }
                else
                {
                    pnlDiscontinuedDate.Visible = false;
                }

                txtDiscontinuedDate.Text = hREmployeeEntity.DiscontinuedDate.ToStringDefault();

                if (ddlDepartmentID.Items.Count > 0 && hREmployeeEntity.DepartmentID != null)
                {
                    ddlDepartmentID.SelectedValue = hREmployeeEntity.DepartmentID.ToString();
                }

                if (ddlProjectID.Items.Count > 0 && hREmployeeEntity.ProjectID != null)
                {
                    ddlProjectID.SelectedValue = hREmployeeEntity.ProjectID.ToString();
                }

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
Example #25
0
        protected void btnSendMailToGuest_Click(object sender, EventArgs e)
        {
            //Mail will implement here.

            #region Guest Invitation Mail

            CMNEventEntity cMNEventEntity = FCCCMNEvent.GetFacadeCreate().GetByID(OverviewEventID);

            String MailBody = String.Empty;
            String Subject  = String.Empty;

            StringBuilder sb = new StringBuilder();

            sb.Append("Dear Sir,");
            sb.Append("<br/>");
            sb.Append("This is a auto generated mail from the ERP.");
            sb.Append("<br/>");
            sb.Append("An Event has created.");
            sb.Append("<br/>");
            sb.Append("Dated : " + cMNEventEntity.ExpectedStartDate.ToString(UIConstants.SHORT_DATE_FORMAT));
            sb.Append("<br/>");
            sb.Append("-");
            sb.Append("<br/>");
            sb.Append("Thanks");
            sb.Append("<br/>");
            sb.Append("ERP System");
            MailBody = sb.ToString();
            Subject  = "ERP, Event";

            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventID, OverviewEventID.ToString(), SQLMatchType.Equal);
            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventInvitatedPersonTypeID, MasterDataConstants.EventInvitationPersonType.GUEST.ToString(), SQLMatchType.Equal);
            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

            IList <CMNEventInvitationInformationEntity> lstEventInvitationInformationEntity = FCCCMNEventInvitationInformation.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (lstEventInvitationInformationEntity != null && lstEventInvitationInformationEntity.Count > 0)
            {
                String[] sendToMail = new String[10]; // Should change here.
                Int64    i          = 0;

                foreach (CMNEventInvitationInformationEntity ent in lstEventInvitationInformationEntity)
                {
                    HRMemberEntity hRMemberEntity = FCCHRMember.GetFacadeCreate().GetByID(ent.InitationGivenToMemberID);

                    if (hRMemberEntity != null && hRMemberEntity.MemberID > 0)
                    {
                        switch (hRMemberEntity.MemberTypeID)
                        {
                        case MasterDataConstants.MemberType.HR_MEMBER:

                            String fe_member = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_MemberID, ent.InitationGivenToMemberID.ToString(), SQLMatchType.Equal);
                            IList <HREmployeeEntity> lsthREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe_member, DatabaseOperationType.LoadWithFilterExpression);

                            if (lsthREmployeeEntity != null && lsthREmployeeEntity.Count > 0)
                            {
                                sendToMail[i++] = lsthREmployeeEntity[0].PrimaryEmail;
                            }
                            break;

                        //Will Implement Later on...
                        case MasterDataConstants.MemberType.CONSULATANT:
                            break;
                            //case MasterDataConstants.MemberType.CONSULATANT:
                            //    break;
                        }
                    }
                }

                MiscUtil.SendMail(sendToMail, Subject, MailBody);
            }

            #endregion
        }
Example #26
0
 Int64 IHRMemberFacade.Delete(HRMemberEntity hRMemberEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRMemberDataAccess().Delete(hRMemberEntity, filterExpression, option, reqTran));
 }
Example #27
0
        private void SaveHREmployeeEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }

                    if (result > 0)
                    {
                        HREmployeeEntity hREmployeeEntity = BuildHREmployeeEntity();

                        Int64 resultC = -1;

                        if (hREmployeeEntity.IsNew)
                        {
                            hREmployeeEntity.MemberID = result;

                            resultC = FCCHREmployee.GetFacadeCreate().Add(hREmployeeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_EmployeeID, hREmployeeEntity.EmployeeID.ToString(), SQLMatchType.Equal);
                            resultC = FCCHREmployee.GetFacadeCreate().Update(hREmployeeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        #region Create Six Task For HR

                        try
                        {
                            StringBuilder xmlStr      = new StringBuilder();
                            Int64         employeeID  = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                            Int64         referenceID = 49;
                            DateTime      joinDate    = (DateTime)hREmployeeEntity.JoinDate;
                            String        fe          = "DepartmentID = " + MasterDataConstants.MDDepartment.HR_DEPARTMENTID + "";

                            IList <HREmployeeEntity> lst = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            #region Delete Old Task

                            String filter = "IssueIdentityCategoryID = " + MasterDataConstants.MDIssueIdentityCategory.HRMETTINGWITHEMPLOYEE + " and SupervisorEmployeeID = " + hREmployeeEntity.EmployeeID + "";
                            IList <OTIssueEntity> issueList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, String.Empty, filter, DatabaseOperationType.LoadWithFilterExpression);
                            if (issueList != null && issueList.Count > 0)
                            {
                                OTIssueEntity oTIssueEntity = new OTIssueEntity();
                                FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, filter, DatabaseOperationType.Delete, TransactionRequired.No);
                            }

                            #endregion

                            String title = "Employee Name: " + hRMemberEntity.FirstName + " " + hRMemberEntity.MiddleName + " " + hRMemberEntity.LastName + ", Code: " + hREmployeeEntity.EmployeeCode + " join Date: " + hREmployeeEntity.JoinDate + " has metting with you";

                            xmlStr.Append("<m>");
                            if (lst != null && lst.Count > 0)
                            {
                                foreach (HREmployeeEntity e in lst)
                                {
                                    for (int i = 1; i <= 6; i++)
                                    {
                                        String subXmlStr = null;
                                        subXmlStr = subXmlStr + "<i><a>" + title + "</a><b>" + hREmployeeEntity.EmployeeID + "</b><c>" + e.EmployeeID + "</c><d>" + CurrentMember.MemberID + "</d><e>" + referenceID + "</e><f>" + joinDate.AddDays(i * 30) + "</f><g>" + joinDate.AddDays((i * 30) + 1) + "</g></i>";
                                        xmlStr.Append(subXmlStr.ToString());
                                    }
                                }
                            }
                            xmlStr.Append("</m>");

                            FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.CreateSixTaskForHR);

                            MiscUtil.ShowMessage(lblMessage, "Six Task has created for HR Successfully.", false);
                        }
                        catch (Exception ex)
                        {
                            MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true);
                        }

                        #endregion

                        if (resultC > 0)
                        {
                            _EmployeeID       = 0;
                            _HREmployeeEntity = new HREmployeeEntity();
                            PrepareInitialView();
                            BindHREmployeeList();

                            if (hREmployeeEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new employee id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.EMPLOYEE;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (hREmployeeEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (hREmployeeEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }