Ejemplo n.º 1
0
        //Get Records
        public static cs_recordcollection GetRecords()
        {
            Database  db = DatabaseFactory.CreateDatabase();
            DbCommand cw = db.GetStoredProcCommand("sp_CANNED_getRecords");

            using (System.Data.IDataReader dr = db.ExecuteReader(cw))
            {
                cs_recordcollection coll = new cs_recordcollection();
                while (dr.Read())
                {
                    cs_record k = new cs_record(
                        dr.GetInt32(dr.GetOrdinal("cannid")),
                        dr["recordid"].ToString(),
                        dr["headertext"].ToString(),
                        (dr["audience"] == DBNull.Value) ? "" : dr["audience"].ToString(),
                        (dr["cancertype"] == DBNull.Value) ? "" : dr["cancertype"].ToString(),
                        (dr["language"] == DBNull.Value) ? "" : dr["language"].ToString(),
                        (dr["prodformat"] == DBNull.Value) ? "" : dr["prodformat"].ToString(),
                        (dr["race"] == DBNull.Value) ? "" : dr["race"].ToString(),
                        (dr["series"] == DBNull.Value) ? "" : dr["series"].ToString(),
                        (dr["subject"] == DBNull.Value) ? "" : dr["subject"].ToString(),
                        dr.GetInt32(dr.GetOrdinal("active"))
                        );
                    coll.Add(k);
                }
                return(coll);
            }
        }
