BN089-BS开发框架MVC4版/source20131023/Zephyr.Web/Areas/Mms/Common/MmsHelper.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using Zephyr.Core;
using Zephyr.Utils;

namespace Zephyr.Web.Areas.Mms.Common
{
    public class MmsHelper
    {
        public static string GetCookies(string name) 
        {
            var cookie = HttpContext.Current.Request.Cookies.Get(name);
            return cookie == null ? null : cookie.Value;
        }

        public static string GetUserName()
        {
            return FormsAuth.GetUserData().UserName;
        }

        public static string GetCurrentProject()
        {
            return GetCookies("CurrentProject");
        }

        public static void ThrowHttpExceptionWhen(bool condition,string message,params object[] param)
        {
            if (condition)
                throw new HttpResponseException(new HttpResponseMessage() { Content = new StringContent(string.Format(message,param)) });
        }

        public static dynamic GetEditUrls(string controller,object extend=null)
        {
            var expando = (IDictionary<string, object>)new ExpandoObject();
            expando["getdetail"] =  string.Format("/api/mms/{0}/getdetail/",controller);
            expando["getmaster"] =  string.Format("/api/mms/{0}/geteditmaster/",controller);
            expando["edit"] =  string.Format("/api/mms/{0}/edit/",controller);
            expando["audit"] =  string.Format("/api/mms/{0}/audit/",controller);
            expando["getrowid"] =  string.Format("/api/mms/{0}/getnewrowid/",controller);
            expando["report"] = controller;
 
            if (extend!=null)
                EachHelper.EachObjectProperty(extend, (i, name, value) => { expando[name] = value; });

            return expando;
        }

        public static dynamic GetEditResx(string billName, object extend = null)
        {
            var expando = (IDictionary<string, object>)new ExpandoObject();
            expando["rejected"] = "已撤消修改!";
            expando["editSuccess"] = "保存成功!";
            expando["auditPassed"] ="单据已通过审核!";
            expando["auditReject"] = "单据已取消审核!";
 
后面还有 36 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。