Profiles.Edit.Utilities.DataIO.EditCustomPublication C# (CSharp) Method

EditCustomPublication() public method

public EditCustomPublication ( Hashtable parameters, long subjectID, XmlDocument PropertyListXML ) : void
parameters System.Collections.Hashtable
subjectID long
PropertyListXML System.Xml.XmlDocument
return void
        public void EditCustomPublication(Hashtable parameters, long subjectID, XmlDocument PropertyListXML)
        {
            ActivityLog(PropertyListXML, subjectID, "MPID", parameters["@mpid"].ToString());
            string skey = string.Empty;
            string sparam = string.Empty;

            try
            {
                SessionManagement sm = new SessionManagement();
                string connstr = ConfigurationManager.ConnectionStrings["ProfilesDB"].ConnectionString;

                SqlConnection dbconnection = new SqlConnection(connstr);

                SqlCommand comm = new SqlCommand();

                foreach (object key in parameters.Keys)
                {
                    skey = (string)key;
                    sparam = (string)parameters[skey].ToString();
                    comm.Parameters.Add(new SqlParameter(skey, sparam));
                }

                comm.Connection = dbconnection;
                comm.Connection.Open();
                comm.CommandType = CommandType.StoredProcedure;
                comm.CommandText = "[Profile.Data].[Publication.MyPub.UpdatePublication]";
                comm.ExecuteScalar();

                comm.Connection.Close();

                if (dbconnection.State != ConnectionState.Closed)
                    dbconnection.Close();

            }
            catch (Exception e)
            {
                Framework.Utilities.DebugLogging.Log(e.Message + e.StackTrace);
                throw new Exception(e.Message);
            }
        }

Usage Example

        protected void btnPubMedSaveCustom_OnClick(object sender, EventArgs e)
        {
            Hashtable myParameters = new Hashtable();
            Utilities.DataIO data = new Profiles.Edit.Utilities.DataIO();

            myParameters.Add("@HMS_PUB_CATEGORY", drpPublicationType.SelectedValue);
            myParameters.Add("@ADDITIONAL_INFO", txtPubMedAdditionalInfo.Text);
            myParameters.Add("@ABSTRACT", txtPubMedAbstract.Text);
            myParameters.Add("@AUTHORS", txtPubMedAuthors.Text);
            if (drpPublicationType.SelectedValue == "Thesis")
            { myParameters.Add("@PLACE_OF_PUB", txtPubMedNewsCity.Text); }
            else
            { myParameters.Add("@PLACE_OF_PUB", txtPubMedPublisherCity.Text); }
            myParameters.Add("@NEWSPAPER_COL", txtPubMedNewsColumn.Text);
            myParameters.Add("@CONF_DTS", txtPubMedConferenceDate.Text);
            myParameters.Add("@CONF_EDITORS", txtPubMedConferenceEdition.Text);
            myParameters.Add("@CONF_NM", txtPubMedConferenceName.Text);
            myParameters.Add("@CONTRACT_NUM", txtPubMedPublisherContract.Text);
            myParameters.Add("@PUBLICATION_DT", txtPubMedPublicationDate.Text);
            myParameters.Add("@EDITION", txtPubMedEdition.Text);
            myParameters.Add("@ISSUE_PUB", txtPubMedPublicationIssue.Text);
            myParameters.Add("@CONF_LOC", txtPubMedConferenceLocation.Text);
            myParameters.Add("@PUBLISHER", txtPubMedPublisherName.Text);
            myParameters.Add("@URL", txtPubMedOptionalWebsite.Text);
            myParameters.Add("@PAGINATION_PUB", txtPubMedPublicationPages.Text);
            myParameters.Add("@REPT_NUMBER", txtPubMedPublisherReport.Text);
            myParameters.Add("@NEWSPAPER_SECT", txtPubMedNewsSection.Text);
            myParameters.Add("@PUB_TITLE", txtPubMedTitle.Text);
            myParameters.Add("@ARTICLE_TITLE", txtPubMedTitle2.Text);
            myParameters.Add("@DISS_UNIV_NM", txtPubMedNewsUniversity.Text);
            myParameters.Add("@VOL_NUM", txtPubMedPublicationVolume.Text);

            if (grdEditPublications.SelectedIndex > -1)
            {
                //myParameters.Add("@username", Profile.UserId);
                myParameters.Add("@updated_by", _personId);
                HiddenField hdn = (HiddenField)grdEditPublications.Rows[grdEditPublications.SelectedIndex].FindControl("hdnMPID");
                myParameters.Add("@mpid", hdn.Value);

                data.EditCustomPublication(myParameters, _subject, this.PropertyListXML);
                grdEditPublications.SelectedIndex = -1;
            }
            else
            {
                myParameters.Add("@PersonID", _personId);
                myParameters.Add("@created_by", _personId);
                data.AddCustomPublication(myParameters, _personId, _subject, this.PropertyListXML);
            }
            this.Counter = 0;
            grdEditPublications.DataBind();
            ClearPubMedCustom();

            LinkButton lb = (LinkButton)sender;
            if (lb.ID == "btnPubMedSaveCustom")
            {
                phAddPub.Visible = true;
                phAddPubMed.Visible = true;
                phDeletePub.Visible = true;
                phSecuritySettings.Visible = true;
                phMain.Visible = false;
                pnlAddCustomPubMed.Visible = false;
                btnImgAddCustom.ImageUrl = Root.Domain + "/Framework/images/icon_squareArrow.gif";
            }
            Session["pnlAddCustomPubMed.Visible"] = null;
            upnlEditSection.Update();
        }
All Usage Examples Of Profiles.Edit.Utilities.DataIO::EditCustomPublication