コード例 #1
0
 /// <summary>
 /// 获取BizObject显示页面
 /// </summary>
 /// <param name="Mode"></param>
 /// <param name="SchemaCode"></param>
 /// <param name="BizObjectID"></param>
 /// <param name="SheetCode"></param>
 /// <param name="IsMobile"></param>
 /// <returns></returns>
 public static string GetBizObjectUrl(SheetMode Mode, string SchemaCode, string BizObjectID, string SheetCode, bool IsMobile)
 {
     return(System.IO.Path.Combine(PortalRootForUrl, "EditBizObject.aspx").Replace('\\', '/') + "?" +
            "SchemaCode=" + SchemaCode + "&" +
            "Mode=" + Mode.ToString() + "&" +
            "BizObjectID=" + BizObjectID + "&" +
            "SheetCode=" + SheetCode + "&" +
            "IsMobile=" + IsMobile);
 }
コード例 #2
0
        public string GetViewSheetUrl(
            WorkItem.WorkItem WorkItem,
            BizSheet Sheet,
            SheetMode SheetMode,
            bool IsMobile)
        {
            string baseUrl = GetSheetBaseUrl(SheetMode.View, IsMobile, Sheet);

            baseUrl += SheetEnviroment.Param_Mode + "=" + SheetMode + "&";
            baseUrl += SheetEnviroment.Param_WorkItemID + "=" + WorkItem.WorkItemID + "&";
            return(baseUrl);
        }
コード例 #3
0
        public DrawingSheetView()
        {
            InitializeComponent();
            initializeGLControl();

            DrawingSheetStreamViewModel.Get(this);
            DrawingSheetAvatarViewModel.Get(this);
            sheet            = DrawingSheetAvatarViewModel.Get(this);
            this.DataContext = sheet;
            MyImage.Source   = sheet.getImage();
            this.mode        = SheetMode.AvatarMode;
            ChangeMode(SheetMode.StreamMode);
            ChangeMode(SheetMode.AvatarMode);
            instance = this;
        }
        public JsonResult EditBizObjectSheet(string BizObjectID, string SchemaCode, string SheetCode, string Mode, bool IsMobile, string EditInstanceData)
        {
            return(ExecuteFunctionRun(() =>
            {
                ActionResult result = new ActionResult(false, "");

                string url = string.Empty;
                SheetMode SheetMode = SheetMode.Work;

                SheetMode = (SheetMode)Enum.Parse(typeof(SheetMode), Mode);
                if (!string.IsNullOrEmpty(EditInstanceData))
                {
                    url = GetWorkSheetUrl(
                        SchemaCode,
                        BizObjectID,
                        SheetMode,
                        IsMobile);
                    url += "&EditInstanceData=true";
                }
                else
                {
                    Sheet.BizSheet sheet = this.Engine.BizSheetManager.GetBizSheetByCode(SheetCode);
                    if (sheet == null)
                    {
                        // 兼容旧版本
                        OThinker.H3.Sheet.BizSheet[] sheets = this.Engine.BizSheetManager.GetBizSheetBySchemaCode(SchemaCode);
                        if (sheets == null || sheets.Length == 0)
                        {
                            throw new Exception("流程包{" + SchemaCode + "}表单不存在,请检查。");
                        }
                        sheet = sheets[0];
                    }
                    url = GetWorkSheetUrl(
                        SchemaCode,
                        BizObjectID,
                        sheet,
                        SheetMode,
                        IsMobile);
                }
                result.Message = url;
                result.Success = true;
                return Json(result, JsonRequestBehavior.AllowGet);
            }));
        }
コード例 #5
0
        public string GetSheetBaseUrl(SheetMode SheetMode, bool IsMobile, BizSheet Sheet)
        {
            string baseUrl = null;

            switch (Sheet.SheetType)
            {
            case SheetType.None:
                baseUrl = null;
                break;

            case SheetType.DefaultSheet:
                baseUrl = this.GetDefaultSheetUrl(Sheet, IsMobile);
                break;

            case SheetType.CustomSheet:
                string sheetUrl = GetWorkItemSheet(IsMobile, SheetMode, Sheet.MobileSheetAddress, Sheet.SheetAddress, Sheet.PrintSheetAddress);
                if (sheetUrl.LastIndexOf("?") == -1)
                {
                    // url的形式应该是http://.../page1.aspx
                    baseUrl = sheetUrl + "?";
                }
                else if (sheetUrl.LastIndexOf("?") == sheetUrl.Length - 1 ||
                         sheetUrl.LastIndexOf("&") == sheetUrl.Length - 1)
                {
                    // url的形式应该是http://.../page1.aspx?
                    // url的形式应该是http://.../page1.aspx?param1=value1&
                    baseUrl = sheetUrl;
                }
                else
                {
                    // url的形式应该是http://.../page1.aspx?param1=value1
                    baseUrl = sheetUrl + "&";
                }
                break;

            default:
                throw new NotImplementedException();
            }
            return(baseUrl);
        }
