private void GetPlanningData() { MWDataManager.clsDataAccess _PrePlanningData = new MWDataManager.clsDataAccess(); _PrePlanningData.ConnectionString = TConnections.GetConnectionString(systemDBTag, UserCurrentInfo.Connection); _PrePlanningData.queryExecutionType = MWDataManager.ExecutionType.StoreProcedure; _PrePlanningData.queryReturnType = MWDataManager.ReturnType.DataTable; _PrePlanningData.SqlStatement = "sp_Load_Planning"; SqlParameter[] _paramCollection = { _PrePlanningData.CreateParameter("@ProdMonth", SqlDbType.Int, 0, Convert.ToInt32(planningSettings.ProdMonth)), _PrePlanningData.CreateParameter("@Sectionid_2", SqlDbType.VarChar, 20, planningSettings.MOSectionID), _PrePlanningData.CreateParameter("@Activity", SqlDbType.Int,0, planningSettings.ActivityID), }; _PrePlanningData.ParamCollection = _paramCollection; var result = _PrePlanningData.ExecuteInstruction(); _PrePlanningData.ResultsDataTable.Columns["OrgUnitNight"].DataType = typeof(string); tblPlanningData = _PrePlanningData.ResultsDataTable.Copy(); _PrePlanningData.Dispose(); _PrePlanningData = null; }
public void Dispose() { if (TheData != null) { TheData.Dispose(); TheData = null; } }
public void LoadPlanningCycle() { try { MWDataManager.clsDataAccess _PrePlanningCycleData = new MWDataManager.clsDataAccess(); _PrePlanningCycleData.ConnectionString = TConnections.GetConnectionString(systemDBTag, UserCurrentInfo.Connection); _PrePlanningCycleData.queryExecutionType = MWDataManager.ExecutionType.StoreProcedure; _PrePlanningCycleData.queryReturnType = MWDataManager.ReturnType.DataTable; _PrePlanningCycleData.SqlStatement = "sp_LoadPlanningCycle"; SqlParameter[] _paramCollection = { _PrePlanningCycleData.CreateParameter("@sectionid", SqlDbType.VarChar, 20, (planningSettings.MOSectionID)), _PrePlanningCycleData.CreateParameter("@sectionidMO", SqlDbType.VarChar, 20, planningSettings.MOSectionID), _PrePlanningCycleData.CreateParameter("@ProdMonth", SqlDbType.Int, 0, Convert.ToInt32(planningSettings.ProdMonth)), _PrePlanningCycleData.CreateParameter("@Activity", SqlDbType.Int, 0, planningSettings.ActivityID) }; _PrePlanningCycleData.ParamCollection = _paramCollection; var result = _PrePlanningCycleData.ExecuteInstruction(); tblPlanningCycleData = _PrePlanningCycleData.ResultsDataTable.Copy(); planningCycle.LoadPlanningCycleData(tblPlanningCycleData); _PrePlanningCycleData.Dispose(); _PrePlanningCycleData = null; } catch (Exception) { } }
/// <summary> /// Load all miners for selected MO section and production month /// </summary> /// 2019/03/05 : DvdB Updated code to standards public void LoadMinerList() { MWDataManager.clsDataAccess minerData = new MWDataManager.clsDataAccess(); minerData.ConnectionString = TConnections.GetConnectionString(systemDBTag, UserCurrentInfo.Connection); minerData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; minerData.queryReturnType = MWDataManager.ReturnType.DataTable; sb.Clear(); sb.AppendLine("select distinct a.SECTIONID, Name from section_complete a inner join SECCAL b on "); sb.AppendLine("A.PRODMONTH = B.Prodmonth AND "); sb.AppendLine("A.SECTIONID_1 = B.SectionID "); sb.AppendLine(String.Format("where A.prodmonth = '{0}' and a.SECTIONID_2 = '{1}' ORDER BY a.Name", PlanningSettings.ProdMonth, PlanningSettings.MOSectionID)); minerData.SqlStatement = sb.ToString(); var theResult = minerData.ExecuteInstruction(); if (theResult.success) // check if the query was executed correctly { tblMinerListData = minerData.ResultsDataTable.Copy(); } minerData.Dispose(); minerData = null; }