コード例 #1
0
 public RunAsAccountWrapper(SecureData account)
 {
     AccountName = account.Name;
     AccountId = account.Id;
     AccountStorageIdByteArray = account.SecureStorageId;
     AccountStorageIdString = ConvertToHex(AccountStorageIdByteArray);
 }
コード例 #2
0
        private void bindAttachments(int resultID, int?resultAttachID, SecureData sd)
        {
            var dtAttach = sd.GetData("web_feedback_result_attachments", ":feedbackresultid=" + resultID + ";:feedbackresultattachid=" + resultAttachID, 0, 0).Tables["web_feedback_result_attachments"];

            gvAttachments.DataSource = dtAttach;
            gvAttachments.DataBind();
        }
コード例 #3
0
        private void bindCitation(int id)
        {
            pnlLiterature.Visible = false;

            using (SecureData sd = UserManager.GetSecureData(true))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    DataTable dt = dm.Read(@"
                    select c.*, l.abbreviation  from citation c left join literature l on c.literature_id = l.literature_id  where citation_id = :cid",
                                           new DataParameters(":cid", id));

                    if (dt.Rows.Count > 0)
                    {
                        pnlCitation.Visible = true;

                        DataRow dr = dt.Rows[0];
                        lblCitation.Text = dr["author_name"] + "<br />" + dr["citation_title"] + "<br />" + dr["abbreviation"] + " " + dr["reference"] + " " + dr["citation_year"] + "<br />";
                    }

                    rptCitation.DataSource = sd.GetData("web_crop_citation_accession", ":citationid=" + id, 0, 0).Tables["web_crop_citation_accession"];
                    rptCitation.DataBind();
                }
            }
        }
コード例 #4
0
 public DataSet ListTableNames(bool suppressExceptions, string loginToken, string schemaName)
 {
     using (SecureData sd = new SecureData(suppressExceptions, loginToken))
     {
         return(sd.ListTableNames(schemaName));
     }
 }
コード例 #5
0
        private void bindAccessionPIBook(int id)
        {
            try
            {
                using (var sd = new SecureData(false, UserManager.GetLoginToken(true)))
                {
                    using (DataManager dm = sd.BeginProcessing(true, true))
                    {
                        // Only US NPGS would have the value and continue processing
                        string acp = dm.ReadValue(@"select accession_number_part1 from accession where accession_id = :aid", new DataParameters(":aid", id, DbType.Int32)).ToString();

                        if (acp.Trim() == "PI")
                        {
                            //string cnt = dm.ReadValue(@"select count(sys_table_id) from sys_table where table_name = 'plant_inventory_index'").ToString();
                            //if (cnt != "0")
                            //{
                            int pinumber = Int32.Parse(dm.ReadValue(@"select accession_number_part2 from accession where accession_id = :aid", new DataParameters(":aid", id, DbType.Int32)).ToString());

                            DataTable dt = sd.GetData("web_accessiondetail_pi", ":pinumber=" + pinumber, 0, 0).Tables["web_accessiondetail_pi"];

                            if (dt.Rows.Count > 0)
                            {
                                HasPIValue = true;
                                DataRow dr = dt.Rows[0];
                                PIAssigned = dr["plant_inventory_year"].ToString();
                                IVVolume   = dr["plant_inventory_volumn"].ToString();
                            }


                            dt = sd.GetData("web_accessiondetail_piindex", ":pinumber=" + pinumber, 0, 0).Tables["web_accessiondetail_piindex"];

                            if (dt.Rows.Count > 0)
                            {
                                lblViewPDF.Visible = true;
                                foreach (DataRow dr in dt.Rows)
                                {
                                    string PIIndex = "in_vol=" + dr["plant_inventory_volumn"].ToString() + "&in_suffix=" + dr["volumn_suffix"].ToString() + "&in_page=" + dr["page"].ToString();
                                    lblViewPDF.Text = lblViewPDF.Text.Replace("*", PIIndex);
                                }
                            }

                            dt = sd.GetData("web_accessiondetail_pimindex", ":pinumber=" + pinumber, 0, 0).Tables["web_accessiondetail_pimindex"];

                            if (dt.Rows.Count > 0)
                            {
                                lblViewIMPDF.Visible = true;
                                foreach (DataRow dr in dt.Rows)
                                {
                                    string PIIndex = "in_vol=" + dr["plant_immigrant_volumn"].ToString() + "&in_page=" + dr["plant_immigrant_page"].ToString();
                                    lblViewIMPDF.Text = lblViewIMPDF.Text.Replace("*", PIIndex);
                                }
                            }
                            //}
                        }
                    }
                }
            }
            catch (Exception ex)
            { string msg = ex.Message; }
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dt = null;

            var accessionID = Toolkit.ToInt32(Request.QueryString["accessionid"], -1); // 390399

            if (accessionID < 0)
            {
                // HACK: just for testing, remove later!
                dt = new DataTable();
                dt.Columns.Add("thumbnail_virtual_path", typeof(string));
                dt.Columns.Add("title", typeof(string));
                dt.Columns.Add("virtual_path", typeof(string));
                dt.Rows.Add(new object[] { "~/uploads/images/PI_501110_93ncei01_SD_pk.jpg", "some title here", "~/uploads/images/PI_501110_93ncei01_SD_pk_thumbnail.jpg" });
                dt.Rows.Add(new object[] { @"~\uploads\images\PI_501111_93ncei01_SD_pk.jpg", "title 2 here", @"~\uploads\images/PI_501111_93ncei01_SD_pk_thumbnail.jpg" });
            }
            else
            {
                using (var sd = new SecureData(false, UserManager.GetLoginToken())) {
                    dt = sd.GetData("web_accessiondetail_inventory_image", ":accessionid=" + accessionID, 0, 0).Tables["web_accessiondetail_inventory_image"];
                }
            }

            if (dt.Rows.Count > 0)
            {
                imagePreviewer.DataSource = dt;
                imagePreviewer.DataBind();
            }
            else
            {
                imagePreviewer.Visible = false;
            }
        }
