Example #1
0
        public static Result ExceptionBill(string BillNo, string userId, string handle)
        {
            Result res = new Result();

            res.ReturnValue = true;
            LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId);

            Service.VerificationHandle(userId, handle, Handle, res);
            if (res.ReturnValue)
            {
                LibDataAccess access = new LibDataAccess();
                try
                {
                    string sql = string.Empty;
                    if (!string.IsNullOrEmpty(Handle.PersonId))
                    {
                        sql             = string.Format(@"SELECT A.BILLNO,
                                                A.PLANENDTIME,
                                                A.ABNORMALREASONID,
                                                B.ABNORMALREASONNAME,
                                                B.ABNORMALREASONTYPEID,
                                                C.ABNORMALREASONTYPENAME,
                                                A.PERSONID,
                                                D.PERSONNAME,
                                                A.DEALWITHPERSONID,
                                                E.PERSONNAME AS DEALWITHPERSONNAME,
                                                E.DEPTID AS DEALWITHDEPTID,
                                                F.DEPTNAME AS DEALWITHDEPTNAME,
                                                A.SOLUTION,
                                                A.DEALWITHSTATE
                                                FROM COMABNORMALTRACE A
                                                LEFT JOIN COMABNORMALREASON B ON B.ABNORMALREASONID=A.ABNORMALREASONID
                                                LEFT JOIN COMABNORMALREASONTYPE C ON C.ABNORMALREASONTYPEID=B.ABNORMALREASONTYPEID
                                                LEFT JOIN COMPERSON D ON D.PERSONID=A.PERSONID
                                                LEFT JOIN COMPERSON E ON E.PERSONID=A.DEALWITHPERSONID
                                                LEFT JOIN COMDEPT F ON F.DEPTID =E.DEPTID
                                                WHERE A.FROMBILLNO={0}", BillNo);
                        res.Info        = access.ExecuteDataSet(sql);
                        res.ReturnValue = true;
                        res.Message     = "成功!";
                    }
                    else
                    {
                        res.ReturnValue = false;
                        res.Message     = "请重新登录!";
                    }
                }
                catch (Exception ex)
                {
                    res.ReturnValue = false;
                    res.Message     = "查询失败!" + ex.Message;
                }
            }
            return(res);
        }
Example #2
0
        public DataSet GetMyNews(string userId, string password)
        {
            SystemService server = new SystemService();
            LibDataAccess access = new LibDataAccess();
            string        sql    = string.Format("SELECT count(*) FROM AXPUSER  WHERE USERID ='{0}' AND USERPASSWORD ='******'", userId, password);
            int           count  = LibSysUtils.ToInt32(access.ExecuteScalar(sql));

            if (count > 0)
            {
                sql = string.Format("SELECT  NEWSID ,USERID ,TITLE ,MAINCONTENT ,INFOID ,A.CREATETIME ,PERSONID ,ISREAD ,EXECTASKDATAID ,B.CREATETIME ,PROGID ,RESULTDATA FROM AXPUSERNEWS A LEFT JOIN AXAEXECTASKDATA B ON A.INFOID = B.EXECTASKDATAID WHERE A.USERID = {0} AND A.ISREAD = 0", LibStringBuilder.GetQuotString(userId));

                return(access.ExecuteDataSet(sql));
            }
            else
            {
                return(new DataSet());
            }
        }
Example #3
0
        public static Result GetDept()
        {
            Result        res    = new Result();
            LibDataAccess access = new LibDataAccess();

            res.ReturnValue = true;
            res.Message     = "OK";
            try
            {
                string sql = string.Format("SELECT DEPTID,DEPTNAME FROM COMDEPT");
                res.Info = access.ExecuteDataSet(sql);
            }
            catch (Exception ex)
            {
                res.ReturnValue = false;
                res.Message     = "查询失败!" + ex.Message;
            }
            return(res);
        }
