Exemplo n.º 1
0
        public void SaveLogin(LoginModule login)
        {
            string sql = string.Format(@"DELETE  APP_LOGIN_CONFIG;INSERT INTO [APP_LOGIN_CONFIG]
           (
            [CREATEDATE]
           ,[CREATEUSER]
           ,[WXLOGIN]
           ,[WXID]
           ,[WXAGENTID]
           ,[WXSECRET]
           ,[DDLOGIN]
           ,[DDID]
           ,[DDAGENTID]
           ,[DDSECRET]
           ,[OLOGIN], [DDCORPID],[WXLINKSQL],[DDLINKSQL])
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}')", DateTime.Now.ToString(), YZAuthHelper.LoginUserAccount, login.WxLogin, login.WxId, login.WxAgentId, login.WxSecret, login.DdLogin, login.DdId, login.DdAgentId, login.DdSecret, login.OLogin, login.DdCorpId, login.WxLinkSql, login.DdLinkSql);

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 2
0
        public void AddMFavorite(string resID)
        {
            string sql = "select * from  YZSysFavorites where uid='" + YZAuthHelper.LoginUserAccount + "' and resid='" + resID + "' and resType='App'";

            if (!DBUtil_APP.Exists(sql))
            {
                string sql3       = "select max(ORDERINDEX) from  YZSysFavorites where uid='" + YZAuthHelper.LoginUserAccount + "'  and resType='App'";
                int    ORDERINDEX = Convert.ToInt32(DBUtil_APP.GetSingle(sql3)) + 1;
                string sql2       = string.Format(@"INSERT INTO [YZSysFavorites]
           (
            [UID]
           ,[RESTYPE]
           ,[RESID]
           ,[DATE]
           ,[COMMENTS]
           ,[ORDERINDEX]
           )
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}')", YZAuthHelper.LoginUserAccount, "App", resID, DateTime.Now.ToString(), "", ORDERINDEX);
                DBUtil_APP.ExecuteSqlWithGoUseTran(sql2);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取应用数据
        /// </summary>
        /// <param name="type">类别</param>
        /// <returns></returns>
        public List <ApplistItem> GetMApplist(string type)
        {
            List <ApplistItem> AP    = new List <ApplistItem>();
            string             sql   = "";
            string             appid = YZApp.App.GetAllAppId("");

            if (string.IsNullOrEmpty(type))
            {
                sql = " select VIEWTYPE,MAX(sort) as SORT from  App_Index where Enable=1 and ID IN (" + appid + @") group by  VIEWTYPE  order by sort";
            }
            else
            {
                sql = " select VIEWTYPE,MAX(sort) as SORT from  App_Index   where    Enable=1 and ID IN (" + appid + @")  and ViewType='" + type + "'  group by  VIEWTYPE  order by sort";
            }
            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string      GroupName = Convert.ToString(dt.Rows[i][0]);
                ApplistItem apl       = new ApplistItem();
                apl.GroupName = GroupName;
                List <AppItem> atl  = new List <AppItem>();
                string         sql2 = " select AppName,AppUrl,Badge,Icon,IconColor,IconSize,Type,ID  from  App_Index  where     Enable=1  and ID IN (" + appid + @") and VIEWTYPE='" + GroupName + "'  order by sort";
                DataTable      dt2  = DBUtil_APP.Query(sql2).Tables[0];
                for (int j = 0; j < dt2.Rows.Count; j++)
                {
                    AppItem at = new AppItem();
                    at.AppName = Convert.ToString(dt2.Rows[j][0]);      //应用名称
                    at.AppUrl  = Convert.ToString(dt2.Rows[j][1]);      //应用路径

                    string Badgesql = Convert.ToString(dt2.Rows[j][2]); //角标sql
                    if (Badgesql == "0" || Badgesql == "")
                    {
                        at.Badge = 0;
                    }
                    else
                    {
                        SqlParameter[] paras = new SqlParameter[]
                        { new SqlParameter("@Account", YZAuthHelper.LoginUserAccount) };
                        at.Badge = Convert.ToInt32(DBUtil_APP.GetSingle(Badgesql, paras));
                    }
                    at.Icon      = Convert.ToString(dt2.Rows[j][3]); //图标名称
                    at.IconColor = Convert.ToString(dt2.Rows[j][4]); //图标颜色
                    at.IconSize  = Convert.ToString(dt2.Rows[j][5]); //图标大小
                    at.Type      = Convert.ToString(dt2.Rows[j][6]); //图标类别
                    at.Json      = Convert.ToString(DBUtil_APP.GetSingle("select  JSON from  APP_APPINFO  where PID='" + Convert.ToString(dt2.Rows[j][7]) + "'"));
                    atl.Add(at);
                }
                apl.App = atl;
                AP.Add(apl);
            }
            return(AP);
        }
Exemplo n.º 4
0
 /// <summary>
 ///获取父级ID
 /// </summary>
 /// <returns></returns>
 public static string GETParentID(string id)
 {
     if (id == "1")
     {
         return("1");
     }
     else
     {
         string sql = @"select  DDID from APP_ORGSYNC_DEPTBPM2DD WHERE OUID='" + id + "';";
         return(Convert.ToString(DBUtil_APP.GetSingle(sql)));
     }
 }
Exemplo n.º 5
0
        public PushNoticeModule LoadNotice()
        {
            string sql = "select * from  APP_NOTICE_CONFIG  ";

            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(YZApp.DataTableToModel.ToSingleModel <PushNoticeModule>(dt));
            }
            else
            {
                return(new PushNoticeModule());
            }
        }
Exemplo n.º 6
0
        public LoginModule LoadLogin()
        {
            string sql = "select * from  APP_LOGIN_CONFIG  ";

            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(YZApp.DataTableToModel.ToSingleModel <LoginModule>(dt));
            }
            else
            {
                return(new LoginModule());
            }
        }
