public bool Save() { int retValueSetProdGenData = 0; bool retResult = false; bool retOwner = true; bool retSponsor = true; bool blnOwneractive = true; bool blnSponsoractive = true; bool blnLiveInt = false; double l_weight = -1; int l_maxQty = -1; //Begin NCIDC int maxqty = 0; double weight = 0; int qtyavai = 0; int qtythresh = 0; int bookstatusid = 0; if (int.TryParse(txtMaxQtyTile.Text.Trim(), out maxqty)) { if (maxqty > 0) { l_maxQty = maxqty; } } if (double.TryParse(txtWeight.Text.Trim(), out weight)) { if (weight > 0) { l_weight = weight; } } if (int.TryParse(txtQtyAvai.Text.Trim(), out qtyavai)) { if (qtyavai <= 0) { qtyavai = -1; } } else { qtyavai = -1; } if (int.TryParse(txtQtyThresh.Text.Trim(), out qtythresh)) { if (qtythresh <= 0) { qtythresh = -1; } } else { qtythresh = -1; } if (string.Compare(ddlBookStatus.SelectedValue.Trim(), "") != 0) { if (int.TryParse(ddlBookStatus.SelectedValue.Trim(), out bookstatusid)) { if (bookstatusid <= 0) { bookstatusid = -1; } } else { bookstatusid = -1; } } else { bookstatusid = 0; //Special case - remove the assigned bookstatus } //End NCIDC this.SecVal(); if (this.txtWeight.Visible && this.txtMaxQtyTile.Visible) { if (this.txtWeight.Text.Trim().Length > 0) { l_weight = System.Convert.ToDouble(this.txtWeight.Text.Trim()); } if (this.txtMaxQtyTile.Text.Trim().Length > 0) { l_maxQty = System.Convert.ToInt32(this.txtMaxQtyTile.Text.Trim()); } } else { if (this.lblWeight.Text.Trim().Length > 0) { l_weight = System.Convert.ToDouble(this.lblWeight.Text.Trim()); } if (this.lblMaxQtyTile.Text.Trim().Length > 0) { l_maxQty = System.Convert.ToInt32(this.lblMaxQtyTile.Text.Trim()); } } int l_pubid = 0; if (Session[PubEntAdminManager.strPubGlobalMode].ToString() != PubEntAdminManager.strPubGlobalAMode) { l_pubid = this.PubID; } if (ddlOwner.SelectedValue != "") { blnOwneractive = PE_DAL.GetOwnerStatusByOwnerID(Convert.ToInt32(ddlOwner.SelectedValue)); } if (ddlSponsor.SelectedValue != "") { blnSponsoractive = PE_DAL.GetSponsorStatusByOwnerID(Convert.ToInt32(ddlSponsor.SelectedValue)); } //NCIDC if (this.lblBkStatus.Text.Trim() != PubEntAdminManager.strInactivePubs && blnOwneractive == false //NCIDC || this.lblBkStatus.Text.Trim() != PubEntAdminManager.strInactivePubs && blnSponsoractive == false) if (this.ddlBookStatus.SelectedValue.Trim() != PubEntAdminManager.strInactivePubs && blnOwneractive == false || this.ddlBookStatus.SelectedValue.Trim() != PubEntAdminManager.strInactivePubs && blnSponsoractive == false) { //NCIDC if (this.lblBkStatus.Text.Trim() != PubEntAdminManager.strInactivePubs && blnOwneractive == false) if (this.ddlBookStatus.SelectedValue.Trim() != PubEntAdminManager.strInactivePubs && blnOwneractive == false) { lblOwnerEr.Visible = true; lblOwnerEr.Text = "An active owner name is required."; retResult = false; } //NCIDC if (this.lblBkStatus.Text.Trim() != PubEntAdminManager.strInactivePubs && blnSponsoractive == false) if (this.ddlBookStatus.SelectedValue.Trim() != PubEntAdminManager.strInactivePubs && blnSponsoractive == false) { lblSponsorEr.Visible = true; lblSponsorEr.Text = "An active sponsor name is required."; retResult = false; } } else { PlaceHolder plhLiveInt = (PlaceHolder)this.Parent.FindControl("plcHldLiveInt"); bool InNCIPL = ((LiveIntSel)plhLiveInt.Controls[0]).InNCIPL; bool InROO = ((LiveIntSel)plhLiveInt.Controls[0]).InROO; bool InExh = ((LiveIntSel)plhLiveInt.Controls[0]).InExh; bool InCatalog = ((LiveIntSel)plhLiveInt.Controls[0]).InCatalog; blnLiveInt = InNCIPL || InROO || InExh || InCatalog; if (blnLiveInt == true && ddlOwner.SelectedValue == "" || blnLiveInt == true && this.ddlSponsor.SelectedValue == "") { lblOwnerEr.Text = ""; lblSponsorEr.Text = ""; if (blnLiveInt == true && ddlOwner.SelectedValue == "") { lblOwnerEr.Visible = true; lblOwnerEr.Text = "An owner name is required."; retResult = false; } if (blnLiveInt == true && this.ddlSponsor.SelectedValue == "") { lblSponsorEr.Visible = true; lblSponsorEr.Text = "An sponsor name is required."; retResult = false; } } else { Regex r = new Regex(@"\s+"); retValueSetProdGenData = PE_DAL.SetProdGenData(r.Replace(this.txtCPJNum.Text.Trim(), " "), this.txtShortTitle.Text.Trim(), this.txtLongTitle.Text.Trim(), this.txtFS.Text.Trim().Length > 0 ? this.txtFS.Text.Trim() : null, this.txtSpanishAccentLongTitle.Text.Trim().Length > 0 ? this.txtSpanishAccentLongTitle.Text.Trim() : null, this.txtSpanishNoAccentLongTitle.Text.Trim().Length > 0 ? this.txtSpanishNoAccentLongTitle.Text.Trim() : null, this.txtURL.Text.Trim().Length > 0 ? this.txtURL.Text.Trim() : null, this.txtNerdoURL.Text.Trim().Length > 0 ? this.txtNerdoURL.Text.Trim() : null, this.txtPDFURL.Text.Trim().Length > 0 ? this.txtPDFURL.Text.Trim() : null, this.txtKindleURL.Text.Trim().Length > 0 ? this.txtKindleURL.Text.Trim() : null, this.txtePubURL.Text.Trim().Length > 0 ? this.txtePubURL.Text.Trim() : null, this.txtPrintFileURL.Text.Trim().Length > 0 ? this.txtPrintFileURL.Text.Trim() : null, l_maxQty, l_weight, qtyavai, qtythresh, bookstatusid, ref l_pubid); if (this.ddlOwner.SelectedValue.ToString() != "") { retOwner = PE_DAL.SetOwnerByPubID(l_pubid, Convert.ToInt32(this.ddlOwner.SelectedValue)); } else { PE_DAL.DeleteOwnerByPubID(l_pubid); } if (this.ddlSponsor.SelectedValue.ToString() != "") { retSponsor = PE_DAL.SetSponsorByPubID(l_pubid, Convert.ToInt32(this.ddlSponsor.SelectedValue)); } else { PE_DAL.DeleteSponsorByPubID(l_pubid); } if (Session[PubEntAdminManager.strPubGlobalMode].ToString() == PubEntAdminManager.strPubGlobalAMode) { if (retValueSetProdGenData > 0 && retOwner && retSponsor) { this.PubID = l_pubid; retResult = true; } else if (retValueSetProdGenData == 0 || retValueSetProdGenData == -1) { if (l_pubid == 0) { Session[PubEntAdminManager.strGlobalMsg] = "The publication already existed."; } else if (l_pubid == -1) { Session[PubEntAdminManager.strGlobalMsg] = "Error occurs."; } retResult = false; } } else { if (retValueSetProdGenData > 0) { retResult = true; } else if (retValueSetProdGenData == -1) { retResult = false; } } } } return(retResult); }