/// <summary> /// 导入积分 /// </summary> private void DoImpScore() { string FileName = RequestData.Get("FileId") + ""; if (!string.IsNullOrEmpty(FileName)) { FileName = MapPath("/Document/") + FileName; DataTable UsrScoreDt = ImpUser(FileName); for (int i = 0; i < UsrScoreDt.Rows.Count; i++) { var Ent = SysUser.FindFirstByProperties(SysUser.Prop_WorkNo, UsrScoreDt.Rows[i]["工号"].ToString()); if (Ent == null) { continue; } SurveyScore Ss = new SurveyScore(); Ss.UserID = Ent.UserID; Ss.WorkNo = Ent.WorkNo; Ss.UserName = Ent.Name; int score = 0; if (int.TryParse(UsrScoreDt.Rows[i]["积分"].ToString(), out score)) { score = int.Parse(UsrScoreDt.Rows[i]["积分"].ToString()); } Ss.Score = score; Ss.Detail = "导入"; Ss.DoCreate(); } this.PageState.Add("State", "1"); } }
//public IDbConnection Connection //{ // get // { // return new SqlConnection(_configuration.GetConnectionString("dbConn")); // } //} public Dashboard2Response GetCyclewisepercentage(SurveyScore surveyScore) { DbConnection c = new DbConnection(_configuration); using (IDbConnection con = c.Connection) { con.Open(); var param = new DynamicParameters(); param.Add("@EMPID", surveyScore.EMPID); param.Add("@Role", surveyScore.Role); param.Add("@CompetencyID", surveyScore.CompetencyID); param.Add("@OrderBy", surveyScore.OrderBy); Dashboard2Response desboard2Response = new Dashboard2Response(); List <Dashboard2Modal> castDeshboardData; List <Fields> fields = new List <Fields>(); using (var qList = con.QueryMultiple("dbo.usp_Dashboard2SurveyData", param, commandType: CommandType.StoredProcedure)) { castDeshboardData = qList.Read <Dashboard2Modal>().AsList(); fields = qList.Read <Fields>().AsList(); desboard2Response.data = castDeshboardData; desboard2Response.Fields = fields; } return(desboard2Response); } }
public Dashboard2Response GetCyclewisepercentage([FromBody] SurveyScore surveyScore) { Dashboard2Response dashboardData = new Dashboard2Response(); try { Dashboard2Response desboard2 = this._dashboard2Services.GetCyclewisepercentage(surveyScore); if (desboard2 != null) { dashboardData.Result = true; dashboardData.data = desboard2.data; dashboardData.Fields = desboard2.Fields; dashboardData.Message = "Success"; } else { dashboardData.Result = false; } } catch (Exception ex) { throw; } return(dashboardData); }
public SurveyTrendResponse GetCompentencyScore([FromBody] SurveyScore surveyScore) { try { SurveyTrendResponse response = new SurveyTrendResponse(); response.Data = this._dashboard2Services.GetCompentencyScore(surveyScore.CompetencyID, surveyScore.EMPID, surveyScore.Role); response.Result = true; return(response); } catch (Exception) { throw; } }
public Dashboard2Response GetCyclewisepercentage(SurveyScore surveyScore) { return(this._dashboard2Repo.GetCyclewisepercentage(surveyScore)); }
private void CommitSurvey() /*存储提交的调查问卷数据*/ { string CommitHistory = this.RequestData.Get <string>("CommitHistory"); IList <string> list = this.RequestData.GetList <string>("commitArr"); if (list.Count > 0 && !string.IsNullOrEmpty(CommitHistory)) { IList <SurveyedResult> ents = list.Select(ten => JsonHelper.GetObject <SurveyedResult>(ten) as SurveyedResult).ToArray(); SurveyCommitHistory shEnt = JsonHelper.GetObject <SurveyCommitHistory>(CommitHistory); if (!string.IsNullOrEmpty(shEnt.SurveyedUserId)) { var UserEnt = SysUser.Find(shEnt.SurveyedUserId); shEnt.WorkNo = UserEnt.WorkNo; shEnt.SurveyedUserName = UserEnt.Name; } try { foreach (var v in ents) { v.DoCreate(); } } catch (Exception ex) { string SQL = "delete from FL_Culture..SurveyedResult where SurveyId='{0}' and UserId='{1}' "; SQL = string.Format(SQL, Id, uid); DataHelper.ExecSql(SQL); } int totalScore = -1; //计算总分 -1 表示无分值项 string SocreInfo = string.Empty; // 分值总分 var Ents = QuestionAnswerItem.FindAllByProperties(QuestionAnswerItem.Prop_SurveyId, shEnt.SurveyId); QuestionAnswerItem[] QArr = Ents.Where(ten => ten.Score.HasValue).ToArray(); if (QArr.Length > 0) { string sql = "select FL_Culture.dbo.f_SumSurveyScore('{0}','{1}') As TotalScore"; sql = string.Format(sql, shEnt.SurveyId, shEnt.SurveyedUserId); object obj = DataHelper.QueryValue(sql); int tryVal = 0; if (int.TryParse(obj.ToString(), out tryVal)) { tryVal = int.Parse(obj.ToString()); } totalScore = tryVal; SocreInfo = GetScoreInfo(shEnt.SurveyId, shEnt.SurveyedUserId); } //添加积分项 SurveyQuestion SQ = SurveyQuestion.Find(shEnt.SurveyId); if (SQ.Score.HasValue) { SurveyScore Score = new SurveyScore(); Score.Score = SQ.Score; Score.Sign = "s"; Score.UserID = shEnt.SurveyedUserId; Score.UserName = shEnt.SurveyedUserName; Score.Detail = SQ.SurveyTitile; Score.Ext1 = SQ.Id;//SurveyId Score.DoCreate(); } shEnt.TotalScore = totalScore; shEnt.ScoreInfo = SocreInfo; shEnt.DoCreate(); } }