コード例 #6
0
 /// <summary>
 /// 获取任务打开的表单URL
 /// </summary>
 /// <param name="IsMobile"></param>
 /// <param name="SheetMode"></param>
 /// <param name="MobileSheetUrl"></param>
 /// <param name="PCSheetUrl"></param>
 /// <param name="PrintSheetUrl"></param>
 /// <returns></returns>
 public string GetWorkItemSheet(bool IsMobile, SheetMode SheetMode, string MobileSheetUrl, string PCSheetUrl, string PrintSheetUrl)
 {
     if (SheetMode == SheetMode.Print)
     {
         return(PrintSheetUrl);
     }
     if (IsMobile)
     {
         if (!string.IsNullOrEmpty(MobileSheetUrl))
         {
             return(MobileSheetUrl + "?" + Param_IsMobile + "=" + true);
         }
         else
         {
             return(PCSheetUrl + "?" + Param_IsMobile + "=" + true);
         }
     }
     else
     {
         return(PCSheetUrl + "?");
     }
 }
コード例 #7
0
        /// <summary>
        /// Change the view according to the selected mode
        /// </summary>
        /// <param name="mode"></param>
        public void ChangeMode(SheetMode mode)
        {
            switch (mode)
            {
            case SheetMode.AvatarMode:
                this.Show3DSheet();
                sheet          = DrawingSheetAvatarViewModel.Get(this);
                MyImage.Source = sheet.getImage();
                this.mode      = SheetMode.AvatarMode;
                break;

            case SheetMode.StreamMode:
                this.Show2DSheet();
                sheet          = DrawingSheetStreamViewModel.Get(this);
                MyImage.Source = sheet.getImage();
                this.mode      = SheetMode.StreamMode;
                break;

            default:
                //TODO
                break;
            }
            this.DataContext = sheet;
        }
コード例 #8
0
        /// <summary>
        /// 获取当前任务表单打开模式
        /// </summary>
        public SheetMode GetSheetMode(string strMode, string WorkItemID)
        {
            SheetMode SheetMode = SheetMode.Unspecified;

            OThinker.H3.WorkItem.WorkItem CurrentWorkItem = this.GetCurrentWorkItem(WorkItemID);

            if (strMode.Trim() != string.Empty)
            {
                SheetMode = (SheetMode)Enum.Parse(typeof(SheetMode), strMode);
            }
            else if (CurrentWorkItem.State == WorkItem.WorkItemState.Finished || CurrentWorkItem.State == WorkItem.WorkItemState.Canceled)
            {
                SheetMode = SheetMode.View;
            }
            else
            {
                SheetMode = SheetMode.Work;
            }
            if (SheetMode == SheetMode.Work && (CurrentWorkItem.State == WorkItem.WorkItemState.Finished || CurrentWorkItem.State == WorkItem.WorkItemState.Canceled))
            {
                SheetMode = SheetMode.View;
            }
            return(SheetMode);
        }