Example #4
0
        public static Result ExceptionTrackBillNo(string BillNo, string userId, string handle)
        {
            Result res = new Result();

            res.ReturnValue = true;
            LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId);

            Service.VerificationHandle(userId, handle, Handle, res);
            if (res.ReturnValue)
            {
                LibDataAccess access = new LibDataAccess();
                try
                {
                    string sql = string.Empty;
                    if (!string.IsNullOrEmpty(Handle.PersonId))
                    {
                        sql             = string.Format(@"SELECT DISTINCT A.BILLNO,A.BILLDATE,D.ABNORMALTYPENAME, A.FROMPERSONID,C.PERSONNAME AS FROMPERSONNAME,C.PHONENO AS FROMPHONENO,A.ABNORMALDESC FROM COMABNORMALREPORT A 
                    LEFT JOIN COMABNORMALREPORTTYPEFLOW B ON B.TYPEID = A.TYPEID 
                    LEFT JOIN COMPERSON C ON C.PERSONID=A.FROMPERSONID 
                    LEFT JOIN COMABNORMALTYPE D ON D.ABNORMALTYPEID=A.ABNORMALTYPEID  
                    WHERE A.TRANSMITLEVEL = B.TRANSMITLEVEL AND B.PERSONID = {0} AND A.BILLNO ={1}", LibStringBuilder.GetQuotString(Handle.PersonId), LibStringBuilder.GetQuotString(BillNo));
                        res.Info        = access.ExecuteDataSet(sql);
                        res.ReturnValue = true;
                        res.Message     = "成功!";
                    }
                    else
                    {
                        res.ReturnValue = false;
                        res.Message     = "请重新登录!";
                    }
                }
                catch (Exception ex)
                {
                    res.ReturnValue = false;
                    res.Message     = "查询失败!" + ex.Message;
                }
            }
            return(res);
        }
Example #5
0
        public int GetUserCount()
        {
            int countUser = 1;

            AxCRL.Data.SqlBuilder.SqlBuilder builder = new AxCRL.Data.SqlBuilder.SqlBuilder("axp.User");
            string sql = builder.GetQuerySql(0, "A.USERID,A.PERSONID,A.PERSONNAME,A.ROLEID,A.WALLPAPER,A.WALLPAPERSTRETCH",
                                             string.Format("A.ISUSE={0}", 1));
            LibDataAccess dataAccess = new LibDataAccess();

            System.Data.DataTable tbUser = dataAccess.ExecuteDataSet(sql).Tables[0];

            IEnumerator <string>      enumerator = _Default.GetKeys();
            Dictionary <string, bool> dicUser    = new Dictionary <string, bool>();

            while (enumerator.MoveNext())
            {
                LibHandle handle = this.Get <LibHandle>(enumerator.Current);
                if (handle != null)
                {
                    if (!String.IsNullOrWhiteSpace(handle.UserId))
                    {
                        dicUser[handle.UserId] = true;
                    }
                }
            }

            foreach (KeyValuePair <string, bool> kvp in dicUser)
            {
                foreach (System.Data.DataRow dr in tbUser.Rows)
                {
                    if (kvp.Key.Equals(dr["USERID"].ToString(), StringComparison.CurrentCultureIgnoreCase))
                    {
                        ++countUser;
                    }
                }
            }
            return(countUser);
        }