コード例 #7
0
        private void bindData3(int traitID, string value)
        {
            DataTable dt = null;

            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    string traitName = dm.ReadValue(@"select coded_name from crop_trait where crop_trait_id = :ctid", new DataParameters(":ctid", traitID, DbType.Int32)).ToString();
                    string cropName  = dm.ReadValue(@"select name from crop where crop_id = (select crop_id from crop_trait where crop_trait_id = :ctid)", new DataParameters(":ctid", traitID, DbType.Int32)).ToString();

                    if (traitName != "")
                    {
                        var low = value.Split(';')[0];
                        var up  = value.Split(';')[1];

                        lblDesc.Text = cropName + " accessions with values between " + low + " and " + up + " for descriptor " + traitName;

                        dt = sd.GetData("web_descriptor_value_accession3", ":traitid=" + traitID + ";:low=" + low + ";:up=" + up, 0, 0).Tables["web_descriptor_value_accession3"];
                        gvAccession.DataSource = dt;
                        gvAccession.DataBind();
                    }
                }
            }
        }
コード例 #8
0
        private void populateShippingAddressList(int wuserid)
        {
            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken()))
            {
//                using (DataManager dm = sd.BeginProcessing(true))
//                {
//                    DataTable dt = dm.Read(@"
//                    select 0 as wusaid, '' as address_name
//                    union select web_user_shipping_address_id as wusaid, address_name as address_name
//                    from web_user_shipping_address
//                    where web_user_id = :wuserid
//                    order by address_name",
//                    new DataParameters(":wuserid", wuserid
//                    ));

                DataTable dt = sd.GetData("web_user_shipping_address", ":wuserid=" + wuserid, 0, 0).Tables["web_user_shipping_address"];

                if (dt.Rows.Count > 0)
                {
                    ddlShipping.DataValueField = "wusaid";
                    ddlShipping.DataTextField  = "address_name";
                    ddlShipping.DataSource     = dt;
                    ddlShipping.DataBind();
                }
                //}
            }
        }