Exemplo n.º 7
0
        public OrgSyncInfoModule LoadOrgSyncConfig()
        {
            string sql = "select * from  APP_ORGSYNC ";

            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            if (dt.Rows.Count > 0)
            {
                return(YZApp.DataTableToModel.ToSingleModel <OrgSyncInfoModule>(dt));
            }
            else
            {
                return(new OrgSyncInfoModule());
            }
        }
Exemplo n.º 8
0
        public void SaveAppInfo(AppInfoModule aim)
        {
            string sql = @"DELETE  APP_APPINFO WHERE PID='" + aim.PID + @"';INSERT INTO APP_APPINFO
           ([UID]
           ,[PID]
           ,[CREATEDATE]
           ,[JSON])
     VALUES
           ('" + aim.UID + @"'
           ,'" + aim.PID + @"'
           ,'" + aim.CREATEDATE + @"'
           ,'" + aim.JSON + "')";

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 9
0
        public static string GetAllAppId(string sid)
        {
            string appid = "";

            if (string.IsNullOrEmpty(sid))
            {
                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpen();
                    object[]  groups = OrgManager.GetGroups(cn, YZAuthHelper.LoginUserAccount);
                    ArrayList al     = (ArrayList)JSON.Decode(JsonConvert.SerializeObject(groups));
                    for (int i = 0; i < al.Count; i++)
                    {
                        Hashtable ht   = (Hashtable)al[i];
                        string    sids = Convert.ToString(ht["SID"]);

                        DataTable dt = DBUtil_APP.Query("select APPID from  APP_APPAUTH where sid=" + sids + "").Tables[0];
                        for (int j = 0; j < dt.Rows.Count; j++)
                        {
                            appid += "'" + dt.Rows[j][0] + "',";
                        }
                    }
                    DataTable dtt = DBUtil_APP.Query("select APPID from  APP_APPAUTH where sid='S_GS_90674E5E-AC3C-4032-9EDF-7477F2247542'").Tables[0];
                    for (int j = 0; j < dtt.Rows.Count; j++)
                    {
                        appid += "'" + dtt.Rows[j][0] + "',";
                    }
                }
            }
            else
            {
                DataTable dt = DBUtil_APP.Query("select APPID from  APP_APPAUTH where sid=" + sid + "").Tables[0];
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    appid += "'" + dt.Rows[j][0] + "',";
                }
            }
            if (!string.IsNullOrEmpty(appid))
            {
                return(appid.Trim(','));
            }
            else
            {
                return("'-1'");
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 读取应用
        /// </summary>
        /// <param name="type">类别</param>
        public List <AppModule> GetApplist(string type)
        {
            string sql = "";

            if (string.IsNullOrEmpty(type))
            {
                sql = "select * from  App_Index  order by  sort";
            }
            else
            {
                sql = "select * from  App_Index  where ViewType='" + type + "' order by sort";
            }

            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            return(YZApp.DataTableToModel.ToListModel <AppModule>(dt));
        }
Exemplo n.º 11
0
    /// <summary>
    /// 获取部门数据源
    /// </summary>
    /// <param name="ParentOUID">根目录</param>
    /// <returns></returns>
    public static DataTable OUData()
    {
        DataTable dt = new DataTable();

        try
        {
            string SQL = System.Web.HttpUtility.HtmlDecode(m.WxOuSql);

            dt = DBUtil_APP.Query(SQL).Tables[0];
        }
        catch (Exception ex)
        {
            Res("获取部门数据源失败," + ex.Message);
        }

        return(dt);
    }
Exemplo n.º 12
0
        public List <SearchAppModule> SearchMApplist(string kwd)
        {
            string sql   = "";
            string appid = YZApp.App.GetAllAppId("");

            if (string.IsNullOrEmpty(kwd))
            {
                sql = @"select *,case   when resID is not null then 'true' else 'false' end as Favorited from App_Index  A LEFT JOIN YZSysFavorites  B  ON A.AppName=B.resID  and resType='App' and uid='" + YZAuthHelper.LoginUserAccount + @"'
                          LEFT JOIN  APP_APPINFO C ON A.ID=C.PID     where    Enable=1  and A.ID IN (" + appid + @")  and AppName is not null  ORDER BY a.Sort";
            }
            else
            {
                sql = @"select *,case   when resID is not null then 'true' else 'false' end as Favorited from App_Index  A LEFT JOIN YZSysFavorites  B  ON A.AppName=B.resID  and resType='App' and uid='" + YZAuthHelper.LoginUserAccount + @"'
                          LEFT JOIN  APP_APPINFO C ON A.ID=C.PID    where  AppName like '%" + kwd + @"%' and  Enable=1  and A.ID IN (" + appid + @")   and AppName is not null  ORDER BY a.Sort";
            }
            DataTable dt = DBUtil_APP.Query(sql).Tables[0];

            return(YZApp.DataTableToModel.ToListModel <SearchAppModule>(dt));
        }
Exemplo n.º 13
0
        public List <AppModule> GetMFavorite()
        {
            string    appid = YZApp.App.GetAllAppId("");
            string    sql   = "select * from YZSysFavorites  A LEFT JOIN  App_Index  B  ON A.resID=B.AppName   LEFT JOIN  APP_APPINFO C ON B.ID=C.PID where  Enable=1 and B.ID IN (" + appid + @")   and  resType='App'   and  a.uid='" + YZAuthHelper.LoginUserAccount + "' and AppName is not null  ORDER BY orderIndex";
            DataTable dt    = DBUtil_APP.Query(sql).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                int    Badge    = 0;
                string Badgesql = Convert.ToString(dt.Rows[i]["BADGE"]);//角标sql
                if (Badgesql != "0" && Badgesql != "")
                {
                    SqlParameter[] paras = new SqlParameter[]
                    { new SqlParameter("@Account", YZAuthHelper.LoginUserAccount) };
                    Badge = Convert.ToInt32(DBUtil_APP.GetSingle(Badgesql, paras));
                }
                dt.Rows[i]["BADGE"] = Badge;
            }
            return(YZApp.DataTableToModel.ToListModel <AppModule>(dt));
        }
