Ejemplo n.º 1
0
Archivo: Form.cs Proyecto: radtek/EMIP
        public virtual JObject GetFormStateInfo(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    app       = request.GetString("app");
            string    key       = request.GetString("key", null);
            string    formstate = request.GetString("formstate", null);

            FormApplication formApplication;
            FormState       formState;

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

                formApplication = FormApplication.Open(cn, app);
                formState       = FormService.GetFormStateBasicInfo(cn, app, formstate);
            }

            JObject rv = new JObject();

            rv[YZJsonProperty.success] = true;
            rv["appShortName"]         = formApplication.Name;
            rv["formstate"]            = formState.Name;
            rv["token"]           = YZSecurityHelper.GenFormApplicationToken(app, key, formState.Name);
            rv["showSaveButton"]  = formState.ShowSaveButton;
            rv["validationGroup"] = formState.ValidationGroup;
            rv["url"]             = YZUtility.GetFormRedirectUrl(formApplication.Form).ToString();
            return(rv);
        }
Ejemplo n.º 2
0
Archivo: Form.cs Proyecto: radtek/EMIP
        public virtual JObject GetTaskReadInfo(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       taskid     = request.GetInt32("tid");
            string    permisions = request.GetString("Permisions", null);

            BPMTask task;
            string  formFile;
            JObject perm;

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

                task     = BPMTask.Load(cn, taskid);
                formFile = BPMProcess.GetTaskReadForm(cn, taskid);
                perm     = this.CheckPermision(cn, taskid, -1, permisions);
            }

            JObject rv = new JObject();

            rv[YZJsonProperty.success] = true;
            rv["sn"]        = task.SerialNum;
            rv["url"]       = YZUtility.GetFormRedirectUrl(formFile).ToString();
            rv["urlParams"] = task.UrlParams;
            rv["perm"]      = perm;

            return(rv);
        }
Ejemplo n.º 3
0
        public virtual JObject GetXClassSchema(HttpContext context)
        {
            YZRequest     request     = new YZRequest(context);
            String        xclass      = request.GetString("xclass", null);
            FlowDataSet   dataset     = new FlowDataSet();
            FlowDataTable table       = new FlowDataTable();
            FlowDataTable tableFilter = new FlowDataTable();

            dataset.Tables.Add(table);

            if (!String.IsNullOrEmpty(xclass))
            {
                string url     = YZUtility.GetUrlFromXClass(xclass);
                string phyPath = context.Server.MapPath(url);
                using (StreamReader rd = new StreamReader(phyPath))
                {
                    string jsText      = rd.ReadToEnd();
                    string dataColumns = this.GetProperty(jsText, "datasourceColumns", '[', ']');
                    if (!String.IsNullOrEmpty(dataColumns))
                    {
                        JArray jDataColumns = JArray.Parse(dataColumns);
                        foreach (JToken token in jDataColumns)
                        {
                            if (token.Type == JTokenType.String)
                            {
                                FlowDataColumn column = new FlowDataColumn((string)token, typeof(string));
                                table.Columns.Add(column);
                            }
                        }
                    }
                }
            }

            return(YZJsonHelper.SerializeSchema(dataset, "", "DataType"));
        }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!YZAuthHelper.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
            return;
        }

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

        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();
            formFile = BPMProcess.GetDefaultReadForm(cn, tid);
        }

        if (String.IsNullOrEmpty(formFile))
        {
            throw new Exception(Resources.YZStrings.Aspx_Read_MissForm);
        }
        else
        {
            YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, formFile);
            this.Response.Redirect(urlBuilder.ToString(), true);
        }
    }
Ejemplo n.º 5
0
        protected static object HtmlEncode(string fieldXClass, object value)
        {
            if (value is string)
            {
                return(YZUtility.HtmlEncode((string)value));
            }

            return(Default(fieldXClass, value));
        }