コード例 #9
0
        public void SecureData_Asymmetric()
        {
            string privateKey = AsymmetricCrypto.CreatePrivateKey(CryptoAlgorithm.RSA, 1024);
            string publicKey  = AsymmetricCrypto.GetPublicKey(CryptoAlgorithm.RSA, privateKey);

            byte[] plainText;
            byte[] cipherText;

            plainText  = new byte[] { 0, 1, 2, 3 };
            cipherText = SecureData.Encrypt(publicKey, plainText, CryptoAlgorithm.AES, 256);
            CollectionAssert.AreNotEqual(plainText, cipherText);
            CollectionAssert.AreEqual(plainText, SecureData.Decrypt(privateKey, cipherText));

            plainText  = new byte[] { 0, 1, 2, 3 };
            cipherText = SecureData.Encrypt(publicKey, plainText, CryptoAlgorithm.AES, 256, 1000);
            Assert.IsTrue(cipherText.Length >= 1000);

            plainText  = new byte[0];
            cipherText = SecureData.Encrypt(publicKey, plainText, CryptoAlgorithm.AES, 256);
            CollectionAssert.AreNotEqual(plainText, cipherText);
            CollectionAssert.AreEqual(plainText, SecureData.Decrypt(privateKey, cipherText));

            plainText = new byte[2000000];
            for (int i = 0; i < plainText.Length; i++)
            {
                plainText[i] = (byte)i;
            }

            cipherText = SecureData.Encrypt(publicKey, plainText, CryptoAlgorithm.AES, 256);
            CollectionAssert.AreNotEqual(plainText, cipherText);
            CollectionAssert.AreEqual(plainText, SecureData.Decrypt(privateKey, cipherText));
        }
コード例 #10
0
        private void bindData1(int traitID, int codeID)
        {
            DataTable dt = null;

            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    string traitName = dm.ReadValue(@"select coded_name from crop_trait where crop_trait_id = :ctid", new DataParameters(":ctid", traitID, DbType.Int32)).ToString();
                    string cropName  = dm.ReadValue(@"select name from crop where crop_id = (select crop_id from crop_trait where crop_trait_id = :ctid)", new DataParameters(":ctid", traitID, DbType.Int32)).ToString();

                    string codeValue = dm.ReadValue(@"select code from crop_trait_code where crop_trait_code_id = :ctcid", new DataParameters(":ctcid", codeID, DbType.Int32)).ToString();
                    string codeDesc  = dm.ReadValue(@"select description from crop_trait_code_lang where crop_trait_code_id = :ctcid and sys_lang_id = :langid", new DataParameters(":ctcid", codeID, DbType.Int32, ":langid", sd.LanguageID, DbType.Int32)).ToString();


                    if (traitName != "")
                    {
                        lblDesc.Text = cropName + " accessions with code " + codeValue + " (" + codeDesc + ") for descriptor " + traitName;

                        dt = sd.GetData("web_descriptor_value_accession1", ":traitid=" + traitID + ";:codeid=" + codeID, 0, 0).Tables["web_descriptor_value_accession1"];
                        gvAccession.DataSource = dt;
                        gvAccession.DataBind();
                    }
                }
            }
        }
コード例 #11
0
ファイル: CartItem.cs プロジェクト: radtek/genebank-gg_server
        public static string GetMaterialDescription(string formcode)
        {
            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
//                using (DataManager dm = sd.BeginProcessing(true))
//                {
//                    string text = (dm.ReadValue(@"
//                            select
//	                            coalesce(cvl.description, cv.value) as description
//                            from
//	                            code_value cv
//	                        left join code_value_lang cvl
//		                        on cv.code_value_id = cvl.code_value_id
//		                        and cvl.sys_lang_id = :langid
//                            where
//	                            cv.group_name = 'GERMPLASM_FORM'
//	                            and cv.value = :formcode
//                             ", new DataParameters(":langid", sd.LanguageID, DbType.Int32
//                                 , ":formcode", formcode, DbType.String))).ToString();
//                    return text;
//                }

                var dt = sd.GetData("web_lookup_material_description", ":langid=" + sd.LanguageID + ";:formcode=" + formcode, 0, 0).Tables["web_lookup_material_description"];
                return(dt.ToScalarValue());
            }
        }