Example #6
0
        /// <summary>
        /// 获取异常消息
        /// </summary>
        /// <param name="userId">帐号</param>
        /// <param name="handle">句柄</param>
        /// <param name="info">分页参数</param>
        /// <returns></returns>
        public static Result GetAbnormalReport(string userId, string handle, PageModel info)
        {
            Result res = new Result();

            res.ReturnValue = true;
            LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId);

            Service.VerificationHandle(userId, handle, Handle, res);
            if (res.ReturnValue)
            {
                LibDataAccess access = new LibDataAccess();
                try
                {
                    string sql = string.Empty;
                    if (!string.IsNullOrEmpty(Handle.PersonId))
                    {
                        StringBuilder builder = new StringBuilder();
                        if (info.queryField != null)
                        {
                            switch (info.queryField[0].QueryChar)
                            {
                            case LibQueryChar.Equal:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, "=", info.queryField[0].Value[0]);
                                break;

                            case LibQueryChar.Region:
                                builder.AppendFormat("AND {0}{1}{2} AND {3}{4}{5}", info.queryField[0].Name, ">=", info.queryField[0].Value[0], info.queryField[0].Name, "<=", info.queryField[0].Value[1]);
                                break;

                            case LibQueryChar.GreaterOrEqual:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, ">=", info.queryField[0].Value[0]);
                                break;

                            case LibQueryChar.LessOrEqual:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, "<=", info.queryField[0].Value[0]);
                                break;

                            case LibQueryChar.GreaterThan:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, ">", info.queryField[0].Value[0]);
                                break;

                            case LibQueryChar.LessThan:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, "<", info.queryField[0].Value[0]);
                                break;

                            case LibQueryChar.UnequalTo:
                                builder.AppendFormat("AND {0}{1}{2}", info.queryField[0].Name, "<>", info.queryField[0].Value[0]);
                                break;
                            }
                        }
                        //StringBuilder buildString = new StringBuilder();
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        int beginNum = 0, endNum = 0;
                        sql = string.Format("SELECT COUNT(*) FROM COMABNORMALREPORT A LEFT JOIN COMABNORMALREPORTTYPEFLOW B ON B.TYPEID = A.TYPEID  WHERE A.TRANSMITLEVEL = B.TRANSMITLEVEL AND B.PERSONID = '{0}' AND (SELECT COUNT(BILLNO) FROM COMABNORMALTRACE C WHERE C.FROMBILLNO=A.BILLNO )={1} {2}", Handle.PersonId, LibSysUtils.ToInt32(info.SelectCondition), builder);
                        int totalCount    = LibSysUtils.ToInt32(access.ExecuteScalar(sql));
                        int pageCount     = 0;
                        if (totalCount / info.PageSize == 0)
                        {
                            pageCount = totalCount / info.PageSize;
                        }
                        else
                        {
                            pageCount = totalCount / info.PageSize + 1;
                        }
                        endNum   = info.PageNo * info.PageSize;
                        beginNum = (info.PageNo - 1) * info.PageSize + 1;
                        DatabaseProviderFactory factory = new DatabaseProviderFactory(ConfigurationSourceFactory.Create());
                        Database dataBase = factory.Create("DefaultConnection");
                        if (dataBase.GetType().Name == "OracleDatabase")
                        {
                            sql = string.Empty;
                            sql = string.Format(@" SELECT DISTINCT  A.BILLNO,
                                                              A.BILLDATE,
                                                              D.ABNORMALTYPENAME,
                                                              A.FROMPERSONID,
                                                              C.PERSONNAME AS FROMPERSONNAME,
                                                              C.PHONENO AS FROMPHONENO,
                                                              A.ABNORMALDESC
                                                              FROM 
                                                              (
                                                              SELECT E.*,ROWNUM RN 
                                                              FROM (SELECT * FROM COMABNORMALREPORT F LEFT JOIN COMABNORMALREPORTTYPEFLOW B ON B.TYPEID = F.TYPEID  WHERE B.PERSONID={2} AND F.TRANSMITLEVEL = B.TRANSMITLEVEL AND (SELECT COUNT(BILLNO) FROM COMABNORMALTRACE A WHERE A.FROMBILLNO=F.BILLNO )={3}) E 
                                                              WHERE ROWNUM <= {1} ) A 
                                                             LEFT JOIN COMPERSON C ON C.PERSONID=A.FROMPERSONID 
                                                             LEFT JOIN COMABNORMALTYPE D ON D.ABNORMALTYPEID=A.ABNORMALTYPEID  
                                                             WHERE  RN>={0} {4}", beginNum, endNum, Handle.PersonId, LibSysUtils.ToInt32(info.SelectCondition), builder);
                        }
                        else
                        {
                            sql = string.Empty;
                            sql = string.Format("");
                        }
                        res.Info = access.ExecuteDataSet(sql);
                        //res.Info = access.ExecuteStoredProcedureReturnDataSet("GETABNORMALREPORT", ref dic, beginNum, endNum, Handle.PersonId, LibSysUtils.ToInt32(info.SelectCondition), builder);
                        res.pageModel.PageNo     = info.PageNo;
                        res.pageModel.PageSize   = info.PageSize;
                        res.pageModel.PageCount  = pageCount;
                        res.pageModel.TotalCount = totalCount;
                        res.ReturnValue          = true;
                    }
                    else
                    {
                        res.ReturnValue = false;
                        res.Message     = "请重新登录!";
                    }
                }
                catch (Exception ex)
                {
                    res.ReturnValue = false;
                    res.Message     = "查询失败!" + ex.Message;
                }
            }
            return(res);
        }
