public void SaveKeyResultAreaEvaluation(RatingHeader header, IEnumerable <RatingKeySuccessArea> ratings, int userid, int employeeid) { if (header.Id == 0) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[dbo].[spNotifications]"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@From", userid); cmd.Parameters.AddWithValue("@To", employeeid); cmd.Parameters.AddWithValue("@Message", "KRA evaluation was created."); cmd.Parameters.AddWithValue("@QueryType", 1); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); header.EvaluationSeason = ActiveSeason(); _dbContext.Add(header); } else { header.EvaluationSeason = ActiveSeason(); _dbContext.Entry(header).State = EntityState.Modified; } foreach (var item in ratings) { item.RatingHeader = header; if (item.Id == 0) { _dbContext.Add(item); } else { _dbContext.Entry(item).State = EntityState.Modified; } } _dbContext.SaveChanges(); }
public void Save(ApprovalLevelAssignment approval, int userid) { //if(approval.Id == 0) //{ // approval.CreatedBy = userid.ToString(); // approval.CreationDate = DateTime.Now; // _dbContext.Add(approval); //} //else //{ // approval.ModifiedBy = userid.ToString(); // approval.ModifiedDate = DateTime.Now; // _dbContext.Entry(approval).State = EntityState.Modified; //} //_dbContext.SaveChanges(); SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[dbo].[spApprovalLevelAssignment]"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", approval.Id); cmd.Parameters.AddWithValue("@EmployeeId", approval.Employee.Id); cmd.Parameters.AddWithValue("@FirstApproval", approval.FirstApproval.Id); if (approval.IsWithSecondApproval) { cmd.Parameters.AddWithValue("@SecondApproval", approval.SecondApproval.Id); } cmd.Parameters.AddWithValue("@CreatedBy", userid); cmd.Parameters.AddWithValue("@ModifiedBy", userid); cmd.Parameters.AddWithValue("@IsWithSecondApproval", approval.IsWithSecondApproval ? 1 : 0); cmd.Parameters.AddWithValue("@QueryType", approval.Id == 0 ? 1 : 2); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); }
public void RemoveById(int id) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@QueryType", 4); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); }
public string ChangePassword(int id, string password) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Password", Security.Encrypt(password)); cmd.Parameters.AddWithValue("@QueryType", 2); return(SCObjects.ExecuteNonQuery(cmd, UserConnectionString)); }
public void DisapproveSecondApproval(int id, string remarks, int userid) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@Remarks", remarks); cmd.Parameters.AddWithValue("@ApproverId", userid); cmd.Parameters.AddWithValue("@QueryType", 4); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); }
public void Save(RecommendationAssignment item, int userid) { SqlCommand cmd = new SqlCommand(); cmd.CommandText = StoredProcedure; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", item.Id); cmd.Parameters.AddWithValue("@EmployeeId", item.Employee.Id); cmd.Parameters.AddWithValue("@RecommenderId", item.Recommender.Id); cmd.Parameters.AddWithValue("@CreatedBy", userid); cmd.Parameters.AddWithValue("@ModifiedBy", userid); cmd.Parameters.AddWithValue("@QueryType", item.Id == 0 ? 2 : 3); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); }
public void Save(decimal behavioral, decimal kra) { SqlCommand cmd = new SqlCommand(); List <SqlCommand> cmdList = new List <SqlCommand>(); cmd.CommandText = "[dbo].[spEvaluationSettings]"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@KRA", kra); cmd.Parameters.AddWithValue("@QueryType", 2); cmdList.Add(cmd); SqlCommand cmdNew = new SqlCommand(); cmdNew.CommandText = "[dbo].[spEvaluationSettings]"; cmdNew.Parameters.Clear(); cmdNew.Parameters.AddWithValue("@Behavioral", behavioral); cmdNew.Parameters.AddWithValue("@QueryType", 3); cmdList.Add(cmd); var result = SCObjects.ExecuteNonQuery(cmdList, UserConnectionString); }
public void PostKeyResultArea(int kraid, int employeeid) { var item = _dbContext.RatingKeySuccessAreas .Include(a => a.RatingHeader) .Include(a => a.RatingHeader.Ratee) .Include(a => a.KeyResultArea) .Include(a => a.RatingHeader.Status) .FirstOrDefault(a => a.KeyResultArea.Id == kraid && a.RatingHeader.Ratee.Id == employeeid && a.RatingHeader.IsExpired == false); var header = _dbContext.RatingHeader.FirstOrDefault(a => a.Id == item.RatingHeader.Id); var status = _dbContext.Statuses.FirstOrDefault(a => a.Id == TransactionStatus.ForApproval.ToInt()); header.Status = status; header.PostedDate = DateTime.Now; _dbContext.Entry(header).State = EntityState.Modified; _dbContext.SaveChanges(); var id = item.RatingHeader.Id; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "[dbo].[spEvaluationPostingNotification]"; cmd.Parameters.Clear(); cmd.Parameters.AddWithValue("@Id", id); cmd.Parameters.AddWithValue("@QueryType", 2); var result = SCObjects.ExecuteNonQuery(cmd, UserConnectionString); }