private DataTable GetExpenseTable() { DataTable tbl = null; CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnStr"]); CoreLab.Oracle.OracleCommand cmd = new CoreLab.Oracle.OracleCommand("BASDBA.pkg_training.GetEmployeeExpenses", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = 30; SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "header_record_id_", ViewState["Request_Record_ID"].ToString()); SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "Expenses_List_", "cursor", "out", ""); DataSet mds = new DataSet(); CoreLab.Oracle.OracleDataAdapter da = new CoreLab.Oracle.OracleDataAdapter(cmd); try { conn.Open(); da.Fill(mds); tbl = mds.Tables[0]; } finally { conn.Close(); conn.Dispose(); cmd.Dispose(); mds.Dispose(); } return(tbl); }
private void FillDataDateTimes() { CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnStr"]); CoreLab.Oracle.OracleCommand cmd = new CoreLab.Oracle.OracleCommand("BASDBA.PKG_Training.gettrainingcoursedatetimerec", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = 30; SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "header_record_id_", ViewState["Request_Record_ID"].ToString()); SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "Step_3_record", "cursor", "out", ""); DataSet mds = new DataSet(); CoreLab.Oracle.OracleDataAdapter da = new CoreLab.Oracle.OracleDataAdapter(cmd); DataTable tbl = null; try { conn.Open(); da.Fill(mds); tbl = mds.Tables[0]; if (tbl.Rows.Count != 0) { txtStartDate.Text = tbl.Rows[0]["course_start_date"].ToString(); txtEndDate.Text = tbl.Rows[0]["course_end_date"].ToString(); string strCourseTime = tbl.Rows[0]["course_time"].ToString(); txtCourseHoursDuty.Text = tbl.Rows[0]["course_hours_duty"].ToString(); txtCourseHoursNonDuty.Text = tbl.Rows[0]["course_hours_non_duty"].ToString(); txtCourseHoursTotal.Text = tbl.Rows[0]["course_hours_total"].ToString(); for (int i = 0; i < optCoursrTime.Items.Count; i++) { if (optCoursrTime.Items[i].Value == strCourseTime) { optCoursrTime.SelectedIndex = i; break; } } } } finally { conn.Close(); conn.Dispose(); cmd.Dispose(); mds.Dispose(); if (tbl != null) { tbl.Dispose(); } } }
private void FillDataTypesNeeds() { CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnStr"]); CoreLab.Oracle.OracleCommand cmd = new CoreLab.Oracle.OracleCommand("BASDBA.PKG_Training.TrainingTypesNeedsRecord", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = 30; SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "header_record_id_", ViewState["Request_Record_ID"].ToString()); SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "Step_4_record", "cursor", "out", ""); DataSet mds = new DataSet(); CoreLab.Oracle.OracleDataAdapter da = new CoreLab.Oracle.OracleDataAdapter(cmd); DataTable tbl = null; try { conn.Open(); da.Fill(mds); tbl = mds.Tables[0]; if (tbl.Rows.Count != 0) { SetDropDownIndex(ddlTrainingType, tbl.Rows[0]["training_type"].ToString()); optMandatoryTraining.SelectedIndex = tbl.Rows[0]["mandatory_training"].ToString() == "T" ? 0 : 1; SetDropDownIndex(ddlSourseTraining, tbl.Rows[0]["source_of_training"].ToString()); SetDropDownIndex(ddlPurposeOfTraining, tbl.Rows[0]["purpose_of_training"].ToString()); txtPurposeOfTainingOther.Text = tbl.Rows[0]["purpose_of_training_other"].ToString(); } } finally { conn.Close(); conn.Dispose(); cmd.Dispose(); mds.Dispose(); if (tbl != null) { tbl.Dispose(); } } }
private void FillData() { if (ViewState["Request_Record_ID"].ToString() == "-1") { txtCourseCode.Text = ""; txtCourseTitle.Text = ""; txtVedorName.Text = ""; txtPhoneNumber.Text = ""; txtFaxNumber.Text = ""; txtAddressLine1.Text = ""; txtAddressLine2.Text = ""; txtCity.Text = ""; ddlStates.SelectedIndex = 0; txtZipCode.Text = ""; txtWebSite.Text = ""; txtDescribtion.Text = ""; return; } CoreLab.Oracle.OracleConnection conn = new CoreLab.Oracle.OracleConnection(System.Configuration.ConfigurationSettings.AppSettings["ConnStr"]); CoreLab.Oracle.OracleCommand cmd = new CoreLab.Oracle.OracleCommand("BASDBA.PKG_Training.GetHeaderRecord", conn); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandTimeout = 30; SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "record_id_", ViewState["Request_Record_ID"].ToString()); SQLStatic.ProcedureParameters.SetStoredProcedureParameter(cmd, "header_record", "cursor", "out", ""); DataSet mds = new DataSet(); CoreLab.Oracle.OracleDataAdapter da = new CoreLab.Oracle.OracleDataAdapter(cmd); DataTable tbl = null; try { conn.Open(); da.Fill(mds); tbl = mds.Tables[0]; txtCourseCode.Text = tbl.Rows[0]["course_code"].ToString(); txtCourseTitle.Text = tbl.Rows[0]["course_title"].ToString(); txtVedorName.Text = tbl.Rows[0]["vendor_name"].ToString(); txtPhoneNumber.Text = tbl.Rows[0]["vendor_phone_number"].ToString(); txtFaxNumber.Text = tbl.Rows[0]["vendor_fax_number"].ToString(); txtAddressLine1.Text = tbl.Rows[0]["vendor_address1"].ToString(); txtAddressLine2.Text = tbl.Rows[0]["vendor_address2"].ToString(); txtCity.Text = tbl.Rows[0]["vendor_city"].ToString(); string strState = tbl.Rows[0]["vendor_state"].ToString(); txtZipCode.Text = tbl.Rows[0]["vendor_zip_code"].ToString(); txtWebSite.Text = tbl.Rows[0]["vendor_website"].ToString(); txtDescribtion.Text = tbl.Rows[0]["desription_of_course_value"].ToString(); ViewState["application_status"] = tbl.Rows[0]["application_status"].ToString(); ViewState["description"] = tbl.Rows[0]["description"].ToString(); for (int i = 0; i < ddlStates.Items.Count; i++) { if (ddlStates.Items[i].Value == strState) { ddlStates.SelectedIndex = i; break; } } } finally { conn.Close(); conn.Dispose(); cmd.Dispose(); mds.Dispose(); if (tbl != null) { tbl.Dispose(); } } lblCourseTitle.Text = txtCourseCode.Text + " - " + txtCourseTitle.Text; }