コード例 #12
0
        private static void mergeCartItems(string loginToken, CartItem[] accessions)
        {
            if (accessions != null)
            {
                if (accessions.Length > 0)
                {
                    using (SecureData sd = new SecureData(true, loginToken, null))
                    {
                        Cart c = Cart.Current;
                        c.FillDB(loginToken);

                        int    added = 0;
                        int    id    = 0;
                        string distributionFormCode = "";
                        foreach (CartItem ci in accessions)
                        {
                            id = ci.ItemID;
                            distributionFormCode = ci.DistributionFormCode;

                            added += c.AddAccession(id, distributionFormCode);
                        }
                        c.Save(loginToken);
                    }
                }
            }
        }
コード例 #13
0
        private static void checkExpiredPassword(string webUserName, string loginToken, HttpContext ctx)
        {
            int days = Toolkit.GetSetting("PasswordExpireDays", 0);

            if (days > 0)
            {
                using (SecureData sd = new SecureData(true, loginToken, null))
                {
                    using (DataManager dm = sd.BeginProcessing(true, true))
                    {
                        string lastModified = (dm.ReadValue(@"select modified_date from web_user where user_name = :username
                                        ", new DataParameters(":username", webUserName, DbType.String))).ToString();

                        if (lastModified == "") // level 1 user
                        {
                            lastModified = (dm.ReadValue(@"select created_date from web_user where user_name = :username
                                        ", new DataParameters(":username", webUserName, DbType.String))).ToString();
                        }

                        if (lastModified != "")
                        {
                            DateTime date        = Toolkit.ToDateTime(lastModified);
                            DateTime currentDate = DateTime.UtcNow;
                            if ((currentDate - date).Days > days)
                            {
                                ctx.Response.Clear();
                                ctx.Response.Redirect("~/userAcct.aspx?action=expirePwd");
                                ctx.Response.End();
                            }
                        }
                    }
                }
            }
        }
コード例 #14
0
        public static string GetAccessionIds(string sql)
        {
            string s = "";

            using (SecureData sd = GetSecureData(true))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    DataTable     dtID = dm.Read(sql);
                    List <string> IDs  = new List <string>();
                    if (dtID != null)
                    {
                        foreach (DataRow dr in dtID.Rows)
                        {
                            IDs.Add(dr[0].ToString());
                        }
                        if (IDs.Count > 0)
                        {
                            s = " @accession.accession_id in (" + String.Join(",", IDs.ToArray()) + ")";
                        }
                    }
                }
            }

            return(s);
        }
コード例 #15
0
ファイル: gui.asmx.cs プロジェクト: radtek/genebank-gg_server
 public DataSet GetAllLookupTableStats(bool suppressExceptions, string userName, string password)
 {
     using (SecureData sd = new SecureData(suppressExceptions, Login(userName, password))) {
         DataSet ds = sd.GetAllLookupTableStats();
         return(ds);
     }
 }
コード例 #16
0
        private void bindAttachment(int id)
        {
            DataTable dt = null;

            using (var sd = new SecureData(false, UserManager.GetLoginToken()))
            {
                dt = sd.GetData("web_descriptor_detail_attach", ":traitid=" + id + ";:categorycode='IMAGE'", 0, 0).Tables["web_descriptor_detail_attach"];

                if (dt.Rows.Count > 0)
                {
                    imagePreviewer.DataSource = dt;
                    imagePreviewer.DataBind();
                }
                else
                {
                    imagePreviewer.Visible = false;
                }

                dt = sd.GetData("web_descriptor_detail_attach", ":traitid=" + id + ";:categorycode='LINK'", 0, 0).Tables["web_descriptor_detail_attach"];
                if (dt.Rows.Count > 0)
                {
                    plLink.Visible     = true;
                    rptLink.DataSource = dt;
                    rptLink.DataBind();
                }
            }
        }
コード例 #17
0
        public void bindData()
        {
            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
                var dt     = sd.GetData("web_searchcriteria_item_list", "", 0, 0).Tables["web_searchcriteria_item_list"];
                var drNone = dt.NewRow();
                drNone["group_name"] = " -- Select One -- ";
                drNone["name"]       = "none";
                dt.Rows.InsertAt(drNone, 0);

                //foreach (DataRow dr in dt.Rows)
                //{
                //    dr["group_name"] = dr["group_name"].ToString().ToLower().Replace("_", "  ");
                //}

                bool isInternal = (Page.User.IsInRole("ALLUSERS"));
                if (isInternal)
                {
                    var drOrder = dt.NewRow();
                    drOrder["group_name"] = "order request id";
                    drOrder["name"]       = "@order_request.order_request_id";
                    dt.Rows.Add(drOrder);
                }
                ddlItem.DataSource = dt;
                ddlItem.DataBind();
            }
            //lblChoose.Text = "Choose Query " + sequence + ":";
            //btnClear.Text = "Clear Criteria " + sequence;
            lblChoose.Text = Site1.DisplayText("lblChooseN", "Choose Criterion") + " " + sequence + ":";
            btnClear1.Text = Site1.DisplayText("btnClearN", "Clear Criterion") + " " + sequence;
        }
コード例 #18
0
ファイル: Cart.cs プロジェクト: radtek/genebank-gg_server
        public DataTable ListDistributionTypes(int accessionID)
        {
            using (SecureData sd = UserManager.GetSecureData(true)) {
                return(sd.GetData("web_lookup_distribution_type", ":accessionid=" + accessionID + ";:langid=" + sd.LanguageID, 0, 0).Tables["web_lookup_distribution_type"]);

//                using (var dm = sd.BeginProcessing(true)) {
//                    var dt = dm.Read(@"
//select
//    distinct
//	cv.value as value,
//	coalesce(cvl.description, cv.value) as display_text
//from
//	inventory i
//	left join code_value cv
//		on cv.group_name = 'GERMPLASM_FORM'
//		and cv.value = i.form_type_code
//	left join code_value_lang cvl
//		on cv.code_value_id = cvl.code_value_id
//		and cvl.sys_lang_id = :langid
//where
//	i.accession_id = :accessionid
//	and i.is_distributable = 'Y'
//	and i.is_available = 'Y'
//", new DataParameters(":accessionid", accessionID, DbType.Int32, ":langid", sd.LanguageID, DbType.Int32));

//                    return dt;
            }
        }
コード例 #19
0
        private void bindData(int iprID)
        {
            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken()))
            {
                DataTable dt = sd.GetData("web_accessiondetail_ipr_disclaimer", ":accessioniprid=" + iprID, 0, 0).Tables["web_accessiondetail_ipr_disclaimer"];
                if (dt.Rows.Count > 0)
                {
                    string description = dt.Rows[0]["description"].ToString();
                    Regex  regx        = new Regex("http://([\\w+?\\.\\w+])+([a-zA-Z0-9\\~\\!\\@\\#\\$\\%\\^\\&amp;\\*\\(\\)_\\-\\=\\+\\\\\\/\\?\\.\\:\\;\\'\\,]*)?", RegexOptions.IgnoreCase);

                    MatchCollection mactches = regx.Matches(description);

                    foreach (Match match in mactches)
                    {
                        string matchURL = match.Value;
                        if (matchURL.Substring(matchURL.Length - 1, 1) == ")")
                        {
                            matchURL = matchURL.Substring(0, matchURL.Length - 1);
                        }
                        if (matchURL.Substring(matchURL.Length - 2, 2) == ").")
                        {
                            matchURL = matchURL.Substring(0, matchURL.Length - 2);
                        }
                        description = description.Replace(match.Value, "<a href='" + matchURL + "'>" + match.Value + "</a>");
                    }
                    lblDescription.Text = description;
                }
            }
        }
