Beispiel #1
0
        public ActionResult Select(CommonCodeType type)
        {
            String viewName = "Select";

            viewName += ParseExtName(type);

            return(View(viewName, type));
        }
Beispiel #2
0
        public ActionResult TypeInfo(CommonCodeType type)
        {
            String viewName = "TypeInfo";

            viewName += ParseExtName(type);

            return(View(viewName, type));
        }
Beispiel #3
0
        public String ParseExtName(CommonCodeType type)
        {
            String strRet = "";

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

            return(strRet);
        }
        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);
        }
Beispiel #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);
        }
        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);
        }
Beispiel #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));
        }
        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);
        }
Beispiel #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));
        }
        public ActionResult Select(CommonCodeType type)
        {
            String viewName = "Select";

            viewName += ParseExtName(type);

            return View(viewName, type);
        }
        public ActionResult TypeInfo(CommonCodeType type)
        {
            String viewName = "TypeInfo";

            viewName += ParseExtName(type);

            return View(viewName,type);
        }
Beispiel #12
0
 public CommonCode GetBy(string name, CommonCodeType type)
 {
     return(Query.FirstOrDefault(c => (c.Type == type && c.Name.Equals(name))));
 }
Beispiel #13
0
 public IList <CommonCode> GetRoot(CommonCodeType type)
 {
     return(Query.Where(c => (c.Parent == null && c.Type == type)).ToList());
 }
Beispiel #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);
        }
Beispiel #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));
        }
Beispiel #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));
 }
 public ActionResult Select(CommonCodeType type)
 {
     return View(type);
 }
Beispiel #18
0
 public static MvcHtmlString DropDownListForCommonCode <T>(this HtmlHelper <T> helper, Expression <Func <T, CommonCode> > commonCodeExpression, CommonCodeType type)
 {
     return(helper.DropDownListForCommonCode(commonCodeExpression, type, null));
 }
        public String ParseExtName(CommonCodeType type)
        {
            String strRet = "";

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

            return strRet;
        }
 public ActionResult TypeInfo(CommonCodeType type)
 {
     return View(type);
 }
Beispiel #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));
        }