Ejemplo n.º 6
0
        public virtual object Process(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            int       stepid  = request.GetInt32("StepID");
            string    uid     = request.GetString("uid", YZAuthHelper.LoginUserAccount); //共享任务uid为空,会导致重定向到登录页面,产生异常

            using (BPMConnection cn = new BPMConnection())
            {
                string orguid = YZAuthHelper.LoginUserAccount;
                YZAuthHelper.SetAuthCookie(uid);
                try
                {
                    cn.WebOpen();
                }
                finally
                {
                    YZAuthHelper.SetAuthCookie(orguid);
                }

                ProcessInfo processInfo = BPMProcess.GetProcessInfo(cn, stepid);
                if (processInfo.Links.Count == 0)
                {
                    throw new BPMException(BPMExceptionType.MissOutLink, processInfo.NodeName);
                }

                string postXml = @"{0}
                    <XForm>
                        <Header>
                            <Method>Process</Method>
                            <PID>{1}</PID>
                            <Action>{2}</Action>
                            <Comment></Comment>
                        </Header>
                        <FormData>
                        </FormData>
                    </XForm>";

                postXml = String.Format(postXml,
                                        "<?xml version=\"1.0\"?>",
                                        stepid,
                                        YZUtility.EncodeXMLInnerText(processInfo.Links[0].DisplayString));

                using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml)))
                {
                    PostResult postResult = BPMProcess.Post(cn, postStream);

                    return(new
                    {
                        success = true,
                        result = (postResult.PostResultType == PostResultType.TaskFinishedApproved || postResult.PostResultType == PostResultType.TaskFinishedRejected) ? "finished" : "running"
                    });
                }
            }
        }
Ejemplo n.º 7
0
    public static string ConvertToXmlValue(object value)
    {
        string strValue;

        if (value == null)
        {
            strValue = String.Empty;
        }
        else
        {
            if (value is DateTime)
            {
                strValue = ((DateTime)value).ToString("yyyy-MM-dd HH:mm:ss");
            }
            else if (value is byte[])
            {
                strValue = Convert.ToBase64String((byte[])value);
            }
            else if (value is JsonItemCollection)
            {
                StringBuilder sb = new StringBuilder();
                sb.AppendLine();
                foreach (JsonItem item in (value as JsonItemCollection))
                {
                    item.AppendToXmlString(sb);
                }
                strValue = sb.ToString();
            }
            else if (value is JsonItem)
            {
                StringBuilder sb = new StringBuilder();
                (value as JsonItem).AppendToXmlString(sb);
                strValue = sb.ToString();
            }
            else
            {
                strValue = Convert.ToString(value);
                strValue = YZUtility.EncodeXMLInnerText(strValue);
            }
        }

        return(strValue);
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!YZAuthHelper.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
        }

        string          appName         = this.Request.QueryString["app"];
        FormApplication formApplication = null;

        using (BPMConnection cn = new BPMConnection())
        {
            cn.WebOpen();
            formApplication = FormApplication.Load(cn, appName);
        }

        string       formFile   = formApplication.Form;
        YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, formFile);

        urlBuilder.QueryString["md"] = "App";
        this.Response.Redirect(urlBuilder.ToString(), true);
    }
Ejemplo n.º 9
0
Archivo: Form.cs Proyecto: radtek/EMIP
        public virtual JObject GetProcessInfo(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            int       stepid     = request.GetInt32("pid");
            string    permisions = request.GetString("Permisions", null);

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

                BPMProcStep step        = BPMProcStep.Load(cn, stepid);
                BPMTask     task        = BPMTask.Load(cn, step.TaskID);
                ProcessInfo processInfo = BPMProcess.GetProcessInfo(cn, stepid);

                //检查处理权
                if (!step.Share || !String.IsNullOrEmpty(step.OwnerAccount)) //常规任务及已获取的共享任务
                {
                    if (!NameCompare.EquName(step.OwnerAccount, cn.UID) &&
                        !NameCompare.EquName(step.AgentAccount, cn.UID))
                    {
                        throw new BPMException(BPMExceptionType.ProcessErrPermDenied);
                    }
                }

                //获得ProcessSubModel
                ProcessSubModel subModel;
                if (step.Share && String.IsNullOrEmpty(step.OwnerAccount))
                {
                    subModel = ProcessSubModel.Share;
                }
                else
                {
                    if (processInfo.StepProcessPermision == StepProcessPermision.Inform)
                    {
                        subModel = ProcessSubModel.Inform;
                    }
                    else if (processInfo.StepProcessPermision == StepProcessPermision.Indicate)
                    {
                        subModel = ProcessSubModel.Indicate;
                    }
                    else
                    {
                        subModel = ProcessSubModel.Process;
                    }
                }

                //ProcessSubModel.Process - 则获得任务操作权限
                JObject perm = null;
                if (subModel == ProcessSubModel.Process ||
                    subModel == ProcessSubModel.Inform ||
                    subModel == ProcessSubModel.Indicate)
                {
                    perm = this.CheckPermision(cn, step.TaskID, stepid, permisions);
                }
                else
                {
                    perm = new JObject();
                }

                if (String.IsNullOrEmpty(processInfo.FormFile))
                {
                    throw new Exception(String.Format(Resources.YZStrings.Aspx_Process_MissForm, step.NodeName));
                }

                JObject rv = new JObject();
                rv[YZJsonProperty.success] = true;
                rv["uid"]      = cn.UID;
                rv["subModel"] = subModel.ToString();

                rv["sn"]             = task.SerialNum;
                rv["taskid"]         = task.TaskID;
                rv["urlParams"]      = task.UrlParams;
                rv["url"]            = YZUtility.GetFormRedirectUrl(processInfo.FormFile).ToString();
                rv["NodePermisions"] = this.Serialize(processInfo.NodePermision);
                rv["Comments"]       = step.Comments;
                rv["perm"]           = perm;

                if (subModel == ProcessSubModel.Process)
                {
                    rv["shareTask"] = step.Share;
                    rv["IsConsign"] = step.IsConsignStep;

                    JArray links = new JArray();
                    rv["links"] = links;
                    foreach (Link link in processInfo.Links)
                    {
                        links.Add(this.Serialize(link, "normal"));
                    }

                    rv["directsend"] = this.GetDirectSendInfo(cn, step, processInfo.SystemLinks);

                    //自由流
                    if (!step.IsConsignStep) //加签不显示自由流
                    {
                        rv["ParticipantDeclares"] = JArray.FromObject(processInfo.ParticipantDeclares);
                        rv["Routing"]             = processInfo.Routing;
                    }
                }

                return(rv);
            }
        }