Ejemplo n.º 2
0
        protected void lstviewCannedRecords_ItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                ListViewDataItem item       = (ListViewDataItem)e.Item;
                cs_record        currRecord = (cs_record)item.DataItem; //Get the Current Record Item in the collection

                #region ReadOnlyMode
                //Get the Controls
                HiddenField CannId         = (HiddenField)e.Item.FindControl("CannId");
                Label       lblRecordId    = (Label)e.Item.FindControl("lblRecordId");
                Label       lblHeaderText  = (Label)e.Item.FindControl("lblHeaderText");
                Label       lblUrl         = (Label)e.Item.FindControl("lblUrl");
                Label       lblCancerType  = (Label)e.Item.FindControl("lblCancerType");
                Label       lblSubject     = (Label)e.Item.FindControl("lblSubject");
                Label       lblPubFormat   = (Label)e.Item.FindControl("lblPubFormat");
                Label       lblRace        = (Label)e.Item.FindControl("lblRace");
                Label       lblAudience    = (Label)e.Item.FindControl("lblAudience");
                Label       lblLanguage    = (Label)e.Item.FindControl("lblLanguage");
                Label       lblCollections = (Label)e.Item.FindControl("lblCollections");
                Label       lblActive      = (Label)e.Item.FindControl("lblActive");

                //Assign Values
                if (CannId != null)
                {
                    CannId.Value = currRecord.CannId.ToString();
                }
                if (lblRecordId != null)
                {
                    lblRecordId.Text = currRecord.RecId;
                }
                if (lblHeaderText != null)
                {
                    lblHeaderText.Text = currRecord.HeaderText;
                }
                if (lblUrl != null)
                {
                    lblUrl.Text = ConfigurationManager.AppSettings["NCIPLCannedSearchURL"] + currRecord.RecId;
                }
                if (lblCancerType != null)
                {
                    lblCancerType.Text = currRecord.CancerType;
                }
                if (lblSubject != null)
                {
                    lblSubject.Text = currRecord.Subject;
                }
                if (lblPubFormat != null)
                {
                    lblPubFormat.Text = currRecord.PubFormat;
                }
                if (lblRace != null)
                {
                    lblRace.Text = currRecord.Race;
                }
                if (lblAudience != null)
                {
                    lblAudience.Text = currRecord.Audience;
                }
                if (lblLanguage != null)
                {
                    lblLanguage.Text = currRecord.Language;
                }
                if (lblCollections != null)
                {
                    lblCollections.Text = currRecord.Collections;
                }
                if (lblActive != null)
                {
                    if (currRecord.Active == 1)
                    {
                        lblActive.Text = "Yes";
                    }
                    else
                    {
                        lblActive.Text = "No";
                    }
                }

                #region SecurityCheck1
                if (CannId != null)
                {
                    this.SecurityCheck(1, CannId);
                }
                #endregion

                #endregion



                #region EditMode
                //Get the Controls
                HiddenField CannIdEdit = (HiddenField)e.Item.FindControl("CannIdEdit");
                if (CannIdEdit != null)
                {
                    CannIdEdit.Value = currRecord.CannId.ToString();
                }

                Label lblRecordIdEdit = (Label)e.Item.FindControl("lblRecordIdEdit");
                if (lblRecordIdEdit != null)
                {
                    lblRecordIdEdit.Text = currRecord.RecId;
                }

                TextBox txtHeaderTextEdit = (TextBox)e.Item.FindControl("txtHeaderTextEdit");
                if (txtHeaderTextEdit != null)
                {
                    txtHeaderTextEdit.Text = currRecord.HeaderText;
                }

                //Type of Cancer
                PubEntAdmin.UserControl.cslistbox ucCancerTypeEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucCancerTypeEdit");
                if (ucCancerTypeEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getCancerTypes", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucCancerTypeEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Subject List
                PubEntAdmin.UserControl.cslistbox ucSubjectEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucSubjectEdit");
                if (ucSubjectEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getSubjects", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucSubjectEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Publication Format List
                PubEntAdmin.UserControl.cslistbox ucPubFormatEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucPubFormatEdit");
                if (ucPubFormatEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getProductFormats", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucPubFormatEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Race List
                PubEntAdmin.UserControl.cslistbox ucRaceEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucRaceEdit");
                if (ucRaceEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getRace", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucRaceEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Audience List
                PubEntAdmin.UserControl.cslistbox ucAudienceEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucAudienceEdit");
                if (ucAudienceEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getAudience", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucAudienceEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Language List
                PubEntAdmin.UserControl.cslistbox ucLanguageEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucLanguageEdit");
                if (ucLanguageEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getLanguages", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucLanguageEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                //Collections List
                PubEntAdmin.UserControl.cslistbox ucCollectionsEdit = (PubEntAdmin.UserControl.cslistbox)e.Item.FindControl("ucCollectionsEdit");
                if (ucCollectionsEdit != null)
                {
                    kvpaircoll = DAL.cs_dal.GetKVPair("sp_CANNED_getCollections", 0, currRecord.CannId);
                    foreach (KVPair kvpair in kvpaircoll)
                    {
                        ListItem lstItem = new ListItem();
                        lstItem.Text  = kvpair.Val;
                        lstItem.Value = kvpair.Key;
                        if (kvpair.IsSelected == "1")
                        {
                            lstItem.Selected = true;
                        }
                        else
                        {
                            lstItem.Selected = false;
                        }
                        ucCollectionsEdit.listBoxCtrl.Items.Add(lstItem);
                        lstItem = null;
                    }
                    kvpaircoll = null;
                }

                DropDownList ddlActiveEdit = (DropDownList)e.Item.FindControl("ddlActiveEdit");
                if (ddlActiveEdit != null)
                {
                    if (currRecord.Active == 1)
                    {
                        ddlActiveEdit.SelectedIndex = 0;
                    }
                    else
                    {
                        ddlActiveEdit.SelectedIndex = 1;
                    }
                }

                #region SecurityCheck2
                if (CannIdEdit != null)
                {
                    this.SecurityCheck(1, CannIdEdit);
                }
                if (txtHeaderTextEdit != null)
                {
                    this.SecurityCheck(3, txtHeaderTextEdit);
                }
                if (ucCancerTypeEdit != null)
                {
                    ucCancerTypeEdit.SecurityCheck();
                }
                if (ucSubjectEdit != null)
                {
                    ucSubjectEdit.SecurityCheck();
                }
                if (ucPubFormatEdit != null)
                {
                    ucPubFormatEdit.SecurityCheck();
                }
                if (ucRaceEdit != null)
                {
                    ucRaceEdit.SecurityCheck();
                }
                if (ucAudienceEdit != null)
                {
                    ucAudienceEdit.SecurityCheck();
                }
                if (ucLanguageEdit != null)
                {
                    ucLanguageEdit.SecurityCheck();
                }
                if (ucCollectionsEdit != null)
                {
                    ucCollectionsEdit.SecurityCheck();
                }
                if (ddlActiveEdit != null)
                {
                    this.SecurityCheck(2, ddlActiveEdit);
                }
                #endregion

                #endregion
            }
        }