private IList <PmsHeadCount> AddPmsHeadCount(IList <PmsHeadCount> listPmsHeadCount, DataRow dtExcelRows, string role) { PmsHeadCount pmsHeadCount = new PmsHeadCount(); string ai10HeadCount = dtExcelRows["F6"].ToString(); pmsHeadCount = GetPmsHeadCount(role, "AI10", ai10HeadCount); listPmsHeadCount.Add(pmsHeadCount); string ai20HeadCount = dtExcelRows["F7"].ToString(); pmsHeadCount = GetPmsHeadCount(role, "AI20", ai20HeadCount); listPmsHeadCount.Add(pmsHeadCount); string ai30HeadCount = dtExcelRows["Resource"].ToString(); pmsHeadCount = GetPmsHeadCount(role, "AI30", ai30HeadCount); listPmsHeadCount.Add(pmsHeadCount); string ai40HeadCount = dtExcelRows["F9"].ToString(); pmsHeadCount = GetPmsHeadCount(role, "AI40", ai40HeadCount); listPmsHeadCount.Add(pmsHeadCount); string aic0HeadCount = dtExcelRows["F10"].ToString(); pmsHeadCount = GetPmsHeadCount(role, "AIC0", aic0HeadCount); listPmsHeadCount.Add(pmsHeadCount); return(listPmsHeadCount); }
private IList <PmsHeadCount> GetPmsHeadCountList(DataSet dsExcel) { IList <PmsHeadCount> listPmsHeadCount = new List <PmsHeadCount>(); DataTable dtExcel = new DataTable(); dtExcel = dsExcel.Tables["SUMMARY"]; PmsHeadCount pmsHeadCount = new PmsHeadCount(); for (int k = 1; k < dtExcel.Rows.Count; k++) { string role = dtExcel.Rows[k]["F1"].ToString().ToUpper().Trim(); switch (role) { case "SD": case "SE": case "QA": listPmsHeadCount = AddPmsHeadCount(listPmsHeadCount, dtExcel.Rows[k], role); break; default: break; } } return(listPmsHeadCount); }
private PmsHeadCount GetPmsHeadCount(string role, string userDept, string headCount) { PmsHeadCount pmsHeadCount = new PmsHeadCount(); pmsHeadCount.Vid = "PM"; pmsHeadCount.YearAndMonth = DropDownListYearMonth.SelectedValue.Trim(); pmsHeadCount.RequirementPeriod = DropDownListWeekPeriod.SelectedValue.Trim(); pmsHeadCount.UserDept = userDept; pmsHeadCount.Role = role; pmsHeadCount.HeadCount = float.Parse(headCount); pmsHeadCount.Createdate = System.DateTime.Now; pmsHeadCount.Createuser = WSC.GlobalDefinition.Cookie_LoginUser.Replace(" ", "."); return(pmsHeadCount); }
public bool InsertPmsRequirement(IList <PmsRequirement> listPmsRequirement, IList <PmsHeadCount> listPmsHeadCount, IList <PmsHeadCountByContent> listPmsHeadCountByContent) { try { m_PMSSqlConnection.BeginTransaction(); if (listPmsRequirement.Count > 0) { PmsRequirement pmsRequirement = listPmsRequirement.FirstOrDefault(); m_PMSSqlConnection.Delete("DeletePmsRequirement", pmsRequirement); } if (listPmsHeadCount.Count > 0) { PmsHeadCount pmsHeadCount = listPmsHeadCount.FirstOrDefault(); m_PMSSqlConnection.Delete("DeletePmsHeadCount", pmsHeadCount); } if (listPmsHeadCountByContent.Count > 0) { PmsHeadCountByContent pmsHeadCountByContent = listPmsHeadCountByContent.FirstOrDefault(); m_PMSSqlConnection.Delete("DeletePmsHeadCountByContent", pmsHeadCountByContent); } foreach (var pmsRequirement in listPmsRequirement) { m_PMSSqlConnection.Insert("InsertPmsRequirement", pmsRequirement); } foreach (var pmsHeadCount in listPmsHeadCount) { m_PMSSqlConnection.Insert("InsertPmsHeadCount", pmsHeadCount); } foreach (var pmsHeadCountByContent in listPmsHeadCountByContent) { m_PMSSqlConnection.Insert("InsertPmsHeadCountByContent", pmsHeadCountByContent); } m_PMSSqlConnection.CommitTransaction(); return(true); } catch (Exception ex) { m_PMSSqlConnection.RollBackTransaction(); m_Logger.Error("PmsRequirementBiz/InsertPmsRequirement:" + ex.ToString()); return(false); } }