Profiles.Edit.Utilities.DataIO.GetCustomPub C# (CSharp) Méthode

GetCustomPub() public méthode

public GetCustomPub ( string mpid ) : System.Data.SqlClient.SqlDataReader
mpid string
Résultat System.Data.SqlClient.SqlDataReader
        public SqlDataReader GetCustomPub(string mpid)
        {
            SessionManagement sm = new SessionManagement();
            string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

            SqlConnection dbconnection = new SqlConnection(connstr);
            SqlDataReader reader;

            SqlParameter[] param = null;

            try
            {
                dbconnection.Open();

                //For Output Parameters you need to pass a connection object to the framework so you can close it before reading the output params value.
                reader = GetDBCommand(dbconnection, "exec [Profile.Data].[Publication.MyPub.GetPublication]  '" + mpid.ToString() + "'", CommandType.Text, CommandBehavior.CloseConnection, param).ExecuteReader();
            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }

            return reader;
        }

Usage Example

        protected void grdEditPublications_SelectedIndexChanged(object sender, EventArgs e)
        {
            pnlAddPubById.Visible = false;
            pnlAddPubMed.Visible = false;
            pnlAddPubMedResults.Visible = false;
            pnlAddCustomPubMed.Visible = true;

            IDataReader reader = null;
            try
            {
                Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();

                HiddenField hdn = (HiddenField)grdEditPublications.Rows[grdEditPublications.SelectedIndex].FindControl("hdnMPID");

                reader = data.GetCustomPub(hdn.Value);

                if (reader.Read())
                {

                    drpPublicationType.SelectedValue = reader["hmspubcategory"].ToString();

                    txtPubMedAdditionalInfo.Text = reader["additionalinfo"].ToString();
                    txtPubMedAuthors.Text = reader["authors"].ToString();
                    if (reader["hmspubcategory"].ToString() == "Thesis")
                    { txtPubMedNewsCity.Text = reader["placeofpub"].ToString(); }
                    else
                    { txtPubMedPublisherCity.Text = reader["placeofpub"].ToString(); }
                    txtPubMedNewsColumn.Text = reader["newspapercol"].ToString();
                    txtPubMedConferenceDate.Text = reader["confdts"].ToString();
                    txtPubMedConferenceEdition.Text = reader["confeditors"].ToString();
                    txtPubMedConferenceName.Text = reader["confnm"].ToString();
                    txtPubMedPublisherContract.Text = reader["contractnum"].ToString();

                    if (reader["publicationdt"].ToString().Length > 0)
                    {
                        DateTime dt = (DateTime.Parse(reader["publicationdt"].ToString()));
                        txtPubMedPublicationDate.Text = dt.ToShortDateString();
                    }
                    txtPubMedEdition.Text = reader["edition"].ToString();
                    txtPubMedPublicationIssue.Text = reader["issuepub"].ToString();
                    txtPubMedConferenceLocation.Text = reader["confloc"].ToString();
                    txtPubMedPublisherName.Text = reader["publisher"].ToString();
                    txtPubMedOptionalWebsite.Text = reader["url"].ToString();
                    txtPubMedPublicationPages.Text = reader["paginationpub"].ToString();
                    txtPubMedPublisherReport.Text = reader["reptnumber"].ToString();
                    txtPubMedNewsSection.Text = reader["newspapersect"].ToString();
                    txtPubMedTitle.Text = reader["pubtitle"].ToString();
                    txtPubMedTitle2.Text = reader["articletitle"].ToString();
                    txtPubMedNewsUniversity.Text = reader["dissunivnm"].ToString();
                    txtPubMedPublicationVolume.Text = reader["volnum"].ToString();
                    txtPubMedAbstract.Text = reader["abstract"].ToString();

                    ShowCustomEdit(reader["hmspubcategory"].ToString());

                    upnlEditSection.Update();

                }
            }
            catch (Exception ex)
            {
                string err = ex.Message;
            }
            finally
            {
                if (reader != null)
                {
                    if (!reader.IsClosed)
                    { reader.Close(); }
                }
            }
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::GetCustomPub