public void InitGoal(bool isPostBack) { if (!isPostBack) { CompanyGoal companyGoal = _GetGoal.GetLastCompanyGoal(LoginUser); _IGoalLastCompanyView.CompanyGoal = companyGoal; } }
/// <summary> /// 更新公司目标 /// </summary> /// <param name="companyGoal"></param> /// <returns></returns> public int UpdateCompanyGoal(CompanyGoal companyGoal) { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_GoalID, SqlDbType.Int).Value = companyGoal.Id; cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = 0; cmd.Parameters.Add(_SetHostName, SqlDbType.NVarChar, 50).Value = ""; cmd.Parameters.Add(_Title, SqlDbType.NVarChar, 50).Value = companyGoal.Title; cmd.Parameters.Add(_Content, SqlDbType.Text).Value = companyGoal.Content; cmd.Parameters.Add(_SetTime, SqlDbType.DateTime).Value = companyGoal.SetTime; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.CompanyGoal); return(SqlHelper.ExecuteNonQuery("GoalUpdate", cmd)); }
/// <summary> /// 新增公司目标 /// </summary> /// <param name="companyGoal"></param> /// <returns></returns> public int InsertCompanyGoal(CompanyGoal companyGoal) { int pkid; SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_GoalID, SqlDbType.Int).Direction = ParameterDirection.Output; cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = 0; cmd.Parameters.Add(_SetHostName, SqlDbType.NVarChar, 50).Value = ""; cmd.Parameters.Add(_Title, SqlDbType.NVarChar, 50).Value = companyGoal.Title; cmd.Parameters.Add(_Content, SqlDbType.Text).Value = companyGoal.Content; cmd.Parameters.Add(_SetTime, SqlDbType.DateTime).Value = companyGoal.SetTime; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.CompanyGoal); SqlHelper.ExecuteNonQueryReturnPKID("GoalInsert", cmd, out pkid); return(pkid); }
public void ExecuteEvent(object sender, EventArgs e) { if (Validation()) { CompanyGoal companyGoal = new CompanyGoal(0, _IGoalBaseView.Title, _IGoalBaseView.Content, Convert.ToDateTime(_IGoalBaseView.SetTime)); try { BllInstance.GoalBllInstance.CreateCompanyGoal(companyGoal, 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(string goalID, bool isPostBack) { int GoalID; if (!int.TryParse(goalID, out GoalID)) { _IGoalBaseView.ResultMessage = "目标ID必须为整数!"; return; } if (!isPostBack) { CompanyGoal goal = _GetGoal.GetGoalByPKID(GoalID, LoginUser) as CompanyGoal; if (goal != null) { _IGoalBaseView.GoalID = goal.Id.ToString(); _IGoalBaseView.Title = goal.Title; _IGoalBaseView.Content = goal.Content; _IGoalBaseView.SetTime = goal.SetTime.ToShortDateString(); } } }
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; }
public CompanyGoal GetLastCompanyGoal() { SqlCommand cmd = new SqlCommand(); cmd.Parameters.Add(_SetHostID, SqlDbType.Int).Value = 0; cmd.Parameters.Add(_GoalType, SqlDbType.Int).Value = Convert.ToInt32(GoalType.CompanyGoal); 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]); CompanyGoal companyGoal = new CompanyGoal(goalID, title, content, setTime); return(companyGoal); } } return(null); }
public UpdateCompanyGoal(CompanyGoal companyGoal, Account loginUser) { _CompanyGoal = companyGoal; _LoginUser = loginUser; }
public void UpdateCompanyGoal(CompanyGoal companyGoal, Account loginUser) { UpdateCompanyGoal updateCompanyGoal = new UpdateCompanyGoal(companyGoal, loginUser); updateCompanyGoal.Excute(); }
public void CreateCompanyGoal(CompanyGoal companyGoal, Account loginUser) { AddCompanyGoal addCompanyGoal = new AddCompanyGoal(companyGoal, loginUser); addCompanyGoal.Excute(); }