Example #1
0
    public string FormatSetValue(object value)
    {
        string rv;

        if (value == null)
        {
            rv = "";
        }
        else
        {
            if (value is DateTime)
            {
                rv = AspxHelper.DateToStringL((DateTime)value);
            }
            else if (value is byte[])
            {
                rv = Convert.ToBase64String((byte[])value);
            }
            else
            {
                //rv = value.ToString().Replace(@"\", @"\\");
                //rv = rv.Replace(@"'", @"\'");
                rv = value.ToString();
                rv = rv.Replace("\n", "<br/>");
            }
        }

        rv = rv.Trim();
        return(rv);
    }
Example #2
0
    private TreeNode CreateNode(OU ou)
    {
        TreeNode node = new TreeNode("&nbsp;" + ou.Name, ou.FullName);

        node.Value = ou.FullName;

        node.SelectAction     = TreeNodeSelectAction.Select;
        node.PopulateOnDemand = true;

        string mapvalue;

        mapvalue  = "OUName=" + ou.Name + ";";
        mapvalue += "OUFullName=" + ou.FullName + ";";
        mapvalue += "OULevel=" + ou.OULevel + ";";
        mapvalue += "OUCode=" + ou.Code + ";";

        foreach (string attrName in ou.ExtAttrNames)
        {
            object extValue = ou[attrName];
            if (extValue is DateTime)
            {
                extValue = AspxHelper.DateToString((DateTime)extValue);
            }

            mapvalue += attrName + "=" + extValue + ";";
        }

        node.NavigateUrl = String.Format("javascript:SetOwnerBtnValue({0},'{1}');",
                                         Request.QueryString["idx"],
                                         mapvalue);

        return(node);
    }
Example #3
0
    public static BPMTaskListCollection FilterTaskList(BPMTaskListCollection srcTasks, string processName, string keyword)
    {
        if (String.IsNullOrEmpty(processName) &&
            String.IsNullOrEmpty(keyword))
        {
            return(srcTasks);
        }

        BPMTaskListCollection tasks = new BPMTaskListCollection();

        foreach (BPMTaskListItem item in srcTasks)
        {
            if (!String.IsNullOrEmpty(processName))
            {
                if (!NameCompare.EquName(item.ProcessName, processName))
                {
                    continue;
                }
            }

            if (!String.IsNullOrEmpty(keyword))
            {
                if (!String.IsNullOrEmpty(item.SerialNum) && item.SerialNum.Contains(keyword))
                {
                    tasks.Add(item);
                    continue;
                }

                if (!String.IsNullOrEmpty(item.OwnerAccount) && item.OwnerAccount.Contains(keyword))
                {
                    tasks.Add(item);
                    continue;
                }

                if (!String.IsNullOrEmpty(item.Description) && item.Description.Contains(keyword))
                {
                    tasks.Add(item);
                    continue;
                }

                if (!String.IsNullOrEmpty(item.ProcessName) && item.ProcessName.Contains(keyword))
                {
                    tasks.Add(item);
                    continue;
                }

                if (AspxHelper.IsNumber(keyword) && item.TaskID.ToString() == keyword)
                {
                    tasks.Add(item);
                    continue;
                }
            }
            else
            {
                tasks.Add(item);
            }
        }

        return(tasks);
    }
Example #4
0
    public string FormatValue(object value)
    {
        string rv;

        if (value == null)
        {
            rv = "-";
        }
        else
        {
            if (value is DateTime)
            {
                rv = AspxHelper.DateToStringL((DateTime)value);
            }
            else if (value is byte[])
            {
                rv = HttpUtility.HtmlEncode("<binary data>");
            }
            else
            {
                rv = value.ToString();
            }
        }

        rv = rv.Trim();
        if (String.IsNullOrEmpty(rv))
        {
            return("-");
        }

        return(rv);
    }
Example #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!AspxHelper.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
        }

        int tid = Int32.Parse(this.Request["tid"]);

        string formFile;

        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen(this.Page);

            string token = Request.QueryString["token"];
            if (String.IsNullOrEmpty(token))
            {
                if (!SecurityManager.CheckTaskAccessPermision(cn, tid, BPMPermision.TaskRead, cn.UID))
                {
                    throw new BPMException(BPMExceptionType.PermDeniedReadForm);
                }
            }
            else
            {
                if (!AspxHelper.CheckTaskAccessToken(tid, token) &&
                    !SecurityManager.CheckTaskAccessPermision(cn, tid, BPMPermision.TaskRead, cn.UID))
                {
                    throw new BPMException(BPMExceptionType.PermDeniedReadForm);
                }
            }

            formFile = BPMProcess.GetDefaultReadForm(cn, tid);
        }

        if (String.IsNullOrEmpty(formFile))
        {
            throw new Exception(Resources.BPMResource.Read_MissForm);
        }
        else
        {
            if (formFile.IndexOf('?') != -1)
            {
                this.Server.Transfer(this.ResolveClientUrl("../XForm/") + formFile + "&" + this.Request.QueryString.ToString(), false);
            }
            else
            {
                this.Server.Transfer(this.ResolveClientUrl("../XForm/") + formFile + "?" + this.Request.QueryString.ToString(), false);
            }

            this.Response.End();
        }
    }
Example #6
0
        public void WriteASCXDeclaration_writesattributes()
        {
            //arrange
            var ascxSrc = "~/Controls/SampleControl.ascx";
            var name    = "SampleControl";

            var attributes = new string[] { "Property1=Value", "Property2=Value2" };

            //act
            var output = AspxHelper.WriteASCXDeclaration(ascxSrc, attributes);

            //assert
            Assert.Pass();
        }
Example #7
0
        public void WriteASCXDeclaration_emptyarray_attributes_works()
        {
            //arrange
            var ascxSrc = "~/Controls/SampleControl.ascx";
            var name    = "SampleControl";

            string[] attributes = new string[0];

            //act
            var output = AspxHelper.WriteASCXDeclaration(ascxSrc, attributes);

            //assert
            Assert.Pass();
        }
Example #8
0
        public void WriteASCXDeclaration_gets_name()
        {
            //arrange
            var ascxSrc = "~/Controls/SampleControl.ascx";
            var name    = "SampleControl";

            //act
            var output = AspxHelper.WriteASCXDeclaration(ascxSrc);

            var registername = Regex.Match(output, @"Name=""([A-Z0-9]*)""", RegexOptions.IgnoreCase);
            var controlname  = Regex.Match(output, @"\<ctl\:([A-Z0-9]*)", RegexOptions.IgnoreCase);

            //assert
            Assert.That(name, Is.EqualTo(registername.Groups[1].Value));
            Assert.That(name, Is.EqualTo(controlname.Groups[1].Value));
        }
Example #9
0
 public TableCell CreateCell(DateTime date, int span)
 {
     return(CreateCell(AspxHelper.DateToStringL(date), span));
 }