public PersonalGoal GetLastPersonalGoalBySetHostID(int hostID) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = hostID; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.PersonalGoal); using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetLastGoalBySetHostID", cmd)) { while (sdr.Read()) { int goalID = Convert.ToInt32(sdr[_DbGoalID]); string title = sdr[_DbTitle].ToString(); string content = sdr[_DbContent].ToString(); DateTime setTime = Convert.ToDateTime(sdr[_DbSetTime]); int setHostID = Convert.ToInt32(sdr[_DbSetHostID]); string setHostName = sdr[_DbSetHostName].ToString(); Account employee = new Account(); employee.Name = setHostName; employee.Id = setHostID; PersonalGoal personalGoal = new PersonalGoal(goalID, title, content, setTime, employee); return(personalGoal); } } return(null); }
/// <summary> /// 更新个人目标 /// </summary> /// <param name="personalGoal"></param> /// <returns></returns> public int UpdatePersonalGoal(PersonalGoal personalGoal) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_GoalID, SqlDbType.Int).Value = personalGoal.Id; cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = personalGoal.Account.Id; cmd.Parameters.Add(_SetHostName, SqlDbType.NVarChar, 50).Value = personalGoal.Account.Name; cmd.Parameters.Add(_Title, SqlDbType.NVarChar, 50).Value = personalGoal.Title; cmd.Parameters.Add(_Content, SqlDbType.Text).Value = personalGoal.Content; cmd.Parameters.Add(_SetTime, SqlDbType.DateTime).Value = personalGoal.SetTime; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.PersonalGoal); return(SqlHelper.ExecuteNonQuery("GoalUpdate", cmd)); }
/// <summary> /// 新增个人目标 /// </summary> /// <param name="personalGoal"></param> /// <returns></returns> public int InsertPersonalGoal(PersonalGoal personalGoal) { int pkid; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_GoalID, SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = personalGoal.Account.Id; cmd.Parameters.Add(_SetHostName, SqlDbType.NVarChar, 50).Value = personalGoal.Account.Name; cmd.Parameters.Add(_Title, SqlDbType.NVarChar, 50).Value = personalGoal.Title; cmd.Parameters.Add(_Content, SqlDbType.Text).Value = personalGoal.Content; cmd.Parameters.Add(_SetTime, SqlDbType.DateTime).Value = personalGoal.SetTime; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.PersonalGoal); SqlHelper.ExecuteNonQueryReturnPKID("GoalInsert", cmd, out pkid); return(pkid); }
public void ExecuteEvent(object sender, EventArgs e) { if (Validation()) //&& ValidationPersonalGoal()) { PersonalGoal personalGoal = new PersonalGoal(Convert.ToInt32(_IGoalBaseView.GoalID), _IGoalBaseView.Title, _IGoalBaseView.Content, Convert.ToDateTime(_IGoalBaseView.SetTime), LoginUser); try { BllInstance.GoalBllInstance.UpdatePersonalGoal(personalGoal, LoginUser); _CompleteEvent(this, EventArgs.Empty); } catch (ApplicationException ex) { _IGoalBaseView.ResultMessage = ex.Message; } } }
/// <summary> /// 根据PKID查找目标 /// </summary> /// <param name="pkid"></param> /// <returns></returns> public Goal GetGoalByPKID(int pkid) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_GoalID, SqlDbType.Int).Value = pkid; using (SqlDataReader sdr = SqlHelper.ExecuteReader("GetGoalByPKID", cmd)) { while (sdr.Read()) { int goalID = Convert.ToInt32(sdr[_DbGoalID]); string title = sdr[_DbTitle].ToString(); string content = sdr[_DbContent].ToString(); DateTime setTime = Convert.ToDateTime(sdr[_DbSetTime]); int setHostID = Convert.ToInt32(sdr[_DbSetHostID]); string setHostName = sdr[_DbSetHostName].ToString(); switch ((GoalType)sdr[_DbGoalType]) { case GoalType.PersonalGoal: Account employee = new Account(); employee.Name = setHostName; employee.Id = setHostID; PersonalGoal personalGoal = new PersonalGoal(goalID, title, content, setTime, employee); return(personalGoal); case GoalType.TeamGoal: Department department = new Department(setHostID, setHostName); TeamGoal teamGoal = new TeamGoal(goalID, title, content, setTime, department); return(teamGoal); case GoalType.CompanyGoal: CompanyGoal companyGoal = new CompanyGoal(goalID, title, content, setTime); return(companyGoal); } } } return(null); }
public void InitGoal(bool isPostBack) { CompanyGoal companyGoal = _IGoalBll.GetLastCompanyGoal(LoginUser); TeamGoal teamGoal = _IGoalBll.GetLastTeamGoalBySetHostID(LoginUser.Dept.Id, LoginUser); PersonalGoal personalGoal = _IGoalBll.GetLastPersonalGoalBySetHostID(LoginUser.Id, LoginUser); if (personalGoal == null) { _IGoalAllLastView.PersonalGoalVisible = false; } if (teamGoal == null) { _IGoalAllLastView.TeamGoalVisible = false; } if (companyGoal == null) { _IGoalAllLastView.CompanyGoalVisible = false; } _IGoalAllLastView.CompanyGoal = companyGoal; _IGoalAllLastView.TeamGoal = teamGoal; _IGoalAllLastView.PersonalGoal = personalGoal; }
protected override void ExcuteSelf() { _AssessActivity.PersonalGoal = String.Empty; PersonalGoal pGoal = _IGoal.GetLastPersonalGoalBySetHostID(_AssessActivity.ItsEmployee.Account.Id, null); if (pGoal != null) { _AssessActivity.PersonalGoal = pGoal.Content; } _AssessActivity.Intention = _Dal.GetIntentionByCharacter(_AssessActivity.AssessCharacterType); _AssessActivity.EmployeeDept = _AssessActivity.ItsEmployee.Account.Dept.DepartmentName; Employee employee = _IEmployee.GetEmployeeByAccountID(_AssessActivity.ItsEmployee.Account.Id); _AssessActivity.Responsibility = employee.EmployeeDetails.Work.Responsibility; _AssessActivity.NextStepIndex = -1; PrepareAssessActivity(); _IActiveFlow.AssessActivity = _AssessActivity; _IActiveFlow.AssessStatus = AssessStatus.HRComfirming; _IActiveFlow.ExcuteFlow(); }
public void InitGoal(string goalID, bool isPostBack) { int GoalID; if (!int.TryParse(goalID, out GoalID)) { _IGoalBaseView.ResultMessage = "目标ID必须为整数!"; return; } if (!isPostBack) { PersonalGoal goal = BllInstance.GoalBllInstance.GetGoalByPKID(GoalID, LoginUser) as PersonalGoal; if (goal != null) { _IGoalBaseView.GoalID = goal.Id.ToString(); _IGoalBaseView.Title = goal.Title; _IGoalBaseView.Content = goal.Content; _IGoalBaseView.SetTime = goal.SetTime.ToShortDateString(); } } }
public AddPersonalGoal(PersonalGoal personalGoal, Account loginUser) { _PersonalGoal = personalGoal; _LoginUser = loginUser; }
public void UpdatePersonalGoal(PersonalGoal personalGoal, Account loginUser) { UpdatePersonalGoal updatePersonalGoal = new UpdatePersonalGoal(personalGoal, loginUser); updatePersonalGoal.Excute(); }
public void CreatePersonalGoal(PersonalGoal personalGoal, Account loginUser) { AddPersonalGoal addPersonalGoal = new AddPersonalGoal(personalGoal, loginUser); addPersonalGoal.Excute(); }