Exemplo n.º 14
0
        public AppInfoModule LoadAppInfo(string pid)
        {
            string sql = @"select * from   APP_APPINFO where PID='" + pid + "' ";

            if (DBUtil_APP.Exists("select count(*) from   APP_APPINFO where PID='" + pid + "' "))
            {
                DataTable dt = DBUtil_APP.Query(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    return(YZApp.DataTableToModel.ToSingleModel <AppInfoModule>(dt));
                }
                else
                {
                    return(new AppInfoModule());
                }
            }
            else
            {
                return(new AppInfoModule());
            }
        }
Exemplo n.º 15
0
        public virtual JObject DingTalkLogin(HttpContext context)
        {
            YZRequest request   = new YZRequest(context);
            string    code      = request.GetString("code");
            string    corpId    = request.GetString("corpId");
            string    appSecret = request.GetString("appSecret");
            string    lang      = request.GetString("lang", "zh-chs");

            string accesstoken    = DingTalkManager.Instance.GetAccessToken(corpId, appSecret);
            string uid            = DingTalkManager.Instance.TryGetUserIdFromCode(accesstoken, code);
            string regularAccount = null;
            string linsql         = "";

            using (IYZAppAdminProvider applogin = IYZAppAdminProviderManager.DefaultProvider)
            {
                YZAppAdmin.LoginModule lm = applogin.LoadLogin();
                linsql = lm.DdLinkSql;
            }
            if (!string.IsNullOrEmpty(linsql))
            {
                string sql = string.Format(linsql, uid);
                uid = Convert.ToString(DBUtil_APP.GetSingle(sql));
            }
            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpenAnonymous();
                if (!User.IsAccountExist(cn, uid, ref regularAccount))
                {
                    throw new Exception(String.Format("当前钉钉登录用户{0},不是有效的BPM账号!", uid));
                }

                YZAuthHelper.SetAuthCookie(regularAccount);
            }

            YZAuthHelper.SetLangSession(YZCultureInfoParse.Parse(lang, YZCultureInfoParse.DefauleCultureInfo).LCID);

            JObject rv = this.GenLoginResult(regularAccount, false);

            return(rv);
        }
