Esempio n. 1
0
        public static List <Model.mdlReason> GetSearchReason(string keyword)
        {
            var pReason = DataContext.Reasons.Where(fld => (fld.ReasonType.Contains(keyword)) || (fld.Value.Contains(keyword))).OrderBy(fld => fld.ReasonType).ToList();

            var mdlReasonList = new List <Model.mdlReason>();

            foreach (var reason in pReason)
            {
                var mdlReason = new Model.mdlReason();
                mdlReason.ReasonID   = reason.ReasonID;
                mdlReason.ReasonType = reason.ReasonType;
                mdlReason.Value      = reason.Value;

                mdlReasonList.Add(mdlReason);
            }

            return(mdlReasonList);
        }
Esempio n. 2
0
        public static List <Model.mdlReason> LoadReason()
        {
            var mdlReasonList      = new List <Model.mdlReason>();
            List <SqlParameter> sp = new List <SqlParameter>()
            {
            };

            DataTable dtReason = Manager.DataFacade.DTSQLCommand("SELECT * FROM Reason", sp);

            foreach (DataRow drReason in dtReason.Rows)
            {
                var mdlReason = new Model.mdlReason();
                mdlReason.ReasonID   = drReason["ReasonID"].ToString();
                mdlReason.ReasonType = drReason["ReasonType"].ToString();
                mdlReason.Value      = drReason["Value"].ToString();
                mdlReasonList.Add(mdlReason);
            }
            return(mdlReasonList);
        }