コード例 #20
0
 // for other queries (accession_source)
 private DataTable getDataViewData(string dvName, string dataParams, int limit)
 {
     using (var sd = new SecureData(false, UserManager.GetLoginToken(true)))
     {
         return(sd.GetData(dvName, dataParams, 0, limit).Tables[dvName]);
     }
 }
コード例 #21
0
 private DataTable getDataViewDataForCooperator(string dvName, int orderID, int limit)
 {
     using (var sd = new SecureData(false, UserManager.GetLoginToken(true)))
     {
         return(sd.GetData(dvName, ":cooperatorid=" + sd.CooperatorID + ";:order_request_id=" + orderID, 0, limit).Tables[dvName]);
     }
 }
コード例 #22
0
        private void bindData(bool exportAll)
        {
            string sqlAll    = "";
            string sqlSelect = "";

            if (Session["sqlwhere"] != null)
            {
                sqlAll = Session["sqlwhere"].ToString();

                sqlSelect = sqlAll + ") and " + sqlAll.Substring(1, sqlAll.IndexOf("))"));

                DataTable dt = null;
                using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
                {
                    using (DataManager dm = sd.BeginProcessing(true, true))
                    {
                        //  only selected traits
                        if (exportAll)
                        {
                            dt = sd.GetData("web_descriptorbrowse_trait_export", ":where=" + sqlAll, 0, 0).Tables["web_descriptorbrowse_trait_export"];
                        }
                        else
                        {
                            dt = sd.GetData("web_descriptorbrowse_trait_export", ":where=" + sqlSelect, 0, 0).Tables["web_descriptorbrowse_trait_export"];
                        }

                        dt.Columns.RemoveAt(0);

                        List <string> colist = new List <string>()
                        {
                            "accession_surfix",
                            "plant_name",
                            "taxon",
                            "origin",
                            "original_value",
                            "frequency",
                            "low",
                            "hign",
                            "mean",
                            "sdev",
                            "ssize",
                            "inventory_prefix",
                            "inventory_number",
                            "inventory_suffix",
                            "accession_comment"
                        };

                        for (int i = 0; i < cblOptions.Items.Count; i++)
                        {
                            if (!cblOptions.Items[i].Selected)
                            {
                                dt.Columns.Remove(colist[i]);
                            }
                        }
                        gvResult.DataSource = dt;
                        gvResult.DataBind();
                    }
                }
            }
        }
