Пример #1
0
        public ActionResult Select(CommonCodeType type)
        {
            String viewName = "Select";

            viewName += ParseExtName(type);

            return(View(viewName, type));
        }
Пример #2
0
        public ActionResult TypeInfo(CommonCodeType type)
        {
            String viewName = "TypeInfo";

            viewName += ParseExtName(type);

            return(View(viewName, type));
        }
Пример #3
0
        public String ParseExtName(CommonCodeType type)
        {
            String strRet = "";

            if (type == CommonCodeType.客户等级)
            {
                strRet = "Khdj";
            }

            return(strRet);
        }
Пример #4
0
        public ActionResult Edit(int? id,int? parentid,CommonCodeType? type)
        {
            CommonCode item = null;

            if (id.HasValue)
            {
                item = this.CommonCodeRepository.Get(id.Value);
            }

            if (item == null && parentid.HasValue && type.HasValue)
            {
                item = new CommonCode();
                item.Type = type.Value;
                item.Parent = this.CommonCodeRepository.Get(parentid.Value);
            }

            return View(item);
        }
Пример #5
0
        public ActionResult Edit(int? id, CommonCodeType? chargeTypeFlag)
        {
            Charge item = null;
            ViewData["ChargeType"] = CommonCodeType.支出记账类型;

            if (id.HasValue)
            {
                item = this.ChargeRepository.Get(id.Value);
            }

            if (item == null )
            {
                item = new Charge();
                if (chargeTypeFlag.HasValue)
                {
                    ViewData["ChargeType"] = chargeTypeFlag.Value;
                }
            }

            return View(item);
        }
Пример #6
0
        public ActionResult GetData(int? id, CommonCodeType type)
        {
            IList<CommonCode> list = null;
            if (!id.HasValue)
            {
                list = this.CommonCodeRepository.GetRoot(type);
            }
            else
            {
                list = this.CommonCodeRepository.GetChildren(id.Value);
            }

            IList<CommonCodeModel> data = null;

            if (list != null)
            {
                data = list.Select(c => CommonCodeModel.From(c)).ToList();
            }

            return Json(data);
        }
Пример #7
0
        public ActionResult GetData(int?id, CommonCodeType type)
        {
            IList <CommonCode> list = null;

            if (!id.HasValue)
            {
                list = this.CommonCodeRepository.GetRoot(type);
            }
            else
            {
                list = this.CommonCodeRepository.GetChildren(id.Value);
            }

            IList <CommonCodeModel> data = null;

            if (list != null)
            {
                data = list.Select(c => CommonCodeModel.From(c)).ToList();
            }

            return(Json(data));
        }
Пример #8
0
        public ActionResult Edit(int? id, int? parentid, CommonCodeType? type)
        {
            CommonCode item = null;
            String viewName = "Edit";

            if (id.HasValue)
            {
                item = this.CommonCodeRepository.Get(id.Value);
            }

            if (item == null && parentid.HasValue && type.HasValue)
            {
                item = new CommonCode();
                item.Type = type.Value;
                item.Parent = this.CommonCodeRepository.Get(parentid.Value);
            }

            if (item != null)
            {
                viewName += ParseExtName(item.Type);
            }

            return View(viewName,item);
        }
Пример #9
0
        public static MvcHtmlString DropDownListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, CommonCode> > commonCodeExpression, CommonCodeType type, string optionLabel)
        {
            var val = ModelMetadata.FromLambdaExpression(commonCodeExpression, helper.ViewData);

            var selectval = val.Model;

            IList <CommonCode> selList = new List <CommonCode>();

            if (selectval != null)
            {
                selList.Add((CommonCode)selectval);
            }

            var list = helper.GetCommonCodeList(type, selList);

            return(helper.SelectInternal(optionLabel, ExpressionHelper.GetExpressionText(commonCodeExpression), list, false, null));
        }
Пример #10
0
        public ActionResult Select(CommonCodeType type)
        {
            String viewName = "Select";

            viewName += ParseExtName(type);

            return View(viewName, type);
        }
Пример #11
0
        public ActionResult TypeInfo(CommonCodeType type)
        {
            String viewName = "TypeInfo";

            viewName += ParseExtName(type);

            return View(viewName,type);
        }
Пример #12
0
 public CommonCode GetBy(string name, CommonCodeType type)
 {
     return(Query.FirstOrDefault(c => (c.Type == type && c.Name.Equals(name))));
 }
Пример #13
0
 public IList <CommonCode> GetRoot(CommonCodeType type)
 {
     return(Query.Where(c => (c.Parent == null && c.Type == type)).ToList());
 }
Пример #14
0
        private static IEnumerable <SelectListItem> GetCommonCodeList <T>(this HtmlHelper <T> helper, CommonCodeType type, IList <CommonCode> selectval)
        {
            IEnumerable <SelectListItem> selectList = null;

            IList <CommonCode> list = new List <CommonCode>();

            var controller = helper.ViewContext.Controller as BaseController;

            if (controller != null)
            {
                list = controller.CommonCodeRepository.GetRoot(type);
            }

            selectList = from CommonCode item in list
                         select new SelectListItem
            {
                Value    = item.Id.ToString(),
                Text     = item.Name,
                Selected = (selectval != null?selectval.Contains(item):false)
            };

            return(selectList);
        }
Пример #15
0
        public static MvcHtmlString CheckBoxListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, IList <CommonCode> > > commonCodeExpression, CommonCodeType type, string name)
        {
            var val = ModelMetadata.FromLambdaExpression(commonCodeExpression, helper.ViewData);

            var list = helper.GetCommonCodeList(type, (IList <CommonCode>)val.Model);

            if (name == null)
            {
                name = ExpressionHelper.GetExpressionText(commonCodeExpression);
            }

            return(helper.CheckBoxInternal(name, list, null));
        }
Пример #16
0
 public static MvcHtmlString CheckBoxListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, IList <CommonCode> > > commonCodeExpression, CommonCodeType type)
 {
     return(helper.CheckBoxListForCommonCode(commonCodeExpression, type, null));
 }
Пример #17
0
 public ActionResult Select(CommonCodeType type)
 {
     return View(type);
 }
Пример #18
0
 public static MvcHtmlString DropDownListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, CommonCode> > commonCodeExpression, CommonCodeType type)
 {
     return(helper.DropDownListForCommonCode(commonCodeExpression, type, null));
 }
Пример #19
0
        public String ParseExtName(CommonCodeType type)
        {
            String strRet = "";

            if (type == CommonCodeType.客户等级)
            {
                strRet = "Khdj";
            }

            return strRet;
        }
Пример #20
0
 public ActionResult TypeInfo(CommonCodeType type)
 {
     return View(type);
 }
Пример #21
0
        public static MvcHtmlString DropDownListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, CommonCode> > commonCodeExpression, CommonCodeType type, string name, string optionLabel)
        {
            var list = helper.GetCommonCodeList(type, null);

            return(helper.SelectInternal(optionLabel, name, list, false, null));
        }