Example #7
0
        /// <summary>
        /// 为目录编号列表,获取各个目录对应的所属目录列表(从顶级目录到自身目录)
        /// </summary>
        /// <param name="dirIds">目录编号列表</param>
        /// <returns></returns>
        public static Dictionary <string, List <string> > GetDirIdsForDirs(List <string> dirIds)
        {
            if (dirIds == null || dirIds.Count == 0)
            {
                return(null);
            }

            List <string> newList = (from item in dirIds
                                     select string.Format("'{0}'", item)).ToList();
            string dirIdsQueryStr = string.Join(",", newList);

            Dictionary <string, List <string> > dicDirId_DirIds = new Dictionary <string, List <string> >();
            //构造递归查询语句。
            //从本级目录开始到顶级目录。第一行为本级目录(DirID标识的目录),最后一行为顶级目录(父目录为空)
            string        sqlFindParent = "";
            string        tempTableName = string.Format("{0}_{1}", "temp", DateTime.Now.Ticks);
            LibDataAccess dataAccess    = new LibDataAccess();

            if (dataAccess.DatabaseType == LibDatabaseType.SqlServer)
            {
                sqlFindParent = " with " + tempTableName + " as  " +
                                "   ( " +
                                "   select a.DIRID as SEARCHDIRID,a.DIRID,a.DIRNAME,a.PARENTDIRID,a.DIRPATH  from DMDIRECTORY a  " +
                                "   where a.DIRID in  (" + dirIdsQueryStr + ") " +
                                "   union all " +
                                "   select t.SEARCHDIRID,k.DIRID,k.DIRNAME,k.PARENTDIRID,k.DIRPATH from DMDIRECTORY k inner " +
                                "                               join " + tempTableName + " t on t.PARENTDIRID = k.DIRID " +
                                "   ) select * from " + tempTableName +
                                "   order by SEARCHDIRID";
            }
            else
            {
                //Oracle的递归查询待测试
                //To DO
                sqlFindParent = "select CONNECT_BY_ROOT(DIRID) as SEARCHDIRID,DIRID,DIRNAME,PARENTDIRID,DIRPATH " +
                                " from DMDIRECTORY START WITH DIRID in (" + dirIdsQueryStr + ") " +
                                " CONNECT BY PRIOR PARENTDIRID = DIRID order by SEARCHDIRID";
            }
            if (string.IsNullOrEmpty(sqlFindParent))
            {
                return(null);
            }
            DataSet   ds = dataAccess.ExecuteDataSet(sqlFindParent);
            DataTable dt = new DataTable();

            if (ds != null && ds.Tables.Count > 0)
            {
                dt = ds.Tables[0];
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow row = null;
                //倒序,从根目录开始
                string searchDirId = string.Empty;
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    row         = dt.Rows[i];
                    searchDirId = LibSysUtils.ToString(row["SEARCHDIRID"]);
                    if (dicDirId_DirIds.ContainsKey(searchDirId) == false)
                    {
                        dicDirId_DirIds.Add(searchDirId, new List <string>()
                        {
                            LibSysUtils.ToString(row["DIRID"])
                        });
                    }
                    else
                    {
                        dicDirId_DirIds[searchDirId].Add(LibSysUtils.ToString(row["DIRID"]));
                    }
                }
            }
            return(dicDirId_DirIds);
        }