コード例 #23
0
        private void bindData(int traitID, int methodID)
        {
            DataTable dt = null;

            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    traitName  = dm.ReadValue(@"select coded_name from crop_trait where crop_trait_id = :ctid", new DataParameters(":ctid", traitID, DbType.Int32)).ToString();
                    methodName = dm.ReadValue(@"select name from method where method_id = :mid", new DataParameters(":mid", methodID, DbType.Int32)).ToString();

                    if (methodName != "" & traitName != "")
                    {
                        lblDesc.Text = traitName + " in study " + methodName;

                        dt = sd.GetData("web_method_descriptor_accession", ":traitid=" + traitID + ";:methodid=" + methodID, 0, 0).Tables["web_method_descriptor_accession"];
                        gvAccession.DataSource = dt;
                        gvAccession.DataBind();

                        dt = sd.GetData("web_descriptor_detail_download", ":traitid=" + traitID + ";:methodid=" + methodID, 0, 0).Tables["web_descriptor_detail_download"];
                        gvAccession2.DataSource = dt;
                        gvAccession2.DataBind();
                    }
                }
            }
        }
コード例 #24
0
        private void LoadSettings()
        {
            TextBoxDomain.Text   = Settings.Default.Domain;
            TextBoxPort.Text     = Settings.Default.Port == 80 ? string.Empty : Settings.Default.Port.ToString();
            TextBoxUserName.Text = Settings.Default.UserName;

            PasswordBoxPassword.Password = SecureData.Decrypt(Settings.Default.Password);

            CheckBoxHideInactive.IsChecked = Settings.Default.HideInactive;

            RadioButtonProtocolHttp.IsChecked  = !Settings.Default.UseSsl;
            RadioButtonProtocolHttps.IsChecked = Settings.Default.UseSsl;

            ComboBoxRefreshInterval.Items.Cast <ComboBoxItem>()
            .Where(comboBoxItem => (string)comboBoxItem.Content == Settings.Default.RefreshInterval.ToString())
            .Select(comboBoxItem => comboBoxItem).Single().IsSelected = true;

            ComboBoxColumnsNumber.Items.Cast <ComboBoxItem>()
            .Where(comboBoxItem => (string)comboBoxItem.Content == Settings.Default.NumberOfColumns.ToString())
            .Select(comboBoxItem => comboBoxItem).Single().IsSelected = true;

            ComboBoxHideInactive.Items.Cast <ComboBoxItem>()
            .Where(comboBoxItem => (string)comboBoxItem.Content == Settings.Default.HideInactiveWeeks.ToString())
            .Select(comboBoxItem => comboBoxItem).Single().IsSelected = true;

            ComboBoxCIType.Items.Cast <ComboBoxItem>()
            .Where(comboBoxItem => (string)comboBoxItem.Content == Settings.Default.ClientType.ToString())
            .Select(comboBoxItem => comboBoxItem).Single().IsSelected = true;
        }
