private void gvWorkplaces_ShowingEditor(object sender, CancelEventArgs e) { TUserProduction up = new TUserProduction(); up.SetUserInfo(UserCurrentInfo.UserID, this.theSystemDBTag, this.UserCurrentInfo.Connection); object abc = gvWorkplaces.GetRowCellValue(gvWorkplaces.FocusedRowHandle, gvWorkplaces.Columns["Activity"]); int act = Convert.ToInt32(abc); if (Convert.ToInt32(act) == 0 || Convert.ToInt32(act) == 1) { if ((up.WPProduction == "Y")) { e.Cancel = false; } else { e.Cancel = true; } } if (Convert.ToInt32(act) == 10) { if ((up.WPSurface == "Y")) { e.Cancel = false; } else { e.Cancel = true; } } if (Convert.ToInt32(act) == 11) { if ((up.WPUnderGround == "Y")) { e.Cancel = false; } else { e.Cancel = true; } } }
private void gvWorkplaces_DoubleClick(object sender, EventArgs e) { string wptype = ""; WPID = gvWorkplaces.GetRowCellValue(gvWorkplaces.FocusedRowHandle, gvWorkplaces.Columns["WorkplaceID"]).ToString(); String typecode = ""; typecode = gvWorkplaces.GetRowCellValue(gvWorkplaces.FocusedRowHandle, gvWorkplaces.Columns["TypeCode"]).ToString(); // String DefaultAdvEdit = ""; // DefaultAdvEdit = gvWorkplaces.GetRowCellValue(gvWorkplaces.FocusedRowHandle, gvWorkplaces.Columns["defaultadv"]).ToString(); myEdit.DefaultAdvEdit = "0.00"; myEdit.workplacetype = "D"; //if (TSysSettings.IsCentralizedDatabase .ToString () == "1") // myEdit.theDiv = ddlWorkplaceDivision.SelectedValue.ToString(); // #region Workplaces // if (Typelabel.Text == "Workplaces") // { myEdit.Edit = "E"; //MWDataManager.clsDataAccess _dbMan = new MWDataManager.clsDataAccess(); //_dbMan.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); //_dbMan.queryExecutionType = MWDataManager.ExecutionType.GeneralSQLStatement; //_dbMan.queryReturnType = MWDataManager.ReturnType.DataTable; //_dbMan.SqlStatement = " select * FROM Planning WHERE WorkplaceID = '" + WPID + "' "; //_dbMan.ExecuteInstruction(); //DataTable dt = _dbMan.ResultsDataTable; //if (dt.Rows.Count > 0) myEdit.Locked = "1"; else myEdit.Locked = "0"; 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 * FROM WPType_Setup WHERE TypeCode = '" + typecode + "' "; _dbManA.ExecuteInstruction(); DataTable dtA = _dbManA.ResultsDataTable; if (dtA.Rows.Count > 0) { myEdit.workplacetype = dtA.Rows[0]["SetupCode"].ToString(); wptype = dtA.Rows[0]["SetupCode"].ToString(); if (wptype == "S") { type = 0; } if (wptype == "D") { type = 1; } if (wptype == "OUG") { type = 3; } if (wptype == "SU") { type = 2; } } else { MessageBox.Show("WPType not setup.", "WP Setup not done", MessageBoxButtons.OK); return; } //} // string wpid = ""; // gvWorkplaces.AddNewRow(); myEdit.LoadWorkplace("E", WPID, type); TUserProduction up = new TUserProduction(); up.SetUserInfo(UserCurrentInfo.UserID, this.theSystemDBTag, this.UserCurrentInfo.Connection); object abc = gvWorkplaces.GetRowCellValue(gvWorkplaces.FocusedRowHandle, gvWorkplaces.Columns["Activity"]); int act = Convert.ToInt32(abc); if (Convert.ToInt32(act) == 0 || Convert.ToInt32(act) == 1) { if ((up.WPProduction == "Y")) { gvWorkplaces.ShowEditForm(); } else { } } if (Convert.ToInt32(act) == 10) { if ((up.WPSurface == "Y")) { gvWorkplaces.ShowEditForm(); } else { } } if (Convert.ToInt32(act) == 11) { if ((up.WPUnderGround == "Y")) { gvWorkplaces.ShowEditForm(); } else { } } // gvWorkplaces.ShowEditForm(); }
private void ucWorkplaces_Load(object sender, EventArgs e) { // _clsWorkplaces.theData.ConnectionString = TConnections.GetConnectionString(theSystemDBTag, UserCurrentInfo.Connection); loadData(); TUserProduction up = new TUserProduction(); up.SetUserInfo(UserCurrentInfo.UserID, this.theSystemDBTag, this.UserCurrentInfo.Connection); if ((up.WPProduction == "Y") || (up.WPSurface == "Y") || (up.WPUnderGround == "Y")) { btnEdit.Enabled = true; btnAdd.Enabled = true; } else { btnEdit.Enabled = false; btnAdd.Enabled = false; } if ((up.WPClassify == "Y") || (up.WPEditAttribute == "Y") || (up.WPEditName == "Y")) { btnEdit.Enabled = true; btnAdd.Enabled = true; } else { btnEdit.Enabled = false; btnAdd.Enabled = false; } if (up.WPProduction == "N") { rdbtnWPAddStopDevNon.Properties.Items[0].Enabled = false; rdbtnWPAddStopDevNon.Properties.Items[1].Enabled = false; } else { rdbtnWPAddStopDevNon.Properties.Items[0].Enabled = true; rdbtnWPAddStopDevNon.Properties.Items[1].Enabled = true; } if (up.WPUnderGround == "N") { rdbtnWPAddStopDevNon.Properties.Items[2].Enabled = false; } else { rdbtnWPAddStopDevNon.Properties.Items[2].Enabled = true; } if (up.WPSurface == "N") { rdbtnWPAddSurface.Enabled = false; } else { rdbtnWPAddSurface.Enabled = true; } }