Exemplo n.º 16
0
        public void SaveOrgSyncConfig(OrgSyncInfoModule OrgSync)
        {
            string sql = string.Format(@"DELETE  APP_ORGSYNC;INSERT INTO [APP_ORGSYNC]
           (
            [WXCORPID]
           ,[WXSECRET]
           ,[DDCORPID]
           ,[DDSECRET]
,[DDOUSQL]
,[DDUSERSQL]
,[WXOUSQL]
,[WXUSERSQL]
          )
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}','{4}','{5}','{6}','{7}'
           )", OrgSync.WxCorpId, OrgSync.WxSecret, OrgSync.DdCorpId, OrgSync.DdSecret, System.Web.HttpUtility.HtmlEncode(OrgSync.DdOuSql), System.Web.HttpUtility.HtmlEncode(OrgSync.DdUserSql), System.Web.HttpUtility.HtmlEncode(OrgSync.WxOuSql), System.Web.HttpUtility.HtmlEncode(OrgSync.WxUserSql));

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 17
0
        public void SaveNotice(PushNoticeModule Notice)
        {
            string sql = string.Format(@"DELETE  APP_NOTICE_CONFIG;INSERT INTO [APP_NOTICE_CONFIG]
           ([CREATEDATE]
           ,[CREATEUSER]
           ,[WXID]
           ,[WXAGENTID]
           ,[WXSECRET]
           ,[WXPUSHURL]
           ,[DDID]
           ,[DDAGENTID]
           ,[DDSECRET],[DDPUSHURL],[WXLINKSQL],[DDLINKSQL])
     VALUES
           ('{0}'
           ,'{1}'
           ,'{2}'
           ,'{3}'
           ,'{4}'
           ,'{5}','{6}','{7}','{8}','{9}','{10}','{11}')", DateTime.Now.ToString(), YZAuthHelper.LoginUserAccount, Notice.WxId, Notice.WxAgentid, Notice.WxSecret, Notice.WxPushUrl, Notice.DdId, Notice.DdAgentid, Notice.DdSecret, Notice.DdPushUrl, Notice.WxLinkSql, Notice.DdLinkSql);

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 18
0
      /// <summary>
      /// 新增编辑应用
      /// </summary>
      /// <param name="id"></param>
      public void SaveApp(AppModule app)
      {
          if (app.Id == 0)
          {
              string sql = string.Format(@"INSERT INTO  App_Index
         ([CreateDate]
         ,[CreateUser]
         ,[AppName]
         ,[Icon]
         ,[IconColor]
         ,[IconSize]
         ,[AppUrl]
         ,[Enable]
         ,[Sort]
         ,[TYPE]
         ,[ViewType]
         ,[BADGE])
          VALUES
         ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}')", DateTime.Now.ToString(), YZAuthHelper.LoginUserAccount, app.AppName, app.Icon, app.IconColor, app.IconSize, app.AppUrl, app.Enable, app.Sort, app.Type, app.ViewType, app.BADGE);
              DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
          }
          else
          {
              string sql = string.Format(@"UPDATE App_Index
 SET [CreateDate] = '{0}'
    ,[CreateUser] ='{1}'
    ,[AppName] = '{2}'
    ,[Icon] = '{3}'
    ,[IconColor] = '{4}'
    ,[IconSize] ='{5}'
    ,[AppUrl] = '{6}'
    ,[Enable] = '{7}'
    ,[Sort] = '{8}'
    ,[TYPE] = '{9}'
    ,[ViewType]='{10}',[BADGE]='{11}' where id='{12}'", DateTime.Now.ToString(), YZAuthHelper.LoginUserAccount, app.AppName, app.Icon, app.IconColor, app.IconSize, app.AppUrl, app.Enable, app.Sort, app.Type, app.ViewType, app.BADGE, app.Id);
              DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
          }
      }
Exemplo n.º 19
0
        /// <summary>
        /// 删除部门中间表
        /// </summary>
        /// <returns></returns>
        public static void DELETEBPM2DD(long id)
        {
            string sql = @"DELETE APP_ORGSYNC_DEPTBPM2DD WHERE DDID='" + id + "';";

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 更新部门中间表
        /// </summary>
        /// <returns></returns>
        public static void BPM2DD(int id, long ddid)
        {
            string sql = @"DELETE APP_ORGSYNC_DEPTBPM2DD WHERE OUID='" + id + "'; INSERT APP_ORGSYNC_DEPTBPM2DD values('" + id + "','" + ddid + "','" + DateTime.Now.ToString() + "')";

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 获取部门数据源
        /// </summary>
        /// <returns></returns>
        public static DataTable GetDepData()
        {
            string sql = DeptSQL;

            return(DBUtil_APP.Query(sql).Tables[0]);
        }
Exemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string code   = this.Request.Params["code"];
        string app    = this.Request.Params["app"];
        string linsql = "";

        using (IYZAppAdminProvider applogin = IYZAppAdminProviderManager.DefaultProvider)
        {
            YZAppAdmin.LoginModule lm = applogin.LoadLogin();
            if (lm.WxLogin != "1")
            {
                this.Response.Clear();
                this.Response.Write("<script>alert('未开启微信登陆')</script>");
                return;
            }
            wechat.corpId  = lm.WxId;
            wechat.agentId = lm.WxAgentId;
            wechat.secret  = lm.WxSecret;
            linsql         = lm.WxLinkSql;
        }
        if (String.IsNullOrEmpty(app))
        {
            app = "main";
        }

        if (String.IsNullOrEmpty(code))
        {
            YZUrlBuilder uri = new YZUrlBuilder("https://open.weixin.qq.com/connect/oauth2/authorize");
            uri.QueryString["appid"]         = wechat.corpId;
            uri.QueryString["response_type"] = "code";
            uri.QueryString["redirect_uri"]  = this.Request.Url.ToString();
            uri.QueryString["scope"]         = "SCOPE";
            uri.QueryString["state"]         = "STATE#wechat_redirect";

            this.Response.Redirect(uri.ToString());
        }
        else
        {
            try
            {
                JObject jApp        = jApps[app] as JObject;
                string  accesstoken = WeChatManager.Instance.GetAccessToken(wechat.corpId, wechat.secret);
                string  userid      = WeChatManager.Instance.TryGetUserIdFromCode(accesstoken, code);
                string  ticket      = WeChatManager.Instance.GetJSapiTicket(accesstoken);
                string  timeStamp   = WeChatManager.Instance.GetTimeStamp();
                string  nonceStr    = YZSecurityHelper.SecurityKey;
                string  url         = this.Request.Url.ToString();
                string  signature   = WeChatManager.Instance.GenSigurate(nonceStr, timeStamp, ticket, url);

                if (String.IsNullOrEmpty(userid))
                {
                    throw new Exception("非企业号用户!");
                }

                if (!string.IsNullOrEmpty(linsql))
                {
                    string sql = string.Format(linsql, userid);
                    userid = Convert.ToString(DBUtil_APP.GetSingle(sql));
                }

                using (BPMConnection cn = new BPMConnection())
                {
                    cn.WebOpenAnonymous();
                    string regularAccount = null;
                    if (!BPM.Client.User.IsAccountExist(cn, userid, ref regularAccount))
                    {
                        throw new Exception(String.Format("当前企业号登录用户{0},不是有效的BPM账号!", userid));
                    }

                    YZAuthHelper.SetAuthCookie(regularAccount);

                    this.Title = (string)jApp["title"];

                    JObject jAppResult = new JObject();
                    jAppResult["app"]       = app;
                    jAppResult["agentId"]   = wechat.agentId;
                    jAppResult["secret"]    = wechat.secret;
                    jAppResult["title"]     = jApp["title"];
                    jAppResult["corpId"]    = corpId;
                    jAppResult["timeStamp"] = timeStamp;
                    jAppResult["nonceStr"]  = nonceStr;
                    jAppResult["signature"] = signature;
                    jAppResult["jsApiList"] = jApp["jsApiList"];
                    jAppResult["xclass"]    = jApp["xclass"];
                    JObject jConfig = jApp["config"] == null ? new JObject() : JObject.FromObject(jApp["config"]);
                    jAppResult["config"] = jConfig;
                    foreach (string key in this.Request.QueryString.Keys)
                    {
                        jConfig[key] = this.Request.QueryString[key];
                    }

                    this._litApp.Text = jAppResult.ToString(Formatting.Indented, YZJsonHelper.Converters);
                }
            }
            catch (Exception exp)
            {
                if (exp.Message.Contains("query?e=40029"))
                {
                    YZUrlBuilder uri = new YZUrlBuilder("https://open.weixin.qq.com/connect/oauth2/authorize");
                    uri.QueryString["appid"]         = wechat.corpId;
                    uri.QueryString["response_type"] = "code";
                    string url   = this.Request.Url.ToString();
                    int    code2 = url.IndexOf("code");
                    url = url.Substring(0, code2 - 1);
                    uri.QueryString["redirect_uri"] = url;
                    uri.QueryString["scope"]        = "SCOPE";
                    uri.QueryString["state"]        = "STATE#wechat_redirect";
                    this.Response.Redirect(uri.ToString());
                }
                else
                {
                    this.Response.Redirect("~/YZSoft/assist/AspxError/default.aspx?err=" + HttpUtility.UrlEncode(exp.Message));
                }
            }
        }
    }
Exemplo n.º 23
0
        public void DeleteMFavorite(string resID)
        {
            string sql = "delete   YZSysFavorites   where resID='" + resID + "' and   resType='App'  and  uid='" + YZAuthHelper.LoginUserAccount + "' ";

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }
Exemplo n.º 24
0
        /// <summary>
        /// 获取人员数据源
        /// </summary>
        /// <returns></returns>
        public static DataTable GetUserData()
        {
            string sql = UserSQL;

            return(DBUtil_APP.Query(sql).Tables[0]);
        }
Exemplo n.º 25
0
        public void Send(string address, string title, string message, JToken jtExtra, NotifyAttachmentCollection attachments)
        {
            try
            {
                string       path        = "Server.config";
                XmlDocument  xmlDocument = new XmlDocument();
                MemoryStream inStream    = new MemoryStream(File.ReadAllBytes(path));
                xmlDocument.Load(inStream);
                XmlNode xmlNode          = xmlDocument.SelectSingleNode("//database");
                string  innerText        = xmlNode.SelectSingleNode("Server").InnerText;
                string  innerText2       = xmlNode.SelectSingleNode("Database").InnerText;
                string  innerText3       = xmlNode.SelectSingleNode("Uid").InnerText;
                string  innerText4       = xmlNode.SelectSingleNode("Password").InnerText;
                string  connectionString = string.Format("Data Source={0};Initial Catalog={1};User ID={2};Password={3}", new object[]
                {
                    innerText,
                    innerText2,
                    innerText3,
                    innerText4
                });
                DBUtil_APP.connectionString = connectionString;

                string    sql = "Select DDID,DDAGENTID,DDSECRET,DDPUSHURL,DDLINKSQL from  APP_NOTICE_CONFIG";
                DataTable dt  = DBUtil_APP.Query(sql).Tables[0];
                if (dt.Rows.Count == 0)
                {
                    throw new Exception("钉钉推送参数为空!");
                }
                string CropId  = Convert.ToString(dt.Rows[0][0]);
                string Secret  = Convert.ToString(dt.Rows[0][2]);
                string AgentId = Convert.ToString(dt.Rows[0][1]);
                //string EMIPSiteUrl = Convert.ToString(dt.Rows[0][3]);
                string    accessToken = DingTalkManager.Instance.GetAccessToken(CropId, Secret);
                WebClient webClient   = new WebClient();
                webClient.Encoding = Encoding.UTF8;
                webClient.Headers.Add(HttpRequestHeader.ContentType, "application/json");
                webClient.Headers.Add(HttpRequestHeader.KeepAlive, "false");
                UrlBuilder urlBuilder = new UrlBuilder("https://oapi.dingtalk.com/message/send");
                urlBuilder.QueryString["access_token"] = accessToken;
                JObject jObject = jtExtra as JObject;
                object  o;
                string  DDLINKSQL = Convert.ToString(dt.Rows[0][4]);
                if (!string.IsNullOrEmpty(DDLINKSQL))
                {
                    string sql2 = string.Format(DDLINKSQL, address);
                    address = Convert.ToString(DBUtil_APP.GetSingle(sql2));
                }

                if (string.IsNullOrEmpty(Server.EMIPSiteUrl) || jObject == null)
                {
                    o = new
                    {
                        touser  = address,
                        toparty = "",
                        agentid = AgentId,
                        msgtype = "text",
                        text    = new
                        {
                            content = (title + "\n" + message).Replace("<br/>", "\n")
                        }
                    };
                }
                else
                {
                    if (string.IsNullOrEmpty(title))
                    {
                        throw new Exception("title不能为null、不能为空字符串");
                    }
                    if (string.IsNullOrEmpty(message))
                    {
                        throw new Exception("message不能为null、不能为空字符串");
                    }
                    if (string.IsNullOrEmpty(Server.EMIPSiteUrl))
                    {
                        throw new BPMException(BPMExceptionType.MissEMIPSiteUrlSetting, new object[0]);
                    }
                    UrlBuilder urlBuilder2 = new UrlBuilder(Server.EMIPSiteUrl + "dingtalk.aspx");
                    string     a           = (string)jObject["Type"];
                    if (!(a == "Task.Process"))
                    {
                        if (a == "Task.Read")
                        {
                            urlBuilder2.QueryString["app"] = "openTask";
                            urlBuilder2.QueryString["tid"] = ((int)jObject["TaskID"]).ToString();
                        }
                    }
                    else
                    {
                        urlBuilder2.QueryString["app"] = "process";
                        urlBuilder2.QueryString["pid"] = ((int)jObject["StepID"]).ToString();
                    }
                    o = new
                    {
                        touser      = address,
                        toparty     = "",
                        totag       = "",
                        msgtype     = "action_card",
                        agentid     = AgentId,
                        action_card = new
                        {
                            title        = title,
                            markdown     = "### " + title + "  \n" + message.Replace("<br/>", "  \n"),
                            single_title = "查看详情",
                            single_url   = urlBuilder2.ToString()
                        }
                    };
                }
                JObject jObject2 = JObject.FromObject(o);
                byte[]  bytes    = webClient.UploadData(urlBuilder.ToString(), "POST", Encoding.UTF8.GetBytes(jObject2.ToString()));
                JObject jObject3 = JObject.Parse(Encoding.UTF8.GetString(bytes));
                if ((int)jObject3["errcode"] != 0)
                {
                    throw new Exception((string)jObject3["errmsg"]);
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// 删除应用
        /// </summary>
        /// <param name="id"></param>
        public void DeleteApp(int id)
        {
            string sql = "delete  App_Index  where  id='" + id + "'";

            DBUtil_APP.ExecuteSqlWithGoUseTran(sql);
        }