Ejemplo n.º 10
0
Archivo: Form.cs Proyecto: radtek/EMIP
        public virtual JObject GetPostInfo(HttpContext context)
        {
            YZRequest request       = new YZRequest(context);
            string    processName   = request.GetString("pn", null);
            int       restartTaskID = request.GetInt32("restartTaskID", -1);
            string    owner         = request.GetString("owner", null);
            string    permisions    = request.GetString("Permisions", null);
            string    did           = request.GetString("did", null);

            Version          processVersion = null;
            PostInfo         postInfo;
            JObject          perm;
            BPMDraft         draft        = null;
            JObject          jDraftHeader = null;
            bool             delagation;
            string           selectPosition;
            MemberCollection positions;
            JObject          rv = new JObject();
            PostSubModel     subModel;

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

                if (!String.IsNullOrEmpty(did))
                {
                    draft = new BPMDraft();
                    draft.Open(cn, new Guid(did));
                    processName = draft.ProcessName;

                    if (!String.IsNullOrEmpty(draft.Header))
                    {
                        jDraftHeader = JObject.Parse(draft.Header);
                    }
                }

                if (draft != null)
                {
                    subModel = (PostSubModel)Enum.Parse(typeof(PostSubModel), draft.Type.ToString());
                }
                else
                {
                    subModel = PostSubModel.Post;
                }

                if (restartTaskID == -1)
                {
                    processVersion = cn.GetGlobalObjectLastVersion(StoreZoneType.Process, processName);
                }

                postInfo = BPMProcess.GetPostInfo(cn, processName, processVersion, owner, restartTaskID);
                perm     = this.CheckPermision(postInfo, permisions);

                //获得delagation/selectPosition
                if (draft != null)
                {
                    selectPosition = PositionManager.MemberFullNameFromID(cn, draft.OwnerPositionID);
                    delagation     = !YZStringHelper.EquName(draft.OwnerAccount, cn.UID);
                }
                else
                {
                    if (postInfo.IsPostByAgent)
                    {
                        delagation     = true;
                        selectPosition = owner;
                    }
                    else
                    {
                        delagation     = false;
                        selectPosition = owner;
                    }
                }

                //获得positions
                if (!delagation)
                {
                    positions = OrgSvr.GetUserPositions(cn, cn.UID);
                    if (String.IsNullOrEmpty(selectPosition) && positions.Count != 0)
                    {
                        selectPosition = positions[0].FullName;
                    }
                }
                else
                {
                    Member mb = new Member();
                    mb.Open(cn, selectPosition);
                    positions      = OrgSvr.GetUserPositions(cn, mb.UserAccount);
                    selectPosition = mb.FullName;
                }

                if (String.IsNullOrEmpty(postInfo.FormFile))
                {
                    throw new Exception(Resources.YZStrings.Aspx_Post_MissForm);
                }

                //返回
                rv[YZJsonProperty.success] = true;
                rv["subModel"]             = subModel.ToString();

                //基本信息
                rv["pn"]             = postInfo.ProcessName;
                rv["version"]        = postInfo.ProcessVersion.ToString(2);
                rv["restartTaskID"]  = restartTaskID;
                rv["url"]            = YZUtility.GetFormRedirectUrl(postInfo.FormFile).ToString();
                rv["perm"]           = perm;
                rv["PersistParams"]  = postInfo.PersistParams;
                rv["NodePermisions"] = this.Serialize(postInfo.NodePermision);

                rv["Comments"]    = draft != null ? draft.Comments : null;
                rv["DraftHeader"] = jDraftHeader;

                //处理按钮
                JArray links = new JArray();
                rv["links"] = links;
                foreach (Link link in postInfo.Links)
                {
                    links.Add(this.Serialize(link, "normal"));
                }

                //提交职位
                rv["delagation"]     = delagation;
                rv["selectPosition"] = selectPosition;
                JArray jPoss = new JArray();
                rv["positions"] = jPoss;
                foreach (Member position in positions)
                {
                    JObject jPos = new JObject();
                    jPoss.Add(jPos);

                    string name = position.GetParentOU(cn).Name + "\\" + position.UserAccount;

                    if (position.IsLeader)
                    {
                        name += "(" + position.LeaderTitle + ")";
                    }

                    jPos["name"]  = name;
                    jPos["value"] = position.FullName;
                }

                //自由流
                rv["ParticipantDeclares"] = JArray.FromObject(postInfo.ParticipantDeclares);
            }
            return(rv);
        }
