Beispiel #1
0
        public List <SystemDropDown> getSystemDropDown(SystemDropDown systemDropDownList)
        {
            List <SystemDropDown> lsSystemDropDown = new List <SystemDropDown>();
            CommonData            commonData       = new CommonData();
            DataSet dataset = new DataSet();

            try
            {
                dataset = commonData.getSystemDropDown(systemDropDownList);

                if (dataset.Tables["DROPDOWNLIST"].Rows.Count > 0)
                {
                    for (int i = 0; i < dataset.Tables["DROPDOWNLIST"].Rows.Count; i++)
                    {
                        SystemDropDown localSDD = new SystemDropDown();
                        localSDD.Category       = dataset.Tables["DROPDOWNLIST"].Rows[i]["CATEGORY"].ToString().ToUpper();
                        localSDD.DisplayText    = dataset.Tables["DROPDOWNLIST"].Rows[i]["DISPLAYTEXT"].ToString();
                        localSDD.Key            = dataset.Tables["DROPDOWNLIST"].Rows[i]["KEY"].ToString();
                        localSDD.Value          = dataset.Tables["DROPDOWNLIST"].Rows[i]["VALUE"].ToString();
                        localSDD.ParentCategory = dataset.Tables["DROPDOWNLIST"].Rows[i]["PARENTCATEGORY"].ToString().ToUpper();
                        localSDD.ParentValue    = dataset.Tables["DROPDOWNLIST"].Rows[i]["PARENTVALUE"].ToString();
                        localSDD.ParentKey      = dataset.Tables["DROPDOWNLIST"].Rows[i]["PARENTKEY"].ToString();

                        lsSystemDropDown.Add(localSDD);
                    }
                }
            }
            catch (Exception ex)
            {
                LoggerHelper.WriteToLog(ex);
            }

            return(lsSystemDropDown);
        }
Beispiel #2
0
        public DataSet getSystemDropDown(SystemDropDown systemDropDownList)
        {
            DataSet dataSet = new DataSet();

            try
            {
                string storedProcedure = "pSRGg_SystemDropDown";
                string parameterName   = "@aXMLString";
                string parameterValue  = ObjectHelper.GetXMLFromObject(systemDropDownList);
                sqlCommand = new SqlCommand(storedProcedure, sqlConnection);
                sqlCommand.Parameters.AddWithValue(parameterName, parameterValue);
                sqlCommand.CommandType = CommandType.StoredProcedure;
                sqlConnection.Open();
                sqlDataAdapter.SelectCommand = sqlCommand;
                sqlDataAdapter.Fill(dataSet);
                dataSet.Tables[0].TableName = "DROPDOWNLIST";
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                sqlConnection.Close();
            }

            return(dataSet);
        }
Beispiel #3
0
        public static T getDropDownList <T>(string filterCategory, DropDownControlType ddlControlType, string filterValue = null, string parentFilterCategory = null, string parentFilterValue = null, bool getFromCache = false)
        {
            SystemDropDown systemDropDown = new SystemDropDown();

            filterCategory       = filterCategory.ToUpper();
            parentFilterCategory = !string.IsNullOrEmpty(parentFilterCategory) ? parentFilterCategory.ToUpper() : "";

            if (!getFromCache)
            {
                systemDropDown.Category       = filterCategory;
                systemDropDown.Value          = filterValue;
                systemDropDown.ParentCategory = parentFilterCategory;
                systemDropDown.ParentValue    = parentFilterValue;
            }

            switch (ddlControlType)
            {
            case DropDownControlType.Html:
                return(getFromCache
                           ? (T)Convert.ChangeType(getHtmlDropDown(filterCategory, filterValue, parentFilterCategory, parentFilterValue), typeof(T))
                           : (T)Convert.ChangeType(getHtmlDropDown(filterCategory, filterValue, parentFilterCategory, parentFilterValue, systemDropDown), typeof(T)));

            case DropDownControlType.Asp:
                return(getFromCache
                           ? (T)Convert.ChangeType(getHtmlDropDown(filterCategory, filterValue, parentFilterCategory, parentFilterValue), typeof(T))
                           : (T)Convert.ChangeType(getHtmlDropDown(filterCategory, filterValue, parentFilterCategory, parentFilterValue, systemDropDown), typeof(T)));
            }


            return((T)Convert.ChangeType(new Object(), typeof(T)));
        }
Beispiel #4
0
        public static List <SelectListItem> getMVCDropDown(string filterCategory = null, string filterValue = null, string parentFilterCategory = null, string parentFilterValue = null, bool getFromCache = false)
        {
            List <SelectListItem> lsSelectListItem = new List <SelectListItem>();

            SystemDropDown systemDropDown = new SystemDropDown();

            filterCategory       = filterCategory.ToUpper();
            parentFilterCategory = !string.IsNullOrEmpty(parentFilterCategory) ? parentFilterCategory.ToUpper() : "";

            if (!getFromCache)
            {
                systemDropDown.Category       = filterCategory;
                systemDropDown.Value          = filterValue;
                systemDropDown.ParentCategory = parentFilterCategory;
                systemDropDown.ParentValue    = parentFilterValue;
            }

            lsSelectListItem = getMVCDropDownList(filterCategory, filterValue, parentFilterCategory, parentFilterValue);

            return(lsSelectListItem);
        }
Beispiel #5
0
        private static List <SystemDropDown> getSystemDropDownList(SystemDropDown systemDropDown)
        {
            //return new CommonService().getSystemDropDown(systemDropDown);

            return(new List <SystemDropDown>());
        }
Beispiel #6
0
        private static List <SelectListItem> getMVCDropDownList(string filterCategory, string filterValue, string parentFilterCategory, string parentFilterValue, SystemDropDown systemDropDown)
        {
            List <SelectListItem> lsSelectListItem = new List <SelectListItem>();

            List <SystemDropDown> lsSystemDropDown = new List <SystemDropDown>();

            lsSystemDropDown = WebHelper.getSystemDropDownList(systemDropDown);

            foreach (var item in lsSystemDropDown)
            {
                lsSelectListItem.Add(new SelectListItem()
                {
                    Text = item.Value, Value = item.Key
                });
            }

            return(lsSelectListItem);
        }
Beispiel #7
0
        private static HtmlSelect getHtmlDropDown(string filterCategory, string filterValue, string parentFilterCategory, string parentFilterValue, SystemDropDown systemDropDown)
        {
            HtmlSelect htmlSelect = new HtmlSelect();

            List <SystemDropDown> lsSystemDropDown = new List <SystemDropDown>();

            lsSystemDropDown = WebHelper.getSystemDropDownList(systemDropDown);

            htmlSelect.DataTextField  = "VALUE";
            htmlSelect.DataValueField = "KEY";
            htmlSelect.DataSource     = lsSystemDropDown;
            htmlSelect.DataBind();

            return(htmlSelect);
        }