示例#1
0
        private void PrepareEditView()
        {
            HRSessionEntity hRSessionEntity = CurrentHRSessionEntity;


            if (!hRSessionEntity.IsNew)
            {
                if (ddlSessionCategoryID.Items.Count > 0 && hRSessionEntity.SessionCategoryID != null)
                {
                    ddlSessionCategoryID.SelectedValue = hRSessionEntity.SessionCategoryID.ToString();
                }

                txtSessionName.Text  = hRSessionEntity.SessionName.ToString();
                txtStartDate.Text    = hRSessionEntity.StartDate.ToStringDefault();
                txtEndDate.Text      = hRSessionEntity.EndDate.ToStringDefault();
                txtDeadlineDate.Text = hRSessionEntity.DeadlineDate.ToStringDefault();
                if (ddlEvaluationSessionStatusID.Items.Count > 0 && hRSessionEntity.EvaluationSessionStatusID != null)
                {
                    ddlEvaluationSessionStatusID.SelectedValue = hRSessionEntity.EvaluationSessionStatusID.ToString();
                }

                txtRemarks.Text = hRSessionEntity.Remarks.ToString();

                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
示例#2
0
        Int64 IHRSessionDataAccess.Add(HRSessionEntity hRSessionEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

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

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

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

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        private Int64 UpdateTran(HRSessionEntity hRSessionEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRSession_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, "@SessionID", DbType.Int64, hRSessionEntity.SessionID);
                db.AddInParameter(cmd, "@SessionCategoryID", DbType.Int64, hRSessionEntity.SessionCategoryID);
                db.AddInParameter(cmd, "@SessionName", DbType.String, hRSessionEntity.SessionName);
                db.AddInParameter(cmd, "@StartDate", DbType.DateTime, hRSessionEntity.StartDate);
                db.AddInParameter(cmd, "@EndDate", DbType.DateTime, hRSessionEntity.EndDate);
                db.AddInParameter(cmd, "@DeadlineDate", DbType.DateTime, hRSessionEntity.DeadlineDate);
                db.AddInParameter(cmd, "@EvaluationSessionStatusID", DbType.Int64, hRSessionEntity.EvaluationSessionStatusID);
                db.AddInParameter(cmd, "@Remarks", DbType.String, hRSessionEntity.Remarks);
                db.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hRSessionEntity.CreatedByEmployeeID);
                db.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hRSessionEntity.CreateDate);
                db.AddInParameter(cmd, "@IP", DbType.String, hRSessionEntity.IP);

                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);
        }
示例#4
0
        protected void lvHRSession_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 SessionID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(HRSessionEntity.FLD_NAME_SessionID, SessionID.ToString(), SQLMatchType.Equal);

                        HRSessionEntity hRSessionEntity = new HRSessionEntity();


                        result = FCCHRSession.GetFacadeCreate().Delete(hRSessionEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _SessionID       = 0;
                            _HRSessionEntity = new HRSessionEntity();
                            PrepareInitialView();
                            BindHRSessionList();

                            MiscUtil.ShowMessage(lblMessage, "Session has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Session.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }

                else if (e.CommandName == "GenerateSession")
                {
                    _SessionID = SessionID;
                    this.ModalPopupExtender2.Show();
                }
            }
        }