Ejemplo n.º 11
0
        public virtual object Start(HttpContext context)
        {
            YZRequest request        = new YZRequest(context);
            Guid      draftid        = request.GetGuid("draftid", false);
            string    memberfullname = request.GetString("memberfullname");
            string    uid            = request.GetString("uid");

            using (BPMConnection cn = new BPMConnection())
            {
                string orguid = YZAuthHelper.LoginUserAccount;
                YZAuthHelper.SetAuthCookie(uid);
                try
                {
                    cn.WebOpen();
                }
                finally
                {
                    YZAuthHelper.SetAuthCookie(orguid);
                }

                BPMDraft draft = new BPMDraft();
                draft.Open(cn, draftid);

                JObject jDraftHeader = null;
                if (!String.IsNullOrEmpty(draft.Header))
                {
                    jDraftHeader = JObject.Parse(draft.Header);
                }

                PostInfo postInfo = BPMProcess.GetPostInfo(cn, draft.ProcessName, null, memberfullname, -1);
                if (postInfo.Links.Count == 0)
                {
                    throw new BPMException(BPMExceptionType.MissOutLink, postInfo.NodeName);
                }

                string postXml = @"{0}
                    <XForm>
                        <Header>
                            <Method>Post</Method>
                            <ProcessName>{1}</ProcessName>
                            <OwnerMemberFullName>{2}</OwnerMemberFullName>
                            <Action>{3}</Action>
                            <Comment>{4}</Comment>
                            {5}
                        </Header>
                        {6}
                    </XForm>";

                StringBuilder sb = new StringBuilder();
                if (jDraftHeader != null)
                {
                    foreach (KeyValuePair <string, JToken> jProp in jDraftHeader)
                    {
                        string line = String.Format("<{0}>{1}</{0}>", jProp.Key, YZUtility.EncodeXMLInnerText(jProp.Value.ToString()));
                        sb.AppendLine(line);
                    }
                }

                postXml = String.Format(postXml,
                                        "<?xml version=\"1.0\"?>",
                                        YZUtility.EncodeXMLInnerText(draft.ProcessName),
                                        YZUtility.EncodeXMLInnerText(memberfullname),
                                        YZUtility.EncodeXMLInnerText(postInfo.Links[0].DisplayString),
                                        YZUtility.EncodeXMLInnerText(draft.Comments),
                                        sb.ToString(),
                                        draft.xml);

                using (MemoryStream postStream = new MemoryStream(Encoding.UTF8.GetBytes(postXml)))
                {
                    PostResult postResult = BPMProcess.Post(cn, postStream);

                    return(new
                    {
                        success = true,
                        TaskID = postResult.TaskID,
                        SN = postResult.SN
                    });
                }
            }
        }