コード例 #25
0
        protected void ddlClass_SelectedIndexChanged(object sender, EventArgs e)
        {
            string code  = Utils.Sanitize(ddlClass.SelectedValue);
            string value = ddlClass.SelectedItem.Text;

            if (code != "allclass")
            {
                using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
                {
                    var dt = sd.GetData("web_lookup_taxon_use_subclass", ":usagecode=" + code, 0, 0).Tables["web_lookup_taxon_use_subclass"];


                    lstSubclass.DataSource = dt;
                    lstSubclass.DataBind();

                    lstSubclass.Items.Insert(0, new ListItem("all uses", "all subclasses"));
                    lstSubclass.SelectedIndex = 0;
                    lstSubclass.Rows          = 4;
                }
            }
            else
            {
                lstSubclass.Items.Clear();
                lstSubclass.Items.Insert(0, new ListItem("all uses", "all subclasses"));
                lstSubclass.Rows = 1;
            }
        }
コード例 #26
0
 public DataSet RecreateTableMappings(bool suppressExceptions, string loginToken, List <string> tableNames)
 {
     using (SecureData sd = new SecureData(suppressExceptions, loginToken))
     {
         return(sd.RecreateTableMappings(tableNames));
     }
 }
コード例 #27
0
        private void bindLists()
        {
            using (SecureData sd = new SecureData(false, UserManager.GetLoginToken(true)))
            {
                // Taxon family list
                var dt = sd.GetData("web_lookup_taxon_family", "", 0, 0).Tables["web_lookup_taxon_family"];

                lstFamily.DataSource = dt;
                lstFamily.DataBind();

                lstFamily.Items.Insert(0, new ListItem("ALL FAMILIES", "0"));
                lstFamily.Items.Insert(1, new ListItem("all pteridophytes", "ferns"));
                lstFamily.Items.Insert(2, new ListItem("all gymnosperms", "gymno"));
                lstFamily.Items.Insert(3, new ListItem("all angiosperms", "angio"));
                lstFamily.Items.Insert(4, new ListItem("plant pathogens", "pathogen"));
                lstFamily.SelectedIndex = 0;

                // Continent list
                dt = sd.GetData("web_lookup_continent", "", 0, 0).Tables["web_lookup_continent"];

                ddlContinent.DataSource = dt;
                ddlContinent.DataBind();

                // Country list
                dt = sd.GetData("web_lookup_country_taxon", "", 0, 0).Tables["web_lookup_country_taxon"];

                lstCountry.DataSource = dt;
                lstCountry.DataBind();
                lstCountry.Items.Insert(0, new ListItem("ALL COUNTRIES", "0:0"));
                lstCountry.SelectedIndex = 0;
            }
        }
