Example #1
0
        /// <summary>
        /// 获取往来单位权限
        /// </summary>
        /// <param name="EmployeeId"></param>
        /// <param name="TypeID"></param>
        /// <returns></returns>
        public string GetBusIDsByUserID(string EmployeeId, int TypeID)
        {
            string bussIDs = "";

            try
            {
                if (string.IsNullOrEmpty(EmployeeId))
                {
                    return("( -1 )");
                }
                if (EmployeeId == "1")
                {
                    return("");
                }

                List <DbParameter> parameters = new List <DbParameter>();
                parameters.Add(QueryService.AddInParameter("@UserID", SqlDbType.Int, 0, EmployeeId));
                parameters.Add(QueryService.AddInParameter("@BusinessProperty", SqlDbType.Int, 0, TypeID));
                parameters.Add(QueryService.AddInParameter("@ReturnType", SqlDbType.Int, 0, 0));//集合 //字符串
                //执行存储过程
                DataTable table = QueryService.ExecuteDataTable("[dbo].[proc_Authority_UserBusiness]", parameters);

                if (table != null && table.Rows.Count > 0)
                {
                    foreach (DataRow row in table.Rows)
                    {
                        bussIDs += row["ID"] + ",";
                    }
                    return("( " + bussIDs.Substring(0, bussIDs.Length - 1) + " )");
                }
                else
                {
                    return("( -1 )");
                }
            }
            catch (Exception ex)
            {
                WriteExceptionLog(ex);
                return("( -1 )");
            }
        }
Example #2
0
        /// <summary>
        /// 获取往来单位权限
        /// </summary>
        /// <param name="EmployeeId"></param>
        /// <param name="TypeID"></param>
        /// <returns></returns>
        public string GetBusAllIDsByUserID(string EmployeeId)
        {
            string bussIDs = "";

            try
            {
                if (string.IsNullOrEmpty(EmployeeId))
                {
                    return("( -1 )");
                }

                if (EmployeeId == "1")
                {
                    return("");
                }

                List <DbParameter> parameters = new List <DbParameter>();
                parameters.Add(QueryService.AddInParameter("@UserID", SqlDbType.Int, 0, EmployeeId));
                parameters.Add(QueryService.AddInParameter("@BusinessProperty", SqlDbType.Int, 0, 1));
                parameters.Add(QueryService.AddInParameter("@ReturnType", SqlDbType.Int, 0, 0));//集合 //字符串
                DataTable tableSupplier = QueryService.ExecuteDataTable("[dbo].[proc_Authority_UserBusiness]", parameters);

                parameters = new List <DbParameter>();
                parameters.Add(QueryService.AddInParameter("@UserID", SqlDbType.Int, 0, EmployeeId));
                parameters.Add(QueryService.AddInParameter("@BusinessProperty", SqlDbType.Int, 0, 2));
                parameters.Add(QueryService.AddInParameter("@ReturnType", SqlDbType.Int, 0, 0));//集合 //字符串
                DataTable tableClient = QueryService.ExecuteDataTable("[dbo].[proc_Authority_UserBusiness]", parameters);


                string    strSql         = @" SELECT *  FROM CO_Business WHERE BusinessProperty = 3 ";
                DataTable tableLogistics = QueryService.ExecuteDataTable(strSql);

                //供应商
                if (tableSupplier != null && tableSupplier.Rows.Count > 0)
                {
                    foreach (DataRow row in tableSupplier.Rows)
                    {
                        bussIDs += row["ID"] + ",";
                    }
                }

                //客户
                if (tableClient != null && tableClient.Rows.Count > 0)
                {
                    foreach (DataRow row in tableClient.Rows)
                    {
                        bussIDs += row["ID"] + ",";
                    }
                }

                //物流
                if (tableLogistics != null && tableLogistics.Rows.Count > 0)
                {
                    foreach (DataRow row in tableLogistics.Rows)
                    {
                        bussIDs += row["ID"] + ",";
                    }
                }

                if (string.IsNullOrEmpty(bussIDs))
                {
                    return(" (  -1 ) ");
                }

                return("( " + bussIDs.Substring(0, bussIDs.Length - 1) + " )");
            }
            catch (Exception ex)
            {
                WriteExceptionLog(ex);
                return("( -1 )");
            }
        }