Example #8
0
        /// <summary>
        /// 为文档编号列表,获取各个文档对应的所属目录列表(从顶级目录到最终目录)
        /// </summary>
        /// <param name="docIds">文档编号列表</param>
        /// <returns></returns>
        public static Dictionary <string, List <DocInfo> > GetParentDirIdsForDocs(List <string> docIds)
        {
            if (docIds == null || docIds.Count == 0)
            {
                return(null);
            }

            List <string> newList = (from item in docIds
                                     select string.Format("'{0}'", item)).ToList();
            string docIdsQueryStr = string.Join(",", newList);

            Dictionary <string, List <DocInfo> > dicDocId_DirIds = new Dictionary <string, List <DocInfo> >();
            //构造递归查询语句。
            //从本级目录开始到顶级目录。第一行为本级目录(DirID标识的目录),最后一行为顶级目录(父目录为空)
            string        sqlFindParent = "";
            string        tempTableName = string.Format("{0}_{1}", "temp", DateTime.Now.Ticks);
            LibDataAccess dataAccess    = new LibDataAccess();

            if (dataAccess.DatabaseType == LibDatabaseType.SqlServer)
            {
                sqlFindParent = " with " + tempTableName + " as  " +
                                "   ( " +
                                "   select b.DOCID,a.DIRID,a.DIRNAME,a.PARENTDIRID,a.DIRPATH, a.DIRTYPE, b.CREATORID  from DMDIRECTORY a  " +
                                "   left join DMDOCUMENT b on a.DIRID = b.DIRID where b.DOCID in  (" + docIdsQueryStr + ") " +
                                "   union all " +
                                "   select t.DOCID,k.DIRID,k.DIRNAME,k.PARENTDIRID,k.DIRPATH, k.DIRTYPE, t.CREATORID from DMDIRECTORY k inner " +
                                "                               join " + tempTableName + " t on t.PARENTDIRID = k.DIRID " +
                                "   ) select * from " + tempTableName +
                                "   order by DOCID";
            }
            else
            {
                //Oracle的递归查询待测试
                //To DO
                sqlFindParent = "select b.DOCID,a.DIRID,a.DIRNAME,a.PARENTDIRID,a.DIRPATH, a.DIRTYPE, b.CREATORID from (select CONNECT_BY_ROOT(DIRID) as ROOTDIRID,DIRID,DIRNAME,PARENTDIRID,DIRPATH,DIRTYPE " +
                                " from DMDIRECTORY START WITH DIRID in (select distinct DIRID from DMDOCUMENT where DOCID in (" + docIdsQueryStr + ")) " +
                                " CONNECT BY PRIOR PARENTDIRID = DIRID) a left join DMDOCUMENT b on a.ROOTDIRID = b.DIRID order by b.DOCID";
            }
            if (string.IsNullOrEmpty(sqlFindParent))
            {
                return(null);
            }
            DataSet   ds = dataAccess.ExecuteDataSet(sqlFindParent);
            DataTable dt = new DataTable();

            if (ds != null && ds.Tables.Count > 0)
            {
                dt = ds.Tables[0];
            }
            if (dt != null && dt.Rows.Count > 0)
            {
                DataRow row = null;
                //倒序,从根目录开始
                string      docId     = string.Empty;
                string      dirId     = string.Empty;
                DirTypeEnum dirType   = DirTypeEnum.Public;
                string      creatorId = string.Empty;
                for (int i = dt.Rows.Count - 1; i >= 0; i--)
                {
                    row       = dt.Rows[i];
                    docId     = LibSysUtils.ToString(row["DOCID"]);
                    dirId     = LibSysUtils.ToString(row["DIRID"]);
                    dirType   = (DirTypeEnum)LibSysUtils.ToInt32(row["DIRTYPE"]);
                    creatorId = LibSysUtils.ToString(row["CREATORID"]);
                    DocInfo temp = new DocInfo()
                    {
                        DocId     = docId,
                        DirType   = dirType,
                        CreatorId = creatorId,
                        DirId     = dirId
                    };
                    if (dicDocId_DirIds.ContainsKey(docId) == false)
                    {
                        dicDocId_DirIds.Add(docId, new List <DocInfo>()
                        {
                            temp
                        });
                    }
                    else
                    {
                        dicDocId_DirIds[docId].Add(temp);
                    }
                }
            }
            return(dicDocId_DirIds);
        }
