private void frmPlanProtCpature_Load(object sender, EventArgs e) { updateSecurity(); barCaptureOptions.EditValue = "1"; captureOption = "1"; barProdMonth.EditValue = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); btnUnlockData.Enabled = true; CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; if (BMEBL.get_ReviseActivity() == true) { editActitivity.DataSource = BMEBL.ResultsDataTable; editActitivity.DisplayMember = "Desc"; editActitivity.ValueMember = "Code"; } LoadSections(); }
private void frmResavePlanningProtocol_Load(object sender, EventArgs e) { //string ThePath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData); //string path = string.Format(@"{0}\{1}_{2}.txt", ThePath, r["Prodmonth"], r["WorkPlaceID"]); //MessageBox.Show(ThePath); mwProdmonthEdit1.EditValue = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; if (BMEBL.get_Activity() == true) { // this.tscbShaft.Items.Add("MINE"); editActivity.Properties.DataSource = BMEBL.ResultsDataTable; editActivity.Properties.DisplayMember = "Desc"; editActivity.Properties.ValueMember = "Code"; editActivity.ItemIndex = 0; } updateSections(TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(mwProdmonthEdit1.EditValue)), editActivity.EditValue.ToString()); DataStructure(); }
public void LoggedOn() { // Use this section to load all module settings like user logon info or production info //TProductionGlobal.get(resWPAS .systemDBTag,TUserInfo .Connection ); TProductionGlobal.SetProductionGlobalInfo(resWPAS.systemDBTag); TProductionGlobal.getSystemSettingsProductioInfo(resWPAS.systemDBTag); TProductionGlobal.SetUserInfo(resWPAS.systemDBTag); //TProductionGlobal.getUserInfo(resWPAS.systemDBTag); }
private void PlathondWallChartReportUserControl_Load(object sender, EventArgs e) { ActiveReport.UserCurrentInfo = this.UserCurrentInfo; reportSettings.Prodmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); iProdMonth.Properties.Value = reportSettings.Prodmonth; LoadSections(); reportSettings.Activity = "Stoping"; pgMeasuringList.SelectedObject = reportSettings; }
private void ucPlannedVsBooked_Load(object sender, EventArgs e) { try { reportSettings.Type = "Tons"; reportSettings.ShowType = "Both"; reportSettings.CastType = "Both"; reportSettings.MSType = "All"; reportSettings.WhatMonth = "Production Month"; CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; DataTable dtActivityData = BMEBL.GetActivityReports(); rpActivity.DataSource = dtActivityData; rpActivity.DisplayMember = "Desc"; rpActivity.ValueMember = "Code"; reportSettings.UserCurrentInfo = this.UserCurrentInfo; reportSettings.systemDBTag = this.theSystemDBTag; reportSettings.pmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); int theYear = Convert.ToInt32(reportSettings.pmonth.Substring(0, 4)); int theMonth = Convert.ToInt32(reportSettings.pmonth.Substring(4, 2)); DateTime theDate = new DateTime(theYear, theMonth, 1); reportSettings.Prodmonth = theDate.Date; reportSettings.UpdateSumOnRequest += reportSettings_UpdateSumOnRequest; reportSettings.Showuntil = DateTime.Now; iShowuntil.Properties.Value = reportSettings.Showuntil; reportSettings.Desc = "0"; iProdmonth.Properties.Value = reportSettings.Prodmonth.ToString(); DataTable dtSectionData = new DataTable(); if (BMEBL.GetPlanSectionsAndNameADO(reportSettings.pmonth) == true) { dtSectionData = BMEBL.ResultsDataTable; rpSectionid.DataSource = BMEBL.ResultsDataTable; rpSectionid.DisplayMember = "NAME"; rpSectionid.ValueMember = "NAME"; } reportSettings.NAME = dtSectionData.Rows[0]["NAME"].ToString(); pgPlanVsBookSettings.SelectedObject = reportSettings; } catch (Exception) { throw; } }
private void ucSundryMiningMeasurements_Load(object sender, EventArgs e) { prodmonth1.EditValue = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth; setSections(); LoadSundryMiningDescription(); LoadMiningMethod(); rpPreplanning.Visible = true; rpReplanning.Visible = false; MainGrid.Visible = false; panelControl1.Visible = false; }
public void info(string changed, string dept, string SECTION, string USER, string sectype) { hasChanged = changed; department = dept; //editUser.EditValue = USER; //editSection.EditValue = SECTION; // editSection.Properties.NullText = SECTION; if (sectype == "1") { // layoutControlItem4.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always; // } else { if (sectype == "2") { layoutControlItem5.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never; } } // } if (hasChanged == "2") { editUser.Enabled = false; } else { editUser.Enabled = true; } RSDB.UserCurrentInfo = UserCurrentInfo; RSDB.theData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); DataTable SectionList = RSDB.GetSections(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth); DataTable UserList = RSDB.GetUserList(department); DataTable SecurityType = RSDB.GetSecurityType(); editSection.Properties.DataSource = SectionList; editSection.Properties.DisplayMember = "Name"; editSection.Properties.ValueMember = "ID"; //editSection.EditValue = SectionList.Rows[0][0]; editUser.Properties.DataSource = UserList; editUser.Properties.ValueMember = "UserID"; editUser.Properties.DisplayMember = "UserName"; //editUser.EditValue = UserList.Rows[0][0]; editSecurity.Properties.DataSource = SecurityType; editSecurity.Properties.ValueMember = "SecurityType"; editSecurity.Properties.DisplayMember = "Description"; //editSecurity.EditValue = SecurityType.Rows[0][0]; }
private void ucMODailyProduction_Load(object sender, EventArgs e) { ActiveReport.UserCurrentInfo = this.UserCurrentInfo; //reportSettings.ReportDate = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Rundate; reportSettings.Prodmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); LoadSections(); reportSettings.SectionID = dtSections.Rows[0][0].ToString(); pgMODaily.SelectedObject = reportSettings; reportSettings.ReportDate = DateTime.Now; iReportDate.Properties.Value = reportSettings.ReportDate; }
private void ucMeasuringListReport_Load(object sender, EventArgs e) { ActiveReport.UserCurrentInfo = this.UserCurrentInfo; // reportSettings.ReportDate = DateTime.Now; reportSettings.Prodmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); iProdMonth.Properties.Value = reportSettings.Prodmonth; LoadSections(); reportSettings.SectionID = dtSections.Rows[0][0].ToString(); reportSettings.Activity = "Stoping"; pgMeasuringList.SelectedObject = reportSettings; // theReport.Preview.Click += Preview_Click; }
private void ucRevisedPlanningAuditReport_Load(object sender, EventArgs e) { CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; reportSettings.FromProdmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); reportSettings.ToProdmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); DataTable section = new DataTable(); if (BMEBL.GetPlanSectionsAndNameADO(TProductionGlobal.ProdMonthAsString(reportSettings.FromProdmonth)) == true) { section = BMEBL.ResultsDataTable; rpSection.DataSource = BMEBL.ResultsDataTable; rpSection.DisplayMember = "NAME"; rpSection.ValueMember = "sectionid"; } reportSettings.sectionid = section.Rows[0]["sectionid"].ToString(); reportSettings.RevisedPlanningType = "All"; MWDataManager.clsDataAccess _RevisedOptions = new MWDataManager.clsDataAccess(); _RevisedOptions.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _RevisedOptions.SqlStatement = "SELECT 0 Code, 'All' [RevisedPlanningType] " + "UNION " + "SELECT 1 Code, 'Stop Workplace' [RevisedPlanningType] " + "union " + "select 2 Code, 'New Workplace' [RevisedPlanningType] " + "union " + "select 3 Code, 'Crew Miner Changes' [RevisedPlanningType] " + "union " + "select 4 Code, 'Call Changes' [RevisedPlanningType] " + "union " + "select 5 Code, 'Move Planning' [RevisedPlanningType] " + "union " + "select 6 Code, 'Start Workplace' [RevisedPlanningType] " + "union " + "select 7 Code, 'Mining Method Change' [RevisedPlanningType] " + "union " + "select 8 Code, 'Drill Rig Change' [RevisedPlanningType] " + "union " + "select 9 Code, 'Delete Planning' [RevisedPlanningType] "; _RevisedOptions.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _RevisedOptions.queryReturnType = MWDataManager.ReturnType.DataTable; _RevisedOptions.ExecuteInstruction(); rpRevisedPlanningType.DataSource = _RevisedOptions.ResultsDataTable; rpRevisedPlanningType.DisplayMember = "RevisedPlanningType"; rpRevisedPlanningType.ValueMember = "RevisedPlanningType"; pgRevisedPlanningAudit.SelectedObject = reportSettings; }
public DataTable loadIfEditId(string editid, string division) { theData.SqlStatement = "select c.*, b.name name1, e.OreFlowID lvl,e.OreFlowID Ore, e.name lvlname, r.ReefID, r.Description, e.Division Division from oreflowentities c left outer join (select * from section " + " where prodmonth = '" + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).ProdMonth.ToString() + "'" + " ) b on c.sectionid = b.sectionid " + "left outer join oreflowentities e on c.parentoreflowid = e.oreflowid " + "left outer join Reef r on c.ReefType = convert(varchar(10), r.ReefID) " + "where c.oreflowid = '" + editid + "' and c.Division = '" + division + "' "; theData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; theData.queryReturnType = MWDataManager.ReturnType.DataTable; theData.ExecuteInstruction(); return(theData.ResultsDataTable); }
private void setSections() { CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; if (BMEBL.get_Sections(Convert.ToString(prodmonth1.EditValue), TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID.ToString()) == true) { editSection.DataSource = BMEBL.ResultsDataTable; editSection.DisplayMember = "Name"; editSection.ValueMember = "SectionID"; } }
public void updateSections(int prodMonth) { CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; if (BMEBL.get_Sections(Convert.ToString(prodMonth), TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID.ToString()) == true) { editMineoverseer1.DataSource = BMEBL.ResultsDataTable; editMineoverseer1.DisplayMember = "Name"; editMineoverseer1.ValueMember = "Name"; } }
private void ucProblemAnalysisReport_Load(object sender, EventArgs e) { ActiveReport.UserCurrentInfo = this.UserCurrentInfo; reportSettings.FromProdmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); reportSettings.ToProdmonth = TProductionGlobal.ProdMonthAsDate(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); reportSettings.FromDate = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Rundate; reportSettings.ToDate = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Rundate; reportSettings.Period = "Prodmonth"; reportSettings.Sections = "Single"; reportSettings.Activity = "Stoping"; reportSettings.Type = "ProbDesc"; reportSettings.GraphInfo = "Potential"; reportSettings.Available = GetAvailableList(); reportSettings.Details = false; reportSettings.DetailsGraph = false; reportSettings.TrendGraph = false; reportSettings.PerShaft = false; reportSettings.LostBlasts = false; iFromProdmonth.Visible = true; iToProdmonth.Visible = true; iToDate.Visible = false; iFromDate.Visible = false; iSectionSelect.Enabled = false; GetAvailableData(); CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = this.theSystemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; _pmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); DataTable section = new DataTable(); if (BMEBL.GetPlanSectionsAndNameADO(_pmonth) == true) { section = BMEBL.ResultsDataTable; riSectionSingle.DataSource = BMEBL.ResultsDataTable; riSectionSingle.DisplayMember = "NAME"; riSectionSingle.ValueMember = "NAME"; } reportSettings.NAME = section.Rows[0]["NAME"].ToString(); pgProblemAnalysis.SelectedObject = reportSettings; }
private void rpSectionid_EditValueChanged(object sender, EventArgs e) { pgPlanVsBookSettings.PostEditor(); //pgPlanVsBookSettings.FocusNext(); DataTable dtlevels = reportSettings.LoadAllLevel(); reportSettings.pmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); rpSummaryon.DataSource = dtlevels; if (dtlevels != null) { rpSummaryon.DisplayMember = "Description"; rpSummaryon.ValueMember = "HierarchicalID"; } }
void reportSettings_UpdateSumOnRequest(object sender, PlannedVsBookedSettingsProperties.UpdateSumOnArg e) { pgPlanVsBookSettings.PostEditor(); DataTable dtlevels = reportSettings.LoadAllLevel(); reportSettings.pmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); rpSummaryon.DataSource = dtlevels; if (dtlevels != null) { rpSummaryon.DisplayMember = "Description"; rpSummaryon.ValueMember = "HierarchicalID"; } //reportSettings.HierarchicalID = reportSettings.SumOn.Rows[0]["HierarchicalID"].ToString(); }
private void ucMiningMethodsPlanningSetup_Load(object sender, EventArgs e) { MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess(); _dbMan.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbMan.SqlStatement = "select a.TargetID, a.Activity,b.ShowInPlanning ShowInPlanning1,b.RequireDocuments RequireDocuments1, TheActivity = Case when a.Activity in (0,3) then 'Stoping' else 'Development' end, " + "cast(a.TargetID as Varchar(10))+':'+a.Description Method, " + "ShowInPlanning=case when b.ShowInPlanning ='Y' then cast(0 as bit) ELSE cast(1 as bit) END, RequireDocuments=case when b.RequireDocuments ='Y' THEN cast( 0 as bit) ELSE cast( 1 as bit) END from " + " " + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Bonus_Database + " dbo.Bonus_poolDEfaults a left join BONUS_POOL_VALIDATIONS b on " + "a.TargetID =b.TargetID and " + "a.Activity =b.Activity order by TheActivity desc,a.TargetID asc "; _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbMan.queryReturnType = MWDataManager.ReturnType.DataTable; _dbMan.ExecuteInstruction(); dt = _dbMan.ResultsDataTable; gridControl1.DataSource = dt; }
private void tlMiningTypes_FocusedNodeChanged(object sender, DevExpress.XtraTreeList.FocusedNodeChangedEventArgs e) { if (theMainData != null) { saveData(); } string s = FullNameByNode(e.Node, 0); MWDataManager.clsDataAccess _theData = new MWDataManager.clsDataAccess(); _theData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _theData.SqlStatement = "SELECT TargetID,Activity FROM " + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Bonus_Database + "dbo.Bonus_poolDEfaults WHERE Description = '" + s + "'"; _theData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _theData.queryReturnType = MWDataManager.ReturnType.DataTable; _theData.ExecuteInstruction(); if (_theData.ResultsDataTable.Rows.Count != 0) { foreach (DataRow r in _theData.ResultsDataTable.Rows) { theTargetID = Convert.ToInt32(r["TargetID"].ToString()); theActivity = Convert.ToInt32(r["Activity"].ToString()); } switch (theActivity) { case 0: buildStoping(); break; case 3: buildStoping(); break; case 1: buildDev(); break; } LoadData(theTargetID); } else { vgcOptions.Rows.Clear(); groupA.ChildRows.Clear(); } }
private void ucVampPlanning_Load(object sender, EventArgs e) { ProdmonthEdit.EditValue = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); MWDataManager.clsDataAccess _dbMan11 = new MWDataManager.clsDataAccess(); _dbMan11.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbMan11.SqlStatement = "select Code code1, * from Code_Cycle_Vamps order by Code "; _dbMan11.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbMan11.queryReturnType = MWDataManager.ReturnType.DataTable; _dbMan11.ExecuteInstruction(); DataTable Neilzz1 = _dbMan11.ResultsDataTable; CycleCodeLstOther.Items.Clear(); foreach (DataRow r in Neilzz1.Rows) { CycleCodeLstOther.Items.Add(r["code1"].ToString() + ":" + r["description"].ToString()); } MWDataManager.clsDataAccess _dbManWP = new MWDataManager.clsDataAccess(); _dbManWP.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManWP.SqlStatement = "Select distinct s1.ReportToSectionid+':'+s2.name Section from section s, section s1 , section s2 \r\n" + "where s.Prodmonth = s1.Prodmonth and s.ReportToSectionid = s1.SectionID \r\n" + "and s1.Prodmonth = s2.Prodmonth and s1.ReportToSectionid = s2.SectionID \r\n" + "and s.Prodmonth = '" + ProdmonthEdit.EditValue.ToString() + "' "; _dbManWP.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManWP.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManWP.ExecuteInstruction(); DataTable dt = _dbManWP.ResultsDataTable; repositoryItemComboBox2.Items.Clear(); foreach (DataRow dr in dt.Rows) { repositoryItemComboBox2.Items.Add(dr["Section"].ToString()); } }
public DataTable getUserSections(string userID, string type) { TheData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; TheData.queryReturnType = MWDataManager.ReturnType.DataTable; TheData.ConnectionString = TConnections.GetConnectionString(resWPAS.systemDBTag, this.UserCurrentInfo.Connection); sb.Clear(); sb.AppendLine("SELECT Distinct SEC.SectionID,SEC.Name,SEC.ReportToSectionID, "); sb.AppendLine(" CASE WHEN UD.SectionID is not NULL THEN Cast(1 as bit) ELSE Cast(0 as bit) END IsLinked, "); sb.AppendLine(" cast(0 as bit) Updated"); sb.AppendLine("FROM [dbo].[SECTION] SEC"); sb.AppendLine("LEFT JOIN "); sb.AppendLine(String.Format("(SELECT * FROM [dbo].[USERS_SECTION] WHERE UserID = '{0}' and LinkType = '{1}') UD ON", userID, type)); sb.AppendLine("SEC.SectionID = UD.SectionID"); sb.AppendLine("WHERE Prodmonth >= " + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString()); // sb.AppendLine(String.Format("SELECT * FROM USERS WHERE UserID = '{0}'", userID)); TheData.SqlStatement = sb.ToString(); TheData.ExecuteInstruction(); return(TheData.ResultsDataTable); }
public void LoadOrgUnits(string prodMonth, string sectionidMO) { MWDataManager.clsDataAccess _OrgUnitsData = new MWDataManager.clsDataAccess(); _OrgUnitsData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _OrgUnitsData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _OrgUnitsData.queryReturnType = MWDataManager.ReturnType.DataTable; _OrgUnitsData.SqlStatement = "SELECT 1 thepos,'' Crew_Org " + " UNION " + " SELECT 2 thepos,'Contractor' Crew_Org" + " UNION " + "SELECT 3 thepos,Crew_Org FROM " + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).Bonus_Database + "dbo.Production_Orgunit_View WHERE MO_SectionID = '" + sectionidMO + "' "; _OrgUnitsData.ExecuteInstruction(); reOrgDaySelection.DataSource = _OrgUnitsData.ResultsDataTable; reOrgDaySelection.DisplayMember = "Crew_Org"; reOrgDaySelection.ValueMember = "Crew_Org"; reOrgNightSelection.DataSource = _OrgUnitsData.ResultsDataTable; reOrgNightSelection.DisplayMember = "Crew_Org"; reOrgNightSelection.ValueMember = "Crew_Org"; }
private void cmbLevelDivison_EditValueChanged(object sender, EventArgs e) { if (cmbLevelDivison.ItemIndex != -1) { if (TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).IsCentralizedDatabase.ToString() == "1") { // GridMine = ""; //MWDataManager.clsDataAccess _dbManA = new MWDataManager.clsDataAccess(); // _dbManA.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); //_dbManA.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; //_dbManA.queryReturnType = MWDataManager.ReturnType.DataTable; //_dbManA.SqlStatement = " select mine from Code_WPDivision where DivisionCode = '" + cmbLevelDivison.EditValue .ToString () + "' "; //_dbManA.ExecuteInstruction(); //DataTable dtA = _dbManA.ResultsDataTable; // if (dtA.Rows.Count > 0) // GridMine = dtA.Rows[0]["mine"].ToString(); } } Load_LevelOrePass(); }
private void ileRevisedPlanningSecurity_Load(object sender, EventArgs e) { RSDB.UserCurrentInfo = UserCurrentInfo; RSDB.theData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); editSection.Properties.DataSource = RSDB.GetSections(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth); editSection.Properties.DisplayMember = "Name"; editSection.Properties.ValueMember = "ID"; editUser.Properties.DataSource = RSDB.GetUserList(department); editUser.Properties.ValueMember = "UserID"; editUser.Properties.DisplayMember = "UserName"; editSecurity.Properties.DataSource = RSDB.GetSecurityType(); editSecurity.Properties.ValueMember = "SecurityType"; editSecurity.Properties.DisplayMember = "Description"; //info(hasChanged); }
private void loadingData() { cmbType.Items.Add("Stoping"); cmbType.Items.Add("Development"); userList.DataSource = getUserList("", TempID); userList.ValueMember = "USERID"; userList.DisplayMember = "NAME"; //gridControl1.ForceInitialize(); // Add new template MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess(); _dbMan.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbMan.SqlStatement = "[spUpdate_PlanningTemplate_UserSecurity_Table]"; _dbMan.queryExecutionType = MWDataManager.ExecutionType.StoreProcedure; SqlParameter[] _paramCollection = { _dbMan.CreateParameter("@Prodmonth", SqlDbType.Int, 7, TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth), }; _dbMan.ParamCollection = _paramCollection; _dbMan.queryReturnType = MWDataManager.ReturnType.longNumber; _dbMan.ExecuteInstruction(); SqlDataAdapter oleDBAdapter1 = new SqlDataAdapter("SELECT TemplateID, TemplateName FROM PlanProt_Template WHERE TemplateID = " + TempID.ToString(), TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection)); SqlDataAdapter oleDBAdapter2 = new SqlDataAdapter("SELECT * FROM PlanProt_ApproveUsers WHERE SEction = 'NONE' and Shaft <> 'NONE' ORDER BY Shaft ", TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection)); SqlDataAdapter oleDBAdapter3 = new SqlDataAdapter("SELECT * FROM PlanProt_ApproveUsers WHERE SEction <> 'NONE' ORDER BY Section ", TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection)); SqlDataAdapter oleDBAdapter4 = new SqlDataAdapter("SELECT DISTINCT * FROM PlanProt_ApproveUsers WHERE SEction = 'NONE' and Shaft = 'NONE' ORDER BY Shaft,Unit ", TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection)); oleDBAdapter1.Fill(dsTemplateSecurity.theTemplates); oleDBAdapter2.Fill(dsTemplateSecurity.theShaft); oleDBAdapter3.Fill(dsTemplateSecurity.theSection); oleDBAdapter4.Fill(dsTemplateSecurity.theUnits); if (formAction == currentAction.caAdd) { // Load all User Profiles in CPM MWDataManager.clsDataAccess _dbManLastMonthWP = new MWDataManager.clsDataAccess(); _dbManLastMonthWP.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManLastMonthWP.SqlStatement = "SELECT USERPROFILEID ProfileName,CAST(FullAccess AS BIT) FullAccess,CAST(ReadOnlyAccess AS BIT) ReadOnlyAccess FROM (SELECT USERPROFILEID,0 FullAccess,1 ReadOnlyAccess FROM dbo.USERPROFILES) theProfile"; _dbManLastMonthWP.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManLastMonthWP.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManLastMonthWP.ExecuteInstruction(); using (DataTableReader reader = new DataTableReader(_dbManLastMonthWP.ResultsDataTable)) { dtProfileInfo.Clear(); dtProfileInfo.Load(reader); } gridSecurity.DataSource = dtProfileInfo; // Populate grid MWDataManager.clsDataAccess _dbManTemplate = new MWDataManager.clsDataAccess(); _dbManTemplate.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManTemplate.SqlStatement = "select MAX(TemplateID) TemplateID from PlanProt_Template"; _dbManTemplate.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManTemplate.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManTemplate.ExecuteInstruction(); using (DataTableReader readerTemplate = new DataTableReader(_dbManTemplate.ResultsDataTable)) { tableTemplate.Load(readerTemplate); } foreach (DataRow Temp in tableTemplate.Rows) { if (Temp["TemplateID"].ToString() == "") { TempID = 1; } else { TempID = Convert.ToInt32(Temp["TemplateID"].ToString()) + 1; } } } else if (formAction == currentAction.caEdit) { MWDataManager.clsDataAccess _dbManTemplateDetail = new MWDataManager.clsDataAccess(); _dbManTemplateDetail.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManTemplateDetail.SqlStatement = "Select * from PLANPROT_TEMPLATE where TemplateID = '" + TempID + "'"; _dbManTemplateDetail.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManTemplateDetail.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManTemplateDetail.ExecuteInstruction(); _dbApproveUsers.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbApproveUsers.SqlStatement = "SELECT TemplateID,Shaft,User1,User2 FROM dbo.PLANPROT_APPROVEUSERS WHERE TemplateID = '" + TempID + "'"; _dbApproveUsers.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbApproveUsers.queryReturnType = MWDataManager.ReturnType.DataTable; _dbApproveUsers.ExecuteInstruction(); cmbType.Enabled = false; txtDescription.Enabled = false; // gcApproveData.DataSource = _dbApproveUsers.ResultsDataTable; using (DataTableReader readerTempDetail = new DataTableReader(_dbManTemplateDetail.ResultsDataTable)) { tableTemplate.Load(readerTempDetail); } foreach (DataRow dr in tableTemplate.Rows) { if (dr["Activity"].ToString() == "0") { cmbType.SelectedIndex = 0; } else { cmbType.SelectedIndex = 1; } txtDescription.Text = dr["TemplateName"].ToString(); string edit1; if (dr["ApprovalRequired"].ToString() == "True") { rgReqApproval.SelectedIndex = 0; } else { rgReqApproval.SelectedIndex = 1; } } DataTable CPMProfiles = new DataTable(); MWDataManager.clsDataAccess _dbManLastMonthWP = new MWDataManager.clsDataAccess(); _dbManLastMonthWP.ConnectionString = TConnections.GetConnectionString("SystemSettings", UserCurrentInfo.Connection); //_dbManLastMonthWP.SqlStatement = "SELECT USERPROFILEID FROM USERPROFILES "; _dbManLastMonthWP.SqlStatement = "SELECT DepartmentID,Description FROM tblDepartments "; _dbManLastMonthWP.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManLastMonthWP.queryReturnType = MWDataManager.ReturnType.DataTable; var result = _dbManLastMonthWP.ExecuteInstruction(); if (!result.success) { MessageItem.viewMessage(MessageType.Error, "SQL ERROR", theSystemDBTag, "frmPlanProtTemplateSetup", "loadingData", result.Message, ButtonTypes.OK, MessageDisplayType.FullScreen); return; } DataTableReader reader = new DataTableReader(_dbManLastMonthWP.ResultsDataTable); CPMProfiles.Load(reader); _dbManLastMonthWP.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManLastMonthWP.SqlStatement = "SELECT DepartmentID ,TemplateID ,FullAccess ,ReadOnlyAccess , '' Description , CAST(DATA1 .AccessLevel as bit) AccessLevel FROM ( " + "select DepartmentID ,TemplateID, cast(data.FullAccess as bit) FullAccess, cast(data.ReadOnlyAccess as bit) ReadOnlyAccess, AccessLevel = CASE WHEN FullAccess = 0 THEN '0' ELSE '1' END from ( " + "SELECT PPA.DepartmentID ,PPA .TemplateID , " + "FullAccess= CASE WHEN PPA .AccessLevel=1 then '1' else '0' end, " + "ReadOnlyAccess= case when PPA.AccessLevel =1 then '0' else '1' end , " + "PPA.AccessLevel FROM PLANPROT_PROFILEACCESS PPA WHERE TemplateID = '" + TempID.ToString() + "')data)DATA1 "; result = _dbManLastMonthWP.ExecuteInstruction(); if (!result.success) { MessageItem.viewMessage(MessageType.Error, "SQL ERROR", theSystemDBTag, "frmPlanProtTemplateSetup", "loadingData", result.Message, ButtonTypes.OK, MessageDisplayType.FullScreen); return; } DataTableReader reader2 = new DataTableReader(_dbManLastMonthWP.ResultsDataTable); dtProfileInfo.Load(reader2); foreach (DataRow dr in CPMProfiles.Rows) { string expression; //expression = "ProfileName = '" + dr["USERPROFILEID"].ToString() + "'"; expression = "DepartmentID = '" + dr["DepartmentID"].ToString() + "'"; DataRow[] foundRows; foundRows = dtProfileInfo.Select(expression); var description = dr["Description"].ToString(); if (foundRows.Length == 0) { //dtProfileInfo.Rows.Add(dr["USERPROFILEID"].ToString(), 0, TempID); //dtProfileInfo.Rows.Add(dr["Description"].ToString(), 0, TempID); dtProfileInfo.Rows.Add(dr["DepartmentID"].ToString(), TempID, false, true, description); } else { foundRows[0]["Description"] = description; } } dtProfileInfo.Select(""); //dtProfileInfo.Columns.Add("Access1", typeof(bool)); // //{ // if (dr["ProfileAccess"] == DBNull.Value) // { // dr["Access1"] = false; // } // else // { // dr["Access1"] = dr["ProfileAccess"]; // } //} //bandedGridView1.PopulateColumns(dtProfileInfo); //LoadColumns(); gridSecurity.DataSource = dtProfileInfo; // Populate grid //bandedGridView1.Columns[1].Visible = false; } MWDataManager.clsDataAccess _dbManGrid = new MWDataManager.clsDataAccess(); _dbManGrid.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _dbManGrid.SqlStatement = "select Distinct pf.FieldID [FieldID],pf.FieldName [Field Name],ppf.fieldDescription [Field Type],pf2.FieldName[Parent] from PlanProt_Fields pf " + "left outer join " + "PlanProt_FieldTypes ppf " + "on pf.FieldType = ppf.fieldTypeID " + "left outer join PLANPROT_DATA pg " + "on pf.FieldID = pg.FieldID " + "left outer join " + "PlanProt_Fields pf2 " + "on pg.FieldID = pf2.parentID " + " where pf.TemplateID = '" + TempID + "' Order by pf.FieldID "; _dbManGrid.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbManGrid.queryReturnType = MWDataManager.ReturnType.DataTable; _dbManGrid.ExecuteInstruction(); DataTableReader readerGrid = new DataTableReader(_dbManGrid.ResultsDataTable); tableGrid.Load(readerGrid); gridOutput.DataSource = tableGrid; // Populate Grid // bandedGridView2.Columns[0].Visible = false; }
private void lcSections_SelectedIndexChanged(object sender, EventArgs e) { try { _WorkplaceList.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _WorkplaceList.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _WorkplaceList.queryReturnType = MWDataManager.ReturnType.DataTable; StringBuilder sb = new StringBuilder(); sb.AppendLine("Update AT set[FileName] = Cast(pp.ProdMonth As VarChar(7)) + '_' + Cast(pp.Workplaceid As VarChar(7)) + '.fpx' "); sb.AppendLine(" "); sb.AppendLine("FROM PLANMONTH PP "); sb.AppendLine("LEFT JOIN PLANPROT_APPROVEDTEMPLATE AT ON "); sb.AppendLine("PP.Prodmonth = AT.Prodmonth and "); sb.AppendLine("PP.[Workplaceid] = AT.[Workplaceid] and "); sb.AppendLine("PP.[Activity] = AT.[Activity] "); sb.AppendLine("WHERE PP.Prodmonth = " + TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(mwProdmonthEdit1.EditValue)) + " and "); sb.AppendLine(" Locked = 1 and"); sb.AppendLine(" pp.PlanCode = 'MP' and [FileName] is null"); _WorkplaceList.SqlStatement = sb.ToString(); _WorkplaceList.ExecuteInstruction(); sb.Clear(); sb.AppendLine("Insert Into PLANPROT_APPROVEDTEMPLATE "); sb.AppendLine("Select pp.Prodmonth, pp.WorkplaceID, pp.Sectionid_2, pp.Activity, [FileName] = Cast(pp.ProdMonth As VarChar(7)) + '_' + Cast(pp.Workplaceid As VarChar(7)) + '.fpx', GetDate()"); sb.AppendLine("FROM PLANMONTH PP "); sb.AppendLine("LEFT JOIN PLANPROT_APPROVEDTEMPLATE AT ON "); sb.AppendLine("PP.Prodmonth = AT.Prodmonth and "); sb.AppendLine("PP.[Workplaceid] = AT.[Workplaceid] and "); sb.AppendLine("PP.[Activity] = AT.[Activity] "); sb.AppendLine("WHERE PP.Prodmonth = " + TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(mwProdmonthEdit1.EditValue)) + " and "); sb.AppendLine(" Locked = 1 and"); sb.AppendLine(" pp.PlanCode = 'MP' and [FileName] is null"); _WorkplaceList.SqlStatement = sb.ToString(); _WorkplaceList.ExecuteInstruction(); //sb.Clear(); //sb.AppendLine("update a set Locked = 1 "); //sb.AppendLine("from"); //sb.AppendLine("planmonth a inner"); //sb.AppendLine("join"); //sb.AppendLine("(select Prodmonth,"); //sb.AppendLine("SectionID,"); //sb.AppendLine("WorkplaceID,"); //sb.AppendLine("Activity,"); //sb.AppendLine("PlanCode,"); //sb.AppendLine("Count(Prodmonth) Shifts"); //sb.AppendLine(" from planning"); //sb.AppendLine(" group by Prodmonth,"); //sb.AppendLine("SectionID,"); //sb.AppendLine("WorkplaceID,"); //sb.AppendLine("Activity,"); //sb.AppendLine("PlanCode) b on"); //sb.AppendLine("a.Prodmonth = b.Prodmonth and"); //sb.AppendLine("a.SectionID = b.SectionID and"); //sb.AppendLine("a.WorkplaceID = b.WorkplaceID and"); //sb.AppendLine("a.Activity = b.Activity and"); //sb.AppendLine("a.PlanCode = b.PlanCode"); //sb.AppendLine("where a.Prodmonth = " + TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(mwProdmonthEdit1.EditValue)) + " and"); //sb.AppendLine("a.Plancode = 'MP'"); //sb.AppendLine("and b.Shifts >= 20"); //sb.AppendLine("and a.Locked = 0"); //_WorkplaceList.SqlStatement = sb.ToString(); //_WorkplaceList.ExecuteInstruction(); sb.Clear(); sb.AppendLine("SELECT * FROM"); sb.AppendLine("( SELECT PP.Prodmonth, PP.[Workplaceid], PP.[Activity], [FileName],dbo.fn_FileExists('" + TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).PlanProtSaveDir + "\\' + [FileName]) FileExsits "); sb.AppendLine("FROM PLANMONTH PP "); sb.AppendLine("LEFT JOIN PLANPROT_APPROVEDTEMPLATE AT ON "); sb.AppendLine("PP.Prodmonth = AT.Prodmonth and "); sb.AppendLine("PP.[Workplaceid] = AT.[Workplaceid] and "); sb.AppendLine("PP.[Activity] = AT.[Activity] "); sb.AppendLine("WHERE PP.Prodmonth = " + TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(mwProdmonthEdit1.EditValue)) + " and "); sb.AppendLine(" PP.sectionID_2 = '" + lcSections.SelectedValue + "' and "); sb.AppendLine(" PP.[Activity] = " + editActivity.EditValue.ToString() + " and Locked = 1 and"); sb.AppendLine(" pp.PlanCode = 'MP' ) data "); sb.AppendLine("WHERE FileExsits = 0 "); _WorkplaceList.SqlStatement = sb.ToString(); _WorkplaceList.ExecuteInstruction(); gridControl1.DataSource = _WorkplaceList.ResultsDataTable; } catch (Exception ex) { // MessageBox.Show(ex.Message); } }
private void LoadSections() { DataTable _SectionResult = new DataTable(); GetSectionsAndName theData = new GetSectionsAndName { theSystemDBTag = this.theSystemDBTag, UserCurrentInfo = this.UserCurrentInfo }; List <string> sections = TProductionGlobal.getUserInfo(UserCurrentInfo.Connection).PlanBookSections; foreach (string item in sections) { MWDataManager.clsDataAccess temp = theData.theSectionsAndName(TProductionGlobal.ProdMonthAsString(Convert.ToDateTime(barProdMonth.EditValue.ToString())), item, TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID); temp.ExecuteInstruction(); if (temp.ResultsDataTable.Rows.Count != 0) { if (_SectionResult.Columns.Count == 0) { _SectionResult = temp.ResultsDataTable.Clone(); } _SectionResult.Merge(temp.ResultsDataTable); } } editListSections.DataSource = _SectionResult; editListSections.ValueMember = "SectionID"; editListSections.DisplayMember = "Name"; }
public void saveRecords(DataTable records, string Dept) { //var theData = new MWDataManager.clsDataAccess(); //theData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); foreach (DataRow dr in records.Rows) { if (dr["hasChanged"].ToString() == "1") { string Section = dr["ID"].ToString(); MWDataManager.clsDataAccess _Query = new MWDataManager.clsDataAccess(); _Query.ConnectionString = TConnections.GetConnectionString(systemDBTag, UserCurrentInfo.Connection); _Query.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _Query.queryReturnType = MWDataManager.ReturnType.DataTable; String Prodmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); _Query.SqlStatement = "Select isnull(HierarchicalID,0) HierarchicalID from Section where Prodmonth = " + Prodmonth + " and SectionID = '" + Section + "'"; _Query.ExecuteInstruction(); Int32 Level = 5; foreach (DataRow r in _Query.ResultsDataTable.Rows) { Level = Convert.ToInt32(r["HierarchicalID"]); } string SectionID = "SectionID_2"; switch (Level) { case 1: SectionID = "SectionID_5"; break; case 2: SectionID = "SectionID_4"; break; case 3: SectionID = "SectionID_3"; break; case 4: SectionID = "SectionID_2"; break; case 5: SectionID = "SectionID_1"; break; case 6: SectionID = "SectionID"; break; } _Query.SqlStatement = "Select * \n " + "from PREPLANNING_CHANGEREQUEST a inner\n " + "join\n " + "PREPLANNING_CHANGEREQUEST_APPROVAL b on\n " + "a.ChangeRequestID = b.ChangeRequestID\n " + "inner\n " + "join Syncro_tblUsers c on\n " + "b.User1 = c.USERID\n " + "inner\n " + "join Section_Complete d on\n " + "a.prodmonth = d.Prodmonth and\n " + "a.SectionID = d.SectionID\n " + "where \n" + "d." + SectionID + " = '" + Section + "' \n" + "and b.approved = 0 \n" + "and Declined = 0"; _Query.queryReturnType = MWDataManager.ReturnType.DataTable; _Query.ExecuteInstruction(); if (_Query.ResultsDataTable.Rows.Count > 0) { frmUpdateRevicedRecords theform = new frmUpdateRevicedRecords(); theform.UserID = dr["UserID"].ToString(); theform.Section = dr["ID"].ToString(); theform.UserName = UserName; theform.UserCurrentInfo = UserCurrentInfo; theform.theSystemDBTag = systemDBTag; theform.ShowDialog(); } try { theData.SqlStatement = ""; theData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; theData.SqlStatement = "select * from REVISEDPLANNING_SECURITY where UserID='" + dr["UserID"].ToString() + "' and Section ='" + dr["ID"].ToString() + "' and department='" + Dept + "' "; theData.queryReturnType = MWDataManager.ReturnType.DataTable; theData.ExecuteInstruction(); } catch (Exception e) { } DataTable dt = new DataTable(); dt = theData.ResultsDataTable; if (dt.Rows.Count == 0) { try { //var TheData1 = new MWDataManager.clsDataAccess(); //TheData1.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); theData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; theData.SqlStatement = ""; theData.SqlStatement = "INSERT INTO REVISEDPLANNING_SECURITY (Section, UserID, Department, SecurityType, ApprovalRequired) values ('" + dr["ID"].ToString() + "', '" + dr["UserID"].ToString() + "','" + Dept + "', '" + dr["SecurityType"].ToString() + "', '" + dr["ApprovalRequired"].ToString() + "') "; theData.queryReturnType = MWDataManager.ReturnType.DataTable; theData.ExecuteInstruction(); } catch (Exception E) { } } else { try { //var TheData1 = new MWDataManager.clsDataAccess(); //TheData1.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); theData.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; theData.SqlStatement = ""; theData.SqlStatement = "update REVISEDPLANNING_SECURITY set SecurityType= '" + dr["SecurityType"].ToString() + "', ApprovalRequired= '" + dr["ApprovalRequired"].ToString() + "' where UserID='" + dr["UserID"].ToString() + "' and Department='" + Dept + "' and Section='" + dr["ID"].ToString() + "'"; theData.queryReturnType = MWDataManager.ReturnType.DataTable; theData.ExecuteInstruction(); } catch (Exception E) { } } } } }
public void LoadTheSections() { try { lstApply.Items.Clear(); lstAvailable.Items.Clear(); MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess(); if (((txtBDate.Text != string.Empty) & (txtEDate.Text != string.Empty)) || ((txtBDate.Text != string.Empty) & (txtEDate.Text == string.Empty)) ) { DateTime aa = Convert.ToDateTime(dteBeginDate.EditValue).AddDays(-1); _dbMan.ConnectionString = TConnections.GetConnectionString(resWPAS.systemDBTag, UserCurrentInfo.Connection); _dbMan.SqlStatement = " --select distinct(SectionID) SectionID, Name \r\n " + " --from ( \r\n " + " select s.SectionID SectionID, s.Name Name \r\n " + " from SECTION s \r\n " + " left outer join seccal sc on \r\n " + " sc.Prodmonth = s.Prodmonth and \r\n " + " sc.Sectionid = s.SectionID \r\n " + " where s.Prodmonth = '" + prodmonth + "' and s.Hierarchicalid = " + Convert.ToString(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID + 1) + " \r\n " + ////" and sc.startdate = '" + ////txtBDate.Text + ////"' \r\n " + //" union all \r\n " + //" select s.SectionID SectionID, s.Name Name \r\n " + //" from SECTION s \r\n " + //" left outer join seccal sc on \r\n " + //" sc.Prodmonth = s.Prodmonth and \r\n " + //" sc.Sectionid = s.SectionID \r\n " + //" where s.Prodmonth = '" + //prodmonth + //"' and s.Hierarchicalid = " + Convert.ToString(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID + 1) + " \r\n " + ////" and sc.EndDate = '" + ////String.Format("{0:yyyy-MM-dd}", aa) + ////"' " + " --) a"; _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbMan.queryReturnType = MWDataManager.ReturnType.DataTable; dataresult = _dbMan.ExecuteInstruction(); if (!dataresult.success) { Mineware.Systems.Global.sysNotification.TsysNotification.showNotification("Error", dataresult.Message, Color.Red); } DataTable dt = new DataTable(); dt = _dbMan.ResultsDataTable; if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { if (txtSectionID.Text == dr["SectionID"].ToString()) { lstApply.Items.Add(dr["SectionID"].ToString() + ':' + dr["name"].ToString()); } else { lstAvailable.Items.Add(dr["SectionID"].ToString() + ':' + dr["name"].ToString()); } } } } else { if ((txtBDate.Text == string.Empty) & (txtEDate.Text == string.Empty)) { _dbMan.ConnectionString = TConnections.GetConnectionString(resWPAS.systemDBTag, UserCurrentInfo.Connection); _dbMan.SqlStatement = " select s.SectionID SectionID, s.Name Name \r\n " + " from SECTION s \r\n " + " left outer join seccal sc on \r\n " + " sc.Prodmonth = s.Prodmonth and \r\n " + " sc.Sectionid = s.SectionID \r\n " + " where s.Prodmonth = '" + txtProdMonth.Text + "' and s.Hierarchicalid = " + Convert.ToString(TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID + 1) + " \r\n " + " and sc.begindate is null and sc.EndDate is null \r\n "; _dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _dbMan.queryReturnType = MWDataManager.ReturnType.DataTable; _dbMan.ExecuteInstruction(); DataTable dtsect = new DataTable(); dtsect = _dbMan.ResultsDataTable; if (dtsect.Rows.Count > 0) { foreach (DataRow dr in dtsect.Rows) { if (txtSectionID.Text == dr["SectionID"].ToString()) { lstApply.Items.Add(dr["SectionID"].ToString() + ':' + dr["name"].ToString()); } else { lstAvailable.Items.Add(dr["SectionID"].ToString() + ':' + dr["name"].ToString()); } } } } } lstApply.Enabled = true; lstAvailable.Enabled = true; btnApplytoAvail.Enabled = true; btnAvailtoApply.Enabled = true; } catch (Exception _exception) { Mineware.Systems.Global.sysNotification.TsysNotification.showNotification("Error", _exception.Message, Color.Red); } }
private void btnAdd_Click(object sender, EventArgs e) { MWDataManager.clsDataAccess _Query = new MWDataManager.clsDataAccess(); _Query.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); _Query.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; _Query.queryReturnType = MWDataManager.ReturnType.DataTable; String Prodmonth = TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).CurrentProductionMonth.ToString(); _Query.SqlStatement = "Select isnull(HierarchicalID,0) HierarchicalID from Section where Prodmonth = " + Prodmonth + " and SectionID = '" + Section + "'"; _Query.ExecuteInstruction(); Int32 Level = 5; foreach (DataRow r in _Query.ResultsDataTable.Rows) { Level = Convert.ToInt32(r["HierarchicalID"]); } string SectionID = "SectionID_2"; switch (Level) { case 1: SectionID = "SectionID_5"; break; case 2: SectionID = "SectionID_4"; break; case 3: SectionID = "SectionID_3"; break; case 4: SectionID = "SectionID_2"; break; case 5: SectionID = "SectionID_1"; break; case 6: SectionID = "SectionID"; break; } _Query.SqlStatement = "Insert Into PREPLANNING_CHANGEREQUEST_APPROVAL ( \n" + "ChangeRequestID, \n" + "User1, \n" + "User2, \n" + "Department, \n" + "RequestDate, \n" + "Approved, \n" + "Declined, \n" + "ApprovedDeclinedDate, \n" + "ApprovedDeclinedByUser, \n" + "Comments, \n" + "ApprovalRequired) \n" + "select \n" + "Distinct \n" + "b.ChangeRequestID, \n" + "'" + UserID + "' User1, \n" + "User2, \n" + "Department, \n" + "RequestDate, \n" + "Approved, \n" + "Declined, \n" + "ApprovedDeclinedDate, \n" + "ApprovedDeclinedByUser, \n" + "b.Comments, \n" + "ApprovalRequired \n" + "from PREPLANNING_CHANGEREQUEST a inner join \n" + "PREPLANNING_CHANGEREQUEST_APPROVAL b on \n" + "a.ChangeRequestID = b.ChangeRequestID \n" + "inner join Syncromine.dbo.tblUsers c on \n" + "b.User1 = c.USERID \n" + "inner join Section_Complete d on \n" + "a.prodmonth = d.Prodmonth and \n" + "a.SectionID = d.SectionID \n" + "where \n" + "d." + SectionID + " = '" + Section + "' \n" + "and b.approved = 0 \n" + "and Declined = 0"; _Query.queryReturnType = MWDataManager.ReturnType.longNumber; _Query.ExecuteInstruction(); this.Close(); }
/// <summary> /// Updates the sections list for the selected production month /// </summary> public void updateSections() { CPMBusinessLayer.clsBusinessLayer BMEBL = new CPMBusinessLayer.clsBusinessLayer(); BMEBL._queryReturnType = CPMBusinessLayer.ReturnType.DataTable; BMEBL.SetsystemDBTag = systemDBTag; BMEBL.SetUserCurrentInfo = this.UserCurrentInfo; List <string> Thelist = TProductionGlobal.getUserInfo(UserCurrentInfo.Connection).PlanBookSections; DataTable _SectionResult = new DataTable(); GetSectionsAndName theData = new GetSectionsAndName(); theData.theSystemDBTag = systemDBTag; theData.UserCurrentInfo = UserCurrentInfo; List <string> sections = TProductionGlobal.getUserInfo(UserCurrentInfo.Connection).PlanBookSections; foreach (string item in sections) { MWDataManager.clsDataAccess temp = theData.theSectionsAndName(_prodMonth, item, TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID); temp.ExecuteInstruction(); if (temp.ResultsDataTable.Rows.Count != 0) { if (_SectionResult.Columns.Count == 0) { _SectionResult = temp.ResultsDataTable.Clone(); } _SectionResult.Merge(temp.ResultsDataTable); } } tblSections = _SectionResult; //} //if (BMEBL.get_Sections(Convert.ToString(_prodMonth), TProductionGlobal.getSystemSettingsProductioInfo(UserCurrentInfo.Connection).MOHierarchicalID.ToString()) == true) //{ // tblSections = BMEBL.ResultsDataTable.Clone(); // tblSections = BMEBL.ResultsDataTable.Copy(); //} }