示例#5
0
        private void SaveHRSessionEntity()
        {
            if (IsValid)
            {
                try
                {
                    HRSessionEntity hRSessionEntity = BuildHRSessionEntity();

                    Int64 result = -1;

                    if (hRSessionEntity.IsNew)
                    {
                        result = FCCHRSession.GetFacadeCreate().Add(hRSessionEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRSessionEntity.FLD_NAME_SessionID, hRSessionEntity.SessionID.ToString(), SQLMatchType.Equal);
                        result = FCCHRSession.GetFacadeCreate().Update(hRSessionEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _SessionID       = 0;
                        _HRSessionEntity = new HRSessionEntity();
                        PrepareInitialView();
                        BindHRSessionList();

                        if (hRSessionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Session Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Session Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (hRSessionEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Session Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Session Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
示例#6
0
        private Int64 DeleteTran(HRSessionEntity hRSessionEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRSession_SET";

            Database db = DatabaseFactory.CreateDatabase();


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


                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);
        }
示例#7
0
        private HRSessionEntity BuildHRSessionEntity()
        {
            HRSessionEntity hRSessionEntity = CurrentHRSessionEntity;

            if (ddlSessionCategoryID.Items.Count > 0)
            {
                if (ddlSessionCategoryID.SelectedValue == "0")
                {
                }
                else
                {
                    hRSessionEntity.SessionCategoryID = Int64.Parse(ddlSessionCategoryID.SelectedValue);
                }
            }

            hRSessionEntity.SessionName = txtSessionName.Text.Trim();
            if (txtStartDate.Text.Trim().IsNotNullOrEmpty())
            {
                hRSessionEntity.StartDate = MiscUtil.ParseToDateTime(txtStartDate.Text);
            }

            if (txtEndDate.Text.Trim().IsNotNullOrEmpty())
            {
                hRSessionEntity.EndDate = MiscUtil.ParseToDateTime(txtEndDate.Text);
            }

            if (txtDeadlineDate.Text.Trim().IsNotNullOrEmpty())
            {
                hRSessionEntity.DeadlineDate = MiscUtil.ParseToDateTime(txtDeadlineDate.Text);
            }

            if (ddlEvaluationSessionStatusID.Items.Count > 0)
            {
                if (ddlEvaluationSessionStatusID.SelectedValue == "0")
                {
                }
                else
                {
                    hRSessionEntity.EvaluationSessionStatusID = Int64.Parse(ddlEvaluationSessionStatusID.SelectedValue);
                }
            }

            hRSessionEntity.Remarks             = txtRemarks.Text.Trim();
            hRSessionEntity.CreatedByEmployeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
            hRSessionEntity.CreateDate          = System.DateTime.Now;
            hRSessionEntity.IP = MiscUtil.GetLocalIP();

            return(hRSessionEntity);
        }
示例#8
0
        private Int64 Update(HRSessionEntity hRSessionEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRSession_SET";

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

                Database.AddInParameter(cmd, "@SessionID", DbType.Int64, hRSessionEntity.SessionID);
                Database.AddInParameter(cmd, "@SessionCategoryID", DbType.Int64, hRSessionEntity.SessionCategoryID);
                Database.AddInParameter(cmd, "@SessionName", DbType.String, hRSessionEntity.SessionName);
                Database.AddInParameter(cmd, "@StartDate", DbType.DateTime, hRSessionEntity.StartDate);
                Database.AddInParameter(cmd, "@EndDate", DbType.DateTime, hRSessionEntity.EndDate);
                Database.AddInParameter(cmd, "@DeadlineDate", DbType.DateTime, hRSessionEntity.DeadlineDate);
                Database.AddInParameter(cmd, "@EvaluationSessionStatusID", DbType.Int64, hRSessionEntity.EvaluationSessionStatusID);
                Database.AddInParameter(cmd, "@Remarks", DbType.String, hRSessionEntity.Remarks);
                Database.AddInParameter(cmd, "@CreatedByEmployeeID", DbType.Int64, hRSessionEntity.CreatedByEmployeeID);
                Database.AddInParameter(cmd, "@CreateDate", DbType.DateTime, hRSessionEntity.CreateDate);
                Database.AddInParameter(cmd, "@IP", DbType.String, hRSessionEntity.IP);

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

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

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

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

            return(returnCode);
        }
        private void PrepareInitialView()
        {
            BuildDropDownList();
            BindLabel();
            SubmitButtonEnable();

            Int64 employeeID = _CurrentEmployeeEvaluatedID;

            if (employeeID > 0)
            {
                String fe = SqlExpressionBuilder.PrepareFilterExpression(ResourceEmployee_CustomEntity.FLD_NAME_EmployeeID, employeeID.ToString(), SQLMatchType.Equal);

                IList <ResourceEmployee_CustomEntity> lst = FCCResourceEmployee_Custom.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe);

                if (lst != null && lst.Count > 0)
                {
                    lblEmployeeName.Text = lst[0].MemberFullName.ToString();
                    lblEmployeeCode.Text = lst[0].EmployeeCode;
                    lblDepartment.Text   = lst[0].DepartmentName;
                    lblDesignation.Text  = lst[0].DesignationName;
                    lblConfirmDate.Text  = lst[0].ConfirmDate.ToStringDefault();
                    lblJoinDate.Text     = lst[0].JoinDate.ToStringDefault();

                    lblSessionEvaluatedBy.Text = CurrentMember.FirstName + " " + CurrentMember.MiddleName + " " + CurrentMember.LastName;

                    if (lst[0].EmployeeID == MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember))
                    {
                        lblSessionEvaluatedBy.Text += " (Self)";
                    }
                    else
                    {
                        lblSessionEvaluatedBy.Text += " (Supervisor)";
                    }
                }
            }

            String          fe_session      = SqlExpressionBuilder.PrepareFilterExpression(HRSessionEntity.FLD_NAME_SessionID, _CurrentSessionID.ToString(), SQLMatchType.Equal);
            HRSessionEntity hRSessionEntity = FCCHRSession.GetFacadeCreate().GetByID(_CurrentSessionID);

            if (hRSessionEntity != null && hRSessionEntity.SessionID > 0)
            {
                lblSessionName.Text           = hRSessionEntity.SessionName;
                lblSessionStartDate.Text      = hRSessionEntity.StartDate.ToStringDefault();
                lblSessionEndDate.Text        = hRSessionEntity.EndDate.ToStringDefault();
                lblSessionEvaluationType.Text = "N/A";
            }
        }
示例#10
0
        private Int64 Delete(HRSessionEntity hRSessionEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.HRSession_SET";

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


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

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

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

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

            return(returnCode);
        }
示例#11
0
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _SessionID       = 0;
     _HRSessionEntity = new HRSessionEntity();
     PrepareInitialView();
 }
示例#12
0
 Int64 IHRSessionFacade.Delete(HRSessionEntity hRSessionEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRSessionDataAccess().Delete(hRSessionEntity, filterExpression, option, reqTran));
 }
示例#13
0
 Int64 IHRSessionFacade.Add(HRSessionEntity hRSessionEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateHRSessionDataAccess().Add(hRSessionEntity, option, reqTran));
 }