Example #9
0
        /// <summary>
        /// 根据用户标识,刷新用户具有的目录和文档权限
        /// </summary>
        public void RefreshUserPower()
        {
            LibDataAccess dataAccess = new LibDataAccess();
            //从数据库中找用户或用户所在的部门对目录或文档拥有的权限
            string sql = " select 1 as IsDir, 1 as IsDept,a.DIRID as ItemId, OPERATEMARK from DMDIRPERMISSION a left join COMDEPT b on a.BELONGID=b.DEPTID            " +
                         " 														                                   left join COMPERSON c on c.DEPTID=b.DEPTID         "+
                         " 													                                   where a.BELONGTYPE=0 and c.PERSONID='"+ PersonId + "' " +                                                         //所属部门对目录的权限
                         "  union                                                                                                                                     " +
                         "  select 1 as IsDir,0 as IsDept,a.DIRID as ItemId, OPERATEMARK from DMDIRPERMISSION a left join COMPERSON b on a.BELONGID=b.PERSONID        " +
                         " 														                                where a.BELONGTYPE=2 and b.PERSONID='"+ PersonId + "'" +                                                               //个人对目录的权限
                         "  union                                                                                                                                     " +
                         "  select 0 as IsDir,1 as IsDept,a.DOCID as ItemId, OPERATEMARK from DMDOCPERMISSION a left join COMDEPT b on a.BELONGID=b.DEPTID            " +
                         " 													                                   left join COMPERSON c on c.DEPTID=b.DEPTID             "+
                         " 													                                   where a.BELONGTYPE=0 and c.PERSONID='"+ PersonId + "' " +                                                        //所属部门对文档的权限
                         "  union                                                                                                                                     " +
                         "  select 0 as IsDir,0 as IsDept,a.DOCID as ItemId, OPERATEMARK from DMDOCPERMISSION a left join COMPERSON b on a.BELONGID=b.PERSONID        " +    //个人对目录的权限
                         "                                                                            where a.BELONGTYPE=2 and b.PERSONID='" + PersonId + "' ";
            DataSet ds         = dataAccess.ExecuteDataSet(sql);
            string  dirId      = string.Empty;
            string  docId      = string.Empty;
            int     permission = 0;

            lock (_LockObjOfDicDirAndDoc)
            {
                this._DicDirectoryPowers.Clear();
                this._DicDocumentPowers.Clear();
                if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
                {
                    return;
                }
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    permission = LibSysUtils.ToInt32(row["OPERATEMARK"]);
                    if (LibSysUtils.ToInt32(row["IsDir"]) == 1)
                    {
                        //目录权限
                        dirId = LibSysUtils.ToString(row["ItemId"]);
                        if (_DicDirectoryPowers.ContainsKey(dirId) == false)
                        {
                            _DicDirectoryPowers.Add(dirId, permission);
                        }
                        else
                        {
                            _DicDirectoryPowers[dirId] |= permission;//如果有重复则直接相或,应该是部门和个人对相同的目录都设置了权限。个人可继承部门权限
                        }
                    }
                    else
                    {
                        //文档权限
                        docId = LibSysUtils.ToString(row["ItemId"]);
                        if (_DicDocumentPowers.ContainsKey(docId) == false)
                        {
                            _DicDocumentPowers.Add(docId, permission);
                        }
                        else
                        {
                            _DicDocumentPowers[docId] |= permission;//如果有重复则直接相或,应该是部门和个人对相同的文档都设置了权限。个人可继承部门权限
                        }
                    }
                }
            }
        }