コード例 #28
0
        private void bindData()
        {
            using (_sd = UserManager.GetSecureData(false)){
                var resultID = getResultAndInventoryIDs(false)[0];

                var dt = _sd.GetData("web_feedback_result_field", ":feedbackresultid=" + resultID, 0, 0).Tables["web_feedback_result_field"];
                _hasBeenSubmitted = false;
                if (dt.Rows.Count > 0)
                {
                    var dr = dt.Rows[0];
                    _hasBeenSubmitted = Toolkit.ToDateTime(dr["submitted_date"], DateTime.MinValue) > DateTime.MinValue;
                    litReport.Text    = dr["report_title"].ToString();
                    litProgram.Text   = dr["program_title"].ToString();
                }

                if (_hasBeenSubmitted)
                {
                    btnSubmit.Visible           = false;
                    btnSaveForLater.Visible     = false;
                    lblHasBeenSubmitted.Visible = true;
                }

                rptFields.DataSource = dt;
                rptFields.DataBind();

                var dtTraits = _sd.GetData("web_feedback_result_trait_obs", ":feedbackresultid=" + resultID, 0, 0).Tables["web_feedback_result_trait_obs"];

                rptTraits.DataSource = dtTraits;
                rptTraits.DataBind();

                bindAttachments(resultID, null, _sd);
            }
        }
コード例 #29
0
 public static AppSettingsValues GetAppSettingsValues()
 {
     try
     {
         AppSettingsValues keys = new AppSettingsValues();
         var appSettings        = ConfigurationManager.GetSection("appSettings") as NameValueCollection;
         keys.OrchestratorUrl        = appSettings["OrchestratorUrl"];
         keys.QueueName              = SecureData.Base64Decode(appSettings["QueueName"]);
         keys.ResponseQueueName      = SecureData.Base64Decode(appSettings["ResponseQueueName"]);
         keys.tenancyName            = SecureData.Base64Decode(appSettings["tenancyName"]);
         keys.usernameOrEmailAddress = SecureData.Base64Decode(appSettings["usernameOrEmailAddress"]);
         keys.password                 = SecureData.Base64Decode(appSettings["password"]);
         keys.SecretKey                = SecureData.Base64Decode(appSettings["SecretKey"]);
         keys.oidc_Authority           = appSettings["oidc:Authority"];
         keys.oidc_ClientId            = appSettings["oidc:ClientId"];
         keys.oidc_RedirectUrl         = appSettings["oidc:RedirectUrl"];
         keys.ElasticSearch_Authority  = appSettings["ElasticSearch:Authority"];
         keys.ESSecretKey              = SecureData.Base64Decode(appSettings["ESSecretKey"]);
         keys.LookupKey                = appSettings["LookupKey"];
         keys.DbAutomation_Authority   = appSettings["DbAutomation:Authority"];
         keys.isDevelopmentEnvironment = Convert.ToBoolean(appSettings["isDevelopmentEnvironment"]);
         return(keys);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #30
0
        private static ClientConfiguration LoadClientConfiguration()
        {
            string baseUrl = string.Empty;

            switch (Settings.Default.ClientType)
            {
            case ClientType.TeamCity:
                baseUrl = Settings.Default.BaseUrlTeamCity;
                break;

            case ClientType.Hudson:
                baseUrl = Settings.Default.BaseUrlHudson;
                break;

            case ClientType.Bamboo:
                baseUrl = Settings.Default.BaseUrlBamboo;
                break;
            }

            return(new ClientConfiguration
            {
                Domain = Settings.Default.Domain,
                Port = Settings.Default.Port,
                UserName = Settings.Default.UserName,
                Password = SecureData.Decrypt(Settings.Default.Password),
                UseSsl = Settings.Default.UseSsl,
                IgnoreInvalidCertificate = Settings.Default.IgnoreInvalidCertificate,
                ClientType = Settings.Default.ClientType,
                BaseUrl = baseUrl
            });
        }
コード例 #31
0
        public static bool IsDefaultAddress(int addrid)
        {
            string defaultStatus;

            using (SecureData sd = GetSecureData(true))
            {
                using (DataManager dm = sd.BeginProcessing(true, true))
                {
                    defaultStatus = dm.ReadValue(@"
                                select 
                                    is_default
                                from 
                                    web_user_shipping_address
                                where 
                                    web_user_id = :webuserid
                                    and web_user_shipping_address_id = :addrid
                                ", new DataParameters(
                                                     ":webuserid", sd.WebUserID, DbType.Int32,
                                                     ":addrid", addrid, DbType.Int32
                                                     )).ToString();

                    return((defaultStatus == "Y") ? true : false);
                }
            }
        }