コード例 #9
0
        /// <summary>
        /// 验证权限
        /// </summary>
        /// <param name="UserValidator"></param>
        /// <param name="SheetDataType"></param>
        /// <param name="IsOriginateMode"></param>
        /// <param name="SchemaCode"></param>
        /// <param name="BizObject"></param>
        /// <param name="SheetMode"></param>
        /// <param name="WorkflowCode"></param>
        /// <param name="WorkItem"></param>
        /// <param name="InstanceContext"></param>
        /// <returns></returns>
        public static bool ValidateAuthorization(
            UserValidator UserValidator,
            SheetDataType SheetDataType,
            bool IsOriginateMode,
            string SchemaCode,
            DataModel.BizObject BizObject,
            SheetMode SheetMode,
            string WorkflowCode,
            WorkItem.WorkItem WorkItem,
            WorkItem.CirculateItem CirculateItem,
            Instance.InstanceContext InstanceContext)
        {
            if (UserValidator.ValidateAdministrator())
            {
                return(true);
            }
            // 业务对象表单
            else if (SheetDataType == SheetDataType.BizObject)
            {
                if (IsOriginateMode)
                {
                    return(UserValidator.ValidateBizObjectAdd(SchemaCode, null, UserValidator.UserID));
                }
                else
                {
                    if (UserValidator.ValidateOrgAdmin(BizObject.OwnerId))
                    {
                        return(true);
                    }
                    return(UserValidator.ValidateBizObjectAdmin(SchemaCode, null, BizObject.OwnerId));
                }
            }
            else
            {
                switch (SheetMode)
                {
                case SheetMode.Originate:
                    return(UserValidator.ValidateCreateInstance(WorkflowCode));

                case SheetMode.View:
                case SheetMode.Print:
                    if (WorkItem != null &&
                        ValidateWorkItemAuth(WorkItem, UserValidator, UserValidator.Engine.AgencyManager))
                    {
                        return(true);
                    }
                    else if (CirculateItem != null && ValidateCirculateItemAuth(CirculateItem, UserValidator))
                    {
                        return(true);
                    }
                    else if (UserValidator.ValidateWFInsView(WorkflowCode, InstanceContext.Originator))
                    {
                        // 是否允许查看这个流程模板的所有实例
                        return(true);
                    }
                    else
                    {
                        // 判定用户是否参与过流程实例
                        string[] workItems = UserValidator.Engine.Query.QueryWorkItems(
                            new string[] { InstanceContext.InstanceId },
                            new string[] { UserValidator.UserID },
                            DateTime.Now.AddYears(-100),
                            DateTime.Now.AddDays(1),
                            H3.WorkItem.WorkItemState.Unspecified,
                            OThinker.H3.WorkItem.WorkItem.NullWorkItemID);
                        if (workItems != null && workItems.Length > 0)
                        {
                            return(true);
                        }
                        return(false);
                    }

                case SheetMode.Work:
                    if (WorkItem != null)
                    {
                        return(ValidateWorkItemAuth(WorkItem, UserValidator, UserValidator.Engine.AgencyManager));
                    }
                    else
                    {
                        return(ValidateCirculateItemAuth(CirculateItem, UserValidator));
                    }

                default:
                    throw new NotImplementedException();
                }
            }
        }
コード例 #10
0
        public JsonResult WorkItemDetail(string paramString)
        {
            return(ExecuteFunctionRun(() =>
            {
                ActionResult result = new ActionResult(false, "");
                Dictionary <string, string> dicParams = JsonConvert.DeserializeObject <Dictionary <string, string> >(paramString);

                string strMode = string.Empty, WorkItemID = string.Empty, strIsMobile = string.Empty,
                state = string.Empty;
                Dictionary <string, string> dicOtherParams = new Dictionary <string, string>();
                //读取URL参数
                foreach (string key in dicParams.Keys)
                {
                    if (key == Param_Mode)
                    {
                        strMode = dicParams[key]; continue;
                    }
                    if (key == Param_WorkItemID)
                    {
                        WorkItemID = dicParams[key]; continue;
                    }
                    if (key == Param_IsMobile)
                    {
                        strIsMobile = dicParams[key]; continue;
                    }
                    if (key == "state")
                    {
                        state = dicParams["state"]; continue;
                    }
                    dicOtherParams.Add(key, dicParams[key]);
                }
                //Work、View。。。
                SheetMode Mode = this.GetSheetMode(strMode, WorkItemID);
                //WorkItem
                WorkItem.WorkItem CurrentWorkItem = this.GetCurrentWorkItem(WorkItemID);
                //获取工作任务的表单对象
                BizSheet WorkItemSheet = this.GetWorkItemSheet(CurrentWorkItem);
                bool IsMobile = this.IsMobile(strIsMobile, state);

                // 解析Url地址
                if (Mode == SheetMode.Work)
                {
                    url = this.GetWorkSheetUrl(CurrentWorkItem, WorkItemSheet, IsMobile);
                }
                else
                {
                    url = this.GetViewSheetUrl(CurrentWorkItem, WorkItemSheet, Mode, IsMobile);
                }
                // 将其中的数据参数做转换
                InstanceData InstanceData = this.GetInstanceData(CurrentWorkItem);
                if (url.Contains(OThinker.H3.Math.Variant.VariablePrefix.ToString()))
                {
                    url = InstanceData.ParseText(url);
                }
                // 处理缓存
                DateTime t = DateTime.Now;
                DateTime.TryParse(InstanceData.BizObject[OThinker.Organization.Unit.PropertyName_ModifiedTime] + string.Empty, out t);
                url += "&T=" + t.ToString("HHmmss") + WorkItemID.Substring(0, 8);
                if (Mode == SheetMode.Print)
                {
                    url += "Print";
                }
                result.Success = true;
                result.Message = url;
                return Json(result);
            }));
        }