Example #10
0
        /// <summary>
        /// 获取消息
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="handle"></param>
        /// <param name="info"></param>
        /// <returns></returns>
        public static Result GetMyNews(string userId, string handle, PageModel info)
        {
            Result res = new Result();

            res.ReturnValue = true;
            LibHandle Handle = LibHandleCache.Default.IsExistsHandle(LibHandeleType.PC, userId);

            VerificationHandle(userId, handle, Handle, res);
            if (res.ReturnValue)
            {
                LibDataAccess access = new LibDataAccess();
                try
                {
                    string sql = string.Empty;
                    if (!string.IsNullOrEmpty(Handle.PersonId))//待优化
                    {
                        string selectCondition = string.Empty;
                        if (info.SelectCondition == 0)
                        {
                            selectCondition = string.Format("AND ISPASS = {0}", 0);
                        }
                        else
                        {
                            selectCondition = string.Format("AND ISPASS <> {0}", 0);
                        }
                        Dictionary <string, object> dic = new Dictionary <string, object>();
                        int beginNum = 0, endNum = 0;
                        sql = string.Format("SELECT COUNT(*) AS TOTALNUM FROM AXPAPPROVETASK WHERE PERSONID = {0} {1}", LibStringBuilder.GetQuotString(Handle.PersonId), selectCondition);
                        int totalCount = LibSysUtils.ToInt32(access.ExecuteScalar(sql));
                        int pageCount = 0;
                        if (totalCount / info.PageSize == 0)
                        {
                            pageCount = totalCount / info.PageSize;
                        }
                        else
                        {
                            pageCount = totalCount / info.PageSize + 1;
                        }
                        endNum                   = info.PageNo * info.PageSize;
                        beginNum                 = (info.PageNo - 1) * info.PageSize + 1;
                        sql                      = string.Empty;
                        sql                      = string.Format(@" SELECT A.PROGID,
                                                      B.PROGNAME,
                                                      A.BILLNO,
                                                      A.FROMROWID,
                                                      A.SUBMITPERSONID,
                                                      D.PERSONNAME AS SUBMITPERSONNAME,
                                                      A.PERSONID,
                                                      C.PERSONNAME,
                                                      A.CREATETIME 
                                                      FROM 
                                                      (
                                                      SELECT E.*,ROWNUM RN 
                                                      FROM (SELECT * FROM AXPAPPROVETASK) E 
                                                      WHERE ROWNUM <= {1} AND PERSONID={2} {3}) A 
                                                      LEFT JOIN AXPFUNCLIST B ON A.PROGID = B.PROGID 
                                                      LEFT JOIN COMPERSON C ON A.PERSONID = C.PERSONID 
                                                      LEFT JOIN COMPERSON D ON A.SUBMITPERSONID = D.PERSONID
                                                      WHERE RN>={0}", beginNum, endNum, LibStringBuilder.GetQuotString(Handle.PersonId), selectCondition);
                        res.Info                 = access.ExecuteDataSet(sql);
                        res.pageModel.PageNo     = info.PageNo;
                        res.pageModel.PageSize   = info.PageSize;
                        res.pageModel.PageCount  = pageCount;
                        res.pageModel.TotalCount = totalCount;
                        res.ReturnValue          = true;
                    }
                    else
                    {
                        res.Message = "请重新登录!";
                    }
                }
                catch (Exception ex)
                {
                    res.ReturnValue = false;
                    res.Message     = "查询失败!" + ex.Message;
                }
            }
            return(res);
        }
Example #11
0
        public List <Diary> GetDiary(HttpContext context)
        {
            List <Diary> list = new List <Diary>();

            string        sql        = string.Format(" SELECT * FROM Diary ORDER BY CREATETIME DESC ");
            LibDataAccess dataAccess = new LibDataAccess();
            DataSet       dataSet    = dataAccess.ExecuteDataSet(sql);

            int index = 1;

            foreach (DataRow dr in dataSet.Tables[0].Rows)
            {
                #region 本地案例
                //                Diary info = new Diary()
                //                {
                //                    meta = new DiaryMeta()
                //                    {
                //                        cover = "https://thumbnail0.baidupcs.com/thumbnail/0b95855351dc3e3da0ab41d2b71e00aa?fid=537037902-250528-293683274725876&time=1524326400&rt=sh&sign=FDTAER-DCb740ccc5511e5e8fedcff06b081203-hWFVzqB0U910msWMBvvDYwar3e4%3D&expires=8h&chkv=0&chkbd=0&chkpc=&dp-logid=2574598147729486112&dp-callid=0&size=c710_u400&quality=100&vuk=-&ft=video",
                //                        avatar = "http://i4.bvimg.com/639864/d7ec6328ddb04555.jpg",
                //                        title = "愿你不是至尊宝",
                //                        meta = "2018.4.21",
                //                        create_time = "2018.4.21 23:30:00",
                //                        nickName = "时光"
                //                    },
                //                    list = new List<DiaryContent>()
                //                                                            {
                //                                                                new DiaryContent()
                //                                                                {
                //                                                                    type="TEXT",
                //                                                                    content=@"相遇相离,人间至憾,莫过于此。
                //                                                                            “我的意中人是个盖世英雄,我知道有一天他会在一个万众瞩目的情况下出现,身披金甲圣衣,脚踏七色云彩来娶我,我猜中了前头,可是我猜不着这结局。”一行泪下,紫霞仙子看着戴上金箍变成齐天大圣的至尊宝说着。那是她的意中人,那也不是她的意中人。五百年前,他是那个花言巧语,苟且无为,拔出紫青宝剑,心里却想着晶晶姑娘的至尊宝。戴上金箍,他是那个遁入空门,神通广大,决心西去取经,心里却留着仙子泪滴的孙悟空。他注定是紫霞的意中人,却又注定和紫霞擦肩而过。
                //                                                                            曾经看《大话西游》不觉其中深意,看过几篇精彩的影评后,初觉真味。可后来几次重温,每次都有不同的体会。无论是再精彩的妙语点评,多么深刻的挖掘揣摩,都觉得白璧微瑕。影评终归是他人的感受,只有自己心中的震撼才是最标准的答案。
                //                                                                            其实,至尊宝和紫霞的剧本,是我们每个人的爱情故事。我们曾经可能都做过谎话连篇时的至尊宝,或者一往情深时的紫霞仙子。
                //                                                                            时常会想,如果我是至尊宝,我会怎么选,我遇到的哪一位姑娘,是我的紫霞。然而残忍的是,至尊宝他,没得选。不戴金箍,他救不了紫霞,戴上金箍,他爱不了她。这金箍,他不得不带,这西天路,他不得不走。
                //                                                                            有得选的,是紫霞。单纯,专情,敢爱敢恨,她是这一切美好的化身,可又因这残忍的美好,深深伤了自己的心。如果她不曾抢走月光宝盒,如果她不曾给至尊宝点三颗痣,如果她不曾有过紫青宝剑。就算这些都是命运不可避免,那么请她,不要轻易爱上一个人,即使他拔出了紫青宝剑。这把剑看似锋利,挡了刀枪斩了水火,遇他之后,再难伤人,竟挡不住几句谎言。
                //                                                                            如果你是女子,愿你是紫霞,也愿你不是紫霞。愿你保留纯真,懂得爱人,没有软肋。
                //                                                                            如果你是男生,愿你不是至尊宝。
                //                                                                            愿你不是那个不知道想要什么的至尊宝,愿你不是那个不知道最爱谁的至尊宝,愿你不是那个后知后觉至尊宝。
                //                                                                            有人说,爱过就好。真的不是爱过就好,要知道,失去以后,佳人难再得!",
                //                                                                    poi=new DiaryPoi()
                //                                                                    {
                //                                                                        longitude="117.2",
                //                                                                        latitude="37.5",
                //                                                                        name="广州",
                //                                                                    },
                //                                                                    description="",
                //                                                                    id=1,
                //                                                                    commentNum=0,
                //                                                                    likeNum= 0,
                //                                                                }
                //                                                            }
                //                };
                #endregion

                #region 数据库案例
                Diary info = new Diary()
                {
                    meta = new DiaryMeta()
                    {
                        cover       = string.Format("http://kantime.cn/UserFiles/SysUser/image/{0}.jpg", index++),
                        avatar      = "http://kantime.cn/UserFiles/SysUser/image/0.jpg",
                        title       = LibSysUtils.ToString(dr["Title"]),
                        meta        = "2018.4.21",
                        create_time = "2018.4.21 23:30:00",
                        nickName    = "时光"
                    },
                    list = new List <DiaryContent>()
                    {
                        new DiaryContent()
                        {
                            type    = "TEXT",
                            content = HttpUtility.HtmlDecode(LibSysUtils.ToString(dr["Content"])),
                            poi     = new DiaryPoi()
                            {
                                longitude = "117.2",
                                latitude  = "37.5",
                                name      = "广州",
                            },
                            description = "",
                            id          = 1,
                            commentNum  = 0,
                            likeNum     = 0,
                        }
                    }
                };

                info.list[0].content = CleanHtml(info.list[0].content);
                #endregion
                list.Add(info);
            }

            return(list);
        }