Ejemplo n.º 12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (String.Compare(System.Web.Configuration.WebConfigurationManager.AppSettings["ShowMaintenancePage"], "true", true) == 0)
        {
            Response.Redirect("~/YZSoft/core/Maintenance/Default.aspx");
        }

        bool   webLogin = String.Compare(WebConfigurationManager.AppSettings["WebLoginEnable"], "false", true) == 0 ? false : true;
        bool   ntLogin  = String.Compare(WebConfigurationManager.AppSettings["NTLoginEnable"], "false", true) == 0 ? false : true;
        string action   = this.Request.Params["action"];

        if (action == "login")
        {
            string   type = this.Request.Params["type"];
            JsonItem rv   = new JsonItem();

            if (type == "NT") //NT登录
            {
                try
                {
                    if (this.NTLogin())
                    {
                        rv[YZJsonProperty.success] = true;
                        rv["text"] = Resources.YZStrings.Aspx_Login_Success;
                    }
                }
                catch (Exception exp)
                {
                    rv[YZJsonProperty.success] = false;
                    rv["text"] = exp.Message;
                }

                if (rv.Attributes.ContainsKey(YZJsonProperty.success))
                {
                    Response.Clear();
                    this.Response.Write(rv.ToString());
                    Response.End();
                }
                else
                {
                    this.Response.Clear();
                    this.Response.Status = "401 Unauthorized";
                    this.Response.AppendHeader("WWW-Authenticate", "NTLM");//Basic, Digest, NTLM, and Negotiate
                    this.Response.End();
                }
            }
            else //BPM 登录
            {
                string userid     = this.Request.Params["uid"];
                string password   = this.Request.Params["pwd"];
                string positionid = this.Request.Params["posid"];

                if (String.IsNullOrEmpty(userid) /*|| String.IsNullOrEmpty(password)*/)
                {
                    rv[YZJsonProperty.success] = false;
                    rv["text"] = Resources.YZStrings.Aspx_Login_EnterAccountTip;
                }
                else if (String.IsNullOrEmpty(positionid))
                {
                    rv[YZJsonProperty.success] = false;
                    rv["text"] = Resources.YZStrings.Aspx_Login_SelPosTip;
                }
                else
                {
                    try
                    {
                        string realAccount;
                        string token;
                        if (BPMConnection.Authenticate(YZAuthHelper.BPMServerName, YZAuthHelper.BPMServerPort, userid, password, out realAccount, out token))
                        {
                            YZAuthHelper.SetAuthCookie(realAccount, token);
                            YZAuthHelper.ClearLogoutFlag();

                            rv[YZJsonProperty.success] = true;
                            rv["text"] = Resources.YZStrings.Aspx_Login_Success;
                        }
                        else
                        {
                            rv[YZJsonProperty.success] = false;
                            rv["text"] = Resources.YZStrings.Aspx_Login_Fail;
                        }
                    }
                    catch (Exception exp)
                    {
                        YZEventLog log = new YZEventLog();
                        log.WriteEntry(exp);

                        rv[YZJsonProperty.success] = false;
                        rv["text"] = exp.Message;
                    }
                }

                Response.Clear();
                Response.Write(rv.ToString());
                Response.End();
            }
        }
        else if (action == "logout")
        {
            YZAuthHelper.SignOut();
            YZAuthHelper.SetLogoutFlag("logout", String.Empty);

            string ssoUrl = System.Configuration.ConfigurationManager.AppSettings["ssoUrl"];
            if (String.IsNullOrEmpty(ssoUrl))
            {
                ssoUrl = "~/"; //ssoUrl = "~/YZSoft/Login/";
            }
            this.Response.Redirect(ssoUrl, true);
        }
        else if (action == "changeuser")
        {
            YZAuthHelper.SignOut();
            YZAuthHelper.SetLogoutFlag("changeuser", YZAuthHelper.LoginUserAccount);
            string ssoUrl = System.Configuration.ConfigurationManager.AppSettings["ssoUrl"];
            if (String.IsNullOrEmpty(ssoUrl))
            {
                ssoUrl = "~/"; //ssoUrl = "~/YZSoft/Login/";
            }
            this.Response.Redirect(ssoUrl, true);
        }
        else
        {
            string ssoUrl = WebConfigurationManager.AppSettings["ssoUrl"];
            if (!String.IsNullOrEmpty(ssoUrl))
            {
                Response.Redirect(ssoUrl, true);
            }

            if (ntLogin && !webLogin) //仅NT登录
            {
                if (YZAuthHelper.BPMLogoutType != "logout" &&
                    YZAuthHelper.BPMLogoutType != "changeuser") //非登出情况下
                {
                    if (this.NTLogin())                         //NT登录成功
                    {
                        if (!String.IsNullOrEmpty(Request.QueryString["ReturnURL"]))
                        {
                            Response.Redirect(Request.QueryString["ReturnURL"]);
                        }
                        else
                        {
                            Response.Redirect("~/");
                        }

                        return;
                    }

                    if (String.IsNullOrEmpty(this.Request.ServerVariables["LOGON_USER"]))
                    {
                        this.Response.Clear();
                        this.Response.Status = "401 Unauthorized";
                        this.Response.AppendHeader("WWW-Authenticate", "NTLM");//Basic, Digest, NTLM, and Negotiate
                        this.Response.End();
                        return;
                    }
                }
            }

            //页标题
            this.Page.Title = System.Web.Configuration.WebConfigurationManager.AppSettings["CompanyInfoLoginPageTitle"];
            if (String.IsNullOrEmpty(this.Page.Title))
            {
                this.Page.Title = Resources.YZStrings.Aspx_Login_Title;
            }

            //根据启动程序应用Css
            string startApp = System.Web.Configuration.WebConfigurationManager.AppSettings["StartApp"];
            if (String.IsNullOrEmpty(startApp))
            {
                startApp = "YZApp";
            }

            this._litLoginCss.Text = String.Format("<link href=\"../../../{0}/Styles/login.css\" rel=\"stylesheet\" type=\"text/css\" />", startApp);

            //显示文字
            this._litBoxCaption.Text    = Resources.YZStrings.Aspx_Login_BoxCaption;
            this._litAccount.Text       = Resources.YZStrings.Aspx_Login_Account;
            this._lnkRegNewAccount.Text = Resources.YZStrings.Aspx_Login_RegNewAccount;
            this._litPwd.Text           = Resources.YZStrings.Aspx_Login_Pwd;
            this._lnkForgotPwd.Text     = Resources.YZStrings.Aspx_Login_ForgotPwd;
            this._btnLogin.Value        = Resources.YZStrings.Aspx_Login_BtnLogin;
            this._btnNTLogin.Value      = Resources.YZStrings.Aspx_Login_BtnNTLogin;

            string[]        strLcids = Resources.YZStrings.All_Languages.Split(new char[] { ',', ';' });
            Type            resType  = typeof(Resources.YZStrings);
            ResourceManager mgr      = new ResourceManager(resType.FullName, resType.Assembly);
            List <String>   langs    = new List <string>();
            foreach (string strLcid in strLcids)
            {
                string resName  = "All_Languages_" + strLcid;
                string langName = mgr.GetString(resName);
                bool   current  = String.Compare(langName, Resources.YZStrings.All_Languages_Cur, 0) == 0;

                langs.Add(String.Format("<a href=\"#\" class=\"yz-login-lang-item {0}\" onclick=\"changeLanguage('{1}');\">{2}</a>", current ? "yz-login-lang-item-selected" : "", strLcid, langName));
            }
            this._litChangeLang.Text = String.Join("<span class=\"yz-login-lang-sp\">|</span>", langs.ToArray());

            //关闭用户注册,忘记密码链接
            //this._lnkRegNewAccount.Enabled = false;
            //this._lnkForgotPwd.Enabled = false;
            this._lnkRegNewAccount.Visible = false;
            this._lnkForgotPwd.Visible     = false;

            this._litStep2Caption.Text = Resources.YZStrings.Aspx_Login_Step2_BoxCaption;
            this._litStep2Msg.Text     = String.Format(Resources.YZStrings.Aspx_Login_Step2_Msg, "<span class=\"point\">●</span>");

            this._litStep1Caption.Text         = Resources.YZStrings.Aspx_Login_Step1_BoxCaption;
            this._litStep1Msg.Text             = Resources.YZStrings.Aspx_Login_Step1_Msg;
            this._litStep1InsCurStep0.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep;
            this._litStep1InsCurStep1.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep;
            this._litStep1InsCurStep2.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep;
            this._litStep1InsCurStep3.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep;
            this._litStep1InsCurStep4.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_CurStep;
            this._litStep1NotInstalled.Text    = Resources.YZStrings.Aspx_Login_Step1_Install_NotInstalled;
            this._litStep1InstallNow.Text      = Resources.YZStrings.Aspx_Login_Step1_Install_InstallNow;
            this._litStep1Installing.Text      = Resources.YZStrings.Aspx_Login_Step1_Install_Installing;
            this._litStep1Installing1.Text     = Resources.YZStrings.Aspx_Login_Step1_Install_Installing;
            this._litStep1PlsWaiting.Text      = Resources.YZStrings.Aspx_Login_Step1_Install_PlsWaiting;
            this._litStep1InstallFinished.Text = Resources.YZStrings.Aspx_Login_Step1_Install_InstallFinished;
            this._litStep1CheckAgain.Text      = Resources.YZStrings.Aspx_Login_Step1_Install_CheckAgain;
            this._litStep1InstallFailed.Text   = Resources.YZStrings.Aspx_Login_Step1_Install_InstallFailed;
            this._litStep1Retry.Text           = Resources.YZStrings.Aspx_Login_Step1_Install_Retry;
            this._litStep1InstallSucceed.Text  = Resources.YZStrings.Aspx_Login_Step1_Install_InstallSucceed;
            this._litStep1LoginContinue.Text   = Resources.YZStrings.Aspx_Login_Step1_Login_Continue;
            this._litStep1Ignore.Text          = Resources.YZStrings.Aspx_Login_Step1_Ignore;

            this._litStep0Caption.Text         = Resources.YZStrings.Aspx_Login_Step0_BoxCaption;
            this._litStep0Msg.Text             = Resources.YZStrings.Aspx_Login_Step0_Msg;
            this._litStep0Skip.Text            = Resources.YZStrings.Aspx_Login_Step0_Skip;
            this._litStep0Skip1.Text           = Resources.YZStrings.Aspx_Login_Step0_Skip;
            this._litStep0DownloadBrowser.Text = Resources.YZStrings.Aspx_Login_Step0_DownloadBrowser;

            this._downloadXP.Text    = Resources.YZStrings.Aspx_Login_Step0_Download;
            this._downloadVista.Text = Resources.YZStrings.Aspx_Login_Step0_Download;
            this._download2003.Text  = Resources.YZStrings.Aspx_Login_Step0_Download;
            this._downloadMore.Text  = Resources.YZStrings.Aspx_Login_Step0_Download_More;

            //JS文字
            JsonItem jsonStrings = new JsonItem();
            jsonStrings.Attributes.Add("Account", YZAuthHelper.LoginUserAccount);
            jsonStrings.Attributes.Add("SelPos", Resources.YZStrings.Aspx_Login_SelPos);
            jsonStrings.Attributes.Add("SelPosTip", Resources.YZStrings.Aspx_Login_SelPosTip);
            jsonStrings.Attributes.Add("EnterAccountTip", Resources.YZStrings.Aspx_Login_EnterAccountTip);
            jsonStrings.Attributes.Add("EnterPwdTip", Resources.YZStrings.Aspx_Login_EnterPwdTip);
            jsonStrings.Attributes.Add("BrowserNameOpera", Resources.YZStrings.Aspx_BrowserNameOpera);
            jsonStrings.Attributes.Add("BrowserNameSafari", Resources.YZStrings.Aspx_BrowserNameSafari);
            jsonStrings.Attributes.Add("BrowserNameGoogle", Resources.YZStrings.Aspx_BrowserNameGoogle);
            jsonStrings.Attributes.Add("BrowserNameFirefox", Resources.YZStrings.Aspx_BrowserNameFirefox);
            jsonStrings.Attributes.Add("BrowserNameOther", Resources.YZStrings.Aspx_BrowserNameOther);
            jsonStrings.Attributes.Add("BrowserWarning", Resources.YZStrings.Aspx_Login_BrowserWarning);
            jsonStrings.Attributes.Add("Unknow", Resources.YZStrings.Aspx_Login_Unknow);
            jsonStrings.Attributes.Add("HttpErr", Resources.YZStrings.Aspx_Login_HttpErr);

            HtmlGenericControl jsstrs = new HtmlGenericControl("script");
            jsstrs.Attributes["type"] = "text/javascript";
            jsstrs.InnerHtml          = String.Format("var Strings = {0}", jsonStrings.ToString());
            this.Page.Header.Controls.AddAt(1, jsstrs);

            //地图信息
            JArray factorys;
            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    factorys = provider.GetFactorys(cn);
                }
            }

            string returnUrl = String.Empty;
            if (!String.IsNullOrEmpty(Request.QueryString["ReturnURL"]))
            {
                returnUrl = this.ResolveClientUrl(Request.QueryString["ReturnURL"]);
            }
            else
            {
                returnUrl = this.ResolveClientUrl("~/");
            }

            HtmlGenericControl js = new HtmlGenericControl("script");
            js.Attributes["type"] = "text/javascript";
            js.InnerHtml          = "var _FactoryData=" + factorys.ToString() + ";\n" +
                                    "var returnUrl=\"" + YZUtility.EncodeJsString(returnUrl) + "\";";

            this.Page.Header.Controls.AddAt(1, js);

            if (!webLogin)
            {
                this._txtUserId.Enabled        = false;
                this._txtPassword.Enabled      = false;
                this._txtUserId.CssClass       = "input input-disabled";
                this._txtPassword.CssClass     = "input input-disabled";
                this._lnkRegNewAccount.Enabled = false;
                this._lnkForgotPwd.Enabled     = false;
                this._btnLogin.Disabled        = true;
            }
            if (!ntLogin)
            {
                this._btnNTLogin.Disabled = true;
            }
        }
    }
Ejemplo n.º 13
0
        protected virtual JObject GenFieldItem(Model model, FlowDataTable table, FlowDataRow row, FlowDataColumn column, FlowDataColumn setting)
        {
            object  value = row[column.ColumnName];
            JObject field = new JObject();
            string  valuePropertyName;
            string  xclass = setting.MapTo;

            switch (xclass)
            {
            case "Ext.field.Field":
                valuePropertyName = "html";
                break;

            case "YZSoft.src.field.Users":
                valuePropertyName = "stringValue";
                break;

            default:
                valuePropertyName = "value";
                break;
            }

            value = this.DoRender(setting.SParam1, xclass, value);

            if (valuePropertyName == "html" && value is string)
            {
                value = YZUtility.HtmlEncodeBR((string)value);
            }

            field["xclass"]          = xclass;
            field["label"]           = setting.DisplayName;
            field[valuePropertyName] = new JValue(value);

            if (!table.IsRepeatableTable)
            {
                if (setting.AllowWrite || model == Model.Post)
                {
                    field["xdatabind"] = column.FullName;
                }
                else
                {
                    field["readOnly"] = true;
                }
            }
            else
            {
                field["readOnly"] = true;
            }

            JObject config = setting.FilterValue as JObject;

            if (config != null)
            {
                foreach (KeyValuePair <string, JToken> kv in config)
                {
                    field[kv.Key] = kv.Value;
                }
            }

            return(field);
        }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!YZAuthHelper.IsAuthenticated)
        {
            string token = this.Request.QueryString["Token"];
            if (!String.IsNullOrEmpty(token))
            {
                using (SqlConnection cn = new SqlConnection())
                {
                    cn.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["BPMDB"].ConnectionString;
                    cn.Open();

                    using (SqlCommand cmd = new SqlCommand())
                    {
                        cmd.Connection  = cn;
                        cmd.CommandText = "SELECT StepID,Account,hash FROM BPMInstProcessToken WHERE Token=@Token";
                        cmd.Parameters.Add("@Token", SqlDbType.NVarChar).Value = token;

                        using (DBReader reader = new DBReader(cmd.ExecuteReader()))
                        {
                            if (reader.Read())
                            {
                                int    stepid      = Int32.Parse(this.Request.QueryString["pid"]);
                                int    stepidSaved = reader.ReadInt32(0);
                                string account     = reader.ReadString(1);
                                string hash        = reader.ReadString(2);

                                if (stepid == stepidSaved)
                                {
                                    List <string> values = new List <string>();
                                    values.Add(token);
                                    values.Add(stepid.ToString());
                                    values.Add(account);

                                    if (YZSecurityHelper.CheckHash(values, hash, YZSecurityHelper.SecurityKey))
                                    {
                                        YZAuthHelper.SetAuthCookie(account);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }

        if (!YZAuthHelper.IsAuthenticated)
        {
            FormsAuthentication.RedirectToLoginPage();
            return;
        }

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

        BPM.Client.ProcessInfo processInfo;

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

            //如果是共享任务,表单打开时直接获取共享任务
            //BPMProcStep step = BPMProcStep.Load(cn,pid);
            //if (step.Share)
            //    BPMProcStep.PickupShareStep(cn, pid);

            processInfo = BPMProcess.GetProcessInfo(cn, pid);
        }

        if (String.IsNullOrEmpty(processInfo.FormFile))
        {
            throw new Exception(Resources.YZStrings.Aspx_Process_MissForm);
        }
        else
        {
            YZUrlBuilder urlBuilder = YZUtility.GetFormRedirectUrl(this.Page, processInfo.FormFile);
            this.Response.Redirect(urlBuilder.ToString(), true);
        }
    }
Ejemplo n.º 15
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this._litMessage.Text = String.Format("<span style=\"font-size:18px\">{0}</span><br/><span style=\"font-size:12px;font-weight:normal;color:#aaa\">{1}<span>",
                                           "无法访问PC网站",
                                           YZUtility.HtmlEncode(Resources.YZMobile.Aspx_